:root {
  --space: 8px;
  --sidebar: #1c2430;
  --page: #e8eaed;
  --card: #ffffff;
  --primary: #3d6f99;
  --ink: #1c2430;
  --muted: #5c6770;
  --line: #d7dce1;
  --ok: #2f7d4a;
  --bad: #9b3b3b;
  --warn: #8a6230;
  --unknown: #5c6770;
  --shadow: 0 1px 2px rgba(28, 36, 48, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

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

button { cursor: pointer; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

.sidebar {
  background: var(--sidebar);
  color: #e7ebf0;
  padding: calc(var(--space) * 2);
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

.brand { font-size: 20px; font-weight: 700; padding: var(--space) var(--space) 0; }
.brand-note { margin: 0; padding: 0 var(--space) var(--space); color: #b7c0c8; font-size: 13px; }
.nav-group { display: grid; gap: 4px; }
.nav-label { margin: 12px 8px 0; color: #8b97a3; font-size: 12px; font-weight: 650; }

.nav-button {
  background: transparent;
  color: inherit;
  border: 0;
  text-align: left;
  border-radius: 6px;
  min-height: 36px;
  padding: var(--space) calc(var(--space) * 1.5);
}

.nav-button[aria-current="page"], .nav-button:hover { background: rgba(255, 255, 255, 0.08); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space);
  padding: var(--space) calc(var(--space) * 2);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topbar .spacer { flex: 1; }

.badge, .pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 calc(var(--space) * 1.5);
  border-radius: 999px;
  background: #eceff2;
  color: var(--muted);
  white-space: nowrap;
}

.badge.demo, .pill.warn, .badge.wait { background: #f4ecdc; color: var(--warn); }
.badge.ok { background: #e5f2ea; color: #1f7a45; }
.badge.bad { background: #fde8e6; color: #9f2d2d; }
.pill.ok { background: #e5f2ea; color: var(--ok); }
.pill.bad { background: #f8e8e8; color: var(--bad); }

.banner {
  margin: var(--space) calc(var(--space) * 2) 0;
  padding: var(--space) calc(var(--space) * 1.5);
  background: #f4ecdc;
  color: var(--warn);
  border-radius: 6px;
}

.banner.quiet { background: #eceff2; color: var(--muted); }
.banner.warn { background: #fde8e6; color: #9f2d2d; }

.content { padding: calc(var(--space) * 3); display: grid; gap: calc(var(--space) * 2); }
.page-head h1 { margin: 0; font-size: 28px; line-height: 1.25; }
.page-head .lead, .lead { margin: 4px 0 0; color: var(--muted); max-width: 42rem; }
.target-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space);
  margin: var(--space) calc(var(--space) * 3) 0;
  padding: 10px 12px;
  background: #e7f0f7;
  border: 1px solid var(--primary);
  border-radius: 8px;
}
.step-rail { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.step-rail li { padding: 4px 8px; border-radius: 999px; background: #eceff2; color: var(--muted); }
.step-rail li.current { background: var(--primary); color: #fff; }
.step-rail li.done { background: #e5f2ea; color: var(--ok); }
.action-groups { display: grid; gap: calc(var(--space) * 2); }
.action-group h3 { margin: 0; font-size: 13px; color: var(--muted); }
.choice-row { display: flex; flex-wrap: wrap; gap: var(--space); }
.home-actions .home-button { min-height: 72px; font-size: 20px; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space); }

.card, .login-card, .drawer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: calc(var(--space) * 2);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: calc(var(--space) * 2);
}

.login-card { width: min(420px, 100%); display: grid; gap: calc(var(--space) * 2); }

h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.stack { display: grid; gap: var(--space); }
.row { display: flex; gap: var(--space); flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: calc(var(--space) / 2); }
.field span { color: var(--muted); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: var(--space);
  min-height: 36px;
}

input[type="checkbox"] {
  width: 1.05rem;
  min-width: 1.05rem;
  height: 1.05rem;
  min-height: 0;
  padding: 0;
  flex: 0 0 auto;
}

.ack-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: auto;
}

.confirm-stack {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.drawer-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--card);
}

textarea { min-height: 96px; resize: vertical; }

.btn {
  border: 0;
  border-radius: 6px;
  min-height: 36px;
  padding: var(--space) calc(var(--space) * 2);
  background: #e6ebf0;
}

.btn.primary { background: var(--primary); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: var(--space) calc(var(--space) * 1.5); border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.audit-table .keep-id { white-space: nowrap; overflow-wrap: normal; word-break: keep-all; }
.audit-table .audit-text { overflow-wrap: anywhere; min-width: 12rem; }
.target-strip { position: sticky; top: 0; z-index: 2; margin: 0; background: var(--card); border: 1px solid var(--primary); border-radius: 8px; padding: 8px 10px; font-weight: 700; }
th { color: var(--muted); font-weight: 600; }

.player-cards, .audit-cards { display: none; }
.player-card { display: grid; gap: var(--space); }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(28, 36, 48, 0.28); z-index: 4; }
.drawer {
  overflow-wrap: anywhere;
  position: fixed;
  top: 0;
  right: 0;
  width: min(760px, 100%);
  height: 100%;
  overflow: auto;
  z-index: 5;
  border-radius: 0;
  display: grid;
  align-content: start;
  gap: calc(var(--space) * 2);
  background: var(--card);
}
.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
  padding-bottom: 8px;
}

.error { color: var(--bad); }
.warning { color: var(--warn); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space); }
.limit-list, .choices, .item-grid, .home-actions { display: grid; gap: var(--space); }
.home-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-button { min-height: 64px; font-size: 18px; }
.item-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); max-height: 240px; overflow: auto; }
.wear-line { overflow-wrap: anywhere; }
.page-jump { width: 4.5rem; }
.item-card {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: var(--space);
}
.item-card.selected { outline: 3px solid var(--primary); outline-offset: 2px; }
.item-card img, .preview-icon, .item-missing { width: 54px; height: 54px; object-fit: contain; }
.item-detail { align-items: center; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: var(--space); }
.item-missing { display: grid; place-items: center; background: #eceff2; }
.choices .btn { justify-content: flex-start; text-align: left; }

@media (max-width: 1280px) {
  .content { padding: var(--space); }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; overflow: visible; align-items: center; }
  .brand { flex: none; }
  .nav-group { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .nav-label { margin: 0 4px; }
  .nav-button { flex: none; white-space: nowrap; }
  .target-bar { margin: var(--space); }
  .page-head h1 { font-size: 24px; }
  .drawer { width: 100%; }
  .metrics, .split, .limit-list { grid-template-columns: 1fr; }
  .player-table, .audit-table { display: none; }
  .player-cards, .audit-cards { display: grid; gap: var(--space); }
  .topbar { align-items: flex-start; }
}
:where([data-game-locale]) p { overflow-wrap: anywhere; }

/* The support view has its own layout; the existing workbench is unchanged. */
.support-page [hidden] { display: none !important; }
.support-page .content { max-width: 1280px; margin: 0 auto; }
.support-page .support-query { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 2fr) auto; gap: 16px; align-items: end; }
.support-page .support-query label { display: grid; gap: 6px; }
.support-page .support-query button { min-width: 88px; min-height: 38px; }
.support-page h1, .support-page h2, .support-page h3, .support-page p { margin: 0; }
.support-page td { font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .support-page .support-query { grid-template-columns: 1fr; }
}

/* Operator console: keep the existing brand blue and task-oriented navigation. */
:root { --page: #f4f6f9; --line: #dfe5ed; --muted: #637184; --shadow: 0 3px 16px rgba(28,36,48,.035); }
body { font-size: 14px; line-height: 1.65; }
.shell { grid-template-columns: 226px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 16px; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; padding: 0 8px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: #3d6f99; border: 1px solid #7ea2c0; border-radius: 9px; color: white; font-size: 13px; letter-spacing: .5px; }
.brand-note { padding: 0 8px 12px 52px; font-size: 11px; color: #a6b6c9; }
.nav-label { letter-spacing: .08em; font-size: 11px; margin: 12px 12px 4px; color: #9aabc0; }
.nav-button { padding: 11px 14px; border-radius: 8px; min-height: 42px; font-weight: 500; }
.nav-button[aria-current="page"] { color: #fff; background: #3d6f99; box-shadow: 0 3px 12px #11182722; }
.sidebar-footer { display: grid; gap: 4px; margin-top: auto; padding-top: 20px; border-top: 1px solid #ffffff18; }
a.nav-button { text-decoration: none; color: #bdc9d8; font-size: 13px; }
.topbar { min-height: 72px; padding: 16px 28px; gap: 16px; }
.topbar label { flex-wrap: nowrap; font-size: 12px; color: var(--muted); }
.topbar select { width: auto; max-width: 300px; font-weight: 600; }
.environment-label { font-size: 12px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 16px; }
.content { width: 100%; max-width: 1560px; margin: 0 auto; padding: 30px 32px; gap: 24px; }
.content > .stack { gap: 20px; }
.page-head { padding-bottom: 4px; }
.page-head h1 { font-size: 26px; letter-spacing: -.02em; }
.page-head .lead { margin-top: 8px; color: var(--muted); max-width: none; }
.card, .table-wrap, details { border-radius: 10px; }
.card { padding: 20px; }
.home-actions { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.task-card { position: relative; display: grid; gap: 6px; text-align: left; background: white; border: 1px solid var(--line); border-radius: 12px; padding: 20px; transition: border-color .15s,box-shadow .15s; }
.task-card:hover { border-color: #9db7cf; box-shadow: 0 4px 18px #3d6f9912; }
.task-card strong { font-size: 16px; }
.task-card .muted { font-size: 12px; line-height: 1.65; }
.task-number { display: grid; place-items: center; height: 32px; width: 32px; background: #ecf2f8; color: #3d6f99; border-radius: 8px; font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.task-arrow { position: absolute; top: 22px; right: 20px; color: #8597ab; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading .home-button { font-size: 13px; min-height: 36px; }
.metrics { gap: 14px; }
.metrics .card { gap: 8px; box-shadow: none; border-left: 3px solid #b6c9db; }
.metrics strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metrics .card:last-child strong { font-size: 15px; padding-top: 4px; }
.btn { border: 1px solid transparent; font-weight: 500; min-height: 38px; padding: 8px 16px; transition: background .12s; }
.btn:hover:not(:disabled) { filter: brightness(.97); }
.btn.primary { box-shadow: 0 2px 4px #23405a15; }
.btn.danger { background: #a53d3d; color: white; }
input,select,textarea { min-height: 40px; border-radius: 7px; padding: 8px 11px; }
input::placeholder { color: #92a0ae; }
.query-panel > .row { align-items: flex-end; gap: 14px; }
.query-panel .field { flex: 1 1 140px; }
.query-panel details { padding: 6px 10px; font-size: 12px; background: #f7f9fc; }
.field > span { font-size: 12px; font-weight: 600; }
.table-wrap { box-shadow: var(--shadow); }
th { background: #f7f9fc; color: #647488; font-size: 12px; letter-spacing: .02em; }
th,td { padding: 14px 16px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfd; }
td .btn { min-height: 32px; padding: 4px 12px; }
.pill,.badge { font-size: 12px; padding: 2px 11px; min-height: 26px; }
.banner { margin: 12px 28px 0; font-size: 13px; border: 1px solid #e9d9bb; }
.banner.quiet { border-color: var(--line); }
.notice { padding: 12px 16px; color: #2f7048; background: #eaf6ee; border-radius: 8px; }
.empty-state { padding: 36px 20px; text-align: center; background: white; border: 1px dashed #cbd5e1; border-radius: 10px; color: var(--muted); }
.drawer { width: min(780px,100%); box-shadow: -12px 0 40px #15253822; padding: 24px; gap: 18px; }
.drawer-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.drawer-head .row { justify-content: space-between; }
.target-strip { background: #f0f5fa; border-color: #ccdce9; padding: 10px 12px; font-size: 13px; }
.drawer-actions { box-shadow: 0 -6px 16px #ffffff; padding: 16px; }
.confirm-stack { background: #f8fafd; border-color: #cfdcea; gap: 12px; }
.step-rail { font-size: 12px; gap: 5px; }
.action-group .choice-row { margin-top: 8px; }
.item-grid { max-height: 340px; gap: 10px; }
.item-card { padding: 12px 8px; font-size: 12px; }
.item-card.selected { outline-width: 2px; background: #f3f8fc; }
.audit-filters { display: grid; grid-template-columns: repeat(4,minmax(140px,1fr)); gap: 14px; align-items: end; }
.audit-table .audit-text { min-width: 8rem; max-width: 26rem; }
.request-id { font-family: ui-monospace,monospace; font-size: 12px; overflow-wrap: anywhere; }
summary { cursor: pointer; font-weight: 500; }
.login-wrap { background: radial-gradient(ellipse at 30% 10%,#dbe8f3,transparent 65%),#f4f6f9; }
.login-card { border-radius: 16px; padding: 36px; box-shadow: 0 18px 60px #243f5b12; gap: 22px; }
.eyebrow { color: #3d6f99; font-size: 10px; letter-spacing: .18em; font-weight: 700; }
.login-card h1 { font-size: 26px; }
@media (max-width:1280px) { .home-actions { grid-template-columns: repeat(2,minmax(0,1fr)); } .content { padding: 24px; } .topbar { padding: 14px 24px; } .audit-filters { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width:900px) { .shell { grid-template-columns: 186px minmax(0,1fr); } .environment-label { display:none; } .topbar { flex-wrap: wrap; gap: 10px; } .audit-filters { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width:720px) {
 .sidebar { position: static; height:auto; padding: 12px; gap: 6px; }
 .brand { width:100%; } .brand-note { display:none; } .nav-label { display:none; }
 .nav-group { gap:2px; } .nav-button { padding:8px 10px; min-height:36px; font-size:12px; }
 .sidebar-footer { display:flex; margin-top:0; padding-top:6px; width:100%; }
 .topbar { padding:12px 16px; } .topbar select { max-width:180px; }
 .content { padding:20px 16px; } .home-actions { gap:10px; } .task-card { padding:16px; }
 .metrics { grid-template-columns:1fr; gap:8px; } .metrics .card { display:flex; align-items:center; justify-content:space-between; padding:14px 16px; }
 .metrics strong { font-size:18px; } .metrics .card:last-child strong { padding:0; }
 .banner { margin:12px 16px 0; } .drawer { padding:18px; }
 .audit-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (prefers-reduced-motion:reduce) { * { transition:none !important; } }
/* Keep long previews in document flow so they never cover the input fields. */
.drawer-actions { position: static; box-shadow: none; }
.mail-batch-fields { border: 0; padding: 0; margin: 0; min-width: 0; }

[hidden] { display: none !important; }
