:root {
  --page: #f3f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --ink: #17222c;
  --ink-soft: #344553;
  --muted: #6b7b88;
  --faint: #96a3ad;
  --line: #dce4e9;
  --line-strong: #cbd6dd;
  --accent: #176d63;
  --accent-strong: #0f574f;
  --accent-soft: #e8f4f1;
  --good: #19734d;
  --good-soft: #e7f5ed;
  --warning: #a86b08;
  --warning-soft: #fff4dc;
  --danger: #be3f48;
  --danger-soft: #fcebed;
  --info: #366eae;
  --info-soft: #eaf2fb;
  --shadow: 0 12px 34px rgba(35, 50, 63, 0.07);
  --shadow-small: 0 4px 14px rgba(35, 50, 63, 0.06);
  --radius: 12px;
  --radius-small: 8px;
  --font: Inter, "SF Pro Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--page); color: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0, rgba(23, 109, 99, 0.045), transparent 30rem),
    var(--page);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
strong { font-weight: 700; }
code { font-family: var(--mono); }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.eyebrow, .panel-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.35;
}

/* Shared application chrome */
.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: minmax(230px, auto) 1fr auto;
  align-items: center;
  min-height: 64px;
  padding: 0 26px;
  border-bottom: 1px solid rgba(203, 214, 221, 0.9);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 10px rgba(30, 47, 60, 0.035);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg, #217d71, #0e554d);
  box-shadow: 0 5px 12px rgba(15, 87, 79, 0.2);
  font-size: 16px;
  font-weight: 800;
}
.brand-mark-large { width: 43px; height: 43px; border-radius: 11px; font-size: 19px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-size: 15px; letter-spacing: 0.01em; }
.brand-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.main-nav { align-self: stretch; display: flex; align-items: center; gap: 4px; padding-left: 30px; }
.main-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 17px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--accent-strong); }
.main-nav a[aria-current="page"]::after {
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  content: "";
}

.account-menu { display: flex; align-items: center; gap: 9px; }
.account-menu form { margin-left: 4px; }
.account-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid #cfe1dd;
  border-radius: 50%;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 800;
}
.account-avatar-small { width: 30px; height: 30px; font-size: 12px; }
.account-copy { display: flex; flex-direction: column; min-width: 70px; line-height: 1.25; }
.account-copy strong { max-width: 160px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.nav-toggle { display: none; width: 38px; height: 38px; padding: 9px; border: 0; background: transparent; }
.nav-toggle > span:not(.sr-only) { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: var(--ink-soft); }

.page-shell { width: min(1540px, calc(100% - 48px)); margin: 0 auto; padding: 26px 0 48px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin: 0 2px 20px; }
.page-heading h1 { margin: 0; color: var(--ink); font-size: clamp(24px, 2.2vw, 32px); line-height: 1.2; letter-spacing: -0.035em; }
.page-heading > div:first-child > p:last-child { max-width: 800px; margin: 8px 0 0; color: var(--muted); }
.page-heading > div:first-child > p:last-child strong { color: var(--ink-soft); }
.health-indicator { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius-small); background: rgba(255,255,255,.65); }
.health-indicator > span { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 5px var(--good-soft); }
.health-indicator > div { display: flex; flex-direction: column; line-height: 1.3; }
.health-indicator small { color: var(--muted); font-size: 10px; }
.health-indicator strong { margin-top: 2px; font-size: 12px; }

/* Alerts */
.flash-stack { position: fixed; z-index: 100; top: 76px; right: 22px; display: grid; width: min(430px, calc(100vw - 32px)); gap: 8px; }
.flash { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 9px; background: #fff; box-shadow: var(--shadow); }
.flash p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.flash > button { width: 25px; height: 25px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 20px; line-height: 1; }
.flash-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--info); }
.flash-success { border-left-color: var(--good); }
.flash-success .flash-dot { background: var(--good); }
.flash-error, .flash-danger { border-left-color: var(--danger); }
.flash-error .flash-dot, .flash-danger .flash-dot { background: var(--danger); }
.flash-warning { border-left-color: var(--warning); }
.flash-warning .flash-dot { background: var(--warning); }
.flash.is-hiding { opacity: 0; transform: translateX(10px); transition: .2s ease; }

