:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang HK", "Noto Sans TC", sans-serif;
  color: #1d1d1f;
  background: #f5f5f7;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --ink: #1d1d1f;
  --secondary: #6e6e73;
  --separator: #d2d2d7;
  --surface: #ffffff;
  --surface-muted: #f5f5f7;
  --green: #248a3d;
  --orange: #b25000;
  --red: #d70015;
  --radius-large: 20px;
  --radius-medium: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 12px 34px rgb(0 0 0 / 6%);
}

* { box-sizing: border-box; }

html { min-width: 0; overflow-x: clip; background: #f5f5f7; }

body { margin: 0; min-height: 100vh; background: #f5f5f7; color: var(--ink); }

button, input, select { font: inherit; }

button, a, input, select { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgb(0 113 227 / 35%);
  outline-offset: 2px;
}

button { cursor: pointer; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  text-decoration: none;
}

.skip-link:focus { transform: none; }

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--separator);
  background: rgb(250 250 252 / 88%);
  backdrop-filter: saturate(180%) blur(18px);
}

.brand, .auth-brand {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 5px 14px rgb(0 113 227 / 18%);
}

.brand-mark img { display: block; width: 100%; height: 100%; }

.brand strong, .brand small, .auth-brand strong, .auth-brand small { display: block; }
.brand strong, .auth-brand strong { font-size: 15px; }
.brand small, .auth-brand small { margin-top: 2px; color: var(--secondary); font-size: 12px; }

.nav-list { display: grid; gap: 5px; margin-top: 34px; }

.nav-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  min-height: 46px;
  width: 100%;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #424245;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

.nav-item:hover { background: #ededf0; }
.nav-item.is-active { background: #e8f2fc; color: #0066cc; }
.nav-icon, .button-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e5e5ea;
  color: var(--secondary);
  font-size: 12px;
  text-align: center;
}

.nav-item.is-active .nav-count { background: white; color: #0066cc; }

.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--separator); }

.signed-in-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.signed-in-user > span:last-child { min-width: 0; }
.signed-in-user strong, .signed-in-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signed-in-user strong { font-size: 13px; }
.signed-in-user small { margin-top: 2px; color: var(--secondary); font-size: 12px; text-transform: uppercase; }

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  background: #e8f2fc;
  color: #0066cc;
  font-size: 13px;
  font-weight: 700;
}

.quiet-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}

.quiet-button:hover { background: #fff0f1; }

.workspace { min-width: 0; width: min(100%, 1320px); margin: 0 auto; padding: 48px clamp(24px, 4vw, 64px) 72px; }

.page-header, .section-heading, .panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #0066cc;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .12em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(28px, 4vw, 40px); line-height: 1.12; letter-spacing: -.035em; }
h2 { margin-bottom: 5px; font-size: 19px; letter-spacing: -.015em; }
.page-header p:last-child, .section-heading p { margin-bottom: 0; color: var(--secondary); font-size: 14px; line-height: 1.55; }

.system-state {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--separator);
  border-radius: 999px;
  background: rgb(255 255 255 / 70%);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.system-state span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgb(36 138 61 / 12%); }

.notice {
  margin: 24px 0 0;
  padding: 13px 15px;
  border: 1px solid #b9d9f7;
  border-radius: var(--radius-medium);
  background: #eef7ff;
  color: #004f9e;
  font-size: 14px;
}

