:root {
  color-scheme: light;
  --blue: #2456e0;
  --blue-strong: #1d49c6;
  --blue-soft: #edf2ff;
  --page: #f6f7fa;
  --surface: #ffffff;
  --surface-muted: #f9fafc;
  --ink: #171d2b;
  --muted: #788295;
  --muted-strong: #596477;
  --line: #e6e9ef;
  --line-strong: #d9deea;
  --green: #17865c;
  --green-soft: #eaf7f1;
  --red: #c44854;
  --red-soft: #fff0f1;
  --amber: #a76a0b;
  --amber-soft: #fff6e6;
  --shadow: 0 12px 32px rgba(22, 36, 67, .045);
  font-synthesis: none;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #10141c;
  --surface: #171e2a;
  --surface-muted: #1c2533;
  --ink: #eef2f8;
  --muted: #8793a7;
  --muted-strong: #b0bac9;
  --line: #293444;
  --line-strong: #38475d;
  --blue-soft: #1b2c52;
  --green: #56c99a;
  --green-soft: #17362c;
  --red: #ff8994;
  --red-soft: #3a2229;
  --amber: #edbd6c;
  --amber-soft: #392e1b;
  --shadow: 0 12px 32px rgba(0, 0, 0, .15);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); scroll-behavior: smooth; }
