:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #172026;
  background: #f3f5f6;
  font-synthesis: none;
  --ink: #172026;
  --muted: #66737c;
  --line: #dce2e5;
  --line-strong: #c8d0d5;
  --paper: #fff;
  --canvas: #f3f5f6;
  --nav: #151d22;
  --green: #1d7845;
  --green-soft: #e8f5ed;
  --blue: #1768a6;
  --blue-soft: #eaf4fb;
  --amber: #926600;
  --amber-soft: #fff5d9;
  --red: #b22820;
  --red-soft: #fff0ef;
}
* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 27px; line-height: 1.2; letter-spacing: 0; }
h2 { margin: 0; font-size: 16px; line-height: 1.35; letter-spacing: 0; }
pre, .mono { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }

.login-view { min-height: 100vh; display: grid; place-content: center; gap: 22px; padding: 24px; background: #edf0f2; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 11px; font-size: 20px; font-weight: 750; }
.login-brand img, .brand img { border-radius: 6px; }
.login-panel { width: min(400px, calc(100vw - 30px)); padding: 30px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 16px 42px rgba(23, 32, 38, .1); }
.panel-heading { margin-bottom: 22px; }
.panel-heading p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.login-panel .field + .field { margin-top: 14px; }

.topbar { position: sticky; top: 0; z-index: 10; height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; color: #fff; background: var(--nav); border-bottom: 1px solid #0c1216; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-weight: 750; }
.brand-suffix { color: #aeb8be; font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.service-status { display: flex; align-items: center; gap: 7px; color: #d7dfe3; }
.admin-name { color: #aeb8be; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #48c878; box-shadow: 0 0 0 3px rgba(72, 200, 120, .13); }

.workspace { min-height: calc(100vh - 60px); display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 60px; height: calc(100vh - 60px); display: flex; flex-direction: column; padding: 22px 13px; color: #d8e0e4; background: #1d272d; border-right: 1px solid #12191d; }
.nav-group + .nav-group { margin-top: 22px; }
.nav-group > p { margin: 0 10px 7px; color: #839098; font-size: 10px; font-weight: 750; text-transform: uppercase; }
.nav-item { width: 100%; min-height: 39px; display: flex; align-items: center; gap: 11px; padding: 8px 11px; color: #bfc9cf; background: transparent; border: 0; border-radius: 6px; text-align: left; font-size: 13px; font-weight: 600; }
.nav-item:hover { color: #fff; background: #27343b; }
.nav-item.active { color: #fff; background: #334149; box-shadow: inset 3px 0 #50b67a; }
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; color: #9eabb2; font-size: 16px; line-height: 1; }
.nav-item.active .nav-icon { color: #77d19c; }
.sidebar-runtime { margin-top: auto; display: grid; gap: 3px; padding: 13px 11px; color: #9ba8af; border-top: 1px solid #334047; font-size: 11px; }
.sidebar-runtime strong { color: #e6ecef; font-size: 15px; }
.sidebar-runtime small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-content { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 52px; }
.admin-page { display: grid; gap: 20px; }
.page-heading { min-height: 58px; display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.page-meta, .section-note { margin: 0; color: var(--muted); font-size: 12px; }
.eyebrow { margin-bottom: 5px; color: #72808a; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.page-actions, .button-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.button { min-height: 37px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 13px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; font-weight: 650; text-decoration: none; }
.button:hover { background: #f0f3f4; border-color: #aeb9bf; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { color: #fff; background: var(--ink); border-color: var(--ink); }
.button-primary:hover { background: #2a363d; }
.button-danger { color: var(--red); border-color: #edbbb7; }
.button-danger:hover { background: var(--red-soft); }
.button-quiet { min-height: 31px; color: #d5dde1; background: transparent; border-color: transparent; }
.button-quiet:hover { color: #fff; background: #2d3940; border-color: transparent; }
.button-wide { width: 100%; margin-top: 16px; }
.icon-command { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; color: var(--muted); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 20px; line-height: 1; }
.icon-command:hover { color: var(--ink); background: #eef1f2; }

.surface { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.metrics-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metrics-six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric { min-height: 108px; display: grid; align-content: center; gap: 4px; padding: 18px 21px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span, .metric small { color: var(--muted); font-size: 11px; }
.metric strong { font-size: 29px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.section-heading { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.section-heading > div:first-child { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.section-heading span { color: var(--muted); font-size: 11px; }
.section-note { padding: 0 18px 17px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.facts.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 16px; border: 1px solid var(--line); }
.fact { min-width: 0; padding: 14px 16px; background: #fff; }
.fact span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.fact strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.inline-status { padding: 20px 18px; }
.empty-line { color: var(--muted); font-size: 13px; }

input, select, textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 5px; outline: none; }
input, select { height: 39px; padding: 0 10px; }
textarea { min-height: 90px; padding: 9px 10px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #657782; box-shadow: 0 0 0 3px rgba(71, 91, 102, .1); }
.field { display: grid; align-content: start; gap: 7px; color: #46545c; font-size: 12px; font-weight: 650; }
.field-span { grid-column: 1 / -1; }
.check-field { min-height: 39px; display: flex; align-items: center; gap: 9px; color: #46545c; font-size: 12px; }
.check-field input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-body { display: grid; gap: 17px; padding: 18px; }
.form-error { margin: 12px 0 0; padding: 9px 11px; color: var(--red); background: var(--red-soft); border-left: 3px solid var(--red); font-size: 12px; }
.split-layout { display: grid; grid-template-columns: minmax(380px, .85fr) minmax(460px, 1.15fr); gap: 18px; align-items: stretch; }
.progress-section { min-height: 315px; }
.progress-track { height: 5px; margin: 18px 18px 0; overflow: hidden; background: #e7ebed; border-radius: 3px; }
.progress-track span { width: 0; height: 100%; display: block; background: var(--green); transition: width .25s; }
.log-view { height: 178px; margin: 16px; padding: 12px; overflow: auto; color: #d8e1e5; background: #121a1f; border-radius: 5px; white-space: pre-wrap; word-break: break-word; font: 11px/1.55 "Cascadia Code", Consolas, monospace; }
.register-results-section { margin-top: 18px; }
.register-table, .register-result-row { min-width: 1060px; display: grid; grid-template-columns: 110px 150px minmax(190px, 1.25fr) 155px minmax(180px, 1.15fr) 220px 85px; align-items: center; gap: 12px; padding: 0 18px; }
.register-result-row { min-height: 62px; border-bottom: 1px solid #edf0f1; font-size: 12px; }
.register-result-row:last-child { border-bottom: 0; }
.register-result-row:hover { background: #fafbfb; }
.register-result-row .error-detail { overflow: hidden; color: var(--red); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.table-surface { min-width: 0; }
.table-scroll { overflow-x: auto; }
.table-head { min-height: 41px; color: var(--muted); background: #f8f9fa; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.account-table, .account-row { min-width: 1160px; display: grid; grid-template-columns: minmax(230px, 1.5fr) 90px 110px 120px 170px 150px 105px; align-items: center; gap: 12px; padding: 0 18px; }
.key-table, .key-row { min-width: 850px; display: grid; grid-template-columns: 1.2fr 1.4fr 90px 100px 160px 100px; align-items: center; gap: 12px; padding: 0 18px; }
.task-table, .task-row { min-width: 1270px; display: grid; grid-template-columns: minmax(260px, 1.6fr) minmax(160px, 1fr) 85px 90px 190px 130px 90px 95px; align-items: center; gap: 12px; padding: 0 18px; }
.invite-table, .invite-row { min-width: 780px; display: grid; grid-template-columns: 1.4fr 180px 100px 100px 110px; align-items: center; gap: 12px; padding: 0 18px; }
.claim-table, .claim-row { min-width: 880px; display: grid; grid-template-columns: 1.3fr 1.3fr 140px 100px 180px; align-items: center; gap: 12px; padding: 0 18px; }
.account-row, .key-row, .task-row, .invite-row, .claim-row { min-height: 67px; border-bottom: 1px solid #edf0f1; font-size: 12px; }
.account-row:last-child, .key-row:last-child, .task-row:last-child, .invite-row:last-child, .claim-row:last-child { border-bottom: 0; }
.account-row:hover, .key-row:hover, .task-row:hover { background: #fafbfb; }
.task-row { cursor: pointer; }
.task-preview { width: 58px; height: 58px; display: grid; place-items: center; }
.task-thumbnail { width: 52px; height: 52px; display: block; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #edf0f1; }
.identity { min-width: 0; display: grid; gap: 3px; }
.identity strong, .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity small, .muted { color: var(--muted); font-size: 10px; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions .button { min-height: 29px; padding: 4px 8px; font-size: 11px; }
.status-pill { width: max-content; display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; }
.status-good { color: var(--green); background: var(--green-soft); }
.status-neutral { color: #58656d; background: #edf0f2; }
.status-bad { color: var(--red); background: var(--red-soft); }
.status-warn { color: var(--amber); background: var(--amber-soft); }
.status-info { color: var(--blue); background: var(--blue-soft); }
.search { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.search input { width: 230px; }
.filters { display: flex; gap: 8px; }
.filters select { width: auto; min-width: 122px; }
.empty-state { min-height: 130px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

.dialog { width: min(610px, calc(100vw - 28px)); max-height: calc(100vh - 38px); padding: 22px; overflow: auto; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 25px 75px rgba(20, 29, 34, .25); }
.dialog-wide { width: min(900px, calc(100vw - 28px)); }
.dialog::backdrop { background: rgba(18, 27, 32, .48); }
.dialog-header { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.dialog-footer { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 8px; margin-top: 20px; }
.dialog-between { grid-template-columns: auto 1fr auto auto; }
.dialog .check-field { margin-top: 14px; }
.dialog pre { max-height: 460px; margin: 16px 0 0; padding: 13px; overflow: auto; color: #dce4e8; background: #121a1f; border-radius: 5px; white-space: pre-wrap; word-break: break-word; font-size: 11px; line-height: 1.5; }
.image-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.image-gallery a { aspect-ratio: 1; display: block; overflow: hidden; background: #eef1f2; border: 1px solid var(--line); border-radius: 5px; }
.image-gallery img { width: 100%; height: 100%; display: block; object-fit: contain; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 30; display: grid; gap: 8px; }
.toast { max-width: 360px; padding: 10px 13px; color: #fff; background: var(--ink); border-radius: 6px; box-shadow: 0 8px 24px #0003; font-size: 12px; }
.toast.error { background: var(--red); }

@media (max-width: 1060px) {
  .workspace { grid-template-columns: 184px minmax(0, 1fr); }
  .split-layout { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 13px; }
  .service-status, .admin-name, .brand-suffix { display: none; }
  .workspace { display: block; }
  .sidebar { position: sticky; top: 60px; z-index: 9; width: 100%; height: auto; display: flex; flex-direction: row; gap: 8px; padding: 7px 10px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #11181c; }
  .nav-group { display: flex; gap: 4px; }
  .nav-group + .nav-group { margin: 0; padding-left: 8px; border-left: 1px solid #3a474e; }
  .nav-group > p, .sidebar-runtime, .nav-icon { display: none; }
  .nav-item { width: max-content; min-height: 36px; padding: 7px 11px; }
  .nav-item.active { box-shadow: inset 0 -2px #50b67a; }
  .main-content { width: calc(100% - 24px); padding-top: 18px; }
  .page-heading { display: grid; }
  .page-actions { justify-content: flex-start; }
  .metrics, .metrics-three, .metrics-four, .metrics-six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 95px; padding: 14px; border-bottom: 1px solid var(--line); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric strong { font-size: 24px; }
  .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .section-heading > div:first-child { display: grid; gap: 3px; }
  .form-grid, .facts.compact { grid-template-columns: 1fr; }
  .field-span { grid-column: auto; }
  .search { width: 100%; }
  .search input { width: 100%; }
  .image-gallery { grid-template-columns: 1fr 1fr; }
}
