:root {
  --canvas: #f5f5f7;
  --surface: #ffffff;
  --surface-subtle: #f2f2f7;
  --surface-hover: #fafafa;
  --ink: #1d1d1f;
  --ink-soft: #3a3a3c;
  --muted: #6e6e73;
  --faint: #8e8e93;
  --line: rgba(60, 60, 67, 0.14);
  --blue: #007aff;
  --blue-hover: #006edc;
  --blue-pale: #eaf4ff;
  --green: #248a45;
  --green-pale: #eaf8ed;
  --amber: #a96500;
  --amber-pale: #fff4dc;
  --red: #d72d26;
  --red-pale: #fff0ef;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 18px 56px rgba(26, 26, 30, 0.14);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0, rgba(245, 245, 247, 0) 340px), var(--canvas);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.52; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px max(24px, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid rgba(60, 60, 67, 0.1);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}
.topbar > div:first-child { min-width: 0; }
.brand-lockup { display: flex; min-width: 0; align-items: center; gap: 10px; }
.brand-mark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 8px;
  background: linear-gradient(145deg, #1690ff, #0071e3);
  box-shadow: 0 4px 10px rgba(0, 122, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  color: #fff;
  font-size: 15px;
  font-weight: 760;
  line-height: 1;
}
.topbar h1 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.2;
}
.eyebrow { color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; line-height: 1.2; }
.health {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-radius: var(--radius);
  background: rgba(118, 118, 128, 0.08);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.health::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #8e8e93; content: ""; }
.health.is-ready { border-color: rgba(52, 199, 89, 0.2); background: rgba(52, 199, 89, 0.1); color: var(--green); }
.health.is-ready::before { background: #34c759; }
.health.is-unavailable { border-color: rgba(255, 159, 10, 0.18); background: rgba(255, 159, 10, 0.1); color: var(--amber); }
.health.is-unavailable::before { background: #ff9f0a; }
.shell { width: min(1280px, 100%); margin: 0 auto; padding: 30px 26px 52px; }

.tabs {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 2px;
  margin: 0 0 30px;
  padding: 3px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-radius: var(--radius);
  background: rgba(118, 118, 128, 0.1);
}
.tab {
  min-height: 32px;
  padding: 7px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  transition: background 150ms ease, box-shadow 150ms ease, color 150ms ease;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}
.section-head h2 { margin: 4px 0 5px; color: var(--ink); font-size: 27px; font-weight: 720; letter-spacing: 0; line-height: 1.14; }
.muted { max-width: 680px; margin: 0; color: var(--muted); font-size: 13px; }
.actions, .queue-controls, .settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--blue);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.04);
  color: #fff;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.button:hover { background: var(--blue-hover); }
.button:active { transform: scale(0.982); }
.button.secondary { border-color: rgba(60, 60, 67, 0.1); background: rgba(255, 255, 255, 0.86); box-shadow: var(--shadow-sm); color: var(--blue); }
.button.secondary:hover { background: var(--surface); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08); }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  position: relative;
  min-height: 92px;
  overflow: hidden;
  padding: 15px 16px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.stat::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; background: #c7c7cc; content: ""; }
.stat.green::before { background: #34c759; }
.stat.yellow::before { background: #ff9f0a; }
.stat.red::before { background: #ff453a; }
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 7px; color: var(--ink); font-size: 27px; font-weight: 720; letter-spacing: 0; line-height: 1; }
.stat.green strong { color: var(--green); }
.stat.yellow strong { color: var(--amber); }
.stat.red strong { color: var(--red); }

.filters { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.filters input, .filters select, .queue-controls input, .settings-panel input, .settings-panel textarea, .login-panel .field input, .rules-editor-panel textarea {
  min-height: 38px;
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: 7px;
  outline: 0;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.filters input:focus, .filters select:focus, .queue-controls input:focus, .settings-panel input:focus, .settings-panel textarea:focus, .login-panel .field input:focus, .rules-editor-panel textarea:focus {
  border-color: rgba(0, 122, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}
.filters input { width: min(300px, 100%); padding: 9px 12px; }
.filters select { min-width: 126px; padding: 8px 31px 8px 10px; }

.table-wrap { overflow: auto; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.table-wrap table { width: 100%; min-width: 790px; border-collapse: collapse; }
.table-wrap th, .table-wrap td { padding: 14px; border-bottom: 1px solid rgba(60, 60, 67, 0.1); text-align: left; vertical-align: middle; }
.table-wrap th { height: 44px; background: rgba(250, 250, 252, 0.86); color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.table-wrap tbody tr { transition: background 130ms ease; }
.table-wrap tbody tr:hover { background: var(--surface-hover); }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap td > strong { font-weight: 650; }
.thumb { display: block; width: 76px; height: 46px; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: 6px; background: #e5e5ea; object-fit: cover; }
.status-pill { display: inline-flex; min-width: 30px; min-height: 25px; align-items: center; justify-content: center; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1; }
.status-green { background: var(--green-pale); color: var(--green); }
.status-yellow { background: var(--amber-pale); color: var(--amber); }
.status-red { background: var(--red-pale); color: var(--red); }
.status-gray { background: #ededf0; color: var(--muted); }
.empty { padding: 42px !important; color: var(--muted); text-align: center; }

.dropzone {
  position: relative;
  display: flex;
  min-height: 238px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border: 1.5px dashed #b7bac2;
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 32%, rgba(0, 122, 255, 0.07), transparent 170px), rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: var(--surface); box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08); }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; opacity: 0; }
.drop-icon { display: flex; width: 42px; height: 42px; align-items: center; justify-content: center; margin-bottom: 10px; border: 1px solid rgba(0, 122, 255, 0.14); border-radius: 50%; background: var(--blue-pale); color: var(--blue); font-size: 27px; font-weight: 350; line-height: 1; }
.dropzone strong { color: var(--ink); font-size: 15px; font-weight: 680; }
.dropzone span { display: block; margin-top: 5px; color: var(--faint); font-size: 12px; }

.queue-controls label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.queue-controls input { width: 58px; padding: 7px; text-align: center; }
.queue-summary { margin: 17px 0 10px; color: var(--muted); font-size: 13px; }
.queue-list { display: grid; gap: 9px; }
.queue-item { display: grid; grid-template-columns: minmax(0, 1fr) 142px 64px 80px; align-items: center; gap: 14px; padding: 13px 14px; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.queue-file { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-file strong { font-weight: 650; }
.progress { height: 6px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #e5e5ea; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width 200ms ease; }
.queue-state { color: var(--muted); font-size: 12px; }
.queue-state.done { color: var(--green); font-weight: 700; }
.queue-state.failed { color: var(--red); font-weight: 700; }

.rule-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; margin-bottom: 12px; color: var(--ink-soft); font-weight: 600; }
.rules-editor-panel { max-width: 100%; padding: 18px; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.rules-editor-panel label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 680; }
.rules-editor-panel textarea { display: block; width: 100%; min-height: 410px; padding: 14px; resize: vertical; border-color: transparent; background: var(--surface-subtle); color: var(--ink); font-size: 14px; line-height: 1.72; }
.rules-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.field-note { margin: 7px 0 0; color: var(--faint); font-size: 12px; }

.drawer { position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: min(550px, 100vw); padding: 26px; overflow: auto; border-left: 1px solid rgba(60, 60, 67, 0.1); background: rgba(255, 255, 255, 0.96); box-shadow: -18px 0 56px rgba(28, 28, 30, 0.16); transform: translateX(100%); transition: transform 220ms ease, visibility 220ms ease; visibility: hidden; pointer-events: none; backdrop-filter: blur(22px) saturate(145%); -webkit-backdrop-filter: blur(22px) saturate(145%); }
.drawer.open { transform: translateX(0); visibility: visible; pointer-events: auto; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.drawer h2 { margin: 3px 0 0; font-size: 22px; font-weight: 700; line-height: 1.25; }
.drawer h3 { margin: 22px 0 0; font-size: 15px; }
.icon-button { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; border: 0; border-radius: 7px; background: rgba(118, 118, 128, 0.1); color: var(--muted); font-size: 22px; line-height: 1; }
.icon-button:hover { background: rgba(118, 118, 128, 0.16); color: var(--ink); }
.detail-cover { display: block; width: 100%; max-height: 300px; margin-top: 18px; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: var(--radius); background: var(--surface-subtle); object-fit: contain; }
.detail-summary { padding: 16px 0; border-bottom: 1px solid var(--line); }
.detail-summary p { margin: 9px 0 0; }
.score { margin-left: 8px; font-size: 18px; }
.evidence { display: grid; grid-template-columns: 144px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.evidence img { width: 144px; height: 86px; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: 7px; background: var(--surface-subtle); object-fit: cover; }
.evidence h4 { margin: 0 0 4px; font-size: 14px; }
.evidence p { margin: 3px 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.reference-evidence { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.reference-evidence img { width: 92px; height: 62px; }
.reference-note { margin-top: 16px !important; padding-top: 12px; border-top: 1px solid var(--line); }

.settings-panel { display: grid; max-width: 860px; grid-template-columns: 1fr 1fr; gap: 15px; padding: 20px; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.settings-panel .field { min-width: 0; }
.settings-panel .field.full, .settings-actions.full { grid-column: 1 / -1; }
.settings-panel label, .login-panel .field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 680; }
.settings-panel input, .settings-panel textarea, .login-panel .field input { width: 100%; padding: 10px 11px; }
.settings-panel textarea { min-height: 118px; resize: vertical; background: var(--surface-subtle); line-height: 1.5; }
.review-flow { display: flex; max-width: 860px; align-items: center; flex-wrap: wrap; gap: 8px; padding: 16px 0; color: var(--muted); }
.review-flow span { padding: 8px 10px; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 13px; }
.review-flow b { color: var(--blue); }
.admin-shell { max-width: 980px; }
.admin-user-link { border-color: rgba(0, 122, 255, 0.15); background: var(--blue-pale); color: var(--blue); }
.admin-user-link:hover { background: #dfefff; color: var(--blue); }
.login-panel, .admin-notice { display: grid; max-width: 480px; gap: 18px; padding: 24px; border: 1px solid rgba(60, 60, 67, 0.08); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.login-panel h2, .admin-notice h2 { margin: 3px 0 4px; font-size: 24px; line-height: 1.2; }
.admin-notice { border-left: 3px solid #ff9f0a; }
.admin-notice p { margin: 0; color: var(--muted); }
.admin-notice code { color: var(--ink); overflow-wrap: anywhere; }
.login-panel[hidden], .admin-notice[hidden], #adminSettings[hidden] { display: none !important; }

.toast { position: fixed; z-index: 50; bottom: 28px; left: 50%; max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 7px; background: rgba(29, 29, 31, 0.9); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2); color: #fff; font-size: 13px; pointer-events: none; transform: translate(-50%, 18px); opacity: 0; transition: transform 180ms ease, opacity 180ms ease; backdrop-filter: blur(14px); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 820px) {
  .topbar { padding-right: 20px; padding-left: 20px; }
  .shell { padding-right: 20px; padding-left: 20px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .actions, .queue-controls { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .topbar { position: static; display: block; padding: 15px 16px; }
  .topbar h1 { font-size: 20px; }
  .brand-mark { width: 32px; height: 32px; flex-basis: 32px; }
  .health { margin-top: 11px; }
  .shell { padding: 22px 16px 42px; }
  .tabs { display: flex; width: 100%; margin-bottom: 26px; }
  .tab { flex: 1; padding-right: 6px; padding-left: 6px; font-size: 12px; white-space: nowrap; }
  .section-head h2 { font-size: 25px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stats .stat:last-child { grid-column: span 2; }
  .stat { min-height: 86px; padding: 14px; }
  .stat strong { font-size: 25px; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr) 112px; }
  .filters input { width: 100%; }
  .table-wrap table { min-width: 100%; table-layout: fixed; }
  .table-wrap th, .table-wrap td { padding: 12px 10px; }
  .table-wrap th:nth-child(1), .table-wrap td:nth-child(1),
  .table-wrap th:nth-child(4), .table-wrap td:nth-child(4),
  .table-wrap th:nth-child(5), .table-wrap td:nth-child(5),
  .table-wrap th:nth-child(6), .table-wrap td:nth-child(6) { display: none; }
  .table-wrap th:nth-child(2) { width: auto; }
  .table-wrap th:nth-child(3) { width: 48px; }
  .table-wrap th:nth-child(7) { width: 64px; }
  .table-wrap td:nth-child(2) > strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-wrap td:nth-child(2) .muted { display: none; }
  .table-wrap td:nth-child(7) .button { min-height: 32px; padding: 7px 9px; }
  .actions, .queue-controls { width: 100%; }
  .actions .button { flex: 1; }
  .queue-controls label { width: 100%; }
  .dropzone { min-height: 205px; }
  .queue-item { grid-template-columns: 1fr; gap: 8px; }
  .queue-item .button { justify-self: start; }
  .rules-editor-panel { padding: 14px; }
  .rules-editor-panel textarea { min-height: 360px; padding: 12px; }
  .rules-editor-actions { align-items: stretch; flex-direction: column; gap: 12px; }
  .rules-editor-actions .button { width: 100%; }
  .drawer { width: 100%; padding: 20px; }
  .evidence { grid-template-columns: 104px minmax(0, 1fr); gap: 12px; }
  .evidence img { width: 104px; height: 66px; }
  .settings-panel { grid-template-columns: 1fr; padding: 16px; }
  .settings-panel .field.full, .settings-actions.full { grid-column: auto; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .review-flow { align-items: stretch; }
  .review-flow b { display: none; }
  .review-flow span { width: 100%; text-align: center; }
}

/* Application shell: a focused, desktop-first operating workspace. */
.app-body {
  background: #f4f5f7;
}

.app-shell {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: 252px minmax(0, 1fr);
  background: #f4f5f7;
}

.side-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100dvh;
  flex-direction: column;
  padding: 24px 14px 16px;
  background: #1d1e21;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
  color: #fff;
}

.side-brand {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
}

.side-brand .brand-mark {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  color: #151619;
}

.side-brand .eyebrow { color: rgba(255, 255, 255, 0.46); }
.brand-name { margin-top: 3px; color: #fff; font-size: 16px; font-weight: 720; letter-spacing: 0; line-height: 1; }
.side-label { margin: 38px 10px 9px; color: rgba(255, 255, 255, 0.4); font-size: 11px; font-weight: 650; letter-spacing: 0.04em; }

.side-nav {
  display: grid;
  gap: 3px;
}

.nav-item {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.66);
  font-size: 14px;
  font-weight: 620;
  text-align: left;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.13);
  box-shadow: none;
  color: #fff;
}

.nav-index {
  display: inline-flex;
  width: 23px;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.36);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.nav-item.active .nav-index { color: #8fc4ff; }

.side-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.side-footer .side-label { margin: 0 2px 1px; }
.side-footer .health {
  width: 100%;
  min-height: 34px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.74);
  font-size: 11px;
  text-overflow: ellipsis;
}
.side-footer .health::before { background: #8e8e93; }
.side-footer .health.is-ready { border-color: rgba(52, 199, 89, 0.16); background: rgba(52, 199, 89, 0.11); color: #9ee7af; }
.side-footer .health.is-ready::before { background: #43d568; }
.side-footer .health.is-unavailable { border-color: rgba(255, 159, 10, 0.14); background: rgba(255, 159, 10, 0.1); color: #f5ca79; }
.side-footer .health.is-unavailable::before { background: #ffae29; }
.side-admin-link {
  display: flex;
  min-height: 34px;
  align-items: center;
  padding: 0 9px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}
.side-admin-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.workbench {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(244, 245, 247, 0) 250px),
    #f4f5f7;
}

.workbench-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 42px;
  border-bottom: 1px solid rgba(29, 30, 33, 0.09);
  background: rgba(250, 250, 252, 0.72);
}
.workbench-header .eyebrow { color: var(--faint); }
.workspace-title { margin-top: 3px; color: var(--ink); font-size: 16px; font-weight: 700; line-height: 1.1; }
.header-context { padding: 6px 9px; border: 1px solid rgba(29, 30, 33, 0.1); border-radius: 999px; color: var(--muted); font-size: 12px; }

.content-canvas {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 40px 42px 54px;
}

.content-canvas .section-head {
  align-items: flex-end;
  margin-bottom: 28px;
}
.content-canvas .section-head h2 { margin-top: 6px; font-size: 32px; font-weight: 740; line-height: 1.06; }
.content-canvas .section-head .eyebrow { color: #787980; }
.content-canvas .muted { max-width: 720px; color: #73747b; line-height: 1.6; }

.content-canvas .actions { gap: 7px; }
.content-canvas .button {
  min-height: 38px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 670;
}
.content-canvas .button.secondary {
  background: rgba(255, 255, 255, 0.78);
  color: #34353a;
}
.content-canvas .button.secondary:hover { color: var(--blue); }

.content-canvas .stats {
  gap: 0;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid rgba(29, 30, 33, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(26, 27, 31, 0.035);
}
.content-canvas .stat {
  min-height: 112px;
  padding: 20px;
  border: 0;
  border-right: 1px solid rgba(29, 30, 33, 0.09);
  border-radius: 0;
  box-shadow: none;
}
.content-canvas .stat:last-child { border-right: 0; }
.content-canvas .stat::before { top: auto; right: 20px; bottom: 18px; left: 20px; height: 2px; border-radius: 999px; background: #dbdce0; }
.content-canvas .stat span { color: #7b7d85; font-size: 12px; font-weight: 620; }
.content-canvas .stat strong { margin-top: 9px; color: #202126; font-size: 31px; font-weight: 720; }
.content-canvas .stat.green strong { color: var(--green); }
.content-canvas .stat.yellow strong { color: var(--amber); }
.content-canvas .stat.red strong { color: var(--red); }

.content-canvas .filters {
  min-height: 62px;
  margin-bottom: 0;
  padding: 11px 12px;
  border: 1px solid rgba(29, 30, 33, 0.1);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, 0.76);
}
.content-canvas .filters input, .content-canvas .filters select {
  min-height: 38px;
  border-color: rgba(29, 30, 33, 0.1);
  background: #f7f7f9;
  box-shadow: none;
}
.content-canvas .filters input:focus, .content-canvas .filters select:focus { background: #fff; }
.content-canvas .table-wrap {
  border-color: rgba(29, 30, 33, 0.1);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(26, 27, 31, 0.035);
}
.content-canvas .table-wrap th { height: 46px; background: #fbfbfc; color: #85868d; }
.content-canvas .table-wrap th, .content-canvas .table-wrap td { padding: 15px 16px; }
.content-canvas .table-wrap tbody tr { height: 78px; }
.content-canvas .table-wrap tbody tr:hover { background: #f9fafb; }
.content-canvas .thumb { width: 72px; height: 44px; border-radius: 5px; }
.content-canvas .status-pill { min-height: 24px; min-width: 31px; }

.content-canvas .queue-controls {
  padding: 7px;
  border: 1px solid rgba(29, 30, 33, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}
.content-canvas .queue-controls label { padding-left: 4px; }
.content-canvas .queue-controls input { border: 0; background: #f1f2f4; box-shadow: none; }
.content-canvas .dropzone {
  min-height: 300px;
  border-color: #c4c7cd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(26, 27, 31, 0.035);
}
.content-canvas .dropzone:hover, .content-canvas .dropzone.drag { background: #fbfdff; box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08); }
.content-canvas .drop-icon { width: 46px; height: 46px; margin-bottom: 12px; background: #eff6ff; }
.content-canvas .queue-list { gap: 10px; }
.content-canvas .queue-item { border-color: rgba(29, 30, 33, 0.1); border-radius: 8px; box-shadow: 0 4px 14px rgba(26, 27, 31, 0.025); }

.content-canvas .rule-toolbar { min-height: 48px; padding: 0 4px; margin-bottom: 8px; }
.content-canvas .rules-editor-panel { padding: 20px; border-color: rgba(29, 30, 33, 0.1); box-shadow: 0 8px 24px rgba(26, 27, 31, 0.035); }
.content-canvas .rules-editor-panel textarea { min-height: 460px; border: 1px solid rgba(29, 30, 33, 0.08); border-radius: 7px; background: #f8f8fa; box-shadow: none; }
.content-canvas .rules-editor-actions { padding-top: 4px; }

.admin-canvas { width: min(1120px, 100%); margin: 0; }
.admin-canvas .section-head { margin-bottom: 28px; }
.admin-canvas .settings-panel { max-width: 940px; padding: 24px; border-color: rgba(29, 30, 33, 0.1); box-shadow: 0 8px 24px rgba(26, 27, 31, 0.035); }
.admin-canvas .review-flow { max-width: 940px; margin-top: 2px; }
.admin-canvas .review-flow span { border-color: rgba(29, 30, 33, 0.1); box-shadow: none; }
.admin-canvas .login-panel, .admin-canvas .admin-notice { max-width: 520px; padding: 26px; border-color: rgba(29, 30, 33, 0.1); box-shadow: 0 8px 24px rgba(26, 27, 31, 0.035); }

@media (max-width: 900px) {
  .app-shell { display: block; }
  .side-rail {
    position: sticky;
    z-index: 20;
    top: 0;
    display: grid;
    height: auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
  }
  .side-brand { min-height: 36px; padding: 0; }
  .side-brand .brand-mark { width: 30px; height: 30px; flex-basis: 30px; border-radius: 7px; }
  .side-brand .eyebrow { display: none; }
  .brand-name { margin: 0; font-size: 15px; }
  .side-label, .side-footer { display: none; }
  .side-nav { display: flex; justify-content: center; gap: 3px; }
  .nav-item { width: auto; min-height: 34px; gap: 0; padding: 0 10px; font-size: 12px; }
  .nav-index { display: none; }
  .workbench-header { min-height: 58px; padding: 0 24px; }
  .workbench-header .eyebrow { display: none; }
  .workspace-title { margin: 0; font-size: 14px; }
  .content-canvas { padding: 30px 24px 48px; }
  .content-canvas .section-head { align-items: flex-start; }
}

@media (max-width: 620px) {
  .side-rail { grid-template-columns: 1fr; gap: 10px; padding: 12px 16px 10px; }
  .side-brand { justify-content: flex-start; }
  .side-nav { width: 100%; justify-content: stretch; }
  .nav-item { flex: 1; justify-content: center; padding: 0 6px; }
  .workbench-header { display: none; }
  .content-canvas { padding: 26px 16px 38px; }
  .content-canvas .section-head { align-items: flex-start; margin-bottom: 22px; }
  .content-canvas .section-head h2 { font-size: 27px; }
  .content-canvas .actions { width: 100%; }
  .content-canvas .actions .button { flex: 1; min-width: 0; padding: 8px 7px; }
  .content-canvas .stats { gap: 9px; overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .content-canvas .stat { min-height: 92px; padding: 15px; border: 1px solid rgba(29, 30, 33, 0.1); border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
  .content-canvas .stat:last-child { border-right: 1px solid rgba(29, 30, 33, 0.1); }
  .content-canvas .filters { min-height: 0; padding: 10px; }
  .content-canvas .table-wrap th, .content-canvas .table-wrap td { padding: 12px 10px; }
  .content-canvas .queue-controls { width: 100%; }
  .content-canvas .dropzone { min-height: 235px; }
  .content-canvas .rules-editor-panel { padding: 14px; }
  .content-canvas .rules-editor-panel textarea { min-height: 400px; }
}

/* Light glass theme. The layout remains operational; only its material system changes. */
:root {
  --glass-canvas: #edf0f4;
  --glass-ink: #20242c;
  --glass-muted: #727985;
  --glass-blue: #1677e8;
  --glass-border: rgba(255, 255, 255, 0.78);
  --glass-line: rgba(77, 87, 102, 0.12);
  --glass-surface: rgba(255, 255, 255, 0.62);
  --glass-surface-strong: rgba(255, 255, 255, 0.82);
  --glass-shadow: 0 16px 42px rgba(49, 61, 78, 0.1), 0 2px 6px rgba(49, 61, 78, 0.04);
  --glass-shadow-sm: 0 7px 20px rgba(49, 61, 78, 0.07), 0 1px 2px rgba(49, 61, 78, 0.04);
}

.app-body {
  color: var(--glass-ink);
  background: var(--glass-canvas);
}

.app-shell { background: var(--glass-canvas); }

.side-rail {
  border-right: 1px solid var(--glass-border);
  background: rgba(247, 249, 252, 0.64);
  box-shadow: 12px 0 34px rgba(49, 61, 78, 0.045);
  color: var(--glass-ink);
  backdrop-filter: blur(28px) saturate(135%);
  -webkit-backdrop-filter: blur(28px) saturate(135%);
}

.side-brand .brand-mark {
  border-color: rgba(22, 119, 232, 0.18);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 18px rgba(22, 119, 232, 0.12), inset 0 1px 0 #fff;
  color: var(--glass-blue);
}
.side-brand .eyebrow { color: #8b939f; }
.brand-name { color: #252a33; }
.side-label { color: #939aa5; }

.nav-item {
  border-color: transparent;
  color: #69717d;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.54); color: #303642; }
.nav-item.active {
  border-color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--glass-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: #202732;
}
.nav-index { color: #a4abb5; }
.nav-item.active .nav-index { color: var(--glass-blue); }

.side-footer { border-top-color: rgba(77, 87, 102, 0.1); }
.side-footer .side-label { color: #949ba6; }
.side-footer .health {
  border-color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
  color: #6e7681;
}
.side-footer .health.is-ready { border-color: rgba(82, 187, 111, 0.22); background: rgba(232, 250, 236, 0.62); color: #2d8751; }
.side-footer .health.is-unavailable { border-color: rgba(230, 165, 52, 0.2); background: rgba(255, 247, 226, 0.66); color: #9a6c1d; }
.side-admin-link { color: #717985; }
.side-admin-link:hover { background: rgba(255, 255, 255, 0.54); color: #2e3540; }

.workbench {
  background: transparent;
}
.workbench-header {
  border-bottom-color: rgba(255, 255, 255, 0.82);
  background: rgba(248, 250, 252, 0.46);
  box-shadow: 0 1px 0 rgba(77, 87, 102, 0.045);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
}
.workbench-header .eyebrow { color: #8b939f; }
.workspace-title { color: #262c35; }
.header-context {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 #fff;
  color: #737b87;
}

.content-canvas .section-head .eyebrow { color: #8b939f; }
.content-canvas .section-head h2 { color: #242a33; }
.content-canvas .muted { color: var(--glass-muted); }
.content-canvas .button { background: var(--glass-blue); box-shadow: 0 7px 16px rgba(22, 119, 232, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.27); }
.content-canvas .button:hover { background: #0869d0; }
.content-canvas .button.secondary {
  border-color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: var(--glass-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: #4a5565;
}
.content-canvas .button.secondary:hover { background: rgba(255, 255, 255, 0.8); color: var(--glass-blue); }

.content-canvas .stats {
  border-color: var(--glass-border);
  background: var(--glass-surface);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}
.content-canvas .stat { border-right-color: rgba(77, 87, 102, 0.1); background: transparent; }
.content-canvas .stat span { color: #7f8792; }
.content-canvas .stat strong { color: #29303b; }
.content-canvas .stat::before { background: rgba(77, 87, 102, 0.18); }

.content-canvas .filters {
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 5px 14px rgba(49, 61, 78, 0.025), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}
.content-canvas .filters input, .content-canvas .filters select {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(247, 249, 251, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}
.content-canvas .filters input:focus, .content-canvas .filters select:focus { background: rgba(255, 255, 255, 0.92); }

.content-canvas .table-wrap {
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
}
.content-canvas .table-wrap th {
  border-bottom-color: rgba(77, 87, 102, 0.1);
  background: rgba(255, 255, 255, 0.38);
  color: #8b929c;
}
.content-canvas .table-wrap td { border-bottom-color: rgba(77, 87, 102, 0.09); }
.content-canvas .table-wrap tbody tr:hover { background: rgba(255, 255, 255, 0.42); }
.content-canvas .thumb { border-color: rgba(255, 255, 255, 0.74); box-shadow: 0 3px 8px rgba(49, 61, 78, 0.08); }

.content-canvas .queue-controls {
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: var(--glass-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}
.content-canvas .queue-controls input { background: rgba(255, 255, 255, 0.66); }
.content-canvas .dropzone {
  border-color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}
.content-canvas .dropzone:hover, .content-canvas .dropzone.drag { border-color: rgba(22, 119, 232, 0.45); background: rgba(255, 255, 255, 0.76); box-shadow: 0 0 0 4px rgba(22, 119, 232, 0.09), var(--glass-shadow); }
.content-canvas .drop-icon { border-color: rgba(22, 119, 232, 0.14); background: rgba(231, 243, 255, 0.76); color: var(--glass-blue); }
.content-canvas .queue-item {
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.57);
  box-shadow: var(--glass-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
}

.content-canvas .rules-editor-panel {
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}
.content-canvas .rules-editor-panel textarea {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(246, 248, 251, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.drawer {
  border-left-color: rgba(255, 255, 255, 0.84);
  background: rgba(247, 249, 252, 0.82);
  box-shadow: -18px 0 58px rgba(49, 61, 78, 0.16);
  backdrop-filter: blur(30px) saturate(145%);
  -webkit-backdrop-filter: blur(30px) saturate(145%);
}
.drawer-head, .detail-summary, .evidence { border-color: rgba(77, 87, 102, 0.1); }
.icon-button { background: rgba(255, 255, 255, 0.6); box-shadow: inset 0 1px 0 #fff; }
.detail-cover, .evidence img { border-color: rgba(255, 255, 255, 0.82); box-shadow: var(--glass-shadow-sm); }

.admin-canvas .settings-panel, .admin-canvas .login-panel, .admin-canvas .admin-notice {
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}
.admin-canvas .settings-panel input, .admin-canvas .settings-panel textarea, .admin-canvas .login-panel .field input {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(246, 248, 251, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

@media (max-width: 900px) {
  .side-rail { border-bottom: 1px solid var(--glass-border); box-shadow: 0 6px 22px rgba(49, 61, 78, 0.07); }
}

/* Individual audit cards give the workspace a clearer, more expressive review rhythm. */
.content-canvas .stats {
  gap: 13px;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.content-canvas .stat {
  min-height: 118px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  box-shadow: var(--glass-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 170ms ease, box-shadow 170ms ease;
}
.content-canvas .stat:hover { box-shadow: var(--glass-shadow); transform: translateY(-2px); }
.content-canvas .stat:nth-child(1) { background: rgba(234, 241, 252, 0.82); }
.content-canvas .stat:nth-child(2) { background: rgba(232, 248, 237, 0.8); }
.content-canvas .stat:nth-child(3) { background: rgba(255, 246, 225, 0.82); }
.content-canvas .stat:nth-child(4) { background: rgba(255, 237, 236, 0.82); }
.content-canvas .stat:nth-child(5) { background: rgba(244, 244, 247, 0.88); }
.content-canvas .stat:not(:last-child) { border-right: 1px solid rgba(255, 255, 255, 0.86); }
.content-canvas .stat::before { right: 18px; left: 18px; bottom: 16px; }

.content-canvas .filters {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--glass-border);
  border-radius: 8px;
  box-shadow: var(--glass-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

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

.record-grid .empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: var(--glass-shadow-sm);
}

.record-card {
  position: relative;
  display: grid;
  min-height: 152px;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 15px;
  padding: 14px 14px 14px 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--glass-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.88);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
}

.record-card::before {
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #a8b0bc;
  content: "";
}
.record-card:hover { background: rgba(255, 255, 255, 0.78); box-shadow: var(--glass-shadow); transform: translateY(-2px); }
.record-card.result-green::before { background: #38b767; }
.record-card.result-yellow::before { background: #f2a42e; }
.record-card.result-red::before { background: #ed655d; }
.record-card.result-gray::before { background: #a8b0bc; }
.record-card.result-green { background: rgba(247, 254, 249, 0.64); }
.record-card.result-yellow { background: rgba(255, 252, 246, 0.68); }
.record-card.result-red { background: rgba(255, 249, 249, 0.68); }

.record-cover {
  min-width: 0;
  height: 122px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  background: rgba(235, 239, 244, 0.82);
  box-shadow: 0 4px 12px rgba(49, 61, 78, 0.08);
}
.record-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.record-cover-empty { width: 100%; height: 100%; background: rgba(216, 221, 228, 0.64); }
.record-card-main { min-width: 0; padding: 1px 0 34px; }
.record-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.record-file { min-width: 0; }
.record-file strong { display: block; overflow: hidden; color: #2a3039; font-size: 14px; font-weight: 700; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.record-file span { display: block; margin-top: 4px; color: #8a929d; font-size: 11px; }
.record-card-top .status-pill { flex: 0 0 auto; }
.record-metrics { display: flex; align-items: stretch; gap: 0; margin-top: 18px; }
.record-metrics > div { min-width: 78px; padding-right: 18px; }
.record-metrics > div + div { padding-left: 18px; border-left: 1px solid rgba(77, 87, 102, 0.12); }
.record-metrics span { display: block; color: #878f9a; font-size: 11px; }
.record-metrics strong { display: block; margin-top: 3px; color: #333a45; font-size: 20px; font-weight: 720; line-height: 1.1; }
.record-metrics small { margin-left: 2px; color: #9299a3; font-size: 11px; font-weight: 600; }
.record-note { margin-top: 9px; color: #a16e18; font-size: 11px; }
.record-detail-button {
  position: absolute;
  right: 14px;
  bottom: 14px;
  min-height: 29px !important;
  padding: 6px 9px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
}

@media (max-width: 1120px) {
  .record-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .content-canvas .stats { gap: 9px; }
  .content-canvas .stat { min-height: 92px; }
  .record-card { grid-template-columns: 98px minmax(0, 1fr); gap: 12px; min-height: 132px; padding: 12px 12px 12px 14px; }
  .record-cover { height: 106px; }
  .record-card-main { padding-bottom: 31px; }
  .record-file strong { font-size: 13px; }
  .record-file span { margin-top: 3px; }
  .record-metrics { margin-top: 13px; }
  .record-metrics > div { min-width: 63px; padding-right: 10px; }
  .record-metrics > div + div { padding-left: 10px; }
  .record-metrics strong { font-size: 18px; }
  .record-detail-button { right: 12px; bottom: 11px; }
}

/* White iOS application material: modular layers, restrained depth, and short feedback motion. */
:root {
  --white-app: #f7f8fa;
  --white-panel: rgba(255, 255, 255, 0.78);
  --white-panel-solid: rgba(255, 255, 255, 0.94);
  --white-edge: rgba(255, 255, 255, 0.96);
  --white-line: rgba(69, 79, 94, 0.1);
  --white-ink: #222831;
  --white-muted: #747c88;
  --white-blue: #0879eb;
  --white-shadow-low: 0 5px 13px rgba(55, 66, 82, 0.055), 0 1px 2px rgba(55, 66, 82, 0.035);
  --white-shadow-float: 0 18px 34px rgba(55, 66, 82, 0.11), 0 4px 9px rgba(55, 66, 82, 0.055);
}

.app-body,
.app-shell {
  background: var(--white-app);
}

.app-body {
  color: var(--white-ink);
}

.side-rail {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 9px 0 26px rgba(55, 66, 82, 0.045), inset -1px 0 0 rgba(255, 255, 255, 0.88);
}

.side-brand .brand-mark {
  border-color: rgba(8, 121, 235, 0.14);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 18px rgba(8, 121, 235, 0.12), inset 0 1px 0 #fff;
  color: var(--white-blue);
}

.nav-item {
  position: relative;
  overflow: hidden;
  transition: transform 170ms ease, background 170ms ease, box-shadow 170ms ease, color 170ms ease;
}
.nav-item::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: transparent;
  content: "";
  transition: background 170ms ease, transform 170ms ease;
  transform: scaleY(0.35);
}
.nav-item:hover { transform: translateX(2px); }
.nav-item.active {
  background: var(--white-panel-solid);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  transform-style: preserve-3d;
}
.nav-item.active::before { background: var(--white-blue); transform: scaleY(1); }

.workbench {
  background: var(--white-app);
}
.workbench-header {
  border-bottom-color: rgba(69, 79, 94, 0.08);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.82);
}
.header-context {
  border-color: var(--white-edge);
  background: var(--white-panel);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
}
.content-canvas {
  perspective: 1400px;
  transform-style: preserve-3d;
}

.tab-panel.active {
  animation: panel-arrive 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin: 50% 8%;
}

.content-canvas .section-head {
  position: relative;
  padding-bottom: 3px;
}
.content-canvas .section-head h2 { color: var(--white-ink); }
.content-canvas .muted { color: var(--white-muted); }

.content-canvas .button {
  position: relative;
  overflow: hidden;
  background: var(--white-blue);
  box-shadow: 0 8px 16px rgba(8, 121, 235, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.content-canvas .button:hover {
  background: #056fd8;
  box-shadow: 0 11px 20px rgba(8, 121, 235, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}
.content-canvas .button:active { box-shadow: inset 0 2px 5px rgba(2, 80, 162, 0.23); transform: translateY(1px) scale(0.985); }
.content-canvas .button.secondary {
  border-color: var(--white-edge);
  background: var(--white-panel);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  color: #4f5865;
}
.content-canvas .button.secondary:hover { background: var(--white-panel-solid); color: var(--white-blue); }

.content-canvas .stats { gap: 14px; }
.content-canvas .stat {
  border-color: var(--white-edge);
  background: var(--white-panel-solid) !important;
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  transform: translateZ(0);
  transition: transform 190ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 190ms ease;
}
.content-canvas .stat:hover {
  box-shadow: var(--white-shadow-float), inset 0 1px 0 #fff;
  transform: translate3d(0, -4px, 12px) rotateX(0.7deg);
}
.content-canvas .stat::after {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b7c0cd;
  box-shadow: 0 0 0 4px rgba(183, 192, 205, 0.14);
  content: "";
}
.content-canvas .stat.green::after { background: #36b967; box-shadow: 0 0 0 4px rgba(54, 185, 103, 0.13); }
.content-canvas .stat.yellow::after { background: #efaa38; box-shadow: 0 0 0 4px rgba(239, 170, 56, 0.13); }
.content-canvas .stat.red::after { background: #ea655d; box-shadow: 0 0 0 4px rgba(234, 101, 93, 0.13); }

.content-canvas .filters {
  border-color: var(--white-edge);
  background: var(--white-panel);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
}
.content-canvas .filters input,
.content-canvas .filters select {
  border-color: rgba(69, 79, 94, 0.08);
  background: rgba(245, 247, 250, 0.9);
  box-shadow: inset 0 1px 1px rgba(69, 79, 94, 0.035);
}

.record-card {
  border-color: var(--white-edge);
  background: var(--white-panel-solid) !important;
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  transform: translateZ(0);
  transition: transform 210ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 210ms ease, border-color 210ms ease;
}
.record-card:hover {
  border-color: #fff;
  background: #fff !important;
  box-shadow: var(--white-shadow-float), inset 0 1px 0 #fff;
  transform: translate3d(0, -5px, 18px) rotateX(0.75deg);
}
.record-card::after {
  position: absolute;
  top: 0;
  right: 18px;
  left: 18px;
  height: 1px;
  background: rgba(255, 255, 255, 0.96);
  content: "";
}
.record-cover {
  border-color: rgba(255, 255, 255, 0.96);
  background: #f0f2f5;
  box-shadow: 0 8px 17px rgba(55, 66, 82, 0.105), inset 0 1px 0 #fff;
  transform: translateZ(8px);
}
.record-card-main { transform: translateZ(6px); }
.record-detail-button { transform: translateZ(9px); }
.record-card:hover .record-cover { box-shadow: 0 11px 20px rgba(55, 66, 82, 0.13), inset 0 1px 0 #fff; }

.queue-panel .queue-controls,
.rules-panel .rule-toolbar {
  border-color: var(--white-edge);
  background: var(--white-panel);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
}
.queue-panel .queue-controls { padding: 8px; }
.rules-panel .rule-toolbar { padding: 5px 10px; border-radius: 8px; }
.content-canvas .dropzone,
.content-canvas .rules-editor-panel {
  border-color: var(--white-edge);
  background: var(--white-panel-solid);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  transform: translateZ(0);
  transition: transform 210ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 210ms ease, background 210ms ease;
}
.content-canvas .dropzone:hover,
.content-canvas .dropzone.drag,
.content-canvas .rules-editor-panel:focus-within {
  background: #fff;
  box-shadow: var(--white-shadow-float), inset 0 1px 0 #fff;
  transform: translate3d(0, -3px, 12px) rotateX(0.45deg);
}
.content-canvas .drop-icon {
  background: #f1f7ff;
  box-shadow: 0 7px 14px rgba(8, 121, 235, 0.11), inset 0 1px 0 #fff;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms ease;
}
.content-canvas .dropzone:hover .drop-icon,
.content-canvas .dropzone.drag .drop-icon {
  box-shadow: 0 11px 18px rgba(8, 121, 235, 0.16), inset 0 1px 0 #fff;
  transform: translateY(-3px) rotate(45deg);
}
.content-canvas .queue-item {
  border-color: var(--white-edge);
  background: var(--white-panel);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.content-canvas .queue-item:hover { box-shadow: var(--white-shadow-float), inset 0 1px 0 #fff; transform: translateY(-2px); }

.content-canvas .rules-editor-panel textarea {
  border-color: rgba(69, 79, 94, 0.08);
  background: rgba(247, 248, 250, 0.94);
  box-shadow: inset 0 1px 1px rgba(69, 79, 94, 0.035);
}

.drawer {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: -20px 0 52px rgba(55, 66, 82, 0.15), inset 1px 0 0 rgba(255, 255, 255, 0.88);
}

@keyframes panel-arrive {
  from { opacity: 0; transform: translate3d(0, 10px, -16px); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

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

@media (max-width: 620px) {
  .content-canvas .stat:hover,
  .record-card:hover,
  .content-canvas .dropzone:hover,
  .content-canvas .rules-editor-panel:focus-within,
  .content-canvas .queue-item:hover { transform: translateY(-2px); }
}

/* Audit browsing is intentionally compact: the card itself is the detail action. */
.content-canvas .filters {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, .74fr) minmax(0, .75fr) minmax(0, .75fr) minmax(88px, .36fr);
  gap: 9px;
  padding: 9px;
}
.content-canvas .filters input,
.content-canvas .filters select { width: 100%; min-width: 0; }
.content-canvas .filters input[type="date"] { color: #56606d; font-size: 12px; }
.content-canvas .filters input[type="date"]::-webkit-calendar-picker-indicator { opacity: .56; cursor: pointer; }
.content-canvas .filters .task-edit-button { min-height: 38px; padding-right: 12px; padding-left: 12px; white-space: nowrap; }

.task-selection-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -3px 0 14px;
  padding: 9px 11px;
  border: 1px solid var(--white-edge);
  border-radius: 8px;
  background: var(--white-panel);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
}
.task-selection-toolbar[hidden] { display: none; }
.task-select-all { display: inline-flex; align-items: center; gap: 7px; color: #4f5865; font-size: 12px; font-weight: 650; cursor: pointer; }
.task-select-all input, .record-selection input { width: 17px; height: 17px; margin: 0; accent-color: var(--white-blue); cursor: pointer; }
.task-selection-count { color: #818a96; font-size: 12px; }
.task-delete-button { margin-left: auto; min-height: 32px !important; padding: 7px 11px !important; border-color: rgba(209, 70, 62, .18) !important; background: #d8524b !important; box-shadow: 0 6px 13px rgba(209, 70, 62, .18) !important; }
.task-delete-button:hover { background: #c7443e !important; }
.task-delete-button:disabled { background: #d8dce1 !important; box-shadow: none !important; color: #8d96a2; }

.record-card { cursor: pointer; outline: none; grid-template-columns: 136px minmax(0, 1fr) 26px; align-items: center; min-height: 154px; }
.record-card:focus-visible { border-color: rgba(8, 121, 235, .55); box-shadow: 0 0 0 4px rgba(8, 121, 235, .13), var(--white-shadow-float), inset 0 1px 0 #fff; }
.record-card.is-editing { grid-template-columns: 30px 136px minmax(0, 1fr); }
.record-card.is-editing .record-card-hint { display: none; }
.record-card.is-selected { border-color: rgba(8, 121, 235, .32); background: #f5faff !important; box-shadow: 0 0 0 3px rgba(8, 121, 235, .09), var(--white-shadow-low), inset 0 1px 0 #fff; }
.record-selection { display: flex; align-items: center; justify-content: center; align-self: stretch; }
.record-selection.is-disabled { opacity: .32; cursor: not-allowed; }
.record-selection.is-disabled input { cursor: not-allowed; }
.record-card-main { align-self: stretch; padding: 4px 0 8px; }
.record-card-hint { position: relative; align-self: center; width: 26px; height: 26px; border: 1px solid rgba(89, 101, 117, .11); border-radius: 50%; background: rgba(255,255,255,.68); box-shadow: inset 0 1px 0 #fff, 0 4px 9px rgba(55, 66, 82, .06); }
.record-card-hint::after { position: absolute; top: 7px; left: 9px; width: 7px; height: 7px; border-top: 1.5px solid #7b8592; border-right: 1.5px solid #7b8592; content: ""; transform: rotate(45deg); transition: transform 160ms ease, border-color 160ms ease; }
.record-card:hover .record-card-hint { border-color: rgba(8, 121, 235, .18); background: #f4f9ff; }
.record-card:hover .record-card-hint::after { border-color: var(--white-blue); transform: translateX(2px) rotate(45deg); }
.detail-result-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.detail-export { margin-left: auto; text-decoration: none; }

@media (max-width: 760px) {
  .content-canvas .filters { grid-template-columns: minmax(0, 1fr) minmax(112px, .54fr); }
  .record-card { grid-template-columns: 108px minmax(0, 1fr) 24px; gap: 12px; min-height: 138px; }
  .record-cover { height: 108px; }
  .record-card-hint { width: 24px; height: 24px; }
  .record-card.is-editing { grid-template-columns: 26px 108px minmax(0, 1fr); }
  .task-selection-toolbar { flex-wrap: wrap; }
  .task-delete-button { margin-left: 0; }
}

@media (max-width: 460px) {
  .content-canvas .filters { grid-template-columns: 1fr; }
  .detail-export { width: 100%; margin-left: 0; }
}

.queue-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-height: 30px; }
.queue-delete {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(214, 83, 76, .14);
  border-radius: 50%;
  background: rgba(255, 245, 244, .78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
  color: #c94a43;
  font-size: 19px;
  line-height: 1;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.queue-delete:hover { background: #fff0ef; box-shadow: 0 5px 12px rgba(189, 64, 57, .13), inset 0 1px 0 #fff; transform: translateY(-1px); }
.queue-delete:active { transform: scale(.94); }

@media (max-width: 620px) {
  .queue-actions { justify-content: flex-start; }
}

.rules-editor-wrap {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  min-height: 460px;
  overflow: hidden;
  border: 1px solid rgba(69, 79, 94, .08);
  border-radius: 7px;
  background: rgba(247, 248, 250, .94);
  box-shadow: inset 0 1px 1px rgba(69, 79, 94, .035);
}
.rules-editor-panel .rule-line-numbers {
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 14px 9px 14px 6px;
  overflow: hidden;
  border-right: 1px solid rgba(69, 79, 94, .08);
  color: #a1a9b3;
  font: 600 12px/1.72 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: right;
  user-select: none;
}
.rule-line-number { display: block; min-height: 1.72em; }
.rule-line-measure {
  position: absolute;
  top: -10000px;
  left: -10000px;
  visibility: hidden;
  pointer-events: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}
.rules-editor-panel .rules-editor-wrap textarea {
  width: 100%;
  min-height: 458px;
  margin: 0;
  padding: 14px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.72;
}
.rules-editor-panel .rules-editor-wrap textarea:focus { box-shadow: inset 2px 0 0 rgba(8, 121, 235, .68); }

@media (max-width: 620px) {
  .rules-editor-wrap { min-height: 400px; grid-template-columns: 40px minmax(0, 1fr); }
  .rules-editor-panel .rules-editor-wrap textarea { min-height: 398px; padding: 12px; }
  .rules-editor-panel .rule-line-numbers { padding: 12px 7px 12px 4px; }
}

/* Keep the upload commands as a compact action row instead of a large nested panel. */
.queue-panel .section-head > div:first-child { min-width: 0; }
.queue-panel .queue-controls {
  width: auto;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.queue-panel .queue-controls label {
  display: inline-flex;
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 7px 0 12px;
  border: 1px solid var(--white-edge);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  color: #65707d;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.queue-panel .queue-controls input {
  width: 40px;
  min-height: 28px;
  padding: 4px 3px;
  border: 0;
  border-radius: 6px;
  background: #f2f5f8;
  box-shadow: inset 0 1px 2px rgba(55, 66, 82, 0.08);
  color: #27303b;
  font-size: 13px;
  font-weight: 700;
}
.queue-panel .queue-controls .button {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
}
.queue-panel .queue-controls .button.secondary {
  border-color: var(--white-edge);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  color: #566170;
}
.queue-panel .queue-controls .button.secondary:hover {
  border-color: rgba(8, 121, 235, 0.18);
  background: #f5faff;
  color: var(--white-blue);
}

@media (max-width: 1080px) {
  .queue-panel .section-head { align-items: flex-start; flex-direction: column; }
  .queue-panel .queue-controls { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .queue-panel .queue-controls { width: 100%; flex-wrap: wrap; }
  .queue-panel .queue-controls label { flex: 1 0 100%; justify-content: space-between; }
  .queue-panel .queue-controls .button { flex: 1 1 0; min-width: 0; }
}

/* Login, personal center, and administrator account management. */
.auth-screen {
  display: grid;
  min-height: 100dvh;
  align-content: center;
  justify-items: center;
  gap: 28px;
  padding: 40px 24px;
  background: #f5f7fa;
}
.auth-brand { display: inline-flex; align-items: center; gap: 12px; color: #222a34; }
.auth-brand .brand-mark { width: 44px; height: 44px; flex-basis: 44px; }
.auth-brand .brand-name { margin-top: 2px; font-size: 20px; }
.user-login-panel {
  width: min(420px, 100%);
  max-width: 420px !important;
  gap: 16px;
  padding: 26px !important;
  border-color: var(--white-edge) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, .78) !important;
  box-shadow: var(--white-shadow-float), inset 0 1px 0 #fff !important;
  backdrop-filter: blur(24px) saturate(125%);
  -webkit-backdrop-filter: blur(24px) saturate(125%);
}
.user-login-panel .settings-actions { align-items: center; }
.user-login-panel .button { min-width: 104px; }
.side-admin-link {
  width: 100%;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.personal-arrow { margin-left: auto; color: #a4acb7; font-size: 19px; line-height: 1; }

.profile-layout { display: grid; grid-template-columns: minmax(210px, .72fr) minmax(0, 1.28fr); align-items: start; gap: 16px; max-width: 920px; }
.profile-card {
  border: 1px solid var(--white-edge);
  border-radius: 8px;
  background: var(--white-panel);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
}
.profile-account-card { display: flex; min-height: 230px; flex-direction: column; align-items: flex-start; padding: 22px; }
.profile-card-label { margin-bottom: 9px; color: #818b98; font-size: 12px; font-weight: 750; }
.profile-account-card > strong { margin-bottom: 11px; color: #252d38; font-size: 23px; font-weight: 760; line-height: 1.15; }
.profile-account-card > p { margin: 16px 0 0; }
.profile-admin-link { margin-top: auto; text-decoration: none; }
.profile-password-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 22px; }
.profile-password-card > :first-child, .profile-password-card .settings-actions { grid-column: 1 / -1; }
.profile-password-card p { margin: 0; }
.profile-password-card .field { min-width: 0; }
.profile-password-card .field:first-of-type { grid-column: 1 / -1; }
.profile-password-card label, .admin-user-editor label { display: block; margin-bottom: 6px; color: #687381; font-size: 12px; font-weight: 690; }
.profile-password-card input, .admin-user-editor input, .admin-user-editor select, .admin-create-user select {
  width: 100%;
  min-height: 39px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(69, 79, 94, .1);
  border-radius: 7px;
  outline: 0;
  background: rgba(247, 248, 250, .94);
  box-shadow: inset 0 1px 1px rgba(69, 79, 94, .035);
  color: #303945;
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.profile-password-card input:focus, .admin-user-editor input:focus, .admin-user-editor select:focus, .admin-create-user select:focus { border-color: rgba(8, 121, 235, .5); box-shadow: 0 0 0 3px rgba(8, 121, 235, .11); background: #fff; }

.admin-management-section { max-width: 1040px; margin-top: 34px; scroll-margin-top: 22px; }
.admin-management-section + .admin-management-section { margin-top: 48px; }
.subsection-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 15px; }
.subsection-head h3 { margin: 4px 0 5px; color: #262e39; font-size: 20px; line-height: 1.2; }
.admin-user-count { flex: 0 0 auto; padding: 6px 9px; border: 1px solid var(--white-edge); border-radius: 999px; background: rgba(255,255,255,.72); box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff; color: #6d7784; font-size: 12px; font-weight: 700; white-space: nowrap; }
.admin-users-layout { display: grid; grid-template-columns: minmax(250px, .55fr) minmax(0, 1.45fr); align-items: start; gap: 16px; }
.admin-create-user, .admin-provider-settings { max-width: none !important; border-color: var(--white-edge) !important; background: var(--white-panel) !important; box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff !important; }
.admin-create-user { grid-template-columns: 1fr 1fr !important; }
.admin-user-list { display: grid; gap: 10px; }
.admin-user-card { padding: 15px 16px; border: 1px solid var(--white-edge); border-radius: 8px; background: var(--white-panel); box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff; }
.admin-user-card.is-current { border-color: rgba(8, 121, 235, .2); background: #f9fcff; }
.admin-user-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.admin-user-card-head > div { min-width: 0; }
.admin-user-card-head strong { display: block; overflow: hidden; color: #29323d; font-size: 15px; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-card-head span:not(.status-pill) { display: block; margin-top: 3px; color: #89929e; font-size: 11px; }
.admin-user-editor { display: grid; grid-template-columns: minmax(0, 1fr) 118px minmax(150px, 1.15fr) auto; align-items: end; gap: 9px; }
.admin-user-editor label { min-width: 0; margin: 0; }
.admin-user-editor input, .admin-user-editor select { min-width: 0; }
.admin-user-editor select:disabled { cursor: not-allowed; opacity: .58; }
.admin-user-actions { display: flex; align-items: center; gap: 7px; min-height: 39px; }
.admin-user-actions .button { min-height: 39px; padding: 8px 11px; white-space: nowrap; }
.danger-button { border-color: rgba(210, 76, 68, .18) !important; background: #fff4f3 !important; box-shadow: inset 0 1px 0 #fff !important; color: #cc4d46 !important; }
.danger-button:hover { border-color: rgba(210, 76, 68, .32) !important; background: #ffebe9 !important; color: #b93c36 !important; }

@media (max-width: 820px) {
  .profile-layout, .admin-users-layout { grid-template-columns: 1fr; }
  .profile-account-card { min-height: 190px; }
  .admin-create-user { grid-template-columns: 1fr !important; }
  .admin-user-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .admin-password-field { grid-column: 1 / -1; }
  .admin-user-actions { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .auth-screen { align-content: start; padding: 68px 16px 32px; }
  .user-login-panel { padding: 20px !important; }
  .profile-password-card { grid-template-columns: 1fr; padding: 17px; }
  .profile-password-card .field:first-of-type { grid-column: auto; }
  .profile-password-card > :first-child, .profile-password-card .settings-actions { grid-column: auto; }
  .subsection-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .admin-user-editor { grid-template-columns: 1fr; }
  .admin-password-field, .admin-user-actions { grid-column: auto; }
  .admin-user-actions .button { flex: 1; }
}

/* Final application shell: one calm top navigation shared by the workspace and admin console. */
.app-shell {
  display: block !important;
  min-height: 100dvh;
  background: var(--white-app);
}
.side-rail,
.workbench-header { display: none !important; }
.workbench { min-height: 100dvh; }
.app-topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  min-height: 76px;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: 22px;
  padding: 12px max(24px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid rgba(69, 79, 94, 0.08);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 3px 15px rgba(55, 66, 82, 0.035), inset 0 -1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}
.topbar-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-self: start;
  gap: 11px;
  color: var(--white-ink);
  text-decoration: none;
}
.topbar-brand .brand-mark { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
.topbar-brand-copy { display: grid; min-width: 0; gap: 3px; }
.topbar-brand-copy strong { overflow: hidden; color: #242a33; font-size: 16px; font-weight: 760; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.topbar-brand-copy .eyebrow { color: #929aa6; font-size: 9px; }
.topbar-nav {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(69, 79, 94, 0.075);
  border-radius: 12px;
  background: rgba(242, 244, 247, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.topbar-nav-item {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 7px 15px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7b8490;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: color 170ms ease, background 170ms ease, box-shadow 170ms ease, transform 170ms ease;
}
.topbar-nav-item:hover { color: #303946; transform: translateY(-1px); }
.topbar-nav-item.active,
.topbar-nav-item[aria-current="page"] {
  background: #fff;
  box-shadow: 0 4px 10px rgba(55, 66, 82, 0.07), inset 0 1px 0 #fff;
  color: #202833;
}
.topbar-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 9px; }
.topbar-actions .health { min-height: 34px; padding: 7px 10px; border-radius: 10px; font-size: 11px; }
.topbar-account,
.topbar-link,
.admin-topbar-state {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(69, 79, 94, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 #fff;
  color: #616b78;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.topbar-account:hover,
.topbar-link:hover { border-color: rgba(8, 121, 235, 0.18); background: #fff; color: var(--white-blue); transform: translateY(-1px); }
.account-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #aab3bf; box-shadow: 0 0 0 3px rgba(170, 179, 191, 0.14); }
.admin-topbar-state .account-dot { background: #35b96a; box-shadow: 0 0 0 3px rgba(53, 185, 106, 0.13); }
.admin-canvas { width: min(1240px, 100%); margin: 0 auto; }
.admin-canvas > #adminSettings > .section-head { max-width: 1040px; }
.admin-canvas .section-head h2 { letter-spacing: 0; }
.admin-canvas #adminSettings > .section-head { margin-bottom: 26px; }
.admin-canvas #providerSettings[hidden],
.admin-canvas #userManagement[hidden] { display: none !important; }
.admin-topbar-nav .topbar-nav-item { min-width: 92px; }
.admin-management-section { max-width: 1040px; margin-top: 30px; }
.admin-management-section + .admin-management-section { margin-top: 36px; }
.admin-management-section .subsection-head { padding-bottom: 3px; }
.admin-management-section .subsection-head .eyebrow { color: #9aa2ad; }

/* Persisted server tasks remain visible after a refresh and have their own action surface. */
.server-queue-section {
  max-width: 1040px;
  margin-top: 34px;
  padding-top: 27px;
  border-top: 1px solid rgba(69, 79, 94, 0.09);
}
.queue-subsection-head { align-items: center; margin-bottom: 13px; }
.queue-subsection-head h3 { margin: 4px 0 4px; color: #2b333d; font-size: 19px; line-height: 1.2; }
.queue-subsection-head p { margin: 0; font-size: 12px; }
.server-queue-count {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--white-edge);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  color: #727c88;
  font-size: 12px;
  font-weight: 700;
}
.server-queue-list { display: grid; gap: 9px; }
.server-queue-list .empty { padding: 22px 16px; }
.server-queue-item {
  display: grid;
  min-height: 70px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 11px 13px;
  border: 1px solid var(--white-edge);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
  transition: transform 170ms ease, box-shadow 170ms ease, background 170ms ease;
}
.server-queue-item:hover { background: #fff; box-shadow: var(--white-shadow-float), inset 0 1px 0 #fff; transform: translateY(-2px); }
.server-queue-file { display: flex; min-width: 0; align-items: center; gap: 10px; }
.server-queue-file > div:last-child { display: grid; min-width: 0; gap: 3px; }
.server-queue-file strong { overflow: hidden; color: #303844; font-size: 13px; font-weight: 730; text-overflow: ellipsis; white-space: nowrap; }
.server-queue-file span { color: #8b949f; font-size: 11px; }
.server-queue-icon { display: inline-flex; width: 30px; height: 30px; flex: 0 0 30px; align-items: center; justify-content: center; border: 1px solid rgba(8, 121, 235, 0.14); border-radius: 9px; background: #f2f8ff; color: var(--white-blue); font-size: 14px; font-weight: 800; letter-spacing: 2px; }
.server-task-status { padding: 6px 9px; border-radius: 999px; background: #fff8e9; color: #a87826; font-size: 11px; font-weight: 700; white-space: nowrap; }
.server-task-status.is-auditing { background: #f0f7ff; color: #337cc4; }
.server-queue-actions { display: flex; min-width: 125px; align-items: center; justify-content: flex-end; gap: 8px; }
.server-queue-actions .button { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.server-task-hint { color: #8b949f; font-size: 11px; }
.server-queue-actions .queue-delete { flex: 0 0 30px; }

@media (max-width: 900px) {
  .app-topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; padding: 10px 18px; }
  .topbar-nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: center; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .health { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .content-canvas { padding: 30px 24px 48px; }
}
@media (max-width: 620px) {
  .app-topbar { min-height: 70px; grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px; }
  .topbar-brand .brand-mark { width: 32px; height: 32px; flex-basis: 32px; }
  .topbar-brand-copy strong { font-size: 14px; }
  .topbar-brand-copy .eyebrow { display: none; }
  .topbar-actions .health { display: none; }
  .topbar-account, .topbar-link, .admin-topbar-state { min-height: 32px; padding: 6px 8px; font-size: 11px; }
  .topbar-nav { width: 100%; justify-content: flex-start; overflow-x: auto; border-radius: 10px; }
  .topbar-nav-item { flex: 0 0 auto; padding: 7px 12px; font-size: 12px; }
  .content-canvas { padding: 26px 16px 38px; }
  .server-queue-item { grid-template-columns: minmax(0, 1fr) auto; gap: 9px 10px; }
  .server-task-status { grid-column: 2; grid-row: 1; }
  .server-queue-actions { grid-column: 1 / -1; grid-row: 2; min-width: 0; justify-content: flex-end; }
  .queue-subsection-head { align-items: flex-start; }
}

/* Named rule sets: users select one; administrators own the content. */
.queue-panel .queue-controls .rule-set-picker { padding-right: 8px; }
.queue-panel .queue-controls select {
  width: min(230px, 28vw);
  min-width: 150px;
  min-height: 28px;
  padding: 4px 28px 4px 8px;
  border: 0;
  border-radius: 6px;
  outline: 0;
  background: #f2f5f8;
  color: #27303b;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}
.queue-panel .queue-controls select:focus { box-shadow: 0 0 0 3px rgba(8, 121, 235, .11); }
.dropzone.is-disabled { cursor: not-allowed; opacity: .58; }
.dropzone.is-disabled:hover { border-color: var(--white-edge); box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff; transform: none; }
.queue-rule-name { display: block; margin-top: 4px; overflow: hidden; color: #8a94a0; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.admin-canvas #ruleManagement[hidden] { display: none !important; }
.admin-section-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.admin-rules-layout {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.rule-set-library,
.rule-set-editor {
  border: 1px solid var(--white-edge);
  border-radius: 10px;
  background: var(--white-panel);
  box-shadow: var(--white-shadow-low), inset 0 1px 0 #fff;
}
.rule-set-library { overflow: hidden; }
.rule-set-library-head { display: grid; gap: 3px; padding: 17px 17px 13px; border-bottom: 1px solid rgba(69, 79, 94, .08); }
.rule-set-library-head strong { color: #303844; font-size: 13px; }
.rule-set-library-head span { color: #929ba6; font-size: 11px; }
.rule-set-list { display: grid; gap: 5px; max-height: 620px; padding: 8px; overflow-y: auto; }
.rule-set-list .empty { padding: 28px 12px; }
.rule-set-list-item {
  display: grid;
  width: 100%;
  min-height: 58px;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #303844;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.rule-set-list-item:hover { background: #f7f9fb; transform: translateX(2px); }
.rule-set-list-item.active { border-color: rgba(8, 121, 235, .16); background: #f2f8ff; box-shadow: inset 3px 0 0 #0879eb; }
.rule-set-list-index { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border: 1px solid rgba(69, 79, 94, .08); border-radius: 9px; background: #fff; color: #5c6876; font-size: 13px; font-weight: 780; box-shadow: 0 3px 9px rgba(55, 66, 82, .05); }
.rule-set-list-item.active .rule-set-list-index { border-color: rgba(8, 121, 235, .14); color: #0879eb; }
.rule-set-list-copy { display: grid; min-width: 0; gap: 3px; }
.rule-set-list-copy strong { overflow: hidden; font-size: 13px; font-weight: 740; text-overflow: ellipsis; white-space: nowrap; }
.rule-set-list-copy small { color: #8a94a0; font-size: 10px; }
.rule-set-list-arrow { color: #a7afb9; font-size: 20px; line-height: 1; }

.rule-set-editor { display: grid; gap: 16px; padding: 20px; }
.rule-set-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid rgba(69, 79, 94, .08); }
.rule-set-editor-head h3 { margin: 4px 0 0; color: #27303b; font-size: 18px; }
.rule-set-revision { flex: 0 0 auto; padding: 5px 9px; border-radius: 7px; background: #f2f5f8; color: #7d8793; font-size: 11px; font-weight: 700; }
.rule-set-editor .field label,
.rule-set-content-label label { display: block; margin-bottom: 7px; color: #687381; font-size: 12px; font-weight: 690; }
.rule-set-editor input,
.rule-set-editor textarea {
  width: 100%;
  border: 1px solid rgba(69, 79, 94, .1);
  border-radius: 8px;
  outline: 0;
  background: rgba(247, 248, 250, .94);
  box-shadow: inset 0 1px 1px rgba(69, 79, 94, .035);
  color: #303945;
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.rule-set-editor input { min-height: 42px; padding: 9px 11px; }
.rule-set-editor textarea { min-height: 420px; padding: 13px 14px; resize: vertical; font-size: 13px; line-height: 1.72; }
.rule-set-editor input:focus,
.rule-set-editor textarea:focus { border-color: rgba(8, 121, 235, .46); background: #fff; box-shadow: 0 0 0 3px rgba(8, 121, 235, .1); }
.rule-set-editor input:disabled,
.rule-set-editor textarea:disabled { cursor: not-allowed; opacity: .62; }
.rule-set-content-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rule-set-content-label span { color: #89939f; font-size: 11px; font-weight: 700; }
.rule-set-editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.rule-import-action { display: flex; min-width: 0; align-items: center; gap: 10px; }
.rule-import-action .field-note { margin: 0; }
.file-button { cursor: pointer; white-space: nowrap; }

@media (max-width: 980px) {
  .admin-rules-layout { grid-template-columns: 1fr; }
  .rule-set-list { max-height: 280px; }
}

@media (max-width: 680px) {
  .queue-panel .queue-controls .rule-set-picker { flex: 1 0 100%; }
  .queue-panel .queue-controls select { width: min(70vw, 280px); }
  .admin-section-actions { width: 100%; justify-content: space-between; }
  .rule-set-editor { padding: 15px; }
  .rule-set-editor textarea { min-height: 360px; }
  .rule-set-editor-footer { align-items: stretch; flex-direction: column; }
  .rule-import-action { align-items: flex-start; flex-direction: column; }
  .rule-set-editor-footer .admin-section-actions .button { flex: 1; }
}
