:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #69736f;
  --line: #dce2df;
  --surface: #ffffff;
  --canvas: #f3f6f4;
  --deep: #11201f;
  --accent: #147d73;
  --accent-dark: #0c5f57;
  --warm: #d48b28;
  --danger: #bb3a42;
  --success: #267451;
  --shadow: 0 16px 40px rgba(17, 32, 31, 0.12);
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 34px; line-height: 1.18; }
h2 { margin: 0; font-size: 25px; }
h3 { margin: 0; font-size: 17px; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 1fr) minmax(380px, 520px); background: var(--surface); }
.auth-brand { position: relative; overflow: hidden; display: flex; align-items: center; gap: 28px; padding: 9vw; color: #fff; background: var(--deep); }
.auth-brand::after { content: ""; position: absolute; right: -90px; bottom: -90px; width: 340px; height: 340px; border: 54px solid rgba(255,255,255,.055); border-radius: 50%; }
.auth-logo { width: 80px; height: 80px; border-radius: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.26); }
.auth-brand .eyebrow { color: #72d4c8; }
.auth-subtitle { margin: 12px 0 0; color: #b9c8c4; font-size: 16px; }
.auth-signals { position: absolute; left: 9vw; bottom: 8vh; display: flex; gap: 8px; align-items: end; height: 38px; }
.auth-signals span { display: block; width: 7px; background: #72d4c8; border-radius: 2px 2px 0 0; }
.auth-signals span:nth-child(1) { height: 10px; }.auth-signals span:nth-child(2) { height: 19px; }.auth-signals span:nth-child(3) { height: 31px; }.auth-signals span:nth-child(4) { height: 24px; }.auth-signals span:nth-child(5) { height: 37px; background: var(--warm); }
.auth-panel { align-self: center; width: min(390px, calc(100% - 48px)); margin: 0 auto; padding: 30px; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); background: #fff; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 28px; padding: 3px; background: #edf2ef; border-radius: 6px; }
.segment { min-height: 38px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-weight: 700; }
.segment.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(17,32,31,.08); }
.auth-form { display: grid; gap: 18px; }
label { display: grid; gap: 7px; color: #46514e; font-weight: 700; font-size: 13px; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #cfd8d4; border-radius: 6px; padding: 9px 11px; color: var(--ink); background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20,125,115,.12); }
.button { min-height: 40px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 6px; padding: 8px 15px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.button.primary { color: #fff; background: var(--accent); }.button.primary:hover { background: var(--accent-dark); }
.button.secondary { color: var(--accent-dark); border-color: #a9c8c2; background: #fff; }
.button.ghost { min-height: 36px; color: #d7e3df; border-color: #435653; background: transparent; }
.button.danger { color: var(--danger); border-color: #e4b9bd; background: #fff; }
.button.wide { width: 100%; margin-top: 4px; }
.admin-link { display: block; margin-top: 22px; color: var(--muted); text-align: center; text-decoration: none; font-size: 13px; }
.compact-auth .auth-brand { padding: 7vw; }

.app-shell { min-height: 100vh; display: grid; grid-template: 68px 1fr / 190px 1fr; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; color: #fff; background: var(--deep); border-bottom: 1px solid #263735; }
.brand-inline { display: flex; align-items: center; gap: 11px; }.brand-icon { width: 36px; height: 36px; border-radius: 6px; }.brand-inline div { display: grid; gap: 2px; }.brand-inline span { color: #9eb1ac; font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }.license-badge { color: #cbd8d4; font-size: 12px; }
.icon-button { width: 38px; height: 38px; border: 1px solid #d6dfdc; border-radius: 6px; color: inherit; background: transparent; font-size: 21px; line-height: 1; }
.topbar .icon-button { border-color: #435653; color: #d7e3df; }
.sidebar { padding: 18px 12px; border-right: 1px solid var(--line); background: #fff; }
.nav-button { width: 100%; min-height: 46px; display: grid; grid-template-columns: 30px 1fr; align-items: center; border: 0; border-radius: 6px; padding: 0 11px; color: var(--muted); background: transparent; text-align: left; }
.nav-button span { font-size: 18px; }.nav-button b { font-size: 13px; }.nav-button:hover { background: #f0f4f2; }.nav-button.active { color: var(--accent-dark); background: #e6f2ef; }
.workspace { min-width: 0; padding: 34px clamp(20px, 4vw, 58px) 56px; overflow: auto; }
.page { display: none; max-width: 1180px; margin: 0 auto; }.page.active { display: block; }
.page-heading { min-height: 54px; display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; }
.page-meta { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.heading-actions { display: flex; align-items: center; gap: 12px; }.dirty-state { color: var(--warm); font-weight: 700; font-size: 12px; }
.summary-band { display: flex; gap: 28px; margin-bottom: 16px; padding: 14px 18px; border: 1px solid var(--line); background: #fff; }
.summary-band span { color: var(--muted); }.summary-band strong { margin-left: 5px; color: var(--ink); }
.account-list { display: grid; gap: 10px; }
.account-row { min-height: 76px; display: grid; grid-template-columns: minmax(170px, 1fr) minmax(140px, .8fr) auto; align-items: center; gap: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.account-main { display: flex; align-items: center; gap: 12px; min-width: 0; }.account-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; color: #fff; background: #35504c; font-weight: 900; }
.account-main div, .account-state { display: grid; gap: 4px; }.account-main small, .account-state small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-actions { display: flex; gap: 7px; }.small-button { min-height: 34px; border: 1px solid #ccd7d3; border-radius: 5px; padding: 5px 10px; color: #3d4b48; background: #fff; font-weight: 700; }
.small-button.danger { color: var(--danger); }.status-pill { width: fit-content; display: inline-flex; align-items: center; gap: 6px; color: #5a6561; font-weight: 800; font-size: 12px; }.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8d9794; }.status-pill.online::before { background: var(--success); }.status-pill.waiting::before { background: var(--warm); }.status-pill.failed::before { background: var(--danger); }
.empty-state { padding: 60px 20px; border: 1px dashed #cbd5d1; color: var(--muted); text-align: center; background: rgba(255,255,255,.55); }

.settings-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 30px; align-items: start; }
.mode-catalog { margin: -6px 0 22px; }
.mode-catalog-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.mode-catalog-heading h3 { font-size: 14px; }
.mode-catalog-heading span { color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.game-mode-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }
.game-mode-list li { min-width: 0; border-bottom: 1px solid var(--line); color: #35423e; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.game-mode-list li:nth-last-child(-n + 2) { border-bottom: 0; }
.game-mode-option { min-height: 42px; display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 6px; padding: 7px 4px; cursor: pointer; }
.game-mode-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.game-mode-list li:has(input:checked) { color: var(--accent-dark); background: #e7f2ef; }
.group-scope-panel { margin: 0 0 22px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); padding-top: 14px; }
.group-scope-panel > h3 { font-size: 14px; }
.group-scope-panel .setting-row { border-bottom: 0; }
.group-scope-panel textarea { width: 100%; min-height: 82px; }
.settings-sections { position: sticky; top: 10px; display: grid; gap: 4px; }.section-button { min-height: 39px; border: 0; border-radius: 5px; padding: 8px 12px; color: var(--muted); background: transparent; text-align: left; font-weight: 700; }.section-button.active { color: var(--accent-dark); background: #e4f0ed; }
.settings-form { min-width: 0; border-top: 1px solid var(--line); }.settings-group { display: none; }.settings-group.active { display: block; }.settings-group h3 { padding: 20px 0 14px; }
.setting-row { min-height: 66px; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(240px, 320px); align-items: center; gap: 30px; border-bottom: 1px solid var(--line); padding: 10px 0; }.setting-row > span { font-weight: 700; }
.setting-row textarea { min-height: 74px; resize: vertical; }.setting-row input[type="checkbox"] { width: 44px; min-height: 24px; justify-self: end; accent-color: var(--accent); }
.number-field, .pair-number-field { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; }
.number-field input { width: 92px; text-align: center; }
.number-field small, .pair-number-field small { color: var(--muted); font-size: 12px; font-weight: 800; }
.pair-number-field input { width: 62px; min-height: 38px; padding: 6px; text-align: center; }
.setting-toggle { appearance: none; position: relative; width: 46px !important; height: 26px; min-height: 26px !important; border: 0; border-radius: 13px; padding: 0; background: #c8d0cd; transition: background .18s ease; }
.setting-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .18s ease; }
.setting-toggle:checked { background: var(--accent); }
.setting-toggle:checked::after { transform: translateX(20px); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }.metric { min-height: 112px; padding: 18px; border-left: 4px solid var(--accent); background: #fff; box-shadow: 0 5px 18px rgba(17,32,31,.06); }.metric.warm { border-color: var(--warm); }.metric.red { border-color: var(--danger); }.metric span { display: block; color: var(--muted); font-size: 12px; }.metric strong { display: block; margin-top: 12px; font-size: 23px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }.flat-section { border-top: 2px solid var(--ink); padding-top: 16px; }.flat-section h3 { margin-bottom: 16px; }.detail-list { margin: 0; }.detail-list div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }.detail-list dt { color: var(--muted); }.detail-list dd { margin: 0; font-weight: 700; text-align: right; }.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 9px; }

.dialog { width: min(430px, calc(100vw - 28px)); border: 0; border-radius: 8px; padding: 22px; box-shadow: 0 24px 80px rgba(0,0,0,.28); }.dialog::backdrop { background: rgba(10,20,19,.62); }.dialog-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }.dialog .icon-button { color: var(--muted); }.qr-canvas { width: min(310px, 100%); aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto; border: 1px solid var(--line); background: #fff; }.qr-canvas img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }.qr-status { min-height: 20px; margin: 14px 0; color: var(--muted); text-align: center; }.dialog-actions { display: flex; justify-content: center; gap: 10px; }.spinner { width: 30px; height: 30px; border: 3px solid #dbe5e1; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 100; right: 18px; top: 18px; max-width: min(390px, calc(100vw - 36px)); transform: translateY(-20px); opacity: 0; pointer-events: none; border-radius: 6px; padding: 12px 15px; color: #fff; background: var(--deep); box-shadow: var(--shadow); transition: .2s ease; }.toast.show { transform: translateY(0); opacity: 1; }.toast.error { background: var(--danger); }
.log-list { border-top: 1px solid var(--line); background: #fff; }
.log-row { display: grid; grid-template-columns: 64px 62px minmax(0, 1fr); gap: 8px; align-items: start; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.log-time { color: var(--muted); font: 11px Consolas, monospace; }
.log-level { width: fit-content; border-radius: 4px; padding: 2px 6px; color: #48605b; background: #e8efec; font-size: 11px; font-weight: 800; }
.log-level.success { color: #1d6645; background: #dff1e8; }
.log-level.warn { color: #8d5c16; background: #f8ecd6; }
.log-level.error { color: #9b2831; background: #f8e0e2; }
.log-content { min-width: 0; display: grid; gap: 4px; }
.log-content strong { font-size: 13px; overflow-wrap: anywhere; }
.log-content small { color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.account-avatar.has-image { overflow: hidden; background: #fff; }
.account-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.account-mode { border-color: #cfc5ec; color: #6653a1; background: #f4f0ff; }
.account-mode.active { border-color: #9c87d8; color: #fff; background: #7359b3; }
.account-mode.instant { border-color: #edc4ae; color: #a6532d; background: #fff2eb; }
.account-mode.instant.active { border-color: #d77748; color: #fff; background: #c55d2f; }
.account-claim { color: var(--accent); font-size: 12px; font-weight: 700; }

.admin-shell { min-height: 100vh; display: grid; grid-template-rows: 68px minmax(0, 1fr); }
.admin-shell > .topbar { grid-row: 1; }
.admin-layout { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 204px minmax(0, 1fr); }
.admin-sidebar { min-width: 0; border-right: 1px solid var(--line); background: #fff; }
.admin-sidebar nav { position: sticky; top: 0; display: grid; gap: 5px; padding: 18px 12px; }
.admin-nav-button { width: 100%; min-height: 48px; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 7px; border: 0; border-radius: 6px; padding: 5px 10px; color: var(--muted); background: transparent; text-align: left; }
.admin-nav-button span { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #d7dfdc; border-radius: 5px; color: #52615d; background: #f7f9f8; font-size: 12px; font-weight: 900; }
.admin-nav-button b { min-width: 0; font-size: 13px; }
.admin-nav-button:hover { color: var(--ink); background: #f0f4f2; }
.admin-nav-button.active { color: var(--accent-dark); background: #e6f2ef; }
.admin-nav-button.active span { border-color: #9fc9c2; color: #fff; background: var(--accent); }
.admin-workspace { min-width: 0; width: 100%; padding: 34px clamp(20px, 4vw, 58px) 60px; overflow: hidden; }
.admin-page { display: none; max-width: 1320px; margin: 0 auto; }
.admin-page.active { display: block; }
.admin-section { margin-top: 28px; border-top: 2px solid var(--ink); padding-top: 16px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 15px; }
.section-heading select { width: auto; min-width: 135px; }
.section-note { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.filter-chip { width: fit-content; display: inline-flex; align-items: center; gap: 6px; margin-top: 7px; border-radius: 4px; padding: 4px 7px; color: var(--accent-dark); background: #e5f1ee; font-size: 12px; font-weight: 800; }
.filter-chip button { width: 20px; height: 20px; border: 0; padding: 0; color: var(--accent-dark); background: transparent; font-size: 16px; line-height: 1; }
.section-tools, .search-form { display: flex; align-items: center; gap: 8px; }
.search-form input { width: min(280px, 36vw); min-height: 36px; }
.bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: -3px 0 12px; padding: 10px 12px; border: 1px solid var(--line); background: #f8faf9; }
.bulk-actions label { display: flex; flex-direction: row; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
.bulk-actions input, .selection-cell input { width: 17px; min-height: 17px; accent-color: var(--accent); }
.bulk-actions span { margin-right: auto; color: var(--muted); font-size: 12px; }
.small-button:disabled { cursor: not-allowed; opacity: .45; }
.generator-form { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; align-items: end; gap: 12px; padding: 18px; border: 1px solid var(--line); background: #fff; }
.generator-form .wide-field { grid-column: span 2; }
.card-type-field { grid-column: 1 / -1; min-width: 0; margin: 0; border: 0; padding: 4px 0 0; }
.card-type-field legend { margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.card-type-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.card-type-options label { position: relative; cursor: pointer; }
.card-type-options input { position: absolute; opacity: 0; pointer-events: none; }
.card-type-options span { min-height: 58px; display: grid; place-content: center; gap: 3px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #f7f9f8; text-align: center; }
.card-type-options small { color: var(--muted); font-size: 11px; }
.card-type-options input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent-dark); background: #e6f2ef; }
.card-type-options input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.agent-form { margin-bottom: 14px; }
.overview-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.overview-links button { min-height: 88px; display: grid; align-content: center; gap: 7px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; padding: 15px 17px; color: var(--ink); background: #fff; text-align: left; }
.overview-links button:hover { border-color: #a9c8c2; background: #f8fbfa; }
.overview-links strong { font-size: 15px; }.overview-links span { color: var(--muted); font-size: 12px; }
.daily-filter { display: grid; grid-template-columns: minmax(150px, 230px) minmax(120px, 160px) auto minmax(230px, 1fr); align-items: end; gap: 12px; margin-bottom: 22px; padding: 16px; border: 1px solid var(--line); background: #fff; }
.daily-filter p { align-self: center; margin: 0; color: var(--muted); font-size: 12px; }
.activation-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.activation-issuer { display: flex; align-items: center; gap: 10px; }
.activation-toggle { white-space: nowrap; color: var(--accent-dark); }
.activation-detail-row > td { padding: 16px; background: #edf5f2; }
.activation-agent { min-width: 0; margin-bottom: 18px; padding-left: 12px; border-left: 3px solid #a9c8c2; }
.activation-agent:last-child { margin-bottom: 0; }
.activation-agent h4 { margin: 0 0 10px; font-size: 14px; }
.activation-agent h4 span { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.activation-depth-1 { margin-left: 16px; }.activation-depth-2 { margin-left: 32px; }.activation-depth-3 { margin-left: 48px; }
#refreshQqStatusButton[aria-busy="true"] { cursor: progress; opacity: .7; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
.compact-table table { min-width: 680px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #f5f7f6; font-size: 12px; }
td { font-size: 13px; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.remark-cell { max-width: 220px; overflow-wrap: anywhere; }
.table-actions, .agent-actions, .quota-editor { display: flex; gap: 7px; align-items: center; }
.agent-actions { flex-wrap: wrap; min-width: 260px; }
.table-actions input { width: 75px; min-height: 34px; }
.quota-editor input { width: 92px; min-height: 34px; }
.muted-text { color: var(--muted); font-size: 12px; }
.card-key-cell { min-width: 260px; display: flex; align-items: center; gap: 8px; }
.card-key-cell code, .card-key { white-space: nowrap; color: var(--ink); font: 600 12px Consolas, "Courier New", monospace; }
.permission-badges { display: flex; flex-wrap: wrap; gap: 5px; min-width: 112px; }
.permission-badge { display: inline-flex; border-radius: 4px; padding: 3px 6px; color: var(--accent-dark); background: #e5f1ee; font-size: 11px; font-weight: 800; }
.permission-option { grid-template-columns: 22px minmax(0, 1fr); align-items: start; gap: 10px; border: 1px solid var(--line); border-radius: 6px; padding: 12px; cursor: pointer; }
.permission-option input { width: 18px; min-height: 18px; margin-top: 2px; accent-color: var(--accent); }
.permission-option span { display: grid; gap: 4px; }.permission-option small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.permission-fieldset { display: grid; gap: 8px; margin: 0; border: 0; padding: 0; }
.permission-fieldset legend { margin-bottom: 2px; color: var(--muted); font-size: 12px; font-weight: 800; }
.selection-cell { width: 58px; text-align: center; }
.state-label { font-weight: 800; }
.state-label.unused { color: var(--success); }
.state-label.revoked { color: var(--danger); }
.keys-dialog textarea { min-height: 260px; resize: vertical; font-family: Consolas, monospace; line-height: 1.7; }
.compact-dialog { max-width: 390px; }

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; background: var(--canvas); }.auth-brand { min-height: 220px; padding: 34px 24px; }.auth-signals { display: none; }.auth-panel { margin: -28px auto 36px; position: relative; z-index: 2; }
  .app-shell { grid-template: 58px 58px 1fr / 1fr; }.topbar { grid-row: 1; padding: 0 12px; }.sidebar { grid-row: 2; display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px; border-right: 0; border-bottom: 1px solid var(--line); }.nav-button { grid-template-columns: 1fr; place-items: center; gap: 1px; min-height: 46px; padding: 3px; text-align: center; }.nav-button span { font-size: 16px; }.nav-button b { font-size: 11px; }
  .workspace { grid-row: 3; padding: 22px 14px 40px; }.page-heading { align-items: end; }.account-row { grid-template-columns: 1fr; gap: 10px; }.account-actions { flex-wrap: wrap; }.summary-band { overflow-x: auto; }.settings-shell { grid-template-columns: 1fr; gap: 14px; }.settings-sections { position: static; display: flex; overflow-x: auto; padding-bottom: 4px; }.section-button { white-space: nowrap; }.setting-row { grid-template-columns: 1fr; gap: 8px; }.setting-row input[type="checkbox"] { justify-self: start; }.metrics { grid-template-columns: 1fr 1fr; }.detail-grid { grid-template-columns: 1fr; }.license-badge { display: none; }
  .admin-layout { grid-template-columns: 86px minmax(0, 1fr); }
  .admin-sidebar nav { padding: 10px 7px; }
  .admin-nav-button { min-height: 58px; grid-template-columns: 1fr; place-items: center; gap: 3px; padding: 5px 2px; text-align: center; }
  .admin-nav-button span { width: 25px; height: 25px; }.admin-nav-button b { font-size: 10.5px; }
  .admin-workspace { width: 100%; padding: 24px 12px 42px; }
  .admin-workspace .page-heading, .section-heading { align-items: stretch; flex-direction: column; }
  .section-tools { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .bulk-actions { align-items: stretch; }
  .search-form { min-width: 0; }
  .search-form input { width: 100%; min-width: 0; }
  .generator-form { grid-template-columns: 1fr 1fr; padding: 14px; }
  .generator-form .wide-field { grid-column: 1 / -1; }
  .generator-form .button { width: 100%; }
  .admin-metrics { grid-template-columns: 1fr 1fr; }
  .overview-links { grid-template-columns: 1fr; }
  .daily-filter { grid-template-columns: 1fr auto; }
  .daily-filter p { grid-column: 1 / -1; }
  .activation-metrics { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .generator-form { grid-template-columns: 1fr; }
  .generator-form .wide-field { grid-column: auto; }
  .section-tools { grid-template-columns: 1fr; }
  .bulk-actions .small-button { flex: 1 1 calc(50% - 5px); }
  .section-heading select { width: 100%; }
  .admin-metrics { grid-template-columns: 1fr 1fr; }
  .daily-filter { grid-template-columns: 1fr; }
  .daily-filter p { grid-column: auto; }
  .activation-metrics { grid-template-columns: 1fr; }
  .card-type-options { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  h1 { font-size: 28px; }.auth-logo { width: 60px; height: 60px; }.auth-panel { width: calc(100% - 24px); padding: 22px; }.page-heading { align-items: stretch; flex-direction: column; }.page-heading .button { width: 100%; }.heading-actions { width: 100%; justify-content: space-between; }.metrics { grid-template-columns: 1fr; }.inline-form, .generator-form { grid-template-columns: 1fr; }.brand-inline span { display: none; }
}

/* The user console is deliberately phone-sized on every screen. */
.protocol-dialog { width: min(400px, calc(100vw - 28px)); box-sizing: border-box; }
.protocol-options { display: grid; gap: 12px; margin: 22px 0 16px; }
.protocol-option { display: grid; grid-template-columns: 44px minmax(0, 1fr) 18px; align-items: center; gap: 12px; width: 100%; min-height: 82px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f6faf9; text-align: left; color: var(--ink); cursor: pointer; }
.protocol-option:hover:not(:disabled), .protocol-option:focus-visible { border-color: var(--accent); background: #edf6f3; outline: 2px solid var(--accent); outline-offset: 2px; }
.protocol-option:disabled { opacity: .5; cursor: default; }
.protocol-option strong { display: block; font-size: 15px; line-height: 1.4; }
.protocol-option small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.protocol-symbol { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: #167d73; color: white; font-weight: 700; font-size: 21px; }
.protocol-symbol.windows { background: #277bb0; }
.protocol-arrow { color: var(--muted); font-size: 26px; }
.protocol-badge { display: inline-block; padding: 2px 7px; margin-top: 5px; border-radius: 5px; background: #e7f2ef; color: #17685e; font-size: 10px; }
.protocol-choice-error { color: var(--danger, #a83c32); }

#authView.auth-layout {
  width: min(100%, 480px);
  min-height: 100svh;
  grid-template-columns: 1fr;
  margin: 0 auto;
  background: var(--canvas);
  box-shadow: 0 0 40px rgba(17, 32, 31, .12);
}
#authView .auth-brand { min-height: 220px; padding: 34px 24px; }
#authView .auth-signals { display: none; }
#authView .auth-panel { position: relative; z-index: 2; margin: -28px auto 36px; }

.app-shell {
  width: min(100%, 480px);
  min-height: 100svh;
  grid-template: 60px minmax(0, 1fr) 62px / 1fr;
  margin: 0 auto;
  background: var(--canvas);
  box-shadow: 0 0 40px rgba(17, 32, 31, .14);
}
.app-shell .topbar { grid-column: 1; grid-row: 1; padding: 0 12px; }
.app-shell .brand-inline span, .app-shell .license-badge { display: none; }
.app-shell .sidebar {
  position: sticky;
  z-index: 20;
  bottom: 0;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px;
  border-top: 1px solid var(--line);
  border-right: 0;
  background: rgba(255, 255, 255, .97);
}
.app-shell .nav-button {
  min-height: 48px;
  grid-template-columns: 1fr;
  place-items: center;
  gap: 1px;
  padding: 3px;
  text-align: center;
}
.app-shell .nav-button span { font-size: 17px; }
.app-shell .nav-button b { font-size: 11px; }
.app-shell .workspace { grid-row: 2; padding: 20px 14px 34px; overflow: visible; }
.app-shell .page-heading { min-height: 0; align-items: stretch; flex-direction: column; margin-bottom: 18px; }
.app-shell .page-heading .button { width: 100%; }
.app-shell .heading-actions { width: 100%; justify-content: space-between; }
.app-shell .summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 12px 6px;
  overflow: hidden;
  text-align: center;
}
.app-shell .summary-band span { display: grid; gap: 3px; font-size: 11px; }
.app-shell .summary-band strong { margin: 0; font-size: 15px; }
.app-shell .account-row { grid-template-columns: minmax(0, 1fr); gap: 11px; padding: 14px; }
.app-shell .account-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.app-shell .small-button { width: 100%; }
.app-shell .settings-shell { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.app-shell .settings-sections { position: static; display: flex; gap: 4px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
.app-shell .section-button { flex: 0 0 auto; white-space: nowrap; }
.app-shell .setting-row { min-height: 54px; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; }
.app-shell .setting-row > span:first-child { min-width: 0; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.app-shell .setting-row input[type="checkbox"] { justify-self: end; }
.app-shell .setting-row.setting-text, .app-shell .setting-row.setting-list { grid-template-columns: minmax(0, 1fr); }
.app-shell .setting-row.setting-text input, .app-shell .setting-row.setting-text select,
.app-shell .setting-row.setting-list textarea { width: 100%; }
.app-shell .number-field input { width: 78px; }
.app-shell .pair-number-field { gap: 5px; }
.app-shell .pair-number-field input { width: 54px; }
.app-shell .metrics { grid-template-columns: 1fr 1fr; }
.app-shell .detail-grid { grid-template-columns: 1fr; gap: 26px; }
.app-shell .log-row { grid-template-columns: 52px 52px minmax(0, 1fr); padding: 11px 8px; }

.clipboard-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
.user-password-display { display: inline-block; max-width: 20rem; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }

@media (min-width: 481px) {
  body:has(.app-shell:not(.hidden)), body:has(#authView:not(.hidden)) { background: #dfe5e2; }
}