.notice.is-error { border-color: #ffc5ca; background: #fff2f3; color: #9f0010; }

.view { margin-top: 34px; }
.view[hidden] { display: none !important; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.metric-card, .panel, .table-panel, .filter-bar {
  border: 1px solid rgb(210 210 215 / 85%);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card { min-height: 148px; padding: 22px; border-radius: var(--radius-large); }
.metric-card span, .metric-card small { display: block; }
.metric-card span { color: var(--secondary); font-size: 13px; font-weight: 600; }
.metric-card strong { display: block; margin: 13px 0 9px; font-size: 34px; line-height: 1; letter-spacing: -.04em; }
.metric-card small { color: var(--secondary); font-size: 12px; line-height: 1.4; }

.two-column { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 14px; margin-top: 14px; }
.panel { padding: 24px; border-radius: var(--radius-large); }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f2f2f7;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.is-good { background: #eaf7ed; color: #187333; }
.status-pill.is-warning { background: #fff4e5; color: #8a4100; }
.status-pill.is-disabled { background: #fff0f1; color: #a90011; }

.definition-grid { display: grid; grid-template-columns: .65fr 1.35fr 1fr; gap: 12px; margin: 22px 0 0; }
.definition-grid div { min-width: 0; padding: 13px; border-radius: 11px; background: var(--surface-muted); }
.definition-grid dt { margin-bottom: 5px; color: var(--secondary); font-size: 12px; }
.definition-grid dd { margin: 0; overflow: hidden; color: #424245; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }

.role-breakdown { display: grid; gap: 10px; margin-top: 20px; }
.role-breakdown div { display: flex; justify-content: space-between; align-items: center; min-height: 45px; padding: 0 14px; border-radius: 11px; background: var(--surface-muted); }
.role-breakdown span { color: var(--secondary); font-size: 13px; }
.role-breakdown strong { font-size: 17px; }

.section-heading { align-items: center; margin-bottom: 18px; }
.section-total { font-size: 24px; letter-spacing: -.03em; }

.primary-button, .secondary-button {
  min-width: 92px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 13px;
}

.primary-button { border: 1px solid var(--blue); background: var(--blue); color: white; }
.primary-button:hover { border-color: var(--blue-hover); background: var(--blue-hover); }
.secondary-button { border: 1px solid var(--separator); background: white; color: #424245; }
.secondary-button:hover { background: #f5f5f7; }
button:disabled { cursor: not-allowed; opacity: .55; }

.filter-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 14px;
  box-shadow: none;
}

label { display: grid; gap: 7px; color: #515154; font-size: 12px; font-weight: 600; }

input, select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #c7c7cc;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-size: 14px;
}

select { min-width: 150px; padding-right: 34px; }
input:hover, select:hover { border-color: #a1a1a6; }
input:focus, select:focus { border-color: var(--blue); }

.table-panel { overflow: hidden; border-radius: var(--radius-large); }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e5e5ea; text-align: left; vertical-align: middle; }
th { height: 45px; background: #fbfbfd; color: var(--secondary); font-size: 12px; font-weight: 650; letter-spacing: .02em; }
td { color: #424245; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafa; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }

.user-cell { display: flex; align-items: center; min-width: 180px; gap: 10px; }
.user-cell strong, .user-cell small { display: block; }
.user-cell strong { color: var(--ink); font-size: 13px; }
.user-cell small { margin-top: 3px; color: var(--secondary); font-size: 12px; }

.inline-actions { display: flex; align-items: center; gap: 8px; }
.inline-actions select { min-width: 112px; }
.inline-actions button { min-height: 44px; padding: 0 12px; border: 1px solid var(--separator); border-radius: 9px; background: white; color: #0066cc; font-size: 12px; font-weight: 650; }
.inline-actions button:hover { background: #f5f5f7; }
.inline-actions button.is-danger { color: var(--red); }

.status-stack, .control-stack { display: grid; justify-items: start; gap: 7px; }
.status-stack small, .control-help { max-width: 34ch; color: var(--secondary); font-size: 12px; line-height: 1.4; }
.detail-button {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--separator);
  border-radius: 9px;
  background: white;
  color: #0066cc;
  font-size: 12px;
  font-weight: 650;
}
.detail-button:hover { background: #f5f5f7; }

.pagination, .load-more-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.pagination span { color: var(--secondary); font-size: 12px; font-weight: 600; }
.load-more-row:has(button[hidden]) { display: none; }

.primary-button.is-danger-solid { border-color: var(--red); background: var(--red); }
.secondary-button.is-danger { color: var(--red); }

.modal-dialog {
  width: min(calc(100% - 32px), 520px);
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--ink);
}
.modal-dialog::backdrop { background: rgb(0 0 0 / 34%); backdrop-filter: blur(3px); }
.dialog-card { max-height: calc(100vh - 32px); padding: 24px; overflow: auto; border-radius: 20px; background: white; box-shadow: 0 28px 90px rgb(0 0 0 / 24%); }
.dialog-card-wide { width: min(100%, 720px); }
.dialog-card > p:not(.eyebrow), .dialog-error { color: var(--secondary); font-size: 14px; line-height: 1.55; }
.dialog-card textarea { width: 100%; min-height: 112px; padding: 12px; resize: vertical; font-size: 14px; line-height: 1.5; }
.dialog-card input[type="password"] { display: block; width: 100%; min-height: 44px; margin-block: 8px 16px; }
.dialog-card .password-reset-target { font-weight: 700; overflow-wrap: anywhere; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-error { margin: 8px 0 0; color: var(--red); }
.icon-button { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border: 0; border-radius: 50%; background: #f2f2f7; color: #424245; }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.audit-json { max-height: min(55vh, 520px); margin: 16px 0 0; padding: 16px; overflow: auto; border: 1px solid var(--separator); border-radius: 12px; background: #f8f8fa; color: #323236; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

.empty-state { margin: 0; padding: 50px 20px; color: var(--secondary); text-align: center; font-size: 14px; }
.hash-preview { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details-preview { max-width: 260px; margin: 0; overflow: hidden; color: var(--secondary); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

/* Authentication screens */
.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 12% 6%, rgb(0 113 227 / 12%), transparent 31%),
    radial-gradient(circle at 92% 88%, rgb(98 54 255 / 7%), transparent 30%),
    #f5f5f7;
}

.auth-shell { width: min(100%, 430px); min-width: 0; }
.auth-brand { width: max-content; margin: 0 auto 22px; }

.auth-card {
  padding: clamp(26px, 7vw, 38px);
  border: 1px solid rgb(210 210 215 / 80%);
  border-radius: 24px;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 26px 80px rgb(0 0 0 / 10%);
  backdrop-filter: blur(22px);
}

.auth-card h1 { margin-bottom: 8px; font-size: 30px; }
.auth-card > p:not(.eyebrow, .auth-message) { color: var(--secondary); font-size: 14px; line-height: 1.5; }

.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 25px 0 22px; padding: 3px; border-radius: 11px; background: #ededf0; }
.segmented-control button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--secondary); font-size: 13px; font-weight: 650; }
.segmented-control button[aria-selected="true"] { background: white; box-shadow: 0 1px 4px rgb(0 0 0 / 12%); color: var(--ink); }

.auth-card form { display: grid; gap: 16px; }
.auth-card input { width: 100%; }
.auth-submit { width: 100%; margin-top: 5px; }
.field-help { display: block; margin-top: -8px; color: var(--secondary); font-size: 12px; line-height: 1.4; }

.auth-message { margin: -4px 0 16px; padding: 11px 12px; border-radius: 10px; background: #eef7ff; color: #0055a7; font-size: 13px; line-height: 1.45; }
.auth-message.is-error { background: #fff0f1; color: #a90011; }
.auth-message.is-success { background: #eaf7ed; color: #187333; }
.auth-footnote { margin: 20px 0 0; color: var(--secondary); font-size: 12px; text-align: center; }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .definition-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table-panel { overflow-x: auto; }
  table { min-width: 760px; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    position: sticky;
    z-index: 20;
    height: auto;
    padding: max(10px, env(safe-area-inset-top)) 12px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--separator);
  }
  .brand { width: max-content; }
  .brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 10px; }
  .brand small { display: none; }
  .nav-list { display: flex; margin-top: 8px; padding-right: 18px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-item { display: flex; flex: 0 0 auto; justify-content: center; width: auto; min-width: 72px; min-height: 44px; gap: 5px; padding: 0 10px; scroll-snap-align: start; }
  .nav-item > span:first-child { display: none; }
  .nav-count { min-width: 20px; padding: 1px 5px; }
  .sidebar-footer { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 12px; display: flex; align-items: center; margin: 0; padding: 0; border: 0; }
  .signed-in-user { display: none; }
  .quiet-button { display: block; min-height: 44px; margin: 0; }
  .workspace { padding: 28px 16px max(48px, env(safe-area-inset-bottom)); }
  .system-state { display: none; }
  .metric-grid { gap: 10px; }
  .metric-card { min-height: 132px; padding: 18px; border-radius: 17px; }
  .metric-card strong { font-size: 30px; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .filter-bar label, .filter-bar select, .filter-bar input { min-width: 0; width: 100%; }
  .filter-bar .primary-button { width: 100%; }
  .section-heading { align-items: flex-end; }

  .table-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .responsive-table { min-width: 0; }
  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .responsive-table tbody { display: grid; gap: 12px; }
  .responsive-table tbody tr { display: block; overflow: hidden; border: 1px solid var(--separator); border-radius: 16px; background: white; box-shadow: var(--shadow); }
  .responsive-table tbody td {
    display: grid;
    grid-template-columns: minmax(92px, .34fr) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 14px;
    text-align: left;
  }
  .responsive-table tbody td::before { content: attr(data-label); color: var(--secondary); font-size: 12px; font-weight: 650; }
  .responsive-table tbody tr:hover { background: white; }
  .responsive-table .user-cell { min-width: 0; overflow-wrap: anywhere; }
  .responsive-table .inline-actions { flex-wrap: wrap; min-width: 0; }
  .responsive-table .inline-actions select { min-width: 0; width: min(100%, 180px); }
  .responsive-table .mono { overflow-wrap: anywhere; }
  .table-panel > .empty-state { border: 1px solid var(--separator); border-radius: 16px; background: white; box-shadow: var(--shadow); }
}

@media (max-width: 480px) {
  h1 { font-size: 29px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 118px; }
  .definition-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading > button { width: 100%; }
  .auth-page { padding-inline: 12px; }
  .auth-card { border-radius: 20px; }
  .auth-card .eyebrow,
  .field-help,
  .auth-footnote { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Ma King Insight briefing palette — aligned with the approved color reference. */
:root {
  --blue: #0b7082;
  --blue-hover: #095c6b;
  --ink: #102f4c;
  --secondary: #4b6173;
  --separator: #c9d7de;
  --surface: #fefdf9;
  --surface-muted: #eff7f9;
  --green: #24744e;
  --orange: #955b1b;
  --red: #ab3940;
  --radius-large: 12px;
  --radius-medium: 9px;
  --shadow: 0 2px 5px rgb(16 47 76 / 4%), 0 14px 28px rgb(16 47 76 / 5%);
  color: var(--ink);
  background: #eff7f9;
}
html, body { background: #eff7f9; color: var(--ink); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgb(11 112 130 / 34%);
  outline-offset: 2px;
}
.skip-link { background: #102f4c; }

.app-shell { grid-template-columns: 226px minmax(0, 1fr); }
.sidebar {
  border-right: 1px solid #31536c;
  background: linear-gradient(180deg, #102f4c 0%, #173a57 100%);
  color: #fefdf9;
  backdrop-filter: none;
}
.brand { color: #fefdf9; }
.brand strong, .auth-brand strong {
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 19px;
  letter-spacing: -.025em;
}
.brand small, .sidebar .signed-in-user small { color: #b7d3db; }
.brand-mark { box-shadow: none; }
.nav-list { margin-top: 37px; }
.nav-item { color: #dcebf0; border-radius: 8px; }
.nav-item:hover { background: rgb(255 255 255 / 11%); }
.nav-item.is-active {
  background: #0b7082;
  color: #fffefa;
  box-shadow: inset 3px 0 0 #62c6d4;
}
.nav-count { background: rgb(255 255 255 / 15%); color: #fefdf9; }
.nav-item.is-active .nav-count { background: #fefdf9; color: #102f4c; }
.sidebar-footer { border-top-color: rgb(255 255 255 / 20%); }
.sidebar .avatar { background: #dbeef0; color: #102f4c; }
.quiet-button { color: #f5d3d0; }
.quiet-button:hover { background: rgb(255 255 255 / 11%); }

.workspace {
  width: min(100%, 1600px);
  padding: 28px clamp(18px, 2.7vw, 44px) 72px;
}
.page-header {
  align-items: center;
  min-height: 146px;
  padding: 24px clamp(22px, 3vw, 38px);
  border: 1px solid #bfced5;
  border-radius: 12px;
  background: #fbf8f1;
  box-shadow: var(--shadow);
}
.eyebrow { color: #0b7082; letter-spacing: .13em; }
h1, h2 { color: #102f4c; font-family: Georgia, "Noto Serif TC", serif; letter-spacing: -.025em; }
h1 { font-size: clamp(30px, 3.3vw, 42px); }
h2 { font-size: 21px; }
.page-header p:last-child, .section-heading p { color: #526b7b; }
.system-state { border-color: #c9d7de; background: #fefdf9; color: #35536b; }
.system-state span { background: #0b7082; box-shadow: 0 0 0 3px rgb(11 112 130 / 13%); }
.notice { border-color: #b6d5dd; background: #e8f5f6; color: #174f60; }
.notice.is-error { border-color: #d8b8b8; background: #fbefec; color: #92353c; }

.view { margin-top: 20px; }
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(270px, .82fr);
  align-items: start;
  gap: 16px;
}
.overview-main, .overview-rail { min-width: 0; }
.metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.metric-card, .panel, .table-panel, .filter-bar {
  border-color: #c9d7de;
  background: #fefdf9;
  box-shadow: var(--shadow);
}
.metric-card {
  position: relative;
  min-height: 162px;
  padding: 21px 23px;
  border-radius: 11px;
  overflow: hidden;
}
.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #0b7082;
}
.metric-card span, .metric-card small { color: #526b7b; }
.metric-card strong { color: #102f4c; font-family: Georgia, "Noto Serif TC", serif; font-size: 39px; }
.panel { border-radius: 11px; }
.role-panel { margin-top: 16px; }
.role-breakdown { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.role-breakdown div {
  display: grid;
  justify-content: stretch;
  align-content: center;
  gap: 5px;
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid #d6e4e8;
  border-radius: 7px;
  background: #eff7f9;
}
.role-breakdown span { color: #526b7b; }
.role-breakdown strong { color: #102f4c; font-family: Georgia, "Noto Serif TC", serif; font-size: 23px; }
.audit-panel { background: #f8fbf9; }
.audit-panel .panel-heading { flex-direction: column; gap: 12px; }
.audit-panel .definition-grid { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 21px; }
.audit-panel .definition-grid div {
  padding: 15px 0;
  border-top: 1px solid #d6e4e8;
  border-radius: 0;
  background: transparent;
}
.audit-panel .definition-grid dt { color: #526b7b; }
.audit-panel .definition-grid dd { color: #102f4c; }
.audit-panel .definition-grid .mono { overflow-wrap: anywhere; white-space: normal; }

.status-pill { border: 1px solid #d5e2e6; border-radius: 7px; background: #eff7f9; color: #35536b; }
.status-pill.is-good { border-color: #c2ddce; background: #e8f4eb; color: #206844; }
.status-pill.is-warning { border-color: #e7d4ad; background: #fbf4e6; color: #81521c; }
.status-pill.is-disabled { border-color: #e4c5c5; background: #fbefec; color: #92353c; }

.section-heading { margin-bottom: 16px; }
.section-total { color: #102f4c; font-family: Georgia, "Noto Serif TC", serif; }
.primary-button, .secondary-button, .detail-button, .inline-actions button { border-radius: 7px; }
.primary-button { border-color: #0b7082; background: #0b7082; }
.primary-button:hover { border-color: #095c6b; background: #095c6b; }
.secondary-button, .detail-button, .inline-actions button {
  border-color: #b9cdd5;
  background: #fefdf9;
  color: #0b596a;
}
.secondary-button:hover, .detail-button:hover, .inline-actions button:hover { background: #eff7f9; }
.filter-bar { gap: 14px; padding: 16px; border-radius: 10px; box-shadow: var(--shadow); }
label { color: #35536b; }
input, select, textarea {
  border-color: #b9cdd5;
  border-radius: 7px;
  background: #fffefa;
  color: #102f4c;
}
input:hover, select:hover, textarea:hover { border-color: #87a7b3; }
input:focus, select:focus, textarea:focus { border-color: #0b7082; }

.table-panel { border-radius: 10px; }
th, td { border-bottom-color: #d6e4e8; }
th { background: #edf6f7; color: #35536b; }
td { color: #2d465c; }
tbody tr:hover { background: #f4faf9; }
.user-cell strong { color: #102f4c; }
.user-cell small, .status-stack small, .control-help { color: #526b7b; }
.avatar { background: #dceff1; color: #0b596a; }
.pagination span, .empty-state, .details-preview { color: #526b7b; }
.empty-state { background: #fefdf9; }

.modal-dialog { color: #102f4c; }
.dialog-card { border: 1px solid #c9d7de; border-radius: 11px; background: #fefdf9; }
.dialog-card > p:not(.eyebrow), .dialog-error { color: #526b7b; }
.dialog-error { color: #92353c; }
.icon-button { background: #eff7f9; color: #102f4c; }
.audit-json { border-color: #c9d7de; background: #eff7f9; color: #102f4c; }

.auth-page {
  background:
    radial-gradient(circle at 10% 9%, rgb(11 112 130 / 8%), transparent 34%),
    radial-gradient(circle at 90% 85%, rgb(16 47 76 / 6%), transparent 32%),
    #eff7f9;
}
.auth-brand { margin-bottom: 25px; color: #102f4c; }
.auth-page .auth-brand {
  width: clamp(305.25px, 82.5vw, 399.3px);
  max-width: 100%;
  min-height: 0;
  margin: 0 auto 25px;
}
.auth-brand-logo {
  display: block;
  width: 100%;
  height: auto;
}
.brand-lab { color: #c59118; }
.auth-brand small { color: #526b7b; }
.auth-card {
  border-color: #bfcfd5;
  border-radius: 12px;
  background: #fbf8f1;
  box-shadow: 0 16px 55px rgb(16 47 76 / 11%);
  backdrop-filter: none;
}
.auth-card h1 { font-size: 34px; }
.auth-card > p:not(.eyebrow, .auth-message) { color: #526b7b; }
.segmented-control { border: 1px solid #c9d7de; border-radius: 8px; background: #eff7f9; }
.segmented-control button { border-radius: 6px; color: #35536b; }
.segmented-control button[aria-selected="true"] { background: #fefdf9; color: #102f4c; }
.auth-message { background: #e8f5f6; color: #174f60; }
.auth-message.is-error { background: #fbefec; color: #92353c; }
.auth-message.is-success { background: #e8f4eb; color: #206844; }
.auth-footnote { color: #526b7b; }

@media (max-width: 1160px) {
  .overview-grid { grid-template-columns: 1fr; }
  .audit-panel .panel-heading { flex-direction: row; }
  .audit-panel .definition-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 820px) {
  .sidebar { border-right: 0; border-bottom-color: #31536c; background: #102f4c; }
  .sidebar .brand strong { font-size: 18px; }
  .nav-list { margin-top: 9px; }
  .nav-item.is-active { box-shadow: inset 0 -3px 0 #62c6d4; }
  .workspace { padding-top: 18px; }
  .page-header { min-height: 0; padding: 20px; }
  .overview-grid { gap: 12px; }
  .metric-grid { gap: 12px; }
  .role-panel { margin-top: 12px; }
  .responsive-table tbody tr { border-color: #c9d7de; border-radius: 9px; background: #fefdf9; }
  .responsive-table tbody tr:hover { background: #fefdf9; }
  .table-panel > .empty-state { border-color: #c9d7de; border-radius: 9px; background: #fefdf9; }
}
@media (max-width: 560px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 128px; padding: 17px; }
  .metric-card strong { font-size: 31px; }
  .role-breakdown { grid-template-columns: 1fr 1fr 1fr; }
  .role-breakdown div { padding: 9px; }
  .audit-panel .panel-heading { flex-direction: column; }
  .audit-panel .definition-grid { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 400px) {
  .metric-grid { grid-template-columns: 1fr; }
  .role-breakdown { grid-template-columns: 1fr; }
}

/* Isolated Ma King Insight preview: a readable bilingual login form. */
.auth-page {
  font-family:"Segoe UI","PingFang HK","Microsoft JhengHei UI","Noto Sans TC",sans-serif;
  font-size:16px; line-height:1.55;
  -webkit-text-size-adjust:100%; text-size-adjust:100%;
}
.auth-page .auth-card h1 { font-family:inherit; letter-spacing:normal; }
.auth-page .auth-card > p:not(.eyebrow,.auth-message) { font-size:16px; }
.auth-page .auth-card .eyebrow { font-size:13px; }
.auth-page .auth-card label { font-size:15px; line-height:1.4; }
.auth-page .auth-card input { min-height:48px; font-size:16px; }
.auth-page .segmented-control button { min-height:44px; font-size:15px; }
.auth-page .field-help,.auth-page .auth-footnote,.auth-page .auth-message {
  font-size:14px; line-height:1.5;
}

.auth-page .auth-language {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: max-content;
  max-width: 100%;
  margin: 0 0 20px auto;
  padding: 3px;
  border: 1px solid #bfcfd5;
  border-radius: 9px;
  background: #eff7f9;
}
.auth-page .auth-language button {
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #35536b;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}
.auth-page .auth-language button[aria-pressed="true"] {
  background: #102f4c;
  color: #fff;
}
.auth-page .auth-language button:not([aria-pressed="true"]):hover {
  background: #dcecf0;
}

@media (max-width: 390px) {
  .auth-page .auth-card { padding: 20px; }
  .auth-page .auth-language { width: 100%; }
  .auth-page .auth-language button { padding-inline: 6px; }
  .auth-page .auth-card h1 { font-size: clamp(28px, 9vw, 34px); }
}

/* The admin desk uses the same complete Ma King Insight artwork as the main desk. */
.sidebar .brand {
  display:grid; place-items:center; flex:0 0 auto;
  width:100%; min-height:178px; padding:4px;
  border-radius:10px; background:#fbf8f1;
}
.admin-brand-logo { display:block; width:min(100%,178px); height:auto; object-fit:contain; }
.sidebar .nav-list { margin-top:20px; }

.admin-header-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:12px; }
.admin-language {
  display:inline-flex; gap:2px; padding:3px; border:1px solid #c9d7de;
  border-radius:10px; background:#fefdf9;
}
.admin-language button {
  min-height:44px; padding:0 12px; border:0; border-radius:7px;
  background:transparent; color:#35536b; font-size:14px; font-weight:700;
}
.admin-language button[aria-pressed="true"] { background:#102f4c; color:#fff; }

.method4-filter { margin-top: 18px; }
.method4-filter label { min-width: min(100%, 230px); }
.method4-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 14px 0; }
.method4-overview .panel { min-width: 0; }
.method4-overview .panel > p:not(.eyebrow) { margin: 12px 0 0; color: #526b7b; line-height: 1.6; }
.method4-provenance { overflow-wrap: anywhere; }
.method4-provenance dd { overflow-wrap: anywhere; }
.method4-table .responsive-table td { vertical-align: top; }

@media (max-width: 820px) {
  .method4-overview { grid-template-columns: 1fr; }
}

@media (max-width:820px) {
  .sidebar .brand { width:120px; min-height:94px; padding:0; }
  .admin-brand-logo { width:116px; }
  .sidebar .nav-list { margin-top:8px; }
}
@media (max-width:560px) {
  .page-header { flex-wrap:wrap; }
  .admin-header-actions { width:100%; justify-content:space-between; }
  .admin-language button { padding-inline:8px; }
}