body {
  min-width: 320px; min-height: 100vh; margin: 0; background: var(--page); color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.shell { width: min(100% - 30px, 520px); margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 0 max(22px, env(safe-area-inset-bottom)); }
.topbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.brand img { width: 29px; height: 33px; object-fit: contain; flex: 0 0 auto; }
.brand-copy { display: grid; line-height: 1.15; gap: 4px; }
.brand-copy strong { font-size: 15px; font-weight: 760; letter-spacing: -.45px; }
.brand-copy small { color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: 1.55px; }
.top-actions { display: flex; align-items: center; gap: 11px; }
.connection-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #aab2c0; }
.status-dot.online { background: #1b9a6b; box-shadow: 0 0 0 3px color-mix(in srgb, #1b9a6b 13%, transparent); }
.icon-button { display: inline-grid; place-items: center; width: 37px; height: 37px; padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted-strong); cursor: pointer; transition: border-color .16s, color .16s, transform .16s; }
.icon-button:hover { border-color: var(--line-strong); color: var(--blue); }
.icon-button:active { transform: scale(.96); }
.icon-button svg { width: 16px; height: 16px; }
main { min-height: calc(100svh - 150px); }
.login-view { width: 100%; max-width: 410px; margin: clamp(42px, 10svh, 94px) auto 42px; }
.login-heading { margin: 0 0 25px; }
.eyebrow { color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: 1.65px; line-height: 1.3; }
h1, h2, p { margin-top: 0; }
.login-heading h1 { margin: 10px 0 10px; font-size: clamp(31px, 8.4vw, 39px); line-height: 1.04; letter-spacing: -1.65px; font-weight: 760; }
.login-heading p { max-width: 340px; margin: 0; color: var(--muted-strong); font-size: 13px; line-height: 1.65; }
.surface { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.login-card { padding: 20px; }
label { display: block; margin: 0 0 7px; color: var(--muted-strong); font-size: 11px; font-weight: 680; }
input, select { width: 100%; min-width: 0; height: 46px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 9px; outline: none; background: var(--surface-muted); color: var(--ink); font-size: 13px; transition: border-color .15s, box-shadow .15s, background-color .15s; }
input::placeholder { color: #a0a9b8; }
input:focus, select:focus { border-color: #7393f2; box-shadow: 0 0 0 3px rgba(36, 86, 224, .11); background: var(--surface); }
.key-field { height: 57px; text-align: center; font: 700 20px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 2px; }
.key-field::placeholder { color: #a5afc0; font-size: 18px; letter-spacing: 2px; }
.admin-key-field { height: 50px; }
.button { min-height: 45px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 740; cursor: pointer; transition: background .16s, border-color .16s, color .16s, transform .16s, opacity .16s; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button svg { width: 16px; height: 16px; }
.button-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--blue-strong); border-color: var(--blue-strong); }
.button-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.button-secondary:hover { color: var(--blue); border-color: #9ab0f1; }
.button-wide { width: 100%; margin-top: 11px; }
.button-wide svg { width: 15px; }
.form-message { min-height: 17px; margin: 9px 0 0; color: var(--red); text-align: center; font-size: 11px; }
.security-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.security-note svg { width: 15px; height: 15px; color: var(--green); }
.login-footnote { margin: 13px 10px 0; color: var(--muted); text-align: center; font-size: 10px; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 33px; padding: 12px 2px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.site-footer span:first-child { color: var(--muted-strong); font-weight: 700; }
/* Dashboard */
.dashboard { padding-top: 1px; animation: enter .28s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 1px 15px; }
.page-heading h1 { margin: 5px 0 0; font-size: 24px; line-height: 1.1; letter-spacing: -.9px; font-weight: 755; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 4px; border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.text-button svg { width: 14px; height: 14px; }
.text-button:hover { color: var(--blue-strong); }
.device-card { padding: 14px; }
.device-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.device-symbol { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); color: var(--blue); }
.device-symbol svg { width: 19px; height: 19px; }
.device-copy { display: grid; min-width: 0; gap: 2px; }
.device-copy strong { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 730; text-overflow: ellipsis; white-space: nowrap; }
.device-copy span { color: var(--muted); font-size: 10px; }
.presence-pill { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted-strong); font-size: 9px; font-weight: 670; white-space: nowrap; }
.presence-pill.is-online { border-color: color-mix(in srgb, var(--green) 25%, var(--line)); background: var(--green-soft); color: var(--green); }
.presence-pill .status-dot { width: 6px; height: 6px; flex-basis: 6px; }
.device-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.device-meta strong { color: var(--muted-strong); font-size: 10px; font-weight: 720; }
.device-meta strong.state-running { color: var(--green); }
.device-meta strong.state-paused { color: var(--amber); }
.section-block { margin-top: 23px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 0 1px 10px; }
.section-heading h2 { margin: 0; font-size: 13px; letter-spacing: -.15px; font-weight: 760; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.section-counter, .updated-label { color: var(--muted); font-size: 9px; white-space: nowrap; }
.command-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.command { min-width: 0; min-height: 93px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; padding: 11px 10px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; transition: border-color .16s, background .16s, transform .16s, opacity .16s; }
.command:not(:disabled):hover { border-color: #9bb1ef; background: var(--blue-soft); }
.command:not(:disabled):active { transform: scale(.985); }
.command:disabled { cursor: not-allowed; opacity: .47; }
.command-icon { display: grid; place-items: center; width: 27px; height: 27px; margin-bottom: 8px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); }
.command-icon svg { width: 14px; height: 14px; }
.command-start { border-color: var(--blue); background: var(--blue); color: #fff; }
.command-start .command-icon { background: rgba(255,255,255,.15); color: #fff; }
.command-start:not(:disabled):hover { border-color: var(--blue-strong); background: var(--blue-strong); }
.command-stop .command-icon { background: var(--red-soft); color: var(--red); }
.command strong { font-size: 11px; font-weight: 760; }
.command small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.command-start small { color: rgba(255,255,255,.77); }
.inline-message { min-height: 15px; margin: 7px 2px 0; color: var(--muted); font-size: 9px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.module-card { min-width: 0; min-height: 78px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.module-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 620; }
.module-mark { display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #aab2c0; }
.module-mark.good { background: var(--green); }
.module-mark.bad { background: var(--red); }
.module-mark.warning { background: var(--amber); }
.module-card strong { display: block; overflow: hidden; margin-top: 8px; color: var(--ink); font-size: 12px; font-weight: 740; text-overflow: ellipsis; white-space: nowrap; }
.module-card small { display: block; overflow: hidden; margin-top: 1px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.users-panel { overflow: hidden; box-shadow: none; }
.users-header, .user-row { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(96px,.7fr); align-items: center; gap: 10px; }
.users-header { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-muted); color: var(--muted); font-size: 9px; font-weight: 700; }
.users-header span:last-child, .user-row span:last-child { text-align: right; }
.user-row { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-name { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 690; text-overflow: ellipsis; white-space: nowrap; }
.user-detail { overflow: hidden; margin-top: 1px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.user-seen { color: var(--muted-strong); font-size: 9px; text-align: right; white-space: nowrap; }
.empty-state { padding: 17px 13px; color: var(--muted); font-size: 10px; text-align: center; }
.activity-panel { display: grid; grid-template-columns: 7px minmax(0,1fr) auto; align-items: start; gap: 9px; padding: 12px; box-shadow: none; }
.activity-indicator { display: block; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--blue); }
.activity-indicator.is-good { background: var(--green); }
.activity-panel p { margin: 0; color: var(--muted-strong); font-size: 10px; line-height: 1.5; }
.activity-panel time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.dashboard-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; }
.dashboard-footer > span { color: var(--muted); font-size: 9px; text-align: right; }
.text-button-muted { color: var(--muted-strong); font-weight: 620; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--ink); color: var(--surface); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* Creator console */
.admin-shell { max-width: 680px; }
.back-link { font-size: 10px; }
.admin-login { margin-top: clamp(32px, 7svh, 65px); }
.admin-view { animation: enter .28s ease both; }
.admin-summary { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.summary-card { min-height: 78px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 11px; box-shadow: none; }
.summary-card span { color: var(--muted); font-size: 9px; }
.summary-card strong { font-size: 21px; line-height: 1; letter-spacing: -.5px; }
.admin-create { margin-top: 14px; padding: 15px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.panel-heading h2 { margin: 0; font-size: 13px; font-weight: 750; }
.panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.panel-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); }
.create-form { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(120px,.8fr); gap: 10px; align-items: end; }
.field-group { min-width: 0; }
.field-group input, .field-group select { height: 43px; font-size: 11px; }
.create-form > .button { grid-column: 1 / -1; width: 100%; }
.generated-key { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px; border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line)); border-radius: 10px; background: var(--green-soft); }
.generated-key > div { min-width: 0; display: grid; gap: 4px; }
.generated-key .eyebrow { color: var(--green); font-size: 8px; }
.generated-key strong { color: var(--ink); font: 750 13px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .5px; overflow-wrap: anywhere; }
.generated-key small { color: var(--muted-strong); font-size: 9px; line-height: 1.4; }
.generated-key .button { min-height: 35px; flex: 0 0 auto; padding: 0 11px; font-size: 10px; }
.admin-registry { margin-top: 22px; }
.registry-tools { display: grid; grid-template-columns: minmax(0,1fr) 112px; gap: 8px; margin-bottom: 9px; }
.registry-tools input, .registry-tools select { height: 40px; font-size: 11px; }
.registry-list { display: grid; gap: 7px; }
.license-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.license-main { display: grid; min-width: 0; gap: 4px; }
.license-main strong { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 740; text-overflow: ellipsis; white-space: nowrap; }
.license-meta { color: var(--muted); font-size: 9px; line-height: 1.45; }
.license-status { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 9px; font-weight: 700; }
.license-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.license-status.expired { color: var(--amber); }
.license-status.revoked { color: var(--red); }
.revoke-button { min-height: 31px; flex: 0 0 auto; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--red); font-size: 9px; font-weight: 700; cursor: pointer; }
.revoke-button:hover { border-color: var(--red); background: var(--red-soft); }
.revoke-button:disabled { opacity: .4; cursor: not-allowed; }
.admin-view .dashboard-footer { padding-top: 10px; border-top: 1px solid var(--line); }
@media (min-width: 600px) {
  .shell { padding-top: 22px; }
  .topbar { margin-bottom: 28px; }
  .login-view { margin-top: 9svh; }
  .dashboard { padding-bottom: 15px; }
  .module-grid { gap: 9px; }
}
@media (max-width: 370px) {
  .shell { width: calc(100% - 24px); }
  .connection-label { font-size: 9px; }
  .command { padding: 10px 8px; }
  .command small { font-size: 8px; }
  .presence-pill { padding: 5px 6px; }
  .users-header, .user-row { grid-template-columns: minmax(0,1fr) 98px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.clipboard-fallback { position: fixed; opacity: 0; pointer-events: none; }