:root {
  color-scheme: light dark;
  --bg: #f4f5f8;
  --card: #ffffff;
  --text: #1c2029;
  --secondary: #626b7b;
  --line: #e9ecf1;
  --blue: #245ddd;
  --blue-bg: #edf3ff;
  --green: #168044;
  --green-bg: #eaf7ef;
  --yellow: #a16a00;
  --yellow-bg: #fff5dc;
  --red: #bd3434;
  --red-bg: #fceeee;
  --neutral-bg: #f0f2f6;
  --shadow: 0 2px 5px rgb(32 45 75 / 2%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
button, input { border-radius: 12px; }
input { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; line-height: 1.3; letter-spacing: -.7px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.25px; }
h3 { font-size: 16px; font-weight: 650; }
.app-shell { max-width: 760px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 18px max(26px, env(safe-area-inset-bottom)); }
.app-header { display: flex; align-items: center; gap: 12px; padding: 8px 0 24px; }
.brand-mark { width: 44px; height: 44px; background: var(--text); color: var(--card); display: grid; place-items: center; border-radius: 14px; font-size: 24px; font-weight: 650; }
.brand-copy { flex: 1; }
.eyebrow { color: var(--secondary); font-size: 11px; letter-spacing: 1px; margin-bottom: 3px; }
.icon-button { border: 1px solid var(--line); color: var(--secondary); background: var(--card); width: 44px; height: 44px; font-size: 27px; line-height: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.connection-strip { padding: 0 3px 18px; }
.connection-main { display: flex; gap: 7px; align-items: center; }
.connection-main strong { font-size: 14px; }
.server-name { margin-left: auto; color: var(--secondary); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 48%; }
#last-update { color: var(--secondary); font-size: 12px; margin: 3px 0 0 15px; }
.status-dot { display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); }
.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); }
.section { margin: 24px 0; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 3px 12px; }
.small { font-size: 12px; }
.muted { color: var(--secondary); }
#session-label { text-align: right; max-width: 65%; overflow-wrap: anywhere; }
.recording-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.recording-card { padding: 15px 16px; min-height: 135px; }
.recording-title { display: flex; gap: 7px; align-items: center; font-size: 13px; color: var(--secondary); }
.recording-time { font-size: 28px; font-weight: 650; line-height: 1.3; letter-spacing: -.6px; font-variant-numeric: tabular-nums; margin: 7px 0 5px; }
.recording-caption { font-size: 11px; }
.recording-caption.green { color: var(--green); }
.recording-caption.yellow { color: var(--yellow); }
.recording-caption.red { color: var(--red); }
.control-card { padding: 18px 16px 14px; }
.control-card .section-heading { margin: 0 0 14px; }
.target-selector { display: flex; padding: 3px; border: 0; background: var(--neutral-bg); border-radius: 12px; margin: 0 0 16px; min-width: 0; }
.target-selector label { flex: 1; position: relative; min-width: 0; }
.target-selector input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.target-selector span { display: grid; place-items: center; min-height: 44px; border-radius: 9px; color: var(--secondary); font-size: 13px; cursor: pointer; }
.target-selector input:checked + span { color: var(--text); background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / 7%); font-weight: 600; }
.target-selector input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 1px; }
.target-selector:disabled { opacity: .65; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.action-button { min-height: 89px; border: 0; border-radius: 14px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 9px; font-size: 13px; font-weight: 650; }
.action-button.power { background: var(--blue-bg); color: var(--blue); }
.action-button.record { background: var(--blue); color: #fff; }
.action-button.stop { background: var(--red-bg); color: var(--red); }
.action-icon { height: 24px; width: 24px; display: block; }
.power-symbol { font-size: 27px; font-weight: 500; line-height: 24px; }
.record-symbol { background: currentColor; width: 19px; height: 19px; border-radius: 50%; margin: 2.5px; }
.stop-symbol { background: currentColor; width: 17px; height: 17px; border-radius: 4px; margin: 3.5px; }
.control-hint { margin-top: 12px; color: var(--secondary); font-size: 11px; line-height: 1.7; }
.notice, .command-feedback { padding: 12px 14px; border-radius: 12px; background: var(--yellow-bg); color: var(--yellow); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.notice { margin: 0 0 12px; }
.command-feedback { margin-top: 12px; }
.command-feedback[data-kind="info"] { background: var(--blue-bg); color: var(--blue); }
.command-feedback[data-kind="error"] { background: var(--red-bg); color: var(--red); }
.legend { display: flex; gap: 17px; flex-wrap: wrap; font-size: 11px; color: var(--secondary); margin: -3px 3px 13px; }
.legend > span { display: flex; align-items: center; gap: 5px; }
.legend .status-dot { width: 6px; height: 6px; flex-basis: 6px; }
.readiness-groups { display: grid; gap: 12px; }
.readiness-group { overflow: hidden; }
.group-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px; border-bottom: 1px solid var(--line); }
.group-summary { border-radius: 7px; padding: 3px 7px; font-size: 10px; white-space: nowrap; }
.group-summary.green { background: var(--green-bg); color: var(--green); }
.group-summary.yellow { background: var(--yellow-bg); color: var(--yellow); }
.group-summary.red { background: var(--red-bg); color: var(--red); }
.condition-list { margin: 0; padding: 0 16px; list-style: none; }
.condition-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.condition-item:last-child { border-bottom: 0; }
.condition-item > .status-dot { margin-top: 7px; }
.condition-copy { flex: 1; min-width: 0; }
.condition-title { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.condition-label { font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.condition-state { font-size: 10px; white-space: nowrap; color: var(--secondary); }
.condition-detail { color: var(--secondary); font-size: 11px; line-height: 1.65; margin-top: 2px; overflow-wrap: anywhere; white-space: pre-line; }
.commands-card { overflow: hidden; }
.command-history { padding: 0 16px; margin: 0; list-style: none; }
.command-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.command-item:last-child { border-bottom: 0; }
.command-item-heading { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.command-item time { color: var(--secondary); font-size: 11px; white-space: nowrap; }
.command-result { margin-top: 5px; color: var(--secondary); font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-line; }
.empty-state { color: var(--secondary); font-size: 12px; padding: 20px 16px; text-align: center; }
.app-footer { text-align: center; color: var(--secondary); font-size: 11px; padding: 0 4px 10px; }
.text-button { background: none; border: 0; color: var(--secondary); font-size: 12px; min-height: 44px; padding: 0 12px; }
.loading-card { min-height: 180px; display: flex; gap: 12px; align-items: center; justify-content: center; font-size: 14px; color: var(--secondary); }
.spinner { border: 2px solid var(--line); border-top-color: var(--blue); height: 20px; width: 20px; border-radius: 50%; animation: spin 1s linear infinite; }
.login-card { padding: 32px 24px; }
.login-symbol { background: var(--blue-bg); color: var(--blue); display: grid; place-items: center; height: 54px; width: 54px; border-radius: 16px; font-size: 28px; margin-bottom: 20px; }
.login-card h2 { font-size: 23px; margin-bottom: 10px; }
.login-card > .muted { font-size: 13px; }
#login-form { margin-top: 28px; }
.input-label { display: block; font-size: 12px; margin-bottom: 8px; }
#password { background: var(--bg); border: 1px solid var(--line); min-height: 50px; padding: 10px 14px; width: 100%; font-size: 16px; color: var(--text); }
.button { min-height: 48px; border: 0; padding: 11px 16px; font-size: 14px; font-weight: 600; }
.primary { background: var(--blue); color: #fff; width: 100%; margin-top: 14px; }
.secondary { background: var(--neutral-bg); color: var(--text); }
.danger { background: var(--red); color: #fff; }
.form-error { color: var(--red); font-size: 12px; margin-top: 14px; }
dialog { width: calc(100% - 36px); max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; color: var(--text); padding: 24px; box-shadow: 0 12px 60px rgb(0 0 0 / 20%); }
dialog::backdrop { background: rgb(0 0 0 / 45%); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 12px; }
dialog p { font-size: 13px; margin-bottom: 12px; line-height: 1.7; }
dialog .small { font-size: 11px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.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; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 640px) {
  .app-shell { padding-right: 28px; padding-left: 28px; }
  .recording-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .readiness-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .action-button { min-height: 100px; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111216; --card: #1c1e24; --text: #f0f2f7; --secondary: #a0a7b5; --line: #2a2d36; --blue: #79a5ff; --blue-bg: #1d2b48; --green: #73d59a; --green-bg: #1d3528; --yellow: #ecc16b; --yellow-bg: #3a3020; --red: #ff9696; --red-bg: #3d272b; --neutral-bg: #292c35; --shadow: none; }
  .action-button.record, .primary { background: #346bdd; color: #fff; }
  .danger { background: #c84146; color: #fff; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
