:root {
  color-scheme: light;
  font-family: Geist, Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #172923;
  background: #f4f6f3;
  --ink: #172923;
  --muted: #5b6e63;
  --line: #dce5dd;
  --soft: #f3f6f1;
  --green: #14604a;
  --deep: #112d25;
  --gold: #e4bb76;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
body { min-width: 300px; margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #b88337; outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
.mono, .event-id { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.shell { display: grid; grid-template-columns: 212px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 23px 14px 16px;
  background: linear-gradient(162deg, #132e27, #0d251e 74%);
  color: #edf6ee;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 5px 26px; }
.brand-mark {
  flex: 0 0 37px;
  display: grid;
  place-items: center;
  height: 37px;
  border: 1px solid #ac915b;
  border-radius: 10px 5px 10px 5px;
  background: #264837;
  color: #ffe1a3;
  font-family: "Noto Serif CJK SC", SimSun, serif;
  font-size: 25px;
  line-height: 1;
}
.brand strong, .brand small { display: block; white-space: nowrap; }
.brand strong { font-size: 15px; font-weight: 750; letter-spacing: .07em; }
.brand small { margin-top: 4px; color: #bed0c0; font-size: 10px; }
.scene-nav { padding-top: 18px; border-top: 1px solid #345145; }
.nav-label { margin: 0 11px 10px; color: #a9bfb1; font-size: 11px; letter-spacing: .1em; }
.scene-tabs { display: grid; gap: 6px; }
.scene-tabs button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 43px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #ccdfd1;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
}
.scene-tabs button:hover { background: #214337; color: #fff; }
.scene-tabs button[aria-selected=true] {
  border-color: #4d6d59;
  background: #28513f;
  color: #fff5dc;
  font-weight: 700;
  box-shadow: inset 3px 0 #ddb06d;
}
.sidebar-footer { display: flex; align-items: start; gap: 9px; margin-top: auto; padding: 14px 7px 0; border-top: 1px solid #345145; }
.sidebar-footer .status-dot { margin-top: 5px; background: var(--gold); }
.sidebar-footer strong, .sidebar-footer small { display: block; }
.sidebar-footer strong { font-size: 12px; }
.sidebar-footer small { margin-top: 4px; color: #adc3b3; font-size: 10.5px; }
.icon { position: relative; display: inline-block; flex: 0 0 auto; width: 18px; height: 18px; }
.icon::before, .icon::after { position: absolute; display: block; content: ""; }
.icon-grid::before { inset: 2px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-grid::after { inset: 2px; background: linear-gradient(currentColor,currentColor) center / 100% 1px no-repeat, linear-gradient(currentColor,currentColor) center / 1px 100% no-repeat; }
.icon-ticket::before { inset: 3px 1px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-ticket::after { top: 5px; bottom: 5px; left: 11px; border-left: 1.5px dotted currentColor; }
.icon-device::before { inset: 2px 1px 5px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-device::after { bottom: 2px; left: 5px; width: 8px; height: 1.5px; border-radius: 1px; background: currentColor; }
.icon-sync::before { inset: 2px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; transform: rotate(-30deg); }
.icon-sync::after { top: 2px; right: 1px; border: 3px solid transparent; border-left-color: currentColor; transform: rotate(30deg); }
.icon-gift::before { inset: 6px 2px 1px; border: 1.5px solid currentColor; border-radius: 2px; background: linear-gradient(90deg, transparent 44%, currentColor 44% 55%, transparent 55%); }
.icon-gift::after { top: 1px; left: 5px; width: 8px; height: 5px; border: 1.5px solid currentColor; border-radius: 5px 5px 1px 1px; }

.workspace { min-width: 0; }
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 9px;
  min-height: 55px;
  padding: 7px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.breadcrumbs, .toolbar-actions { display: flex; align-items: center; gap: 10px; }
.breadcrumbs { color: var(--muted); font-size: 12px; white-space: nowrap; }
.breadcrumbs strong { color: #25483a; font-weight: 700; }
.cloud-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 33px;
  padding: 4px 7px 4px 9px;
  border: 1px solid #cfe2d4;
  border-radius: 999px;
  background: #eaf5eb;
  color: #1b5e42;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.cloud-pill:hover { background: #e0f0e3; }
.cloud-pill[data-cloud=offline] { border-color: #e8d3af; background: #fff2da; color: #835118; }
.cloud-pill[data-cloud=offline] .status-dot { background: #aa6a20; }
.status-dot { width: 7px; min-width: 7px; height: 7px; border-radius: 50%; background: #33895d; }
.pending-count { min-width: 20px; padding: 2px 4px; border-radius: 8px; color: inherit; background: #ffffffb3; font: 700 11px/1.2 var(--mono); text-align: center; }
.workspace-content { max-width: 1500px; margin: 0 auto; padding: 22px clamp(16px, 3vw, 40px) 34px; }
.workbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 17px;
  border-bottom: 1px solid #d8e4da;
  margin-bottom: 18px;
}
.context-label { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; color: #526b5e; font-size: 12px; font-weight: 700; }
.demo-pill { padding: 3px 6px; border: 1px solid #e9d3ac; border-radius: 5px; background: #fbf2e0; color: #775118; font-size: 10.5px; line-height: 1; }
.workbar h1 { font-size: clamp(22px, 2.7vw, 33px); font-weight: 780; letter-spacing: .025em; line-height: 1.18; }
.session-picker { display: grid; gap: 5px; min-width: min(190px, 36vw); color: #365448; font-size: 12px; font-weight: 700; }
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin: 0 0 11px;
}
.page-heading h2 { margin-bottom: 3px; font-size: 22px; font-weight: 760; }
.page-heading p, .panel-heading p { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.quiet-tag { display: inline-block; flex: 0 0 auto; padding: 4px 7px; border: 1px solid #e2e9e0; border-radius: 6px; background: #f1f5ef; color: #476358; font-size: 11px; white-space: nowrap; }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 13px; }
.overview-grid {
  grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "schedule detail" "activity detail";
}
.schedule-panel { grid-area: schedule; }
.stack { display: grid; gap: 13px; min-width: 0; }
.panel { min-width: 0; padding: 15px 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 2px 5px #254a2d08; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; }
.panel-heading h3 { font-size: 16px; font-weight: 740; }
.panel-heading h3 + p { margin-top: 4px; }
.eyebrow { margin-bottom: 4px; }
.detail-panel { grid-area: detail; border-top: 3px solid #479376; }
.detail-panel h3 { color: #1d523e; font-size: 22px; line-height: 1.1; }
.panel-footer { margin-top: 11px; }
.subheading { margin: 14px 0 7px; color: #425e50; font-size: 13px; font-weight: 720; }

.table-scroll { max-height: 315px; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12.5px; }
th, td { padding: 9px 8px; border-bottom: 1px solid #e7eee7; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; padding-top: 8px; padding-bottom: 8px; background: #f2f6f1; color: #4c6558; font-size: 11px; font-weight: 700; white-space: nowrap; }
td { color: #2d493b; line-height: 1.4; overflow-wrap: anywhere; }
tr:last-child td { border-bottom-color: transparent; }
.active-row, tr[aria-selected=true], tr[data-selected=true] { background: #edf6ed; }
tr:has(.table-link):hover { background: #f3f8f2; }
.cell-stack { display: grid; gap: 2px; min-width: 0; }
.cell-stack small, td small, .cell-detail { display: block; color: #587064; font-size: 11px; line-height: 1.4; }
td .mono, td.mono, .event-id { white-space: nowrap; font-size: 11.5px; }
.table-link, .ticket-link {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #165d44;
  font-size: 12.5px;
  font-weight: 730;
  text-align: left;
}
.table-link:hover, .ticket-link:hover { text-decoration: underline; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #edf2ec;
  color: #436150;
  font-size: 10.5px;
  line-height: 1.3;
  white-space: nowrap;
}
.tag[data-tone=good] { background: #e5f3e9; color: #226045; }
.tag[data-tone=pending] { background: #faefda; color: #815116; }
.tag[data-tone=info] { background: #e9f1f3; color: #345f69; }
.tag[data-tone=bad] { background: #faebe8; color: #8d4234; }
.empty { padding: 13px 8px; color: var(--muted); font-size: 12px; }
.count-grid, .network-counts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; min-width: 0; }
.count-grid { margin: 0 0 11px; }
.count-cell { min-width: 0; padding: 8px 9px; border: 1px solid #e1eade; border-radius: 8px; background: #f5f8f2; }
.count-cell span { display: block; color: #526b5c; font-size: 11px; }
.count-cell strong { display: block; margin-top: 4px; color: #26553f; font: 700 22px/1.1 var(--mono); }

.button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover:not(:disabled) { background: #0e4a37; }
.button-secondary { border-color: #cfddd0; background: #f6f8f4; color: #294f40; }
.button-quiet { min-height: 33px; border-color: #d8e2d8; background: #fff; color: #375647; font-size: 11.5px; }
.button-small { min-height: 28px; padding: 4px 6px; }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { border-color: #b7ceb9; background: #eef4eb; }
.button-plain { padding-right: 4px; padding-left: 4px; background: transparent; color: #285c45; }
.button-plain:hover:not(:disabled) { text-decoration: underline; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.scan-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: end; }
.scan-form .button { min-height: 39px; padding-right: 13px; padding-left: 13px; }
.action-form { display: grid; gap: 9px; }
#visitor-form { margin-bottom: 9px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.field { display: grid; gap: 5px; min-width: 0; width: 100%; color: #425d4f; font-size: 12px; font-weight: 700; }
.field input, select {
  width: 100%;
  min-width: 0;
  height: 39px;
  padding: 7px 8px;
  border: 1px solid #cbdacb;
  border-radius: 7px;
  background: #fbfdfa;
  color: var(--ink);
  font-size: 13px;
  font-weight: 580;
}
#ticket-code, #visitor-code { font-size: 14px; }
.roster-search { margin-bottom: 9px; }
.roster-search input { height: 34px; }
.check-field { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.check-field input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }

.result {
  display: grid;
  align-content: center;
  gap: 3px;
  margin-top: 10px;
  min-height: 57px;
  padding: 8px 10px;
  border: 1px solid #dfe9de;
  border-inline-start: 3px solid #9dae9f;
  border-radius: 7px;
  background: #f5f8f3;
  color: #365345;
}
.result-title { font-size: 13px; }
.result-detail { font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.result[data-tone=good] { border-color: #cbe5cf; border-inline-start-color: #5b9b70; background: #eaf6eb; color: #215d42; }
.result[data-tone=bad] { border-color: #efd1c5; border-inline-start-color: #b15f4a; background: #fff3ec; color: #823d2d; }
.result[data-tone=pending] { border-color: #efdeb9; border-inline-start-color: #b88336; background: #fff7e5; color: #7d511c; }
.steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; padding: 0; margin: 9px 0 0; list-style: none; }
.steps li { display: grid; align-content: start; gap: 3px; padding: 7px; border: 1px solid #e3ebe2; border-radius: 7px; background: #f9fbf8; }
.steps strong { font-size: 11.5px; }
.steps strong::before { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #90a698; vertical-align: 2px; content: ""; }
.step-detail { color: #587162; font-size: 10.5px; overflow-wrap: anywhere; }
.steps [data-stage=done] { border-color: #cfe3d1; background: #edf7ec; }
.steps [data-stage=done] strong::before { background: #4e986d; }
.steps [data-stage=active] { border-color: #ecd8af; background: #fff7e7; }
.steps [data-stage=active] strong::before { background: #af762c; }
.demo-codes { margin-top: 11px; padding: 7px 8px; border: 1px solid #e0e9df; border-radius: 7px; background: #fcfdfa; }
.demo-codes summary { color: #365748; font-size: 12px; font-weight: 680; cursor: pointer; }
.sample-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 7px; }
.sample-grid > div { display: grid; justify-items: center; gap: 3px; min-width: 0; color: #4f6c5d; font-size: 10px; }
.sample-grid img { display: block; width: min(100%,112px); height: auto; }
.sample-grid .button { min-height: 29px; padding: 4px 6px; font-size: 11px; }
.order-detail { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 10px; margin-top: 10px; padding: 9px; border: 1px solid #e2ebe0; border-radius: 7px; background: #f7faf5; color: #3a5849; font-size: 12px; }
.order-detail > strong, .order-detail p { grid-column: 1 / -1; }
.order-detail p { padding: 0; color: #566e61; line-height: 1.45; }
.order-detail .cell-stack { display: flex; flex-direction: column; }
.order-detail .cell-stack small { order: -1; color: var(--muted); font-size: 10.5px; }

.device {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #dce8dd;
  border-radius: 8px;
  background: #f4f8f2;
  color: #345747;
}
.device-icon { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 8px; background: #e6efe5; }
.device strong { display: block; font-size: 15px; }
.device p { margin-top: 2px; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.device[data-mode=started], .device[data-mode=ended] { border-color: #c7e3ca; background: #eaf5eb; color: #225c3e; }
.device[data-mode=timeout] { border-color: #eacbc1; background: #fff3ee; color: #864337; }
.device[data-mode=pending] { border-color: #ecd6ad; background: #fff6e4; color: #7e561f; }

.balance-strip { margin: 0; }
.balance-strip .count-cell strong { font-size: 19px; }
.network-panel { display: grid; grid-template-columns: minmax(170px,.62fr) minmax(0,1.5fr); gap: 11px; align-items: stretch; margin-bottom: 13px; }
.network-counts { grid-template-columns: repeat(2,minmax(0,1fr)); }
.network-counts .count-cell { display: grid; align-content: center; }
.network-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.network-actions .result { flex: 1 1 190px; margin: 0; }
.sync-grid .table-scroll { max-height: 440px; }
.event-id { display: inline-block; color: #315e4a; font-weight: 650; }
.activity { grid-area: activity; }
.activity .panel-heading { margin-bottom: 5px; }
.log-list { max-height: 220px; padding: 0; margin: 0; overflow: auto; list-style: none; }
.log-row { display: grid; grid-template-columns: 67px 65px minmax(0,1fr) auto; gap: 8px; padding: 8px 2px; border-top: 1px solid #e8eee7; }
.log-time { font: 11.5px/1.4 var(--mono); color: #536d5e; }
.log-topic, .log-kind { color: #476556; font-size: 11px; }
.log-copy { display: flex; flex-wrap: wrap; gap: 3px 8px; color: #526e5e; font-size: 11.5px; overflow-wrap: anywhere; }
.log-copy strong { color: #2d4e3d; font-size: 12px; }
.log-kind[data-kind=success] { color: #276449; }
.log-kind[data-kind=warning] { color: #9c4d34; }
.error-banner { margin: 0 0 10px; padding: 9px 10px; border: 1px solid #e8baac; border-radius: 7px; background: #fff2eb; color: #874130; font-size: 13px; }
dialog { width: min(420px,calc(100% - 25px)); padding: 20px; border: 1px solid #cbdacd; border-radius: 13px; color: var(--ink); }
dialog::backdrop { background: #09281eb0; }
dialog h2 { font-size: 19px; }
dialog p { margin: 7px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
dialog .button-row { justify-content: flex-end; }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 179px minmax(0,1fr); }
  .sidebar { padding-right: 10px; padding-left: 10px; }
  .brand { gap: 7px; }
  .brand-mark { flex-basis: 32px; height: 32px; font-size: 21px; }
  .panel { padding: 12px; }
  th, td { padding-right: 6px; padding-left: 6px; }
  .panel-grid { gap: 9px; }
}
@media (max-width: 840px) {
  .shell { grid-template-columns: minmax(0,1fr); }
  .sidebar { position: static; height: auto; padding: 12px 14px 9px; }
  .brand { padding: 0 2px 8px; }
  .scene-nav { padding-top: 0; border: 0; }
  .nav-label, .sidebar-footer { display: none; }
  .scene-tabs { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 4px; }
  .scene-tabs button { justify-content: center; gap: 4px; min-height: 35px; padding: 6px 4px; font-size: 12px; }
  .scene-tabs button[aria-selected=true] { box-shadow: inset 0 -2px #ddb06d; }
  .toolbar { min-height: 46px; }
  .workspace-content { padding-top: 16px; }
}
@media (max-width: 620px) {
  .toolbar, .workspace-content { padding-right: 11px; padding-left: 11px; }
  .breadcrumbs > :not(strong) { display: none; }
  .toolbar-actions { gap: 5px; }
  .scene-tabs .icon { display: none; }
  .workbar { align-items: start; flex-direction: column; gap: 8px; margin-bottom: 12px; padding-bottom: 10px; }
  .session-picker { display: flex; align-items: center; gap: 8px; width: 100%; }
  .session-picker span { white-space: nowrap; }
  .session-picker select { height: 34px; }
  .page-heading h2 { font-size: 19px; }
  .page-heading p { font-size: 12px; }
  .page-heading > .quiet-tag { display: none; }
  #ticket-progress { display: inline-block; }
  .panel-grid, .network-panel { grid-template-columns: minmax(0,1fr); }
  .overview-grid { grid-template-rows: auto; grid-template-areas: "schedule" "detail" "activity"; }
  .panel { padding: 11px; }
  .log-row { grid-template-columns: 55px 52px minmax(0,1fr); gap: 4px; }
  .log-kind { display: none; }
  .stack { gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
