:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --text: #172126;
  --muted: #64727a;
  --line: #dce3e7;
  --line-strong: #c6d0d5;
  --primary: #087f72;
  --primary-dark: #06675e;
  --primary-soft: #e2f4f1;
  --blue: #2867b2;
  --blue-soft: #e8f0fa;
  --danger: #c73843;
  --danger-soft: #fbeaec;
  --warning: #a16207;
  --warning-soft: #fff4d6;
  --success: #247a46;
  --success-soft: #e8f5ed;
  --sidebar: #182126;
  --sidebar-muted: #9dabb2;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(20, 31, 36, .08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, "Segoe UI", "Microsoft YaHei", sans-serif; letter-spacing: 0; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 232px; flex-direction: column; background: var(--sidebar); color: white; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 72px; padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; flex: 0 0 auto; border-radius: 6px; background: #18a393; color: white; font-weight: 800; }
.brand-mark.large { width: 46px; height: 46px; font-size: 17px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--sidebar-muted); font-size: 11px; }
.sidebar nav { display: grid; gap: 4px; padding: 16px 10px; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 8px 11px; border-radius: 5px; color: var(--sidebar-muted); font-weight: 600; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: white; text-decoration: none; }
.sidebar nav a.active { background: #26353a; color: #71d4c7; }
.sidebar-footer { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 9px; margin-top: auto; padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #34474e; color: #a9eee5; font-weight: 700; }
.identity strong, .identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity small { color: var(--sidebar-muted); font-size: 11px; }
.sidebar .icon-button { color: var(--sidebar-muted); }

.main-shell { min-height: 100vh; margin-left: 232px; }
.topbar { display: flex; min-height: 72px; align-items: center; gap: 16px; padding: 13px 26px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h1 { margin: 0; font-size: 20px; line-height: 1.25; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; margin-left: auto; }
.content { padding: 22px 26px 36px; }
.mobile-menu { display: none !important; }

.button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 7px; padding: 7px 13px; border: 1px solid transparent; border-radius: 5px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.button:hover { text-decoration: none; }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { border-color: var(--line-strong); background: var(--surface); color: var(--text); }
.button.success { border-color: #add5ba; background: var(--success-soft); color: var(--success); }
.button.warning { border-color: #efd592; background: var(--warning-soft); color: var(--warning); }
.button.danger { border-color: #efb7bc; background: var(--danger-soft); color: var(--danger); }
.button.full { width: 100%; }
.button:disabled { cursor: default; opacity: .5; }
.icon-button { display: inline-grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--surface-muted); color: var(--text); }
.danger-icon { color: var(--danger); }

.alert { display: flex; align-items: center; gap: 8px; margin: 18px 26px 0; padding: 10px 13px; border: 1px solid #b7dbc7; border-radius: var(--radius); background: var(--success-soft); color: var(--success); }
.alert.error { border-color: #efb7bc; background: var(--danger-soft); color: var(--danger); }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(135px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats-grid article { position: relative; min-height: 112px; padding: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stats-grid span { color: var(--muted); font-size: 12px; }
.stats-grid strong { display: block; margin-top: 8px; font-size: 26px; line-height: 1; }
.stats-grid svg { position: absolute; right: 15px; bottom: 15px; width: 23px; height: 23px; color: var(--primary); }
.security-policies { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.security-policies small { display: block; max-width: calc(100% - 28px); margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; }
.detail-layout { align-items: start; margin-bottom: 18px; }
.activation-note { margin: 0 0 18px; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.padded { padding: 18px; }
.table-panel { overflow: hidden; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 40px; padding: 9px 13px; background: var(--surface-muted); color: var(--muted); font-size: 11px; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { min-height: 48px; padding: 11px 13px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #fbfcfc; }
.empty { padding: 40px 16px !important; color: var(--muted); text-align: center; }
.block { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.device-search-match { color: var(--primary-dark); font-weight: 650; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { display: inline-block; max-width: 260px; overflow: hidden; color: #3d515a; font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }
.machine-key { max-width: 230px; }
.module-summary { min-width: 230px; color: #45545b; }
.module-summary span:not(.muted-copy):not(:last-child)::after { margin: 0 6px; color: var(--line-strong); content: "·"; }
.notice-preview { max-width: 460px; overflow: hidden; color: #45545b; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 11px; font-weight: 700; }
.badge.active, .badge.unused { background: var(--success-soft); color: var(--success); }
.badge.frozen { background: var(--warning-soft); color: var(--warning); }
.badge.revoked { background: var(--danger-soft); color: var(--danger); }
.badge.redeemed { background: var(--blue-soft); color: var(--blue); }

.activity-list { margin: 0; padding: 4px 17px 12px; list-style: none; }
.activity-list li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity-list li:last-child { border-bottom: 0; }
.activity-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.activity-icon svg { width: 14px; height: 14px; }
.activity-list strong, .activity-list small { display: block; }
.activity-list small { color: var(--muted); font-size: 11px; }

.filters { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.filters > select { width: auto; min-width: 160px; flex: 0 0 auto; }
.search { position: relative; min-width: 280px; flex: 1; max-width: 520px; }
.search svg { position: absolute; top: 9px; left: 10px; width: 17px; color: var(--muted); }
.search input { padding-left: 34px; }
input, select, textarea { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 5px; outline: none; background: white; color: var(--text); }
textarea { resize: vertical; }
[hidden] { display: none !important; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(8,127,114,.12); }
label { display: grid; gap: 5px; color: #45545b; font-size: 12px; font-weight: 650; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid > label:not(.toggle-row) { align-self: start; align-content: start; height: max-content; grid-auto-rows: max-content; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 14px; }
.field-pair > label { display: flex; align-self: start; flex-direction: column; gap: 5px; height: auto; }
.field-pair > label > input { flex: 0 0 36px; height: 36px; }
.field-pair > label > small { line-height: 1.5; }
.account-picker { display: grid; gap: 5px; }
.account-picker > label { display: block; margin: 0; }
.account-picker > small { color: var(--muted); font-size: 11px; font-weight: 400; }
.searchable-select { position: relative; }
.searchable-select-trigger { display: flex; width: 100%; min-height: 36px; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; color: var(--text); text-align: left; }
.searchable-select-trigger:focus, .searchable-select.open .searchable-select-trigger { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(8,127,114,.12); outline: none; }
.searchable-select-trigger span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchable-select-trigger svg { width: 16px; height: 16px; flex: 0 0 auto; transition: transform .15s ease; }
.searchable-select.open .searchable-select-trigger svg { transform: rotate(180deg); }
.searchable-select-panel { position: absolute; z-index: 40; top: calc(100% + 4px); right: 0; left: 0; padding: 7px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; box-shadow: 0 10px 28px rgba(20,31,36,.16); }
.searchable-select-search { position: relative; margin-bottom: 6px; }
.searchable-select-search svg { position: absolute; top: 9px; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.searchable-select-search input { padding-left: 33px; }
.searchable-select-options { max-height: 230px; overflow-y: auto; }
.searchable-select-option { display: block; width: 100%; min-height: 34px; padding: 7px 9px; border: 0; border-radius: 4px; background: transparent; color: var(--text); text-align: left; }
.searchable-select-option:hover, .searchable-select-option:focus { background: var(--surface-muted); outline: none; }
.searchable-select-option.selected { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.searchable-select-empty { padding: 12px 9px; color: var(--muted); text-align: center; }
.modal-content .form-grid > label { align-content: start; }
.option-group { display: flex; gap: 18px; margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 5px; }
.option-group legend { padding: 0 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.option-group label { display: flex; grid-auto-flow: column; align-items: center; gap: 7px; }
.option-group input { width: 16px; min-height: 16px; margin: 0; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; }
.stack-form { display: grid; gap: 15px; }
.row-actions { display: flex; align-items: center; gap: 3px; }
.status-actions { display: grid; gap: 10px; }
.status-actions form { display: flex; gap: 8px; }
.status-actions input { flex: 1; }

.account-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.account-header h2 { margin: 7px 0 0; font-size: 22px; }
.account-header p { margin: 2px 0 0; color: var(--muted); }
.account-header dl { display: flex; gap: 34px; margin: 0; }
.account-header dl.summary-wide { width: 100%; justify-content: space-between; }
.account-header dl div { min-width: 100px; }
.account-header dt { color: var(--muted); font-size: 11px; }
.account-header dd { margin: 3px 0 0; font-weight: 700; }
.account-header .account-summary-grid > div { flex: 1 1 120px; }
.account-header .account-summary-grid .account-name-summary { flex: 2 1 260px; min-width: 220px; }
.account-header .account-name-summary dd { overflow-wrap: anywhere; font-size: 22px; }

.modal { width: min(620px, calc(100% - 28px)); padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); box-shadow: 0 18px 55px rgba(15,25,30,.25); }
.modal.modal-compact { width: min(540px, calc(100% - 28px)); max-width: 540px; }
.modal::backdrop { background: rgba(13, 24, 29, .55); }
.modal-content { display: grid; max-height: calc(100vh - 40px); gap: 18px; overflow-y: auto; padding: 18px; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.modal-heading h2 { margin: 0; font-size: 17px; }
.modal-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.machine-key-input { min-height: 76px; }
.device-context { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); }
.device-context span, .device-context small { color: var(--muted); font-size: 12px; }
.device-context small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-warning { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-left: 3px solid var(--warning); background: var(--warning-soft); color: #684b0b; font-size: 12px; line-height: 1.55; }
.modal-warning svg { width: 16px; min-width: 16px; margin-top: 1px; }
.orphan-bindings-table th:last-child, .orphan-bindings-table td:last-child { width: 104px; text-align: right; }
.orphan-bindings-table td { vertical-align: middle; }
.danger-zone { padding: 10px 12px; border: 1px solid #f2c4c7; border-radius: 5px; background: var(--danger-soft); }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 700; }
.danger-zone form { margin-top: 12px; }
.danger-zone p { margin: 0; color: #7d3338; font-size: 12px; line-height: 1.55; }
.recovery-panel .panel-heading { border-bottom: 1px solid var(--line); }
.recovery-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button-count { display: inline-grid; min-width: 19px; height: 19px; place-items: center; margin-left: 3px; padding: 0 5px; border-radius: 9px; background: rgba(255,255,255,.2); font-size: 11px; }
.pending-count, .badge.pending { background: var(--warning-soft); color: var(--warning); }
.badge.approved { background: var(--success-soft); color: var(--success); }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.compact-button { min-height: 30px; padding: 4px 10px; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: 12px; }
.detail-list dd { min-width: 0; margin: 0; font-weight: 600; }
.break-all { max-width: none; overflow-wrap: anywhere; white-space: normal; }
.rebind-decision-grid { align-items: start; }
.single-column { grid-template-columns: 1fr; }
.empty-state { display: grid; justify-items: center; gap: 6px; padding: 28px; color: var(--muted); text-align: center; }
.empty-state svg { width: 24px; color: var(--success); }
.empty-state strong { color: var(--text); }

.issued-panel { overflow: hidden; }
.issued-codes { width: calc(100% - 34px); min-height: 420px; margin: 17px; padding: 15px; background: #10181c; color: #d7f5ef; font-family: "Cascadia Mono", Consolas, monospace; line-height: 1.8; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-section { overflow: hidden; }
.settings-list { margin: 0; padding: 8px 17px 16px; }
.settings-list div { display: grid; grid-template-columns: 120px 1fr; padding: 10px 0; border-bottom: 1px solid var(--line); }
.settings-list dt { color: var(--muted); }
.settings-list dd { margin: 0; font-family: "Cascadia Mono", Consolas, monospace; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.status-dot::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.status-dot.ok { color: var(--success); }
.public-key { min-height: 160px; margin: 17px; width: calc(100% - 34px); font-family: "Cascadia Mono", Consolas, monospace; font-size: 11px; }
.settings-section > .button { margin: 0 17px 17px; }
details summary { cursor: pointer; color: var(--primary-dark); }
details pre { max-width: 420px; overflow: auto; padding: 8px; background: var(--surface-muted); font-size: 11px; white-space: pre-wrap; }
.device-history > summary { list-style-position: inside; }
.device-history > summary::marker { color: var(--primary); }
.history-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }

.auth-body { background: #eef2f3; }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-panel { width: min(420px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 12px 34px rgba(24,33,38,.1); }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.auth-brand h1 { margin: 0; font-size: 19px; }
.auth-brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.auth-panel .alert { margin: 0 0 17px; }
.auth-panel footer { margin-top: 22px; color: var(--muted); font-size: 11px; text-align: center; }
.error-state { padding: 90px 20px; text-align: center; }
.error-state span { color: var(--line-strong); font-size: 72px; font-weight: 800; }
.error-state h2 { margin: 0 0 20px; }

.setup-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 60px; }
.setup-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.setup-header h1 { margin: 1px 0 2px; font-size: 26px; }
.setup-header p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.setup-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; gap: 20px; }
.setup-checks { position: sticky; top: 20px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.setup-checks h2 { margin: 0 0 12px; font-size: 14px; }
.check-row { display: flex; align-items: flex-start; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.check-row svg { flex: 0 0 auto; color: var(--success); }
.check-row strong, .check-row small { display: block; }
.check-row small { overflow-wrap: anywhere; color: var(--muted); font-size: 10px; }
.setup-note { margin-top: 14px; padding: 12px; border-left: 3px solid var(--primary); background: var(--primary-soft); }
.setup-note p { margin: 3px 0 0; color: #38544f; font-size: 11px; }
.setup-form { overflow: hidden; }
.setup-form > section { padding: 19px; border-bottom: 1px solid var(--line); }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title > span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; }
.section-title h2 { margin: 0; font-size: 15px; }
.section-title p { margin: 1px 0 0; color: var(--muted); font-size: 11px; }
.check-label { display: flex; grid-auto-flow: column; grid-template-columns: 18px 1fr; align-items: center; justify-content: start; }
.check-label input { width: 16px; min-height: 16px; margin: 0; }
.setup-submit { width: calc(100% - 38px); margin: 19px; }
.setup-alert { margin: 0 0 18px; }
.setup-complete { width: min(520px, 100%); text-align: center; }
.completion-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 12px; place-items: center; border-radius: 50%; background: var(--success-soft); color: var(--success); }
.completion-icon svg { width: 28px; height: 28px; }
.setup-complete h1 { margin: 0 0 5px; }
.setup-complete > p { margin: 0 0 18px; color: var(--muted); }
.credential-list { margin: 0 0 18px; text-align: left; }
.credential-list div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.credential-list dt { color: var(--muted); }
.credential-list dd { margin: 0; overflow-wrap: anywhere; }
.product-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.product-panel { overflow: hidden; }
.policy-switches { display: grid; gap: 7px; }
.toggle-row { display: grid; grid-template-columns: 18px 1fr; align-items: start; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); }
.toggle-row input { width: 16px; min-height: 16px; margin: 2px 0 0; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { color: var(--muted); font-size: 10px; font-weight: 400; }
.diagnostic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.diagnostic-item { display: flex; min-height: 72px; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid #b7dbc7; border-radius: var(--radius); background: var(--success-soft); }
.diagnostic-item.failed { border-color: #efb7bc; background: var(--danger-soft); }
.diagnostic-item.warning { border-color: #e1bc62; background: #fff9e8; }
.diagnostic-item.critical { border-color: #e18787; background: #fff0f0; }
.diagnostic-item svg { flex: 0 0 auto; color: var(--success); }
.diagnostic-item.failed svg { color: var(--danger); }
.diagnostic-item.warning svg { color: #9a6800; }
.diagnostic-item.critical svg { color: #b3212b; }
.diagnostic-item strong, .diagnostic-item small { display: block; }
.diagnostic-item small { overflow-wrap: anywhere; color: var(--muted); font-size: 10px; }
.maintenance-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, .5fr); gap: 18px; margin-bottom: 18px; }
.update-panel { overflow: hidden; }
.compact-heading { margin: 0; font-size: 15px; }
.muted-copy { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.error-text { max-width: 260px; color: var(--danger); }
.error-box { margin: 0 17px 17px; padding: 11px 12px; border: 1px solid #efb7bc; border-radius: 5px; background: var(--danger-soft); color: var(--danger); white-space: pre-wrap; }
.badge.draft, .badge.cancelled, .badge.expired { background: #edf0f1; color: #59676d; }
.badge.scheduled, .badge.available { background: #e9f0fb; color: #315f9c; }
.badge.drawing { background: #fff0cf; color: #8a5a00; }
.badge.completed, .badge.won { background: var(--success-soft); color: var(--success); }
.badge.failed, .badge.not_won { background: var(--danger-soft); color: var(--danger); }
.badge.consumed { background: #f0eafb; color: #65439a; }

.draw-monitor { margin-bottom: 18px; padding: 16px 18px; border: 1px solid #e1c875; border-radius: var(--radius); background: #fffaf0; }
.draw-monitor-status { display: flex; align-items: center; gap: 10px; }
.draw-monitor-status [data-draw-count] { margin-left: auto; color: var(--muted); }
.draw-pulse { width: 10px; height: 10px; border-radius: 50%; background: #d99b12; box-shadow: 0 0 0 0 rgba(217,155,18,.35); animation: draw-pulse 1.2s infinite; }
.draw-names { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.draw-names span { display: flex; gap: 7px; padding: 7px 9px; border: 1px solid #eadba9; border-radius: 5px; background: white; }
@keyframes draw-pulse { 70% { box-shadow: 0 0 0 8px rgba(217,155,18,0); } 100% { box-shadow: 0 0 0 0 rgba(217,155,18,0); } }

.public-draw-body { min-height: 100vh; margin: 0; background: #f1f4f4; color: var(--text); }
.public-draw { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }
.public-draw header { padding-bottom: 22px; border-bottom: 1px solid var(--line-strong); }
.public-draw h1 { margin: 8px 0 5px; font-size: 34px; letter-spacing: 0; }
.public-draw header p { margin: 0; color: var(--muted); }
.draw-kicker { color: var(--primary) !important; font-size: 11px; font-weight: 800; }
.draw-stage { display: grid; min-height: 310px; place-items: center; padding: 36px 0; border-bottom: 1px solid var(--line); }
.draw-wheel { display: grid; width: 220px; aspect-ratio: 1; place-items: center; align-content: center; border: 12px solid #087f72; border-right-color: #d99b12; border-bottom-color: #2f6fa3; border-radius: 50%; background: white; box-shadow: 0 14px 35px rgba(20,39,44,.12); }
.draw-wheel.spinning { animation: draw-spin 1.4s linear infinite; }
.draw-wheel span, .draw-wheel strong { display: block; text-align: center; }
.draw-wheel span { color: var(--muted); font-size: 12px; }
.draw-wheel strong { margin-top: 5px; font-size: 20px; }
.draw-meta { display: flex; gap: 22px; margin-top: 18px; color: var(--muted); }
@keyframes draw-spin { to { transform: rotate(360deg); } }
.public-prizes, .public-results { padding: 28px 0; border-bottom: 1px solid var(--line); }
.public-prizes h2, .public-results h2 { margin: 0 0 14px; font-size: 18px; }
.public-prize-list, .public-winner-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.public-prize-list div, .public-winner-list div { min-height: 82px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.public-prize-list strong, .public-prize-list span, .public-prize-list small, .public-winner-list strong, .public-winner-list span { display: block; }
.public-prize-list span { margin-top: 4px; color: var(--primary-dark); font-weight: 800; }
.public-prize-list small { margin-top: 5px; color: var(--muted); }
.public-winner-list span { margin-top: 5px; font-family: "Cascadia Mono", Consolas, monospace; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .two-column { grid-template-columns: 1fr; }
  .diagnostic-grid { grid-template-columns: repeat(2, 1fr); }
  .maintenance-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-shell { margin-left: 0; }
  .mobile-menu { display: inline-grid !important; }
  .topbar { padding: 11px 14px; flex-wrap: wrap; }
  .topbar > div:not(.topbar-actions) { min-width: 0; flex: 1; overflow-wrap: anywhere; }
  .topbar h1 { font-size: 17px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .topbar-actions:empty { display: none; }
  .topbar-actions .button { width: auto; max-width: 100%; padding: 7px 10px; white-space: normal; }
  .topbar-actions .button svg { width: 18px; }
  .content { padding: 14px; }
  .alert { margin: 12px 14px 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stats-grid article { min-height: 98px; padding: 13px; }
  .account-header { align-items: flex-start; flex-direction: column; }
  .account-header dl { width: 100%; gap: 14px; overflow-x: auto; }
  .form-grid, .settings-grid { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list > div { grid-template-columns: 100px minmax(0, 1fr); }
  .product-grid, .diagnostic-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .filters { align-items: stretch; flex-direction: column; }
  .search { max-width: none; }
  .filters > select { width: 100%; }
  .auth-panel { padding: 21px; }
  .setup-layout { grid-template-columns: 1fr; }
  .setup-checks { position: static; }
  .setup-shell { width: min(100% - 24px, 1120px); padding-top: 20px; }
  .public-draw { width: min(100% - 24px, 1080px); padding-top: 24px; }
  .public-draw h1 { font-size: 25px; }
  .public-prize-list, .public-winner-list { grid-template-columns: 1fr; }
}

/* Keep reviewed settlement forms usable at narrow desktop/mobile widths. */
.paid-card-review { min-width: 0; overflow-wrap: anywhere; }
.paid-card-review .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.paid-card-review .form-grid > * { min-width: 0; }
@media (max-width: 760px) { .paid-card-review .form-grid { grid-template-columns: minmax(0, 1fr); } }
.paid-card-review label { grid-template-columns: minmax(0, 1fr); }

.paid-card-review label.toggle-row { grid-template-columns: 18px minmax(0, 1fr); }

.searchable-select-current { padding: 6px 9px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.searchable-select-option.highlighted { background: var(--surface-muted); outline: 2px solid var(--primary); outline-offset: -2px; }
.datetime-zone-hint { color: var(--muted); font-size: 12px; }
