:root {
  color-scheme: light;
  color-scheme: only light;
  --brand: #245ad1;
  --brand-hover: #1746b1;
  --brand-soft: #eef3ff;
  --ink: #1b2230;
  --text: #394150;
  --muted: #667080;
  --faint: #88909c;
  --line: #e2e5ea;
  --line-strong: #c5cbd4;
  --surface: #ffffff;
  --subtle: #f6f7f9;
  --sidebar: #f6f7f9;
  --danger: #b52f36;
  --danger-soft: #fff1f1;
  --warning: #876011;
  --warning-soft: #fff8e9;
  --focus: #245ad1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, input, textarea, select, progress { accent-color: var(--brand); }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
svg { display: block; width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 26px; font-weight: 650; line-height: 1.35; letter-spacing: -.03em; }
h2 { font-size: 16px; font-weight: 600; line-height: 1.5; }
h3 { font-size: 14px; font-weight: 600; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; top: 10px; left: 10px; padding: 10px 16px; border-radius: 5px; color: white; background: var(--brand); transform: translateY(-160%); opacity: 0; pointer-events: none; }
.skip-link:focus { transform: translateY(0); opacity: 1; pointer-events: auto; }

/* Mobile navigation: brand and account first, then the three destination tabs. */
.app-shell { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: var(--sidebar); }
.brand { display: inline-flex; align-items: center; gap: 9px; min-height: 36px; text-decoration: none; }
.brand-symbol { display: flex; align-items: center; justify-content: center; flex: 0 0 31px; width: 31px; height: 31px; border-radius: 5px; color: white; background: var(--ink); font: 700 13px/1 "Segoe UI", sans-serif; letter-spacing: -.04em; }
.brand-name { font-size: 14px; font-weight: 650; line-height: 1.3; white-space: nowrap; }
.brand-name > span { display: none; }
.workspace-label, .sidebar-bottom { display: none; }
.main-nav { order: 2; display: flex; flex-basis: 100%; gap: 20px; }
.nav-item { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 10px 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.nav-item svg { width: 16px; height: 16px; }
.nav-item[aria-current="page"] { color: var(--brand); font-weight: 600; }
.nav-item[aria-current="page"]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--brand); content: ""; }
.account-summary { display: flex; align-items: center; gap: 9px; min-width: 0; margin-left: auto; }
.account-avatar { display: none; }
.account-summary-copy { min-width: 0; max-width: 72px; }
.account-summary-copy strong { display: block; overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.account-summary-copy span { display: none; }
.account-summary .text-button { min-width: 40px; font-size: 12px; }
.main-content { min-width: 0; }
.main-content:focus { outline: none; }
.topbar { display: none; }
.page-content { max-width: 1320px; margin-inline: auto; padding: 24px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.page-heading p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.environment-tag { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--muted); font-size: 12px; }
.environment-tag > span { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.simulation-note { margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.workbench-grid { display: grid; grid-template-areas: "status" "config"; gap: 28px; align-items: start; }
.configuration-panel { grid-area: config; min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 32px; }
.section-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.small-label { color: var(--muted); font-size: 12px; }

/* State and time remain above configuration on narrow screens. */
.run-panel { grid-area: status; display: grid; grid-template-columns: minmax(0, 1fr) 116px; column-gap: 16px; min-width: 0; padding: 18px; border: 1px solid var(--line); border-top: 3px solid #c8ced8; border-radius: 6px; background: var(--subtle); scroll-margin-top: 16px; }
.run-panel[data-phase="running"] { border-top-color: var(--brand); }
.run-panel[data-phase="cooldown"] { border-top-color: #b18a3b; }
.run-panel-heading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.run-panel-heading h2 { color: var(--muted); font-size: 12px; font-weight: 500; }
.status-tag { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 2px 7px; border-radius: 4px; background: #e9ecf0; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.7; white-space: nowrap; }
.status-tag::before { width: 4px; height: 4px; flex: 0 0 4px; border-radius: 50%; background: currentColor; content: ""; }
.status-tag[data-state="running"], .status-tag.is-running, .status-tag[data-state="completed"], .status-tag.is-completed, .status-tag.account-active { color: var(--brand); background: var(--brand-soft); }
.status-tag[data-state="cooldown"], .status-tag[data-state="interrupted"], .status-tag.is-interrupted, .status-tag.account-expired { color: var(--warning); background: var(--warning-soft); }
.status-tag[data-state="error"], .status-tag.account-banned { color: var(--danger); background: var(--danger-soft); }
.run-intro { min-width: 0; padding-top: 3px; }
.run-intro h3 { font-size: 15px; font-weight: 600; }
.run-intro p { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.run-timer { min-width: 0; }
.run-timer > span { display: block; color: var(--muted); font-size: 11px; }
.run-timer strong { display: block; margin: 2px 0 8px; color: var(--ink); font: 500 34px/1.18 "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
progress { display: block; width: 100%; height: 4px; overflow: hidden; margin: 0; border: 0; border-radius: 2px; color: var(--brand); background: #dce1e8; }
progress::-webkit-progress-bar { border-radius: 2px; background: #dce1e8; }
progress::-webkit-progress-value { border-radius: 2px; background: var(--brand); }
progress::-moz-progress-bar { border-radius: 2px; background: var(--brand); }
.run-details { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, .7fr) minmax(0, .7fr); gap: 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; }
.run-details > div { min-width: 0; }
.run-details dt { color: var(--muted); font-size: 11px; }
.run-details dd { margin-top: 2px; color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.run-footnote { grid-column: 1 / -1; margin-top: 10px; color: var(--muted); font-size: 11px; }
#connection-status[data-state="connected"] { color: var(--brand); }
#connection-status[data-state="error"] { color: var(--warning); }

/* Consistent controls; compact selections keep the form in one scan. */
#task-form { margin-top: 16px; }
.target-fields { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 12px; }
.field { min-width: 0; }
.field label, .option-fieldset legend { display: block; margin-bottom: 7px; color: var(--text); font-size: 13px; font-weight: 500; }
.required-mark { margin-left: 2px; color: var(--muted); }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], textarea, select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 11px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.4; transition: border-color 160ms ease; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--brand); }
input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
input:disabled, textarea:disabled, select:disabled { background: var(--subtle); color: var(--muted); opacity: 1; }
.field-hint { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.field-error { margin-top: 5px; color: var(--danger); font-size: 12px; overflow-wrap: anywhere; }
.option-fieldset { min-width: 0; margin: 20px 0 0; padding: 0; border: 0; }
.option-fieldset legend { padding: 0; }
.duration-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.method-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.radio-option { position: relative; display: block; min-width: 0; cursor: pointer; }
.radio-option > input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.radio-option > input:disabled { cursor: not-allowed; }
.option-content { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--text); transition: border-color 160ms ease, background 160ms ease; }
.option-content strong { font-size: 14px; font-weight: 500; }
.duration-option strong { font-variant-numeric: tabular-nums; }
.duration-option strong > span { font-size: 12px; font-weight: 400; }
.selection-dot { width: 12px; height: 12px; flex: 0 0 12px; border: 1px solid var(--line-strong); border-radius: 50%; }
.radio-option > input:checked + .option-content { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.radio-option > input:checked + .option-content .selection-dot { border: 4px solid var(--brand); background: var(--surface); }
.radio-option > input:focus-visible { outline: none; }
.radio-option > input:focus-visible + .option-content { outline: 3px solid var(--focus); outline-offset: 3px; }
.radio-option > input:disabled + .option-content { background: var(--subtle); }
.radio-option > input:disabled:checked + .option-content { background: var(--brand-soft); }
.method-option .option-content { min-height: 62px; padding: 9px 10px; }
.option-description { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.note-field { margin-top: 20px; }
.optional-label { margin-left: 5px; color: var(--muted); font-size: 11px; font-weight: 400; }
textarea { display: block; min-height: 72px; resize: vertical; }
.form-summary { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); }
.summary-icon { color: var(--muted); }
.summary-icon svg { width: 16px; height: 16px; }
.form-summary p { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; min-width: 0; width: 100%; font-size: 12px; }
#selection-summary { min-width: 0; overflow-wrap: anywhere; }
.summary-settings { display: inline-flex; gap: 7px; color: var(--muted); white-space: nowrap; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.form-footer > span { color: var(--muted); font-size: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 5px; font-size: 13px; font-weight: 500; line-height: 1.5; white-space: nowrap; transition: background 160ms ease, border-color 160ms ease; }
.button svg { width: 16px; height: 16px; }
.primary-button { min-width: 132px; background: var(--brand); color: white; }
.primary-button:disabled { background: #98a8c9; color: white; }
.secondary-button { border-color: var(--line-strong); background: var(--surface); color: var(--text); }
.secondary-button:disabled { border-color: var(--line); background: var(--subtle); color: var(--faint); }
.danger-button { background: var(--danger); color: white; }
.text-button, .detail-button { display: inline-flex; justify-content: center; align-items: center; gap: 5px; min-height: 44px; padding: 8px 4px; border: 0; border-radius: 3px; background: transparent; color: var(--brand); font-size: 12px; font-weight: 500; white-space: nowrap; }
.text-button svg { width: 15px; height: 15px; }
.text-button:disabled, .detail-button:disabled { color: var(--faint); }
.muted-button { color: var(--muted); }

/* Records are simple rows, with the same status vocabulary as the timer. */
.recent-section { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); }
.empty-state { color: var(--muted); }
.recent-empty { display: flex; align-items: center; gap: 12px; min-height: 98px; padding: 20px 0; }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; height: 32px; color: var(--faint); }
.empty-state h3 { color: var(--text); font-size: 13px; font-weight: 500; }
.empty-state p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.history-list { min-width: 0; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.history-item-main { min-width: 0; }
.history-title { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.history-meta { margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.history-side { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.history-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 16px; }
.history-controls { display: flex; flex: 1 1 100%; gap: 8px; min-width: 0; }
.history-actions { display: flex; align-items: center; gap: 14px; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field svg { position: absolute; top: 14px; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 34px; }
select { width: auto; flex-shrink: 0; padding-right: 24px; cursor: pointer; font-size: 13px; }
.history-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.history-section-heading h2 { font-size: 14px; }
#history-count { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 400; }
.history-section-heading > span { flex-shrink: 0; color: var(--muted); font-size: 11px; }
.history-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 240px; padding: 32px 16px; font-size: 13px; text-align: center; }
.history-empty .empty-icon { margin-bottom: 12px; }
.history-empty p { max-width: 340px; }
.history-storage-note { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding: 20px 0 max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }

/* Inline messages stay visible; toasts are only supplemental feedback. */
.storage-notice { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #ead4a2; border-radius: 5px; background: var(--warning-soft); color: var(--warning); font-size: 13px; overflow-wrap: anywhere; }
.account-message { margin-top: 18px; padding: 11px 13px; border: 1px solid #e9c0c4; border-radius: 5px; background: var(--danger-soft); color: var(--danger); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.account-message[data-kind="success"], .account-message[data-kind="info"] { border-color: #bfcff3; background: var(--brand-soft); color: var(--brand); }
.task-message { margin-top: 14px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 5px; background: var(--ink); color: white; font-size: 13px; line-height: 1.6; transform: translateX(-50%); overflow-wrap: anywhere; box-shadow: 0 3px 14px #1b223022; }

/* Authentication uses the same restrained, functional controls. */
.auth-screen { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding: 28px max(20px, env(safe-area-inset-left)) 20px; background: var(--subtle); }
.auth-layout { width: min(100%, 440px); margin: auto; }
.auth-intro { margin-bottom: 28px; }
.auth-intro > .auth-eyebrow, .auth-intro > h1, .auth-intro > p, .auth-intro-note { display: none; }
.auth-card { padding: 26px 22px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.auth-eyebrow { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.auth-card h2 { margin-top: 8px; font-size: 23px; font-weight: 600; line-height: 1.4; letter-spacing: -.02em; }
.auth-description { margin-top: 8px; color: var(--muted); font-size: 13px; }
.auth-tabs { display: flex; gap: 24px; margin: 20px 0; border-bottom: 1px solid var(--line); }
.auth-tabs button { position: relative; min-height: 44px; padding: 10px 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.auth-tabs button[aria-pressed="true"] { color: var(--brand); font-weight: 600; }
.auth-tabs button[aria-pressed="true"]::after { position: absolute; inset: auto 0 -1px; height: 2px; background: var(--brand); content: ""; }
.account-form { margin-top: 20px; }
.account-form .field + .field { margin-top: 17px; }
.auth-submit { width: 100%; margin-top: 22px; }
.auth-footnote { margin-top: 13px; color: var(--muted); font-size: 11px; }
.auth-loading { display: flex; align-items: center; gap: 9px; min-height: 100px; color: var(--muted); font-size: 13px; }
.loading-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.auth-page-footer { margin-top: 32px; color: var(--faint); font-size: 11px; text-align: center; }

/* Administration: quiet data tables with horizontal scrolling when needed. */
.admin-loading { margin: 16px 0; color: var(--muted); font-size: 13px; }
#admin-message { margin-bottom: 18px; }
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 26px 0; padding: 18px 0; border-block: 1px solid var(--line); }
.admin-stats > div { padding-left: 14px; border-left: 1px solid var(--line); }
.admin-stats > div:first-child { padding-left: 0; border-left: 0; }
.admin-stats span { color: var(--muted); font-size: 11px; }
.admin-stats strong { display: block; margin-top: 3px; color: var(--ink); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.admin-panel { min-width: 0; margin-top: 28px; }
.invite-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 20px 0; }
.invite-form .field { flex: 1; min-width: 100px; }
.invite-form .button { flex-basis: 100%; }
.generated-invites { margin-bottom: 22px; padding: 16px; border: 1px solid #bfcff3; border-radius: 5px; background: var(--brand-soft); }
.generated-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.generated-heading h3 { color: var(--brand); font-size: 13px; }
.generated-heading p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.generated-heading .button { padding-inline: 10px; font-size: 12px; }
#generated-codes { min-height: 88px; font: 13px/1.9 "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; white-space: pre; }
.admin-table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.admin-table { min-width: 570px; width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.admin-table th { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 500; text-align: left; white-space: nowrap; }
.admin-table td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th:last-child, .admin-table td:last-child { padding-right: 0; text-align: right; }
.admin-table td:first-child { min-width: 110px; max-width: 220px; overflow-wrap: anywhere; }
.admin-table td:nth-child(3) { white-space: nowrap; }
.admin-table .button { min-height: 40px; padding: 8px 12px; font-size: 12px; }
.invite-used-by { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.admin-empty { padding: 26px 12px; color: var(--muted); font-size: 13px; text-align: center; }
#refresh-admin { min-width: 0; padding-inline: 12px; }

/* Native dialogs retain focus behavior and keyboard support. */
.dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); margin: auto; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.dialog::backdrop { background: #17203166; }
.dialog-content { padding: 24px; }
.dialog-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-bottom: 14px; border-radius: 5px; background: var(--danger-soft); color: var(--danger); }
.dialog h2 { font-size: 18px; }
.dialog p { margin-top: 11px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.detail-dialog { width: min(500px, calc(100% - 32px)); }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 10px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
#detail-content { font-size: 13px; overflow-wrap: anywhere; }
#detail-content dl { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 0 16px; }
#detail-content dt, #detail-content dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
#detail-content dt { color: var(--muted); }
#detail-content dt:last-of-type, #detail-content dd:last-of-type { border-bottom: 0; }
#detail-content dd { min-width: 0; overflow-wrap: anywhere; }

@media (hover: hover) {
  .nav-item:hover, .text-button:hover:not(:disabled), .detail-button:hover:not(:disabled) { color: var(--brand-hover); }
  .text-button:hover:not(:disabled), .detail-button:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 4px; }
  input:hover:not(:disabled), textarea:hover:not(:disabled), select:hover:not(:disabled) { border-color: #9099a7; }
  .radio-option > input:hover:not(:disabled) + .option-content { border-color: var(--brand); }
  .primary-button:hover:not(:disabled) { background: var(--brand-hover); }
  .secondary-button:hover:not(:disabled), .icon-button:hover { background: var(--subtle); border-color: #9099a7; }
  .danger-button:hover:not(:disabled) { background: #92262c; }
  .muted-button:hover:not(:disabled) { color: var(--danger); }
}
@media (min-width: 600px) {
  .sidebar { padding-inline: 28px; }
  .page-content { padding: 28px 28px 0; }
  .account-summary-copy { max-width: 140px; }
  .run-panel { grid-template-columns: minmax(0, 1fr) 180px; padding: 22px 24px; }
  .run-timer strong { font-size: 40px; }
  .run-details { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr); }
  .target-fields { grid-template-columns: minmax(0, 1fr) 128px; gap: 16px; }
  .method-option .option-content { padding-inline: 14px; }
  .history-controls { flex-basis: 320px; }
  .invite-form { flex-wrap: wrap; }
  .invite-form .field { flex: 0 1 150px; }
  .invite-form .button { flex-basis: auto; }
  .auth-card { padding: 32px; }
}
@media (min-width: 900px) {
  .app-shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; align-self: start; flex-direction: column; flex-wrap: nowrap; align-items: stretch; min-height: 100vh; min-height: 100dvh; gap: 0; padding: 28px 16px 20px; border-bottom: 0; border-right: 1px solid var(--line); }
  .brand { gap: 10px; padding-inline: 4px; }
  .brand-name { font-size: 14px; }
  .brand-name > span { display: block; margin-top: 4px; color: var(--faint); font-size: 9px; font-weight: 500; letter-spacing: .08em; }
  .workspace-label { display: flex; align-items: center; gap: 6px; margin: 38px 10px 10px; color: var(--faint); font-size: 11px; }
  .workspace-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
  .main-nav { order: 0; flex-direction: column; flex-basis: auto; gap: 4px; }
  .nav-item { min-height: 42px; padding: 10px 12px; border-radius: 5px; font-size: 13px; gap: 10px; }
  .nav-item[aria-current="page"] { background: #e9edf5; }
  .nav-item[aria-current="page"]::after { content: none; }
  .account-summary { gap: 8px; margin: 26px 2px 0; padding-top: 18px; border-top: 1px solid var(--line); }
  .account-summary-copy { flex: 1; max-width: none; }
  .account-summary-copy span { display: block; color: var(--muted); font-size: 11px; }
  .account-summary .text-button { min-width: 32px; }
  .sidebar-bottom { display: block; margin-top: auto; padding-top: 56px; }
  .local-mode { display: flex; align-items: flex-start; gap: 8px; margin-inline: 4px; font-size: 11px; color: var(--text); }
  .local-mode-icon { margin-top: 2px; color: var(--muted); }
  .local-mode-icon svg { width: 16px; height: 16px; }
  .local-mode div > span { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; }
  .sidebar-version { display: flex; justify-content: space-between; margin: 22px 4px 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 9px; letter-spacing: .06em; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; padding: 18px 32px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
  .topbar > span:first-child > span { margin-inline: 10px; color: var(--line-strong); }
  .today-label { font-size: 11px; white-space: nowrap; }
  .page-content { padding: 30px 32px 0; }
  .workbench-grid { grid-template-columns: minmax(0, 1fr) 254px; grid-template-areas: "config status"; gap: 28px; }
  .run-panel { position: sticky; top: 24px; display: block; padding: 20px; }
  .run-panel-heading { margin-bottom: 24px; }
  .run-intro { padding-top: 0; }
  .run-intro h3 { font-size: 16px; }
  .run-intro p { margin-top: 7px; }
  .run-timer { margin-top: 28px; }
  .run-timer strong { margin: 5px 0 14px; font-size: 45px; }
  .run-details { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; padding-top: 18px; }
  .run-details > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
  .run-details dt { flex: 0 0 auto; font-size: 12px; }
  .run-details dd { margin-top: 0; text-align: right; }
  .run-footnote { margin-top: 20px; font-size: 11px; }
  input[type="text"], input[type="search"], input[type="password"], input[type="number"], textarea { font-size: 14px; }
  .target-fields { grid-template-columns: minmax(0, 1fr) 94px; gap: 12px; }
  .method-option .option-content { padding-inline: 10px; }
  .history-toolbar { gap: 16px; }
  .history-side { gap: 16px; }
  .auth-screen { padding: 48px 32px 22px; }
  .auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) 410px; align-items: center; gap: 72px; width: min(100%, 960px); }
  .auth-intro { margin-bottom: 0; }
  .auth-intro .brand { padding: 0; margin-bottom: 72px; }
  .auth-intro > .auth-eyebrow, .auth-intro > h1, .auth-intro > p, .auth-intro-note { display: block; }
  .auth-intro h1 { margin-top: 14px; font-size: 32px; line-height: 1.5; }
  .auth-intro > p { margin-top: 14px; color: var(--muted); font-size: 14px; }
  .auth-intro-note { margin-top: 48px; color: var(--muted); font-size: 12px; }
  .admin-stats span { font-size: 12px; }
  .admin-stats strong { font-size: 30px; }
}
@media (min-width: 1200px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding-inline: 20px; }
  .page-content { padding: 36px 44px 0; }
  .topbar { padding-inline: 44px; }
  .page-heading { margin-bottom: 12px; }
  .simulation-note { margin-bottom: 28px; }
  .workbench-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 42px; }
  .run-panel { padding: 24px; }
  .run-timer strong { font-size: 52px; }
  .target-fields { grid-template-columns: minmax(0, 1fr) 120px; gap: 16px; }
  .method-option .option-content { padding-inline: 14px; }
  .recent-section { margin-top: 36px; }
}
@media (max-width: 359px) {
  .sidebar { column-gap: 6px; padding-inline: 14px; }
  .brand { gap: 7px; }
  .brand-name { font-size: 13px; }
  .account-summary { gap: 4px; }
  .account-summary-copy { max-width: 48px; }
  .main-nav { gap: 14px; }
  .nav-item { gap: 5px; font-size: 12px; }
  .page-content { padding-inline: 14px; }
  .page-heading { gap: 8px; }
  .page-heading h1 { font-size: 24px; }
  .environment-tag { font-size: 11px; }
  .run-panel { grid-template-columns: minmax(0, 1fr) 100px; column-gap: 12px; padding: 15px; }
  .run-timer strong { font-size: 31px; }
  .run-intro h3 { font-size: 14px; }
  .run-details { gap: 8px; }
  .target-fields { grid-template-columns: minmax(0, 1fr) 76px; gap: 9px; }
  .option-content { padding-inline: 9px; }
  .method-option .option-content { padding-inline: 8px; gap: 5px; }
  .history-side { flex-direction: column; gap: 0; align-items: flex-end; }
  .form-footer > span { font-size: 11px; }
  .primary-button { min-width: 124px; }
  .page-footer { font-size: 10px; }
  .auth-card { padding-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (forced-colors: active) {
  .brand-symbol, .primary-button, .danger-button { border: 1px solid ButtonText; }
  .radio-option > input:checked + .option-content { outline: 2px solid Highlight; }
  .radio-option > input:checked + .option-content .selection-dot { border-color: Highlight; }
  .status-tag::before, .environment-tag > span { background: CanvasText; }
}

/* V1.1 dispatch result */
.dispatch-result { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--subtle); }
.dispatch-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dispatch-result-heading h3 { margin: 0; font-size: 13px; }
.dispatch-result-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 10px; }
.dispatch-result-meta div { min-width: 0; }
.dispatch-result-meta dt { color: var(--muted); font-size: 11px; }
.dispatch-result-meta dd { margin: 2px 0 0; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.dispatch-response { max-height: 220px; margin: 0; padding: 10px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 11px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.dispatch-result[data-ok="false"] { border-color: var(--danger); }
.dispatch-result[data-ok="false"] .status-tag { color: var(--danger); background: var(--danger-soft); }
.detail-response { margin-top: 12px; max-height: 280px; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 640px) { .dispatch-result-meta { grid-template-columns: 1fr; } }

/* V1.2 admin and groups */
.admin-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.admin-tabs { display: flex; gap: 4px; margin: 22px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.admin-tab { min-height: 40px; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
.admin-tab[aria-selected="true"] { border-bottom-color: var(--brand); color: var(--brand); font-weight: 600; }
.admin-table { min-width: 760px; }
.group-form { margin: 20px 0 24px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--subtle); }
.group-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.group-form .option-fieldset { margin-top: 12px; }
.check-options { display: flex; flex-wrap: wrap; gap: 14px; }
.check-options label { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--ink); font-size: 13px; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--ink); font-size: 13px; }
.group-form .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.redeem-panel { margin-top: 22px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.redeem-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.redeem-form .field { flex: 1; min-width: 220px; }
.history-search-form { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 18px 0; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--subtle); }
.history-search-form .actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.history-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.group-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.group-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 7px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); font-size: 11px; white-space: nowrap; }
.admin-record-dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.admin-record-dl dt { color: var(--muted); font-size: 12px; }
.admin-record-dl dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 900px) { .history-search-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .admin-stats > div { padding-left: 0; border-left: 0; } .group-grid { grid-template-columns: 1fr; } .history-search-form { grid-template-columns: 1fr; } .admin-tab { padding: 8px 10px; font-size: 12px; } }


.access-list { display: grid; gap: 8px; }
.access-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.access-row strong { font-size: 13px; }
.access-row span { color: var(--muted); font-size: 12px; text-align: right; }
.access-dialog-groups { display: grid; gap: 8px; max-height: 52vh; overflow: auto; margin: 12px 0; }
.access-dialog-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 5px; }
.access-dialog-check { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.access-dialog-status { color: var(--muted); font-size: 12px; }
@media (max-width: 760px) {
  .access-dialog-row { grid-template-columns: 1fr; }
  .access-row { flex-direction: column; gap: 4px; }
  .access-row span { text-align: left; }
}

/* V1.5 公告与通用表单弹窗 */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: auto; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; line-height: 1; }
.announcement-banner { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid #c9d8f5; border-radius: 6px; background: #f3f7ff; }
.announcement-banner-copy { min-width: 0; }
.announcement-banner-label { display: inline-block; margin-right: 8px; padding: 1px 6px; border-radius: 3px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; vertical-align: 2px; }
.announcement-banner strong { color: var(--text); font-size: 13px; }
.announcement-banner p { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.announcement-banner-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.announcement-list { display: grid; gap: 12px; }
.announcement-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.announcement-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.announcement-card h3 { font-size: 15px; font-weight: 600; }
.announcement-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.announcement-mode { display: inline-flex; align-items: center; min-height: 20px; padding: 0 7px; border-radius: 10px; background: var(--subtle); color: var(--muted); font-size: 10px; }
.announcement-mode[data-mode="popup"] { background: #fff1df; color: #8a5a1f; }
.announcement-content { margin-top: 14px; color: var(--ink); font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.announcement-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.announcement-read { color: var(--muted); font-size: 12px; }
.announcement-empty { margin-top: 18px; }
.announcement-dialog { width: min(560px, calc(100% - 32px)); }
.announcement-dialog .announcement-content { max-height: 46vh; overflow: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 5px; background: var(--subtle); }
.form-dialog { width: min(520px, calc(100% - 32px)); }
.form-dialog .dialog-content { max-height: calc(100vh - 48px); overflow-y: auto; }
.form-dialog .field { margin-top: 14px; }
.form-dialog .field:first-child { margin-top: 0; }
.form-dialog .field-hint { margin-top: 6px; }
.form-dialog .account-message { margin-top: 14px; }
.quick-values { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-value { min-height: 30px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.quick-value:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 760px) {
  .announcement-banner { flex-direction: column; gap: 10px; }
  .announcement-banner-actions { width: 100%; justify-content: flex-end; }
  .announcement-card { padding: 15px 16px; }
  .announcement-card-head { flex-direction: column; gap: 8px; }
}
.system-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.system-info-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--subtle); }
.system-info-card span { display: block; color: var(--muted); font-size: 11px; }
.system-info-card strong { display: block; margin-top: 4px; font-size: 16px; }
.system-upgrade-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 0; padding: 14px 16px; border: 1px solid #c9d8f5; border-radius: 5px; background: #f3f7ff; }
.system-upgrade-bar strong { font-size: 13px; }
.system-upgrade-bar p { margin-top: 3px; color: var(--muted); font-size: 12px; }
@media (max-width: 760px) { .system-info-grid { grid-template-columns: 1fr; } .system-upgrade-bar { align-items: stretch; flex-direction: column; } .system-upgrade-bar .button { width: 100%; } }
