:root {
  --ink: #17201c;
  --muted: #647069;
  --line: #dce3df;
  --paper: #f5f7f5;
  --white: #ffffff;
  --green: #087a55;
  --green-dark: #075c43;
  --mint: #e0f5ec;
  --coral: #d8513c;
  --amber: #a66a00;
  --radius: 6px;
  --shadow: 0 12px 34px rgba(22, 36, 29, .08);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; font-size: 14px; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
a { color: inherit; }
.topbar { height: 58px; padding: 0 max(18px, calc((100vw - 1440px) / 2)); display: flex; align-items: center; justify-content: space-between; color: var(--white); background: var(--ink); border-bottom: 3px solid var(--green); }
.brand { text-decoration: none; font-size: 14px; font-weight: 600; }
.brand strong { color: #59d1a3; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions form { margin: 0; }
.language-switch { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; background: #303a35; border-radius: 4px; }
.language-switch a { min-width: 40px; height: 28px; padding: 0 7px; display: grid; place-items: center; color: #cbd5d0; border-radius: 3px; font-size: 11px; font-weight: 750; text-decoration: none; }
.language-switch a.active { color: var(--ink); background: var(--white); }
.identity { color: #dbe4df; font-size: 13px; }
.shell { width: min(1440px, calc(100% - 36px)); margin: 0 auto; padding: 28px 0 56px; }
.page-head, .scan-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-head-actions, .scan-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(25px, 3vw, 38px); line-height: 1.05; font-weight: 760; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.25; }
.section-kicker { margin-bottom: 7px; color: var(--green); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #20a875; box-shadow: 0 0 0 4px rgba(32,168,117,.12); }
.metric-strip { display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 20px; background: var(--ink); color: var(--white); border-radius: var(--radius); overflow: hidden; }
.metric-strip > div { min-width: 0; padding: 16px 20px; border-right: 1px solid #3a433f; }
.metric-strip > div:last-child { border-right: 0; }
.metric-strip span { display: block; color: #aebbb4; font-size: 11px; }
.metric-strip strong { display: block; margin-top: 5px; font-size: 23px; font-variant-numeric: tabular-nums; }
.leader-metrics { grid-template-columns: repeat(6, 1fr); }
.admin-grid, .leader-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { min-height: 69px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.compact-panel { padding-bottom: 18px; }
.compact-panel .stack-form { padding: 18px; }
.settlement-panel { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); background: #f8faf9; font-size: 11px; font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.empty-cell { padding: 34px; color: var(--muted); text-align: center; }
.stack-form { display: grid; gap: 14px; }
.stack-form label, .form-row label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input, select { width: 100%; height: 40px; padding: 0 11px; color: var(--ink); background: var(--white); border: 1px solid #bdc8c2; border-radius: 4px; outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8,122,85,.11); }
select:disabled { color: var(--muted); background: #f0f3f1; }
.button, .icon-button { appearance: none; border: 0; cursor: pointer; }
.button { min-height: 40px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; font-weight: 740; text-decoration: none; }
.button:disabled { opacity: .38; cursor: not-allowed; }
.button-primary { color: var(--white); background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-dark { color: var(--white); background: var(--ink); }
.button-quiet { color: var(--ink); background: #edf1ef; }
.button-danger { color: var(--white); background: var(--coral); }
.button-danger:hover { background: #b83f2e; }
.button-block { width: 100%; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; color: var(--ink); background: #eef2f0; border-radius: 4px; font-size: 17px; }
.topbar .icon-button { color: var(--white); background: #303a35; }
.icon-button.inverse { color: var(--ink); background: var(--white); }
.inline-form, .action-cell { display: flex; align-items: center; gap: 7px; }
.inline-form input { min-width: 130px; }
.price-form input { width: 90px; min-width: 90px; }
.notice { margin-bottom: 16px; padding: 11px 14px; border-radius: 4px; border-left: 4px solid; }
.notice-ok { color: #075d42; background: var(--mint); border-color: var(--green); }
.notice-error { color: #902f22; background: #fbeae7; border-color: var(--coral); }
.invite-bar { margin-bottom: 18px; padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--white); background: var(--green); border-radius: var(--radius); }
.invite-bar span { display: block; margin-bottom: 4px; color: #b7ead8; font-size: 11px; }
.invite-bar code { display: block; max-width: min(900px, 72vw); overflow: hidden; text-overflow: ellipsis; }
.state { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 3px; font-size: 11px; font-weight: 800; }
.state-draft, .state-leased { color: #745000; background: #fff0c7; }
.state-paid, .state-succeeded { color: #076044; background: var(--mint); }
.state-submitted { color: #215b80; background: #e1f1fa; }
.state-neutral { color: #58625d; background: #edf1ef; }
.permissions-table { min-width: 1120px; }
.performance-table { min-width: 820px; }
.performance-filter { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 650; }
.performance-filter select { width: 220px; }
.permissions-table select { min-width: 130px; }
.permissions-table td:nth-child(2) select { min-width: 150px; }
.permissions-table td:nth-child(3) select { min-width: 170px; }
.password-form input { width: 210px; min-width: 210px; }
.credential-username { position: fixed; top: 0; left: 0; width: 1px !important; min-width: 0 !important; height: 1px; padding: 0; clip-path: inset(50%); overflow: hidden; border: 0; pointer-events: none; }
.confirm-dialog { width: min(440px, calc(100% - 24px)); padding: 0; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 22px 70px rgba(17, 26, 22, .28); }
.confirm-dialog::backdrop { background: rgba(15, 24, 20, .58); }
.confirm-dialog-body { padding: 24px; }
.confirm-dialog h2 { margin-bottom: 12px; }
.confirm-dialog p { margin-bottom: 22px; color: var(--muted); line-height: 1.65; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
.auth-shell { min-height: calc(100vh - 58px); display: grid; place-items: center; padding: 32px 0; }
.auth-panel { width: min(430px, 100%); padding: 28px; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-panel h1 { margin-bottom: 25px; }
.scan-shell { width: min(560px, calc(100% - 28px)); padding-top: 22px; }
.personal-count { min-width: 105px; padding: 10px 13px; color: var(--white); background: var(--ink); border-radius: var(--radius); }
.personal-count span { display: block; color: #aebbb4; font-size: 10px; }
.personal-count strong { display: block; margin-top: 3px; font-size: 21px; }
.scan-workspace { min-height: 470px; padding: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.scan-state-line { width: 100%; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.countdown { color: var(--muted); font-variant-numeric: tabular-nums; }
.qr-stage { width: min(100%, 340px); aspect-ratio: 1; padding: 10px; display: grid; place-items: center; border: 1px solid var(--line); }
.qr-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
.scan-actions { width: min(100%, 340px); margin-top: 16px; display: grid; gap: 10px; }
.scan-actions form { margin: 0; }
.waiting-text { min-height: 42px; display: grid; place-items: center; color: var(--muted); background: #f2f5f3; border-radius: 4px; }
.idle-mark { width: 62px; height: 62px; margin-bottom: 16px; display: grid; place-items: center; color: var(--green); background: var(--mint); border-radius: 50%; font-size: 36px; font-weight: 300; }
.scan-workspace h2 { margin-bottom: 22px; font-size: 20px; }
.claim-form { width: min(100%, 300px); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #318bc0; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .28; transform: scale(.78); } }
@media (max-width: 960px) {
  .admin-grid, .leader-grid { grid-template-columns: 1fr; }
  .compact-panel { grid-row: 1; }
  .leader-grid .compact-panel { grid-row: auto; }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric-strip > div { border-bottom: 1px solid #3a433f; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 14px; }
  .topbar-actions { gap: 8px; }
  .identity { display: none; }
  .language-switch a { min-width: 36px; padding: 0 5px; }
  .shell { width: min(100% - 24px, 1440px); padding-top: 19px; }
  .metric-strip, .leader-metrics { grid-template-columns: repeat(2, 1fr); }
  .metric-strip > div { padding: 13px 14px; }
  .metric-strip strong { font-size: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .auth-panel { padding: 22px; }
  .scan-shell { width: min(100% - 20px, 560px); }
  .page-head, .scan-head { align-items: flex-start; }
  .page-head-actions, .scan-head-actions { flex-direction: column-reverse; align-items: flex-end; }
  .scan-workspace { min-height: 430px; padding: 16px; }
  .invite-bar code { max-width: 68vw; }
  .panel-head { align-items: flex-start; gap: 12px; }
  .performance-panel-head { flex-direction: column; }
  .performance-filter { width: 100%; align-items: stretch; flex-direction: column; }
  .performance-filter select { width: 100%; }
}