/* Buttons and form controls */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink-soft);
  background: #fff;
  box-shadow: 0 1px 1px rgba(20, 35, 45, .03);
  font-weight: 700;
  line-height: 1.2;
  transition: border-color .15s, background-color .15s, box-shadow .15s, transform .15s;
}
.button:hover { border-color: #aebdc6; background: var(--panel-soft); }
.button:active { transform: translateY(1px); }
.button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .table-link:focus-visible, .icon-button:focus-visible { outline: 3px solid rgba(23, 109, 99, .16); outline-offset: 1px; }
.button[disabled] { cursor: not-allowed; opacity: .62; transform: none; }
.button-primary { border-color: var(--accent); color: #fff; background: var(--accent); box-shadow: 0 5px 13px rgba(23, 109, 99, .16); }
.button-primary:hover { border-color: var(--accent-strong); color: #fff; background: var(--accent-strong); }
.button-success { border-color: #b7dfca; color: var(--good); background: var(--good-soft); }
.button-success:hover { border-color: #90ceb0; background: #dcf1e5; }
.button-danger-quiet { border-color: #ebc9cd; color: var(--danger); background: #fff; }
.button-danger-quiet:hover { border-color: #dfaab0; background: var(--danger-soft); }
.button-quiet { color: var(--muted); background: transparent; }
.button-small { min-height: 31px; padding: 5px 10px; border-radius: 7px; font-size: 11px; }
.button-block { width: 100%; min-height: 43px; }

.field { display: grid; gap: 6px; }
.field > span:first-child, .field-label-row { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.field small { color: var(--muted); font-size: 10px; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input, select { height: 38px; padding: 0 11px; }
textarea { min-height: 100px; padding: 10px 11px; line-height: 1.55; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: #aabac4; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23, 109, 99, .09); outline: none; }
input::placeholder, textarea::placeholder { color: #9aa8b2; }
input:invalid:not(:placeholder-shown) { border-color: #dc8e95; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 54px; }
.password-field button { position: absolute; top: 1px; right: 1px; height: 36px; padding: 0 10px; border: 0; color: var(--accent); background: transparent; font-size: 11px; font-weight: 700; }
.field-message { min-height: 16px; }
.field-message.is-error { color: var(--danger); }

/* Inventory and panels */
.inventory-strip {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) repeat(8, minmax(88px, .65fr)) auto;
  align-items: center;
  min-height: 76px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-small);
}
.inventory-title { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 13px 18px; }
.section-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 8px; color: var(--accent-strong); background: var(--accent-soft); font-size: 12px; font-weight: 800; }
.inventory-title > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.inventory-title strong { font-size: 13px; }
.inventory-title small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.inventory-item { display: flex; flex-direction: column; justify-content: center; min-height: 48px; padding: 5px 16px; border-left: 1px solid var(--line); }
.inventory-item span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.inventory-item strong { margin-top: 2px; font-size: 19px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.inventory-positive strong { color: var(--good); }
.inventory-warning strong { color: var(--warning); }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; margin: 0 16px 0 6px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fff; font-size: 19px; transition: .15s; }
.icon-button:hover { color: var(--accent); border-color: #b7d2cd; background: var(--accent-soft); }
.icon-button.is-loading span { animation: rotate .8s linear infinite; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(330px, .8fr); align-items: stretch; gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-small); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; line-height: 1.25; letter-spacing: -.015em; }
.compact-head { align-items: center; }
.probe-chip { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 7px; min-width: 150px; padding: 7px 10px; border: 1px solid #cde2dd; border-radius: 8px; background: var(--accent-soft); line-height: 1.2; }
.probe-chip-dot { grid-row: 1 / 3; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(25,115,77,.1); }
.probe-chip span:nth-child(2) { color: var(--muted); font-size: 9px; }
.probe-chip strong { color: var(--accent-strong); font-size: 11px; }

.upload-form { display: grid; gap: 14px; padding: 17px 20px 20px; }
.upload-config-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, .72fr); align-items: stretch; gap: 12px; }
.probe-toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); cursor: pointer; }
.probe-toggle-copy { display: flex; flex-direction: column; min-width: 0; }
.probe-toggle-copy strong { color: var(--ink-soft); font-size: 12px; }
.probe-toggle-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.switch-control { position: relative; display: grid; grid-template-columns: 38px auto; align-items: center; flex: 0 0 auto; gap: 7px; }
.switch-control input { position: absolute; z-index: 2; top: 0; left: 0; width: 38px; height: 22px; margin: 0; opacity: 0; cursor: pointer; }
.switch-control i { position: relative; display: block; width: 38px; height: 22px; border-radius: 999px; background: #bdc8ce; box-shadow: inset 0 0 0 1px rgba(53,72,85,.12); transition: background-color .16s; }
.switch-control i::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(26,43,54,.25); content: ""; transition: transform .16s; }
.switch-control input:checked + i { background: var(--accent); }
.switch-control input:checked + i::after { transform: translateX(16px); }
.switch-control input:focus-visible + i { outline: 3px solid rgba(23,109,99,.16); outline-offset: 2px; }
.switch-control b { min-width: 36px; color: var(--accent-strong); font-size: 10px; white-space: nowrap; }
.switch-control input:not(:checked) ~ b { color: var(--muted); }
.probe-chip.is-disabled { border-color: var(--line); background: var(--panel-soft); }
.probe-chip.is-disabled .probe-chip-dot { background: var(--faint); box-shadow: 0 0 0 4px rgba(107,123,136,.09); }
.probe-chip.is-disabled strong { color: var(--muted); }
.probe-rule.is-disabled { border-color: var(--line); background: var(--panel-soft); }
.probe-rule.is-disabled .probe-rule-icon { background: var(--muted); }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.privacy-note { color: var(--muted); font-size: 10px; font-weight: 500; }
.key-field textarea { min-height: 220px; font: 12px/1.65 var(--mono); white-space: pre; }
.input-counters { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); }
.input-counters > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 12px; border-left: 1px solid var(--line); }
.input-counters > div:first-child { border-left: 0; }
.input-counters span { color: var(--muted); font-size: 10px; }
.input-counters strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.probe-rule { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1px solid #d5e8e4; border-radius: 8px; background: #f4faf8; }
.probe-rule-icon { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; border-radius: 50%; color: #fff; background: var(--accent); font-size: 11px; font-weight: 800; }
.probe-rule p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.probe-rule strong { color: var(--ink-soft); }
.form-actions { display: flex; align-items: stretch; justify-content: flex-end; gap: 9px; }
.form-actions .button-primary { min-width: 190px; flex-direction: column; }
.form-actions .button-primary small { margin-top: 2px; opacity: .76; font-size: 9px; font-weight: 500; }

.upload-progress { margin: 0 20px 20px; padding: 13px; border: 1px solid #cfe1dd; border-radius: 9px; background: var(--accent-soft); }
.progress-heading, .progress-heading > div { display: flex; align-items: center; gap: 8px; }
.progress-heading { justify-content: space-between; }
.progress-heading strong { color: var(--accent-strong); font-size: 12px; }
.progress-heading > span { color: var(--muted); font-size: 10px; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(23,109,99,.18); border-top-color: var(--accent); border-radius: 50%; animation: rotate .75s linear infinite; }
.progress-track { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 4px; background: rgba(23,109,99,.13); }
.progress-track span { display: block; width: 35%; height: 100%; border-radius: inherit; background: var(--accent); animation: progress-move 1.3s ease-in-out infinite; }
.upload-progress p { margin: 8px 0 0; color: var(--muted); font-size: 10px; }

.result-panel { display: flex; flex-direction: column; }
.batch-meta { display: flex; justify-content: space-between; gap: 10px; padding: 13px 17px 0; color: var(--muted); font-size: 10px; }
.batch-meta code { color: var(--ink-soft); font-weight: 700; }
.result-progress { padding: 13px 17px 14px; }
.result-progress > div { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.result-progress strong { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 8px; background: #e6ecef; }
progress::-webkit-progress-bar { border-radius: 8px; background: #e6ecef; }
progress::-webkit-progress-value { border-radius: 8px; background: var(--accent); }
progress::-moz-progress-bar { border-radius: 8px; background: var(--accent); }
.result-counts { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0 17px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.result-counts > div { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 8px 12px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--panel-soft); }
.result-counts > div:nth-child(-n+2) { border-top: 0; }
.result-counts > div:nth-child(odd) { border-left: 0; }
.result-counts span { max-width: 100px; color: var(--muted); font-size: 10px; }
.result-counts strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.result-counts .count-good strong { color: var(--good); }
.result-counts .count-bad strong { color: var(--danger); }
.result-counts .count-warn strong { color: var(--warning); }
.result-summary { display: flex; align-items: center; gap: 10px; margin: auto 17px 17px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.result-summary > span { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 auto; border-radius: 50%; color: var(--muted); background: #e9eef1; font-weight: 800; }
.result-summary p { display: flex; flex-direction: column; margin: 0; line-height: 1.35; }
.result-summary strong { font-size: 11px; }
.result-summary small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.result-summary-good { border-color: #cce4d7; background: var(--good-soft); }
.result-summary-good > span { color: #fff; background: var(--good); }
.result-summary-good strong { color: var(--good); }
.empty-state { display: grid; place-items: center; margin: auto; padding: 60px 25px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 50%; color: var(--faint); background: var(--panel-soft); font-size: 24px; }
.empty-state strong { font-size: 13px; }
.empty-state p { max-width: 250px; margin: 6px 0 0; color: var(--muted); font-size: 11px; }

/* Data tables */
.table-panel { margin-top: 16px; overflow: hidden; }
.table-panel-head { align-items: center; }
.table-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.table-tools-wrap { flex-wrap: wrap; }
.history-filter-form { flex: 1 1 760px; }
.history-filter-form .select-field select { min-width: 116px; }
.history-filter-form .search-field { min-width: 230px; }
.search-field { position: relative; display: block; min-width: min(280px, 60vw); }
.search-field input { height: 34px; padding-right: 34px; font-size: 11px; }
.search-field > span:last-child { position: absolute; top: 50%; right: 11px; color: var(--faint); font-size: 18px; transform: translateY(-52%); pointer-events: none; }
.select-field select { min-width: 130px; height: 34px; padding-right: 28px; font-size: 11px; }
.table-scroll { width: 100%; overflow-x: auto; scrollbar-color: #bdc9d0 #eef2f4; scrollbar-width: thin; }
.table-scroll-tall { max-height: min(64vh, 720px); overflow: auto; }
.data-table { width: 100%; min-width: 1080px; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.detail-table { min-width: 1480px; }
.users-table { min-width: 1050px; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { position: sticky; z-index: 2; top: 0; height: 38px; color: #596b78; background: #f7f9fa; box-shadow: inset 0 -1px var(--line); font-size: 10px; font-weight: 750; white-space: nowrap; }
.data-table tbody tr { background: #fff; }
.data-table tbody tr:hover { background: #fafcfc; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table code { color: #344d5a; font-size: 10px; }
.data-table .number-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .number-good { color: var(--good); font-weight: 700; }
.data-table .number-bad { color: var(--danger); font-weight: 650; }
.data-table .number-warn { color: var(--warning); font-weight: 650; }
.data-table .action-cell { text-align: right; white-space: nowrap; }
.wrap-cell { min-width: 170px; max-width: 340px; overflow-wrap: anywhere; }
.reason-cell { min-width: 300px; max-width: 650px; white-space: normal; overflow-wrap: anywhere; line-height: 1.55; }
.batch-keys-cell { min-width: 390px; max-width: 540px; vertical-align: top !important; }
.full-key-cell { min-width: 430px; max-width: 620px; vertical-align: top !important; }
.full-key-block { display: grid; min-width: 340px; gap: 5px; }
.full-key-block textarea { width: 100%; min-height: 64px; padding: 7px 8px; border-color: var(--line); border-radius: 6px; color: #20333e; background: #f9fbfc; font: 10px/1.55 var(--mono); resize: vertical; white-space: pre; }
.full-key-block textarea:focus { border-color: var(--accent); background: #fff; }
.full-key-block > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.full-key-block small { color: var(--muted); font-size: 9px; }
.full-key-single textarea { min-height: 48px; }
.full-key-block .table-link[disabled] { cursor: not-allowed; color: var(--faint); text-decoration: none; }
.decrypt-error { display: inline-flex; padding: 4px 7px; border-radius: 5px; color: var(--danger); background: var(--danger-soft); font-size: 9px; font-weight: 700; }
.reason-detail { display: grid; gap: 5px; }
.reason-detail strong { color: var(--ink); font-weight: 650; }
.reason-detail small { color: var(--muted); font-variant-numeric: tabular-nums; }
.reason-detail pre { margin: 0; padding: 7px 9px; overflow: visible; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); color: var(--ink-soft); font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.key-suffix { display: inline-block; padding: 3px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink) !important; background: var(--panel-soft); font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.table-link { padding: 3px 0; border: 0; color: var(--accent); background: transparent; font-size: 10px; font-weight: 700; }
.table-link:hover { color: var(--accent-strong); text-decoration: underline; }
.table-empty { padding: 42px 15px; color: var(--muted); text-align: center; }
.table-footer { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 12px; padding: 8px 13px; border-top: 1px solid var(--line); color: var(--muted); background: #fbfcfc; font-size: 10px; }
.pagination { display: flex; align-items: center; gap: 4px; }
.pagination button { min-width: 29px; height: 29px; padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #fff; font-size: 10px; }
.pagination button:hover:not(:disabled) { color: var(--accent); border-color: #b7d2cd; background: var(--accent-soft); }
.pagination button[aria-current="page"] { color: #fff; border-color: var(--accent); background: var(--accent); }
.pagination button:disabled { cursor: default; opacity: .42; }
.status-badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--panel-soft); font-size: 9px; font-weight: 750; white-space: nowrap; }
.status-badge::before { width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-badge.is-positive, .status-badge[data-status="alive"], .status-badge[data-status="approved"], .status-badge[data-status="active"], .status-badge[data-status="completed"] { color: var(--good); border-color: #cbe4d6; background: var(--good-soft); }
.status-badge.is-negative, .status-badge[data-status="invalid"], .status-badge[data-status="quota_zero"], .status-badge[data-status="disabled"], .status-badge[data-status="failed"] { color: var(--danger); border-color: #efcdd1; background: var(--danger-soft); }
.status-badge.is-warning, .status-badge[data-status="pending"], .status-badge[data-status="deferred"], .status-badge[data-status="probing"] { color: var(--warning); border-color: #efdcaf; background: var(--warning-soft); }
.duplicate-mark { display: inline-flex; padding: 2px 6px; border-radius: 5px; color: var(--warning); background: var(--warning-soft); font-size: 9px; font-weight: 700; }
.detail-safety-note { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-bottom: 1px solid var(--line); color: var(--muted); background: #fbfcfc; font-size: 10px; }
.detail-safety-note span { display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid #c4d4de; border-radius: 50%; color: var(--info); font-size: 9px; font-weight: 800; }

/* Administration */
.admin-heading { align-items: center; }
.admin-summary { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-small); }
.admin-summary > div { min-width: 100px; padding: 9px 16px; border-left: 1px solid var(--line); text-align: center; }
.admin-summary > div:first-child { border-left: 0; }
.admin-summary span { display: block; color: var(--muted); font-size: 9px; }
.admin-summary strong { display: block; margin-top: 2px; font-size: 18px; font-variant-numeric: tabular-nums; }
.pending-callout { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; padding: 12px 15px; border: 1px solid #ecd9ae; border-radius: 10px; background: var(--warning-soft); }
.pending-callout-icon { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--warning); font-weight: 800; }
.pending-callout strong { color: #7b4d02; font-size: 12px; }
.pending-callout p { margin: 2px 0 0; color: #8f6b2d; font-size: 10px; }
.attention-row { background: #fffdf8 !important; }
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 155px; }
.user-cell > div { display: flex; flex-direction: column; }
.user-cell strong { font-size: 11px; }
.user-cell small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.role-badge { display: inline-flex; padding: 3px 7px; border-radius: 5px; color: var(--accent-strong); background: var(--accent-soft); font-size: 9px; font-weight: 700; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.protected-label { color: var(--faint); font-size: 9px; }

/* Authentication and pending state */
.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 28px; background: #eef3f4; }
.auth-page::before { position: fixed; z-index: -1; inset: 0; background: radial-gradient(circle at 76% 22%, rgba(23,109,99,.12), transparent 34rem), radial-gradient(circle at 18% 80%, rgba(54,110,174,.07), transparent 28rem); content: ""; }
.auth-shell { display: grid; grid-template-columns: minmax(360px, 450px) minmax(420px, 590px); width: min(1040px, 100%); min-height: 600px; overflow: hidden; border: 1px solid rgba(203,214,221,.9); border-radius: 17px; background: #fff; box-shadow: 0 26px 70px rgba(29, 48, 59, .13); }
.auth-shell-single { display: block; width: min(470px, 100%); min-height: 0; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 45px 50px; background: #fff; }
.auth-brand { position: absolute; top: 42px; display: flex; align-items: center; gap: 10px; }
.auth-brand > div { display: flex; flex-direction: column; line-height: 1.3; }
.auth-brand strong { font-size: 13px; }
.auth-brand span:not(.brand-mark) { margin-top: 2px; color: var(--muted); font-size: 10px; }
.auth-card { position: relative; }
.auth-heading { margin-top: 48px; }
.auth-heading h1 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.auth-heading > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.auth-form { display: grid; gap: 15px; margin-top: 27px; }
.auth-form .button-block { margin-top: 5px; }
.auth-foot { display: flex; flex-wrap: wrap; gap: 3px 7px; margin-top: 22px; color: var(--muted); font-size: 11px; }
.auth-foot a { font-weight: 750; }
.auth-foot small { width: 100%; margin-top: 5px; color: var(--faint); font-size: 9px; }
.auth-aside { position: relative; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding: 70px; color: #f1f7f6; background: linear-gradient(145deg, #163b3a, #0d292c); }
.auth-aside::before { position: absolute; top: -120px; right: -120px; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 50px rgba(255,255,255,.025), 0 0 0 100px rgba(255,255,255,.015); content: ""; }
.auth-aside .eyebrow { color: #7fc7ba; }
.auth-aside h2 { position: relative; margin: 4px 0 34px; font-size: 30px; line-height: 1.3; letter-spacing: -.04em; }
.feature-list { position: relative; display: grid; gap: 23px; margin: 0; padding: 0; list-style: none; }
.feature-list li { display: grid; grid-template-columns: 33px 1fr; gap: 12px; }
.feature-list li > span { color: #73b7ad; font: 700 10px/1.4 var(--mono); }
.feature-list strong { font-size: 12px; }
.feature-list p { margin: 4px 0 0; color: rgba(232,244,241,.65); font-size: 10px; line-height: 1.6; }
.auth-shell-single .auth-card { min-height: 620px; }

.pending-page { display: grid; min-height: 100vh; place-items: center; padding: 30px; background: var(--page); }
.state-shell { width: min(510px, 100%); }
.state-card { padding: 44px 46px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.state-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 20px; border-radius: 50%; background: var(--warning-soft); }
.state-icon span { width: 20px; height: 20px; border: 3px solid rgba(168,107,8,.25); border-top-color: var(--warning); border-radius: 50%; animation: rotate 1.1s linear infinite; }
.state-card h1 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.state-card > p:not(.eyebrow) { margin: 10px auto 0; color: var(--muted); font-size: 12px; }
.state-card > p strong { color: var(--ink); }
.state-notes { display: grid; grid-template-columns: repeat(2, 1fr); margin: 27px 0 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.state-notes > div { display: flex; flex-direction: column; padding: 12px; border-left: 1px solid var(--line); }
.state-notes > div:first-child { border-left: 0; }
.state-notes span { color: var(--muted); font-size: 9px; }
.state-notes strong { margin-top: 2px; font-size: 12px; }
.state-card .muted { font-size: 10px !important; }
.state-card form { margin-top: 25px; }
.noscript { position: fixed; z-index: 200; right: 15px; bottom: 15px; left: 15px; padding: 10px; border: 1px solid #ecd9ae; border-radius: 8px; color: #7b4d02; background: var(--warning-soft); text-align: center; font-size: 11px; }

/* Server pool V2: superadmin overview, account permissions and credit ledger */
.one-time-token { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(420px, 1.3fr); align-items: center; gap: 24px; margin-bottom: 16px; padding: 18px 20px; border-color: #c7dfd9; background: linear-gradient(110deg, #f4fbf9, #fff); }
.one-time-token h2 { margin: 0; font-size: 17px; }
.one-time-token p:not(.panel-kicker) { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.token-copy-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.token-copy-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--accent-strong); font-size: 12px; }
.admin-create-panel, .user-management-panel { margin-bottom: 16px; }
.admin-create-grid { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(220px, 1fr) minmax(350px, 1.3fr) auto; align-items: end; gap: 14px; padding: 17px 20px 20px; }
.permission-fieldset { display: flex; align-items: center; gap: 14px; min-width: 0; margin: 0; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; }
.permission-fieldset legend { padding: 0 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.permission-fieldset label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.permission-fieldset input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.permission-fieldset-vertical { align-items: flex-start; flex-direction: column; gap: 9px; padding: 11px; }
.admin-user-list { display: grid; max-height: calc(100vh - 230px); overflow: auto; scrollbar-color: #bdc9d0 #eef2f4; scrollbar-width: thin; }
.admin-user-card { border-bottom: 1px solid var(--line); background: #fff; }
.admin-user-card:last-child { border-bottom: 0; }
.admin-user-card > summary { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(210px, auto) minmax(220px, auto) auto; align-items: center; gap: 18px; min-height: 70px; padding: 10px 18px; cursor: pointer; list-style: none; }
.admin-user-card > summary::-webkit-details-marker { display: none; }
.admin-user-card > summary:hover { background: #fafcfc; }
.admin-user-card[open] > summary { border-bottom: 1px solid var(--line); background: #f7faf9; }
.admin-user-card > summary::after { color: var(--muted); content: "展开"; font-size: 10px; }
.admin-user-card[open] > summary::after { content: "收起"; }
.permission-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.permission-badge { padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--faint); background: var(--panel-soft); font-size: 9px; font-weight: 750; }
.permission-badge.is-on { color: var(--accent-strong); border-color: #c7dfd9; background: var(--accent-soft); }
.credit-inline { display: flex; gap: 12px; color: var(--muted); font-size: 10px; }
.credit-inline strong { color: var(--ink); font-size: 13px; }
.admin-user-body { display: grid; grid-template-columns: minmax(170px, .65fr) minmax(170px, .65fr) minmax(400px, 1.5fr) minmax(300px, 1.15fr); align-items: start; background: #fbfcfc; }
.admin-user-section { min-height: 100%; padding: 16px 17px; border-right: 1px solid var(--line); }
.admin-user-section:last-child { border-right: 0; }
.admin-user-section h3 { margin: 0 0 11px; font-size: 12px; }
.account-facts dl { display: grid; gap: 8px; margin: 0 0 13px; }
.account-facts dl > div { display: grid; gap: 1px; }
.account-facts dt { color: var(--muted); font-size: 9px; }
.account-facts dd { margin: 0; overflow-wrap: anywhere; font-size: 10px; }
.stack-form { display: grid; gap: 10px; }
.credit-account-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-bottom: 11px; }
.credit-account-grid > div { display: flex; flex-direction: column; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.credit-account-grid span, .credit-account-grid small { color: var(--muted); font-size: 9px; }
.credit-account-grid strong { margin: 2px 0; font-size: 13px; }
.credit-form { display: grid; grid-template-columns: 90px 90px 90px minmax(170px, 1fr) auto; align-items: end; gap: 7px; }
.credit-form label { display: grid; gap: 3px; color: var(--muted); font-size: 9px; }
.credit-form input, .credit-form select { height: 32px; font-size: 10px; }
.mini-ledger { display: grid; max-height: 180px; margin-top: 12px; overflow: auto; border-top: 1px solid var(--line); }
.mini-ledger > div { display: grid; grid-template-columns: 125px 42px 1fr; gap: 7px; padding: 7px 1px; border-bottom: 1px solid var(--line); font-size: 9px; }
.mini-ledger time, .mini-ledger small { color: var(--muted); }
.mini-ledger small { grid-column: 3; }
.mini-ledger .positive { color: var(--good); }
.mini-ledger .negative { color: var(--danger); }
.inline-form { display: flex; gap: 7px; }
.inline-form input { height: 32px; font-size: 10px; }
.token-list { display: grid; max-height: 220px; margin-top: 10px; overflow: auto; }
.token-list > div { display: flex; align-items: center; gap: 7px; padding: 7px 0; border-top: 1px solid var(--line); }
.token-list > div > span:first-child { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.token-list small { overflow-wrap: anywhere; color: var(--muted); font-size: 8px; }

.pool-stat-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pool-stat-grid > div { display: flex; min-width: 0; flex-direction: column; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-small); }
.pool-stat-grid span, .pool-stat-grid small { color: var(--muted); font-size: 9px; }
.pool-stat-grid strong { margin: 3px 0; font-size: 19px; font-variant-numeric: tabular-nums; }
.pool-filter-panel { margin-bottom: 14px; }
.pool-filter-form { display: grid; grid-template-columns: minmax(360px, 2fr) repeat(3, minmax(130px, .55fr)) auto auto; align-items: end; gap: 9px; padding: 13px 15px; }
.pool-table { min-width: 1740px; }
.table-scroll-pool { max-height: calc(100vh - 330px); overflow: auto; }
.pool-table td { vertical-align: top; }
.full-key-cell { width: 380px; }
.full-key-cell code { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: 10px; line-height: 1.5; }
.full-key-cell .icon-button { display: inline-flex; width: auto; height: 25px; margin: 6px 0 0; padding: 0 8px; font-size: 9px; }
.full-key-cell small, .pool-table td > small { display: block; margin-top: 5px; overflow-wrap: anywhere; color: var(--muted); font-size: 8px; }
.source-detail-cell { width: 420px; overflow-wrap: anywhere; }
.source-detail-cell strong, .source-detail-cell span { display: block; }
.source-detail-cell strong { margin-top: 5px; color: var(--muted); font-size: 8px; }
.source-detail-cell strong:first-child { margin-top: 0; }
.source-detail-cell span { color: var(--ink-soft); line-height: 1.5; }
.time-reason-cell { width: 220px; }
.time-reason-cell p { margin: 7px 0 0; overflow-wrap: anywhere; color: var(--ink-soft); }
.type-badge { display: inline-flex; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); font: 700 9px/1.4 var(--mono); }
.duplicate-context-cell { min-width: 270px; vertical-align: top !important; }
.duplicate-context { display: grid; gap: 3px; }
.duplicate-context > a { overflow-wrap: anywhere; color: var(--accent-strong); font-size: 9px; font-weight: 700; }
.duplicate-context > small { display: block; overflow-wrap: anywhere; color: var(--muted); font-size: 8px; line-height: 1.45; }
.duplicate-context .duplicate-mark { width: max-content; margin-bottom: 2px; }
.duplicate-hidden-note { margin-top: 3px; padding: 5px 6px; border: 1px solid #ecd9ae; border-radius: 5px; color: var(--warning) !important; background: var(--warning-soft); }
.pool-duplicate-context { max-height: 190px; margin-top: 5px; overflow: auto; padding-right: 4px; }
.duplicate-count-link { display: inline-flex; min-width: 48px; flex-direction: column; align-items: center; padding: 4px 7px; border: 1px solid #ecd9ae; border-radius: 7px; color: var(--warning); background: var(--warning-soft); line-height: 1.2; }
.duplicate-count-link:hover { border-color: #dfc47f; color: #855304; }
.duplicate-count-link strong { font-size: 13px; }
.duplicate-count-link small { margin-top: 2px; font-size: 8px; white-space: nowrap; }

.client-permission-summary { justify-content: flex-end; }
.client-credit-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.client-credit-card { display: flex; flex-direction: column; padding: 16px 18px; }
.client-credit-card span, .client-credit-card small { color: var(--muted); font-size: 10px; }
.client-credit-card strong { margin: 3px 0; font-size: 25px; font-variant-numeric: tabular-nums; }
.client-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.client-action-card.is-disabled { opacity: .72; }
.client-claim-form { display: grid; grid-template-columns: 130px 110px minmax(190px, 1fr) auto; align-items: end; gap: 10px; padding: 16px 18px 18px; }
.client-disabled-copy { min-height: 75px; margin: 0; padding: 22px 18px; color: var(--muted); }
.client-claim-result { margin-bottom: 14px; border-color: #b9dcd3; }
.client-claim-result-body { padding: 16px 18px 18px; }
.client-claim-result-body > p { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.client-claim-result textarea { min-height: 100px; color: var(--ink); background: #f8fbfa; font-family: var(--mono); font-size: 11px; white-space: pre; }
.client-result-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.client-result-actions form { display: contents; }
.client-history-panel { margin-bottom: 20px; }
.client-claims-table { min-width: 1260px; }
.client-claims-table code { overflow-wrap: anywhere; }
.client-claims-table td > small, .client-claims-table td > time { display: block; color: var(--muted); font-size: 8px; }

@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes progress-move { 0% { transform: translateX(-110%); } 50% { transform: translateX(120%); } 100% { transform: translateX(310%); } }

@media (max-width: 1120px) {
  .inventory-strip { grid-template-columns: minmax(170px, 1fr) repeat(8, minmax(78px, .55fr)) auto; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.45fr) minmax(310px, .8fr); }
  .auth-aside { padding: 50px; }
  .admin-create-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-user-card > summary { grid-template-columns: minmax(180px, 1fr) minmax(190px, auto) minmax(180px, auto) auto; }
  .admin-user-body { grid-template-columns: repeat(2, 1fr); }
  .admin-user-section:nth-child(2) { border-right: 0; }
  .admin-user-section:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .pool-stat-grid { grid-template-columns: repeat(3, 1fr); }
  .pool-filter-form { grid-template-columns: repeat(3, 1fr); }
  .pool-search { grid-column: span 3; }
  .client-claim-form { grid-template-columns: repeat(2, 1fr); }
  .client-consumer-field { grid-column: span 2; }
  .client-claim-form .button { grid-column: span 2; }
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto auto; padding: 0 17px; }
  .nav-toggle { display: block; order: 2; }
  .main-nav { position: absolute; top: 63px; right: 10px; left: 10px; display: none; align-self: auto; flex-direction: column; align-items: stretch; gap: 0; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
  .main-nav.is-open { display: flex; }
  .main-nav a { height: 42px; padding: 0 12px; border-radius: 7px; }
  .main-nav a[aria-current="page"] { background: var(--accent-soft); }
  .main-nav a[aria-current="page"]::after { display: none; }
  .account-menu { order: 3; margin-left: 8px; }
  .account-copy { display: none; }
  .page-shell { width: min(100% - 28px, 1540px); padding-top: 20px; }
  .page-heading { align-items: flex-start; }
  .health-indicator { min-width: 190px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .upload-config-row { grid-template-columns: 1fr; }
  .result-panel { min-height: 430px; }
  .auth-shell { grid-template-columns: minmax(330px, 430px) 1fr; }
  .auth-card { padding: 42px 38px; }
  .auth-aside { padding: 38px; }
  .auth-aside h2 { font-size: 25px; }
  .one-time-token { grid-template-columns: 1fr; }
  .admin-user-card > summary { grid-template-columns: 1fr auto; }
  .admin-user-card > summary .permission-badges, .admin-user-card > summary .credit-inline { display: none; }
}

@media (max-width: 720px) {
  .topbar { min-height: 58px; }
  .brand-copy small { display: none; }
  .brand-mark { width: 32px; height: 32px; }
  .main-nav { top: 57px; }
  .account-menu .account-avatar { display: none; }
  .page-shell { width: min(100% - 20px, 1540px); padding: 16px 0 32px; }
  .page-heading { display: block; margin-bottom: 15px; }
  .page-heading h1 { font-size: 25px; }
  .health-indicator { width: 100%; margin-top: 14px; }
  .inventory-strip { display: flex; min-height: 68px; overflow-x: auto; }
  .inventory-title { min-width: 190px; }
  .inventory-item { display: flex !important; min-width: 105px; }
  .icon-button { flex: 0 0 auto; }
  .panel-head { padding: 15px 14px 12px; }
  .probe-chip { min-width: auto; }
  .upload-form { padding: 14px; }
  .key-field textarea { min-height: 250px; }
  .input-counters { grid-template-columns: 1fr; }
  .input-counters > div { border-top: 1px solid var(--line); border-left: 0; }
  .input-counters > div:first-child { border-top: 0; }
  .form-actions { display: grid; grid-template-columns: 1fr 2fr; }
  .form-actions .button-primary { min-width: 0; }
  .result-counts { margin-right: 14px; margin-left: 14px; }
  .table-panel-head { display: block; }
  .table-tools { justify-content: stretch; margin-top: 12px; }
  .table-tools > label { flex: 1 1 160px; min-width: 0; }
  .search-field { min-width: 0; }
  .table-footer { align-items: flex-start; flex-direction: column; }
  .pagination { align-self: flex-end; }
  .admin-heading { display: block; }
  .admin-summary { margin-top: 14px; }
  .admin-summary > div { flex: 1; min-width: 0; padding: 8px; }
  .auth-page { padding: 15px; }
  .auth-shell { display: block; width: min(460px, 100%); min-height: 0; }
  .auth-card { min-height: 610px; padding: 38px 30px; }
  .auth-aside { display: none; }
  .auth-brand { top: 35px; }
  .auth-heading { margin-top: 58px; }
  .state-card { padding: 38px 25px; }
  .flash-stack { top: 68px; right: 10px; width: calc(100vw - 20px); }
  .admin-create-grid, .admin-user-body, .pool-stat-grid, .pool-filter-form { grid-template-columns: 1fr; }
  .pool-search { grid-column: auto; }
  .admin-user-section { border-right: 0; border-bottom: 1px solid var(--line); }
  .credit-form { grid-template-columns: repeat(3, 1fr); }
  .credit-reason { grid-column: span 3; }
  .credit-form .button { grid-column: span 3; }
  .token-copy-row { align-items: stretch; flex-direction: column; }
  .client-credit-grid, .client-action-grid, .client-claim-form { grid-template-columns: 1fr; }
  .client-consumer-field, .client-claim-form .button { grid-column: auto; }
  .client-result-actions { align-items: stretch; flex-direction: column; }
}

@media (max-width: 440px) {
  .account-menu form { margin-left: 0; }
  .button-small { padding-right: 8px; padding-left: 8px; }
  .brand-copy strong { font-size: 13px; }
  .page-heading > div:first-child > p:last-child { font-size: 12px; }
  .probe-chip span:nth-child(2) { display: none; }
  .probe-chip { display: flex; }
  .input-counters { grid-template-columns: repeat(3, 1fr); }
  .input-counters > div { display: flex; flex-direction: column; align-items: center; border-top: 0; border-left: 1px solid var(--line); }
  .input-counters > div:first-child { border-left: 0; }
  .auth-card { padding-right: 23px; padding-left: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Formal version2 server-function workbench */
body:has(.workbench-page) { background: #f2f5f9; }
body:has(.workbench-page) .page-shell { width: min(1580px, calc(100% - 42px)); padding-top: 18px; }
.workbench-page { display: grid; gap: 14px; }
.workbench-hero { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 178px; overflow: hidden; padding: 30px 34px; border-radius: 18px; color: #fff; background: linear-gradient(125deg, #143b42 0%, #176d63 62%, #238776 100%); box-shadow: 0 15px 38px rgba(18, 71, 70, .18); }
.workbench-hero::before, .workbench-hero::after { position: absolute; border-radius: 50%; content: ""; pointer-events: none; }
.workbench-hero::before { top: -130px; right: 220px; width: 310px; height: 310px; border: 1px solid rgba(255,255,255,.11); }
.workbench-hero::after { right: -65px; bottom: -145px; width: 330px; height: 330px; background: rgba(255,255,255,.055); }
.workbench-hero-copy { position: relative; z-index: 1; }
.workbench-hero-kicker { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.72); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.workbench-hero-kicker > span { width: 7px; height: 7px; border-radius: 50%; background: #69e3bd; box-shadow: 0 0 0 5px rgba(105,227,189,.12); }
.workbench-hero h1 { margin: 10px 0 6px; font-size: clamp(27px, 2.2vw, 36px); line-height: 1.15; letter-spacing: -.04em; }
.workbench-hero p { margin: 0; color: rgba(255,255,255,.76); font-size: 13px; }
.workbench-hero-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.workbench-hero-tags span { padding: 5px 9px; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; color: rgba(255,255,255,.82); background: rgba(255,255,255,.07); font-size: 10px; }
.workbench-boundary-card { position: relative; z-index: 1; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; min-width: 270px; gap: 12px; padding: 15px 16px; border: 1px solid rgba(255,255,255,.18); border-radius: 13px; background: rgba(8,38,42,.25); backdrop-filter: blur(10px); }
.workbench-boundary-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: #143b42; background: #8be4c8; font-weight: 900; }
.workbench-boundary-card > div:nth-child(2) { display: grid; gap: 2px; }
.workbench-boundary-card strong { color: #fff; font-size: 13px; }
.workbench-boundary-card span { color: rgba(255,255,255,.67); font-size: 10px; }
.workbench-boundary-card > i { width: 8px; height: 8px; border-radius: 50%; background: #72e3bb; box-shadow: 0 0 0 5px rgba(114,227,187,.12); }
.workbench-local-nav { position: sticky; z-index: 20; top: 70px; display: flex; gap: 5px; padding: 6px; border: 1px solid #d9e2e9; border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 5px 18px rgba(35,50,63,.06); backdrop-filter: blur(12px); }
.workbench-local-nav a { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 5px 13px; border-radius: 8px; color: #61717d; font-size: 12px; font-weight: 750; }
.workbench-local-nav a:hover, .workbench-local-nav a.is-active { color: #0f574f; background: #e8f4f1; }
.workbench-local-nav a > span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #176d63; background: #fff; box-shadow: 0 1px 3px rgba(35,50,63,.08); font-size: 10px; }
.workbench-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.workbench-metric { position: relative; display: flex; align-items: center; min-height: 90px; overflow: hidden; gap: 12px; padding: 14px 15px; border: 1px solid #dde5eb; border-radius: 13px; background: #fff; box-shadow: 0 5px 15px rgba(35,50,63,.045); }
.workbench-metric::after { position: absolute; top: -30px; right: -30px; width: 70px; height: 70px; border-radius: 50%; background: var(--metric-soft); content: ""; }
.workbench-metric-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; color: var(--metric); background: var(--metric-soft); font-weight: 900; }
.workbench-metric > div:last-child { display: grid; min-width: 0; }
.workbench-metric span { color: #6b7b88; font-size: 10px; font-weight: 700; }
.workbench-metric strong { margin: 1px 0; color: #17222c; font-size: 24px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.workbench-metric small { overflow: hidden; color: #96a3ad; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.workbench-metric.tone-teal { --metric: #176d63; --metric-soft: #e4f4ef; }
.workbench-metric.tone-green { --metric: #26855a; --metric-soft: #e8f6ee; }
.workbench-metric.tone-blue { --metric: #3d72b2; --metric-soft: #e9f1fa; }
.workbench-metric.tone-violet { --metric: #7559a8; --metric-soft: #f0ebf8; }
.workbench-metric.tone-amber { --metric: #aa710f; --metric-soft: #fff3db; }
.workbench-metric.tone-slate { --metric: #536876; --metric-soft: #edf1f4; }
.workbench-panel { overflow: hidden; border-color: #dbe3e9; border-radius: 14px; box-shadow: 0 6px 20px rgba(35,50,63,.05); }
.workbench-section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 21px 15px; border-bottom: 1px solid #e2e8ed; }
.workbench-section-head > div:first-child { display: grid; gap: 3px; }
.workbench-section-head p { margin: 0; color: #176d63; font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.workbench-section-head h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.workbench-section-head span { color: #7b8994; font-size: 10px; }
.workbench-section-head b { padding: 5px 9px; border-radius: 999px; color: #176d63; background: #e8f4f1; font-size: 10px; }
.workbench-section-head.compact { align-items: flex-end; }
.workbench-progress { display: grid; min-width: 210px; gap: 4px; }
.workbench-progress strong { color: #40515e; font-size: 10px; }
.workbench-progress > span { display: block; height: 6px; overflow: hidden; border-radius: 99px; background: #e8edf1; }
.workbench-progress > span i { display: block; width: 38%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #176d63, #54b89b); }
.workbench-progress small { color: #84929c; font-size: 9px; }
.workbench-feature-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 10px; padding: 15px 18px 19px; }
.workbench-feature-card { display: grid; align-content: space-between; gap: 14px; min-height: 158px; padding: 15px; border: 1px solid #e0e7ec; border-radius: 11px; background: #fbfcfd; transition: border-color .16s, box-shadow .16s, transform .16s; }
.workbench-feature-card:hover { border-color: #b9d4cf; box-shadow: 0 7px 18px rgba(35,50,63,.06); transform: translateY(-1px); }
.workbench-feature-top { display: flex !important; align-items: center; justify-content: space-between; }
.workbench-feature-glyph { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; color: #176d63 !important; background: #e8f4f1; font-weight: 900; }
.workbench-feature-card em { padding: 4px 7px; border-radius: 999px; color: #6c7d88; background: #edf1f4; font-size: 9px; font-style: normal; font-weight: 800; }
.workbench-feature-card[data-state="ready"] em { color: #19734d; background: #e7f5ed; }
.workbench-feature-card[data-state="building"] em { color: #366eae; background: #eaf2fb; }
.workbench-feature-card[data-state="pending"] em { color: #9a670e; background: #fff3d8; }
.workbench-feature-card > div:nth-child(2) { display: grid; gap: 5px; }
.workbench-feature-card strong { font-size: 14px; }
.workbench-feature-card span, .workbench-feature-card small { color: #74838e; font-size: 10px; line-height: 1.55; }
.workbench-safe-chip { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #c9e3d6; border-radius: 999px; color: #19734d; background: #eff9f3; font-size: 10px; font-weight: 800; }
.workbench-safe-chip i { width: 7px; height: 7px; border-radius: 50%; background: #2ba66e; box-shadow: 0 0 0 4px rgba(43,166,110,.1); }
.workbench-switch-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)) auto; align-items: stretch; gap: 9px; padding: 15px 18px 18px; }
.workbench-switch { position: relative; display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 10px; min-height: 73px; padding: 11px 12px; border: 1px solid #e0e7ec; border-radius: 10px; background: #fbfcfd; cursor: pointer; }
.workbench-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.workbench-switch > i { position: relative; display: block; width: 36px; height: 21px; border-radius: 99px; background: #c8d1d7; transition: .16s; }
.workbench-switch > i::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(35,50,63,.24); content: ""; transition: .16s; }
.workbench-switch input:checked + i { background: #176d63; }
.workbench-switch input:checked + i::after { transform: translateX(15px); }
.workbench-switch span { display: grid; gap: 3px; min-width: 0; }
.workbench-switch strong { font-size: 11px; }
.workbench-switch small { color: #85929b; font-size: 9px; line-height: 1.35; }
.workbench-switch-grid > .button { min-width: 150px; }
.workbench-two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.workbench-tab-single { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.workbench-tab-single > .workbench-panel { width: 100%; }
.compact-form-grid { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 9px; padding: 15px 18px 17px; border-bottom: 1px solid #e5eaee; }
.compact-form-grid label:not(.check-line) { display: grid; gap: 5px; color: #687985; font-size: 10px; font-weight: 700; }
.compact-form-grid .check-line { align-self: end; min-height: 38px; padding: 8px 9px; border: 1px solid #e0e7ec; border-radius: 8px; background: #fbfcfd; }
.compact-form-grid .check-line input { width: 16px; height: 16px; }
.compact-form-grid .button { align-self: end; }
.workbench-card-list { display: grid; gap: 8px; min-height: 84px; max-height: 360px; overflow: auto; padding: 13px 18px 18px; }
.workbench-card-list > .empty-state { display: grid; place-items: center; min-height: 62px; margin: 0; border: 1px dashed #d5dfe5; border-radius: 9px; color: #8a98a2; background: #fafcfd; font-size: 10px; }
.workbench-list-card { display: flex; justify-content: space-between; gap: 14px; padding: 12px 13px; border: 1px solid #e0e7ec; border-radius: 9px; background: #fbfcfd; }
.workbench-list-card > div { display: grid; gap: 3px; min-width: 0; }
.workbench-list-card span, .workbench-list-card small { color: #7a8993; font-size: 10px; overflow-wrap: anywhere; }
.workbench-list-card.is-archived { opacity: .58; }
.workbench-panel .table-scroll { max-height: 330px; }
.workbench-empty-cell { height: 135px; text-align: center; }
.workbench-empty-cell > span { display: grid; place-items: center; width: 34px; height: 34px; margin: 0 auto 6px; border-radius: 9px; color: #176d63; background: #e8f4f1; font-weight: 900; }
.workbench-empty-cell > strong, .workbench-empty-cell > small { display: block; }
.workbench-empty-cell > strong { color: #51616d; font-size: 11px; }
.workbench-empty-cell > small { margin-top: 3px; color: #91a0aa; font-size: 9px; }
.workbench-action-panel { min-height: 100%; }
.workbench-intake-form, .workbench-issue-form { display: grid; gap: 12px; padding: 16px 18px 18px; }
.workbench-intake-form .field, .workbench-issue-form .field, .workbench-filter-form .field { display: grid; gap: 5px; color: #687985; font-size: 10px; font-weight: 700; }
.workbench-intake-form textarea, .workbench-issue-form textarea { min-height: 184px; resize: vertical; font-family: var(--mono); font-size: 11px; line-height: 1.55; }
.workbench-drop-zone { position: relative; display: grid; place-items: center; gap: 3px; min-height: 74px; padding: 12px; border: 1px dashed #9fc8be; border-radius: 10px; color: #176d63; background: #f2faf7; text-align: center; cursor: pointer; transition: .16s; }
.workbench-drop-zone:hover, .workbench-drop-zone.is-dragging { border-color: #176d63; background: #e7f5f0; }
.workbench-drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.workbench-drop-zone strong { font-size: 11px; }
.workbench-drop-zone small { color: #70877f; font-size: 9px; }
.workbench-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workbench-form-actions > small { color: #7a8993; font-size: 10px; }
.workbench-form-actions .check-line { display: flex; align-items: center; gap: 7px; color: #536873; font-size: 11px; font-weight: 750; }
.workbench-inline-fields { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(240px, 2fr); gap: 10px; }
.workbench-result-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 11px 18px; border-bottom: 1px solid #e5eaee; background: #fbfcfd; }
.workbench-result-strip span { padding: 6px 9px; border: 1px solid #dfe7eb; border-radius: 8px; color: #687985; background: #fff; font-size: 10px; }
.workbench-result-strip strong { margin-left: 4px; color: #17222c; font-size: 13px; }
.workbench-record-scroll, .workbench-ledger-scroll { max-height: min(72vh, 820px) !important; overflow: auto; }
.workbench-detail-table { min-width: 1120px; }
.workbench-detail-table .full-key-cell, .workbench-ledger-table .full-key-cell { min-width: 330px; max-width: 480px; }
.workbench-detail-table code, .workbench-ledger-table code, .workbench-source-key code { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
.workbench-filter-form { display: grid; grid-template-columns: minmax(320px, 2fr) repeat(3, minmax(140px, .7fr)) auto auto; align-items: end; gap: 9px; padding: 13px 18px; border-bottom: 1px solid #e5eaee; background: #fbfcfd; }
.workbench-source-filter { grid-template-columns: minmax(360px, 2fr) minmax(180px, .7fr) auto auto; }
.workbench-ledger-table { min-width: 1460px; table-layout: fixed; }
.workbench-ledger-table th:nth-child(1) { width: 25%; }
.workbench-ledger-table th:nth-child(2) { width: 12%; }
.workbench-ledger-table th:nth-child(3) { width: 24%; }
.workbench-ledger-table th:nth-child(4) { width: 14%; }
.workbench-ledger-table th:nth-child(5) { width: 25%; }
.workbench-ledger-table td { vertical-align: top; }
.workbench-ledger-table .duplicate-context-cell { min-width: 0; }
.workbench-ledger-table .duplicate-context-cell > span, .workbench-ledger-table .duplicate-context-cell > small { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.workbench-issue-cell { display: grid; min-width: 330px; gap: 8px; }
.workbench-issue-current { padding: 8px 9px; border-left: 3px solid #cf7e1c; border-radius: 7px; background: #fff8e9; }
.workbench-issue-current.is-archived { border-color: #7d8c96; background: #f1f4f6; }
.workbench-issue-current strong, .workbench-issue-current span { margin-right: 7px; font-size: 10px; }
.workbench-issue-current p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 10px; line-height: 1.5; }
.workbench-no-issue { color: #87959f; }
.workbench-inline-issue-edit { display: grid; grid-template-columns: 105px minmax(150px, 1fr) auto; gap: 6px; }
.workbench-inline-issue-edit select, .workbench-inline-issue-edit input { min-width: 0; font-size: 10px; }
.workbench-source-list { display: grid; gap: 10px; max-height: min(76vh, 900px); overflow: auto; padding: 14px 18px 18px; }
.workbench-source-list > .empty-state { margin: 0; padding: 34px; color: #84929c; text-align: center; }
.workbench-source-card { min-width: 1240px; overflow: hidden; border: 1px solid #dfe6eb; border-radius: 11px; background: #fbfcfd; }
.workbench-source-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 14px; border-bottom: 1px solid #e5eaee; background: #f7f9fa; }
.workbench-source-card > header > div:first-child { display: grid; gap: 3px; min-width: 0; }
.workbench-source-card > header strong { font-size: 12px; overflow-wrap: anywhere; }
.workbench-source-card > header span { color: #75848f; font-size: 9px; overflow-wrap: anywhere; }
.workbench-source-counts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.workbench-source-counts b, .workbench-source-counts span { padding: 4px 7px; border: 1px solid #dfe6eb; border-radius: 999px; color: #5f707c !important; background: #fff; font-size: 9px !important; }
.workbench-source-keys { display: grid; }
.workbench-source-key { display: grid; grid-template-columns: 58px minmax(310px, 1.2fr) minmax(290px, 1fr) minmax(410px, 1.3fr); align-items: start; gap: 12px; padding: 10px 13px; border-top: 1px solid #edf1f3; }
.workbench-source-key:first-child { border-top: 0; }
.workbench-source-key > span { color: #7b8994; font-size: 9px; }
.workbench-source-key > div { display: grid; gap: 3px; }
.workbench-source-key > div strong, .workbench-source-key > div small { font-size: 9px; overflow-wrap: anywhere; }
.workbench-source-key > div small { color: #75848f; }
.workbench-source-key-value { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.workbench-source-key-value code { grid-column: 1; }
.workbench-source-key-value .icon-button { grid-column: 2; grid-row: 1; }
.workbench-source-key-value small { grid-column: 1 / -1; }
.workbench-source-issue { gap: 7px !important; }
@media (max-width: 1280px) {
  .workbench-stats { grid-template-columns: repeat(3, 1fr); }
  .workbench-feature-grid { grid-template-columns: repeat(2, 1fr); }
  .workbench-switch-grid { grid-template-columns: repeat(3, 1fr); }
  .workbench-switch-grid > .button { min-height: 60px; }
  .compact-form-grid { grid-template-columns: repeat(2, 1fr); }
  .workbench-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-filter-form .workbench-search-field { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  body:has(.workbench-page) .page-shell { width: min(100% - 20px, 1580px); }
  .workbench-hero { align-items: flex-start; flex-direction: column; gap: 20px; padding: 24px; }
  .workbench-boundary-card { width: 100%; min-width: 0; }
  .workbench-local-nav { top: 62px; overflow-x: auto; }
  .workbench-local-nav a { flex: 0 0 auto; }
  .workbench-two-column { grid-template-columns: 1fr; }
  .workbench-feature-grid, .workbench-switch-grid, .compact-form-grid { grid-template-columns: 1fr; }
  .workbench-inline-fields, .workbench-filter-form, .workbench-source-key { grid-template-columns: 1fr; }
  .workbench-filter-form .workbench-search-field { grid-column: auto; }
  .workbench-form-actions, .workbench-source-card > header { align-items: stretch; flex-direction: column; }
  .workbench-source-counts { justify-content: flex-start; }
  .workbench-section-head { align-items: flex-start; flex-direction: column; }
  .workbench-progress { width: 100%; }
}
