/* Shared Apple-inspired control surface. One token system, no theme overrides. */
:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --card: #ffffff;
  --sidebar: #ededf1;
  --ink: #1d1d1f;
  --muted: #626269;
  --line: #dedee3;
  --accent: #0066cc;
  --primary: #0066cc;
  --info: #0066cc;
  --accent-tint: #eef5ff;
  --ok: #18743b;
  --ok-tint: #eef8f0;
  --warn: #865000;
  --warn-tint: #fff7e6;
  --danger: #b42318;
  --danger-tint: #fff1f0;
  --radius: 18px;
  --shadow: 0 2px 8px rgb(0 0 0 / 3%);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body.apple-ui {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Microsoft JhengHei UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select, input, textarea { max-width: 100%; }
button, summary, a, select, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.3; letter-spacing: -.025em; }
h1 { font-size: clamp(23px, 2.3vw, 30px); font-weight: 700; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 8px 0; }
small { font-size: 12px; line-height: 1.5; }
.sub, .hint, .muted, .msg { color: var(--muted); }
.sub, .hint { font-size: 12px; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 200; padding: 12px 20px; border-radius: 10px; color: #fff; background: var(--accent); }
.skip-link:focus { top: 12px; }
.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  width: 100%;
  max-width: 1720px;
  min-height: 100dvh;
  margin: 0 auto;
}
.app-sidebar { position: sticky; top: 0; align-self: start; height: 100dvh; min-width: 0; padding: 30px 18px; border-right: 1px solid var(--line); background: var(--sidebar); overflow: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 32px; color: var(--ink); text-decoration: none; }
.sidebar-brand > div { display: grid; gap: 2px; }
.sidebar-brand strong { font-size: 16px; font-weight: 650; letter-spacing: -.025em; }
.sidebar-brand small { color: var(--muted); font-size: 11px; }
.app-brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; color: #fff; background: var(--accent); font-size: 13px; font-weight: 750; letter-spacing: -.04em; }
.app-header .app-brand-mark { display: none; }
.sidebar-section-label { margin: 26px 12px 8px; color: var(--muted); font-size: 11px; font-weight: 650; }
.sidebar-footnote { margin: 28px 12px 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.workspace { min-width: 0; padding: 32px clamp(24px, 3vw, 48px) 64px; }
.app-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-copy { min-width: 0; }
.brand-kicker { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.brand-copy > p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; min-width: 0; max-width: 420px; }
.header-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.support-control { display: grid; justify-items: end; gap: 4px; min-width: 0; }
.support-button { white-space: normal; min-height: 36px; padding: 7px 13px; }
.web-work-fallback-link { font-size: 11px; line-height: 1.5; text-decoration: none; }
.web-work-fallback-link:hover { text-decoration: underline; }
.support-status { display: inline-block; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.support-status.pending { color: var(--warn); }
.support-status.ok { color: var(--ok); }
.support-status.error { color: var(--danger); }
.quota-badge { color: var(--muted); font-size: 11px; }
.device-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; margin: 0; padding: 12px; border: 1px solid #d8d8df; border-radius: 13px; background: #f7f7fa; box-shadow: none; }
.device-picker, .device-bar label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; }
.device-summary, .device-bar > div { display: grid; min-width: 0; gap: 5px; }
.device-summary strong, #deviceTitle { font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.device-summary span, #deviceSummary { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.device-bar select { min-height: 40px; padding: 8px; font-size: 12px; }
#refreshButton { min-height: 32px; padding: 4px 8px; font-size: 11px; }
.view-tabs, .tabs { display: grid; gap: 4px; margin-top: 8px; }
.view-tabs button, .tabs button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; border: 1px solid transparent; border-radius: 9px; padding: 9px 12px; color: #48484f; background: transparent; text-align: left; font-weight: 500; box-shadow: none; }
.view-tabs button.active, .tabs button.active { color: var(--accent); background: #dfeafa; border-color: #d2e1f6; font-weight: 650; }
.nav-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; font-size: 20px; line-height: 1; }
.app-view, .tab-panel { min-width: 0; }
.app-view { display: grid; gap: 20px; }
.tab-panel { display: none; }
.tab-panel.active { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.overview-grid, .grid.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); align-items: start; gap: 20px; min-width: 0; }
.grid, .diagnostics-grid { display: grid; min-width: 0; gap: 20px; }
.diagnostics-grid, .diagnostics-secondary { grid-template-columns: minmax(0, 1fr); }
.video-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; }
.card { min-width: 0; max-width: 100%; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--panel); box-shadow: var(--shadow); }
.section-heading, .section-title { margin-bottom: 20px; }
.heading-row, .section-title, .settings-list-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-heading > *, .heading-row > *, .section-title > * { min-width: 0; }
.section-heading p, .section-title p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; border: 1px solid #cfcfd6; border-radius: 9px; padding: 9px 15px; color: var(--ink); background: #fff; font-size: 13px; font-weight: 550; line-height: 1.35; cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease; }
button:hover:not(:disabled) { background: #f2f2f5; border-color: #b5b5bf; }
button.ok { color: #fff; background: var(--accent); border-color: var(--accent); }
button.ok:hover:not(:disabled) { background: #0056ad; border-color: #0056ad; }
button.warn { color: var(--ink); background: #f4f4f6; }
button.danger, button.remove-server { color: var(--danger); border-color: #e4c2bf; background: #fff; }
button.info { color: var(--accent); }
button:disabled { opacity: .48; cursor: not-allowed; }
#btnRestart, #restartButton { color: var(--accent); background: var(--accent-tint); border-color: #c4d9f4; }
#btnRestart::before, #restartButton::before { content: "↻"; font-size: 18px; line-height: 1; }
.row, .button-row, .inline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.row.buttons, .button-row { margin: 18px 0; }
.row.buttons, .control-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.control-actions button, .row.buttons button { min-height: 44px; }
input:not([type="checkbox"]), select, textarea { width: 100%; min-width: 0; min-height: 40px; border: 1px solid #c9c9d2; border-radius: 9px; padding: 9px 11px; color: var(--ink); background: #fff; }
input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
textarea { resize: vertical; }
label { color: var(--ink); }
.field, .field-block, .codex-field { display: grid; gap: 7px; font-size: 12px; font-weight: 550; }
.field { margin: 18px 0 12px; }
.field small, .field-block small, .codex-field small { color: var(--muted); font-weight: 400; }
.field .inline { flex-wrap: nowrap; }
.field .inline select { flex: 1 1 auto; width: auto; }
.field .inline button { flex: 0 0 auto; }
.flow-server-card, .flow-box { display: grid; gap: 8px; min-width: 0; border: 1px solid #e0e7ef; border-radius: 13px; padding: 17px; background: #f6f9fd; }
.flow-server-heading, .server-progress-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; }
#currentFlowServer, #flowServer { font-size: 24px; font-weight: 650; letter-spacing: -.035em; line-height: 1.25; overflow-wrap: anywhere; }
#currentFlowStep, #flowStep { margin: 0; color: #48484f; font-size: 13px; overflow-wrap: anywhere; }
.flow-server-notify, #switchProgress { margin: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.flow-server-notify:empty, #switchProgress:empty { display: none; }
.flow-server-card[data-state="complete"] { background: var(--ok-tint); border-color: #c5dec9; }
.flow-server-card[data-state="offline"], .flow-server-card[data-state="idle"] { background: #f7f7f9; border-color: var(--line); }
.badge, .flow-server-badge, .server-progress-status, .status-badge, .event-level, .recording-status-badge, .performance-freshness-badge, .settings-support-badge { display: inline-flex; align-items: center; justify-content: center; justify-self: start; gap: 5px; width: fit-content; max-width: 100%; border-radius: 6px; padding: 4px 8px; color: var(--muted); background: #f0f0f3; font-size: 11px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.badge.ok, .flow-server-badge.complete, .server-progress-status.completed, .status-badge.acked, .event-level.info, .recording-status-badge.complete, .recording-status-badge.success, .performance-freshness-badge.fresh, .settings-support-badge.supported { color: var(--ok); background: var(--ok-tint); }
.badge.warning, .server-progress-status.pending, .status-badge.waiting, .status-badge.unresponsive, .event-level.warn, .recording-status-badge.pending, .recording-status-badge.warning, .performance-freshness-badge.stale { color: var(--warn); background: var(--warn-tint); }
.badge.danger, .status-badge.rejected, .event-level.error, .recording-status-badge.error, .performance-freshness-badge.error, .settings-support-badge.unsupported { color: var(--danger); background: var(--danger-tint); }
.flow-server-badge.active, .server-progress-status.current, .recording-status-badge.running { color: var(--accent); background: var(--accent-tint); }
.server-switch-panel, .server-progress-panel { min-width: 0; margin-top: 20px; padding-top: 18px; border-top: 1px solid #ececf0; }
.server-switch-panel > label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.server-switch-row { flex-wrap: nowrap; }
.server-switch-row select { flex: 1 1 auto; width: auto; }
.server-switch-row button { flex: 0 0 auto; }
.server-progress-list { display: grid; gap: 8px; margin-top: 12px; }
.server-progress-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; min-width: 0; padding: 10px 0; border-bottom: 1px solid #ececf0; }
.server-progress-name { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.server-progress-action { min-height: 32px; padding: 6px 9px; font-size: 11px; }
.command-status, .notice, .settings-status, .settings-ack-status, .transport-status, .performance-notice { min-width: 0; margin: 14px 0 0; padding: 13px 14px; border: 1px solid #e0e0e6; border-radius: 10px; color: var(--muted); background: #f7f7f9; font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
.transport-status { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.command-status, .settings-status { display: grid; gap: 5px; }
.command-status strong, .settings-status strong { font-weight: 650; }
.command-status[data-status="waiting"], .command-status[data-status="sending"], .command-status[data-status="unresponsive"], .settings-status[data-status="pending"], .notice.warning, .transport-status.warning, .settings-ack-status.pending, .performance-notice.warning { color: var(--warn); background: var(--warn-tint); border-color: #eddab1; }
.command-status[data-status="acked"], .settings-status[data-status="acked"], .settings-ack-status.applied, .notice.ok { color: var(--ok); background: var(--ok-tint); border-color: #c5dec9; }
.command-status[data-status="error"], .command-status[data-status="rejected"], .settings-status[data-status="error"], .settings-status[data-status="rejected"], .settings-ack-status.rejected, .notice.danger, .transport-status.danger, .performance-notice.error { color: var(--danger); background: var(--danger-tint); border-color: #edc4c0; }
.snapshot-card { overflow: hidden; }
.snapshot-placeholder, .empty { display: grid; place-items: center; min-height: 240px; padding: 30px; border: 1px dashed #d5d5dd; border-radius: 12px; color: var(--muted); background: #fafafb; font-size: 12px; text-align: center; }
.latest-screenshot, #snapshotImage { display: block; width: 100%; max-height: 620px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #f2f2f5; }
video { display: block; width: 100%; max-height: 70vh; margin-top: 16px; border-radius: 12px; background: #17171a; }
details { min-width: 0; }
summary { cursor: pointer; font-size: 12px; font-weight: 600; }
details[open] > summary { margin-bottom: 14px; }
.device-details, .control-card > details, article.card > details { margin-top: 18px; padding-top: 15px; border-top: 1px solid #ececf0; }
#clientMeta { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
pre { max-width: 100%; max-height: 380px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 10px; padding: 14px; color: #43434a; background: #f7f7f9; font: 12px/1.6 ui-monospace, "SFMono-Regular", Consolas, monospace; }
.performance-title, .performance-heading { align-items: center; }
.performance-range { display: grid; gap: 5px; min-width: 130px; color: var(--muted); font-size: 11px; }
.performance-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.performance-kpis > div { display: grid; gap: 5px; min-width: 0; padding: 15px; border: 1px solid #e6e6eb; border-radius: 12px; background: #fafafb; }
.performance-kpis span, .performance-kpis small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.performance-kpis strong { color: var(--ink); font-size: 24px; font-weight: 650; line-height: 1.25; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.performance-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.performance-chart-grid figure { min-width: 0; margin: 0; padding: 14px; border: 1px solid #e6e6eb; border-radius: 12px; }
.performance-chart-grid figcaption { margin-bottom: 12px; font-size: 12px; font-weight: 600; }
.performance-chart-grid canvas { display: block; width: 100%; max-width: 100%; height: 200px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.chart-legend span::before { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--accent); content: ""; }
.chart-legend .low::before, .chart-legend .gpu::before, .chart-legend .frame::before, .chart-legend .network::before { background: #18743b; }
.chart-legend .encoder::before, .chart-legend .p95::before { background: #a76000; }
.table-wrap { min-width: 0; max-width: 100%; overflow: auto; border: 1px solid #e6e6eb; border-radius: 10px; }
.table-scroll { min-width: 0; max-width: 100%; overflow: auto; border: 1px solid #e6e6eb; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { padding: 12px; border-bottom: 1px solid #ececf0; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); background: #f7f7f9; font-size: 11px; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
.runtime-events-table th:nth-child(1) { width: 150px; }
.runtime-events-table th:nth-child(2) { width: 75px; }
.recording-details summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.recording-details summary > span:first-child { display: grid; gap: 5px; min-width: 0; }
.recording-details summary small, .recording-status-note { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.recording-paths { display: grid; gap: 8px; min-width: 0; margin-top: 12px; }
.recording-paths > span { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; color: var(--muted); font-size: 12px; }
.recording-path-row { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; min-width: 0; border-top: 1px solid #ececf0; padding-top: 10px; font-size: 12px; }
.recording-path-row > * { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.recording-path-row code { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: 11px; }
.recording-status-card { min-width: 0; margin-top: 12px; }
.state-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.progress-block { display: grid; gap: 8px; margin-top: 12px; }
.progress-summary { display: flex; align-items: start; justify-content: space-between; gap: 12px; font-size: 12px; }
.progress-summary span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: #e8e8ed; }
.progress-fill { min-width: 0; height: 100%; border-radius: 99px; background: var(--accent); }
.progress-track.indeterminate .progress-fill { width: 38%; background: repeating-linear-gradient(120deg, #6c95c5 0 8px, #9bb5d7 8px 16px); }
.settings-intro-card, .settings-card { margin-bottom: 20px; }
.quota-note { display: grid; gap: 6px; margin: 16px 0; padding: 13px 14px; border-radius: 10px; color: var(--muted); background: #f7f7f9; font-size: 11px; }
.quota-note strong { color: #48484f; }
.settings-field-grid, .form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.toggle-row, .toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 0; font-size: 13px; cursor: pointer; }
.settings-toggle-list { border-top: 1px solid #ececf0; margin-top: 18px; padding-top: 8px; }
.settings-list-heading { align-items: center; margin: 16px 0 12px; font-size: 12px; }
.server-order-list, .server-choice-grid { display: grid; gap: 10px; min-width: 0; }
.server-order-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) repeat(3, auto); align-items: center; gap: 7px; min-width: 0; padding: 10px; border: 1px solid #e6e6eb; border-radius: 10px; background: #fafafb; }
.server-order-row button { min-width: 34px; min-height: 36px; padding: 6px 8px; }
.server-order-index { color: var(--muted); text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.server-order-empty { padding: 18px; color: var(--muted); font-size: 12px; text-align: center; }
.server-choice-grid label { display: grid; gap: 6px; font-size: 12px; }
.settings-save-bar { position: sticky; z-index: 5; bottom: 16px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; border: 1px solid #d5d5dd; border-radius: 13px; padding: 16px; background: #fff; box-shadow: 0 6px 24px rgb(0 0 0 / 8%); }
#settingsDirtyHint { color: var(--muted); font-size: 12px; }
.settings-ack-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.settings-ack-heading span, .settings-ack-status small { font-size: 11px; }
.key-values { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.key-values > div { display: grid; grid-template-columns: minmax(90px, .6fr) minmax(0, 1fr); gap: 12px; padding: 11px 13px; border-bottom: 1px solid #ececf0; font-size: 12px; overflow-wrap: anywhere; }
.key-values > div:last-child { border-bottom: 0; }
.alert-item { margin-top: 12px; padding: 12px; border-radius: 9px; color: var(--warn); background: var(--warn-tint); font-size: 12px; overflow-wrap: anywhere; }
.codex-progress-banner {
  --codex-progress-color: var(--accent);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-width: 0;
  margin: 24px 0 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 16px 18px;
  background: var(--panel);
}
.codex-progress-banner.pending { --codex-progress-color: var(--warn); }
.codex-progress-banner.ok { --codex-progress-color: var(--ok); }
.codex-progress-banner.error { --codex-progress-color: var(--danger); border-color: #e8c4c0; }
.codex-progress-overview { display: grid; gap: 7px; min-width: 0; }
.codex-progress-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.codex-progress-title-row strong { font-size: 12px; }
.codex-progress-banner p { margin: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.codex-progress-banner progress { appearance: none; width: 100%; height: 5px; border: 0; border-radius: 99px; overflow: hidden; background: #e8e8ed; }
.codex-progress-banner progress::-webkit-progress-bar { border-radius: 99px; background: #e8e8ed; }
.codex-progress-banner progress::-webkit-progress-value { border-radius: 99px; background: var(--codex-progress-color); }
.codex-progress-banner progress::-moz-progress-bar { border-radius: 99px; background: var(--codex-progress-color); }
.codex-progress-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 10px; }
.codex-progress-meta span { overflow-wrap: anywhere; }
.codex-progress-open { min-height: 36px; color: var(--accent); font-size: 11px; }
.codex-support-dialog { width: min(860px, calc(100vw - 40px)); max-height: calc(100dvh - 48px); overflow: auto; border: 1px solid #d7d7df; border-radius: 20px; padding: 28px; color: var(--ink); background: #fff; box-shadow: 0 24px 80px rgb(0 0 0 / 22%); }
.codex-support-dialog::backdrop { background: rgb(22 22 27 / 40%); }
.codex-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.codex-dialog-heading > div { min-width: 0; }
.codex-dialog-close { flex: 0 0 auto; min-height: 34px; padding: 7px 11px; }
.codex-message-grid { display: grid; gap: 16px; }
.codex-field[hidden] { display: none; }
.codex-log-option { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fafafb; }
.codex-log-toggle { display: flex; align-items: start; gap: 10px; cursor: pointer; }
.codex-log-toggle input { margin-top: 3px; }
.codex-log-toggle span { display: grid; gap: 5px; min-width: 0; }
.codex-log-toggle strong { font-size: 12px; }
.codex-log-toggle small { color: var(--muted); font-size: 11px; }
.codex-send-row, .codex-recovery-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.codex-recovery-row button { min-height: 34px; padding: 6px 10px; font-size: 11px; }
.codex-recovery-row small { flex-basis: 100%; color: var(--muted); font-size: 11px; }
.codex-security-note { margin: 0; border: 1px solid #eddab1; border-radius: 10px; padding: 12px 14px; color: var(--warn); background: var(--warn-tint); font-size: 11px; }
.codex-progress-section { margin-top: 24px; }
.codex-progress-section h3 { margin-bottom: 12px; }
.codex-progress-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.codex-progress-list li { display: flex; align-items: start; gap: 9px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafafb; }
.codex-progress-list li > span { display: grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; color: var(--muted); background: #e9e9ee; font-size: 11px; }
.codex-progress-list li > div { min-width: 0; }
.codex-progress-list li strong, .codex-progress-list li small { display: block; font-size: 11px; overflow-wrap: anywhere; }
.codex-progress-list li small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.codex-progress-list li[data-state="active"] { border-color: #eddab1; background: var(--warn-tint); }
.codex-progress-list li[data-state="done"] { border-color: #c5dec9; background: var(--ok-tint); }
.codex-progress-list li[data-state="error"] { border-color: #edc4c0; background: var(--danger-tint); }
.codex-progress-list li[data-state="done"] > span { color: #fff; background: var(--ok); }
.codex-progress-list li[data-state="error"] > span { color: #fff; background: var(--danger); }
.codex-response-card { display: grid; gap: 12px; margin-top: 24px; border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fafafb; }
.codex-response-card.in-progress { border-color: #eddab1; }
.codex-response-card.completed { border-color: #c5dec9; }
.codex-response-card.failed, .codex-response-card.interrupted { border-color: #edc4c0; }
.codex-response-heading, .codex-response-heading > div { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.codex-response-heading time, .codex-response-card > p { margin: 0; color: var(--muted); font-size: 11px; }
.codex-response-card pre { margin: 0; max-height: 420px; background: #fff; }
.codex-request-details { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.codex-request-details dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0 0; }
.codex-request-details dl > div { min-width: 0; padding: 11px; border-radius: 8px; background: #f7f7f9; }
.codex-request-details dl > div.wide { grid-column: 1 / -1; }
.codex-request-details dt { color: var(--muted); font-size: 10px; }
.codex-request-details dd { margin: 4px 0 0; font-size: 11px; overflow-wrap: anywhere; white-space: pre-wrap; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(420px, calc(100% - 32px)); border-radius: 12px; padding: 13px 18px; color: #fff; background: #29292e; font-size: 12px; box-shadow: 0 8px 30px rgb(0 0 0 / 18%); overflow-wrap: anywhere; }
.game-maintenance { min-width: 0; max-width: 100%; margin-bottom: 0; overflow-wrap: anywhere; }
.game-maintenance[hidden] { display: none; }
.game-maintenance h3 { margin-top: 0; }
.game-maintenance label { display: block; margin: 12px 0; font-size: 12px; }
.game-maintenance input[type="datetime-local"] { display: block; width: min(100%, 24rem); margin-top: 6px; }
.maintenance-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.maintenance-actions button { min-height: 44px; white-space: normal; }
.maintenance-warning { color: var(--warn); }
.maintenance-settings-status { border-left: 3px solid var(--accent); padding: 10px 12px; color: var(--accent); background: var(--accent-tint); font-size: 12px; }
@media (max-width: 1180px) {
  .overview-grid, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .header-actions { max-width: 300px; }
  .workspace { padding-inline: 24px; }
  .settings-field-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-sidebar { position: static; height: auto; padding: 18px 22px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .sidebar-brand { margin: 0 0 15px; }
  .sidebar-brand .app-brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 11px; }
  .sidebar-brand strong { font-size: 14px; }
  .sidebar-brand small, .sidebar-section-label, .sidebar-footnote { display: none; }
  .device-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; padding: 10px 12px; }
  .device-bar > button { grid-column: 1 / -1; justify-self: start; }
  .view-tabs, .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; border: 1px solid #d8d8df; border-radius: 10px; padding: 3px; background: #e4e4e9; }
  .tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .view-tabs button, .tabs button { justify-content: center; gap: 5px; min-height: 38px; border-radius: 7px; padding: 7px 5px; font-size: 12px; text-align: center; }
  .view-tabs button.active, .tabs button.active { border-color: #d7d7df; color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 6%); }
  .nav-icon { display: none; }
  .workspace { padding: 24px 22px 48px; }
  .app-header { gap: 14px; }
  .header-actions { max-width: 270px; }
  .header-badges { display: none; }
  .performance-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .codex-progress-list { grid-template-columns: 1fr; }
  .codex-progress-list li { align-items: center; padding: 10px 12px; }
}
@media (max-width: 700px) {
  .app-sidebar { padding: 10px 16px; }
  .workspace { padding: 12px 16px 40px; }
  .app-header { flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .brand-kicker, .brand-copy > p { display: none; }
  .app-header h1 { font-size: 20px; line-height: 1.25; }
  .header-actions { width: 100%; max-width: none; align-items: stretch; }
  .support-control { grid-template-columns: minmax(0, 1fr) auto; align-items: center; justify-items: start; gap: 4px 10px; }
  .support-control .support-button { width: 100%; font-size: 12px; }
  .support-control .support-status { grid-column: 1 / -1; font-size: 11px; line-height: 1.4; }
  .support-control .web-work-fallback-link { max-width: 132px; font-size: 11px; }
  .quota-badge { display: none; }
  .card { padding: 16px; border-radius: 15px; }
  .control-card .section-heading, #panelOverview article.card:first-child .section-title { margin-bottom: 12px; }
  .control-card .section-heading > .sub, #panelOverview article.card:first-child .section-title p { display: none; }
  .flow-server-card, .flow-box { gap: 6px; padding: 13px; }
  .row.buttons, .control-actions { margin: 14px 0; }
  .app-view, .tab-panel.active, .overview-grid, .grid { gap: 16px; }
  .device-bar,
  .grid.two,
  .video-grid { grid-template-columns: minmax(0, 1fr); }
  .device-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; padding: 8px 10px; }
  .device-bar label, .device-picker { grid-template-columns: 56px minmax(0, 1fr); align-items: center; }
  .device-picker { grid-column: 1 / -1; grid-row: 1; }
  .device-bar > div:not(.device-picker), .device-summary { grid-column: 1 / -1; grid-row: 2; gap: 2px; }
  #refreshButton { grid-column: 2; grid-row: 1; min-height: 44px; justify-self: end; padding: 7px 9px; }
  .device-summary strong, #deviceTitle { font-size: 12px; }
  .device-summary span, #deviceSummary { font-size: 12px; line-height: 1.4; }
  .sidebar-brand { display: none; }
  .view-tabs button, .tabs button { min-height: 40px; font-size: 11px; }
  .performance-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .performance-kpis > div { padding: 13px; }
  .performance-kpis strong { font-size: 22px; }
  .performance-chart-grid { grid-template-columns: minmax(0, 1fr); }
  .heading-row, .performance-title { flex-wrap: wrap; }
  .performance-chart-grid canvas { height: 180px; }
  .snapshot-placeholder, .empty { min-height: 180px; padding: 20px; }
  .field .inline, .server-switch-row { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .field .inline select, .server-switch-row select { width: 100%; }
  .form-grid, .settings-field-grid { grid-template-columns: minmax(0, 1fr); }
  .server-order-row { grid-template-columns: 22px minmax(0, 1fr) repeat(3, auto); gap: 4px; padding: 7px; }
  .server-order-row button { min-width: 30px; padding-inline: 5px; font-size: 11px; }
  .server-progress-row { grid-template-columns: minmax(0, 1fr) auto; }
  .server-progress-action { grid-column: 1 / -1; justify-self: stretch; min-height: 38px; }
  .recording-path-row { grid-template-columns: 1fr; gap: 4px; }
  .codex-progress-banner { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px; margin-top: 18px; }
  .codex-progress-open { width: 100%; }
  .codex-progress-meta { font-size: 10px; }
  .codex-support-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); padding: 20px; border-radius: 16px; }
  .codex-log-option, .codex-request-details dl { grid-template-columns: minmax(0, 1fr); }
  .codex-dialog-heading { gap: 12px; }
  .codex-dialog-heading h2 { font-size: 17px; }
  .codex-send-row { align-items: stretch; flex-direction: column; }
  .codex-recovery-row { align-items: stretch; }
  .codex-recovery-row button { flex: 1 1 auto; min-height: 40px; }
  .settings-save-bar { bottom: 8px; padding: 13px; }
  .settings-actions { width: 100%; }
  .settings-actions button { flex: 1 1 auto; min-height: 44px; }
  .table-wrap, .responsive-table { overflow: visible; border: 0; border-radius: 0; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td,
  .responsive-table table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; min-width: 0; max-width: 100%; }
  .table-wrap thead, .responsive-table thead { display: none; }
  .table-wrap tr, .responsive-table tr { margin-bottom: 12px; padding: 5px 11px; border: 1px solid #e6e6eb; border-radius: 10px; }
  .table-wrap td, .responsive-table td { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 9px 0; overflow-wrap: anywhere; word-break: break-word; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 550; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 550; }
  body.apple-ui :is(button, summary, select, input:not([type="checkbox"])) { min-height: 44px; }
  #refreshButton { min-height: 44px; }
  .support-control .web-work-fallback-link { display: inline-flex; align-items: center; min-height: 44px; }
  .toast { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
