:root {
  --ink: #172033;
  --muted: #607086;
  --line: #d8e0ea;
  --surface: #ffffff;
  --bg: #f5f7fb;
  --blue: #31579f;
  --blue-dark: #233e78;
  --green: #147c68;
  --amber: #b86b16;
  --red: #b42318;
  --soft-blue: #e9eff9;
  --soft-green: #e7f4ef;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.brand strong,
.brand span {
  display: block;
  line-height: 1.25;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
}

#accountName {
  color: var(--muted);
  font-size: 14px;
  max-width: min(36vw, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.event-band {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
  padding: 28px;
  background: var(--blue-dark);
  color: #fff;
  border-radius: 8px;
  min-height: 176px;
  background-image: linear-gradient(135deg, #233e78 0%, #31579f 52%, #147c68 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: #ffdf9f;
  font-weight: 800;
  font-size: 13px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.muted {
  color: rgba(255, 255, 255, .82);
  margin-bottom: 0;
}

.event-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .36);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.icon-button.active,
.icon-button:hover {
  background: #fff;
  color: var(--blue-dark);
}

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  background: var(--blue);
  color: #fff;
}

.button.primary:hover {
  background: var(--blue-dark);
}

.button.ghost {
  background: #fff;
  color: var(--blue-dark);
  border-color: var(--line);
}

.button:disabled {
  opacity: .62;
  cursor: not-allowed;
}

.notice {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--soft-blue);
  border: 1px solid #c8d6ee;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--blue-dark);
}

.notice.danger {
  background: #fff0ef;
  border-color: #f1b8b1;
  color: var(--red);
}

.workspace {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 12px;
}

.metric {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 26px;
  color: var(--blue-dark);
  overflow-wrap: anywhere;
}

.metric.accent {
  background: var(--soft-green);
  border-color: #bddfd2;
}

.metric.accent strong {
  color: var(--green);
  font-size: 17px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.state-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue-dark);
  font-weight: 800;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

label {
  display: grid;
  gap: 6px;
  color: #2b394b;
  font-weight: 700;
}

label.wide,
.form-actions.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 87, 159, .16);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f1f4f9;
  color: #3a4960;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

.review-list {
  display: grid;
  gap: 14px;
}

.review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.review-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.review-title h3 {
  margin: 0;
  font-size: 18px;
}

.review-title span {
  color: var(--muted);
  font-size: 13px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  background: #14213d;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 18px 50px rgba(20, 33, 61, .24);
  z-index: 50;
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account {
    width: 100%;
    justify-content: space-between;
  }

  #accountName {
    max-width: 55vw;
  }

  .event-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .event-actions {
    justify-content: stretch;
  }

  .icon-button {
    flex: 1;
  }

  .sidebar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    margin-top: 10px;
  }

  .event-band,
  .panel {
    padding: 16px;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }
}
