:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #f4eee4;
  background: #141923;
  --base: #141923;
  --sidebar: #10141c;
  --panel: #1b212d;
  --field: #151b25;
  --line: #354052;
  --muted: #aab4c3;
  --accent: #f4c47b;
  --ink: #201711;
  --success: #a4e0bc;
  --danger: #ffb4ac;
  --radius: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 3.45rem); font-weight: 680; letter-spacing: -.075em; line-height: 1.07; }
h2 { font-size: 1.1rem; font-weight: 680; letter-spacing: -.025em; }
h3 { font-size: 1.1rem; letter-spacing: -.025em; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-library, .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; }
.muted { color: var(--muted); line-height: 1.55; }
.eyebrow, .nav-label, .index { color: var(--muted); font-size: .69rem; font-weight: 720; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow { color: var(--accent); }
.boot { display: grid; min-height: 100vh; place-items: center; color: var(--muted); }
.layout { min-height: 100vh; display: grid; grid-template-columns: 218px minmax(0, 1fr); }
.sidebar { padding: 24px 16px 16px; display: flex; flex-direction: column; gap: 43px; border-right: 1px solid #293142; background: var(--sidebar); position: sticky; top: 0; height: 100vh; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 720; letter-spacing: -.04em; font-size: 1.12rem; padding-inline: 5px; width: fit-content; }
.brand-icon { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 10px; background: var(--accent); color: var(--ink); }
.brand-icon svg { width: 19px; height: 19px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-label { margin: 0 10px 7px; display: block; }
.sidebar nav a, .quiet { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font-size: .88rem; font-weight: 610; }
.sidebar nav a:hover, .quiet:hover { background: #202736; color: #fff; }
.sidebar nav a[aria-current="page"] { background: #2a2830; color: var(--accent); border-color: #493c33; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #293142; padding-top: 14px; }
.quiet { width: 100%; background: transparent; }
.workspace { width: 100%; max-width: 1510px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 58px) 42px; }
.topbar { min-height: 63px; border-bottom: 1px solid #30394b; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .81rem; }
.topbar b { color: var(--accent); margin: 0 5px; font-weight: 500; }
.badge { display: inline-flex; align-items: center; gap: 7px; flex: none; width: fit-content; padding: 5px 9px; border: 1px solid #4e5b70; border-radius: 999px; font-size: .69rem; font-weight: 650; color: #c5cedc; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.mock, .badge.unknown { color: var(--accent); border-color: #685035; background: #2d2522; }
.badge.succeeded, .badge.live { color: var(--success); border-color: #3d5d53; background: #202e2e; }
.badge.failed, .badge.revoked { color: var(--danger); border-color: #714b50; background: #35272c; }
.section-head { display: grid; gap: 10px; padding: clamp(24px, 4vw, 42px) 0 23px; }
.section-head .muted { max-width: 660px; font-size: .95rem; }
.studio-grid, .management-grid, .settings-grid { display: grid; grid-template-columns: minmax(305px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; padding: 17px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 31px; margin-bottom: 13px; }
.panel-head .index { color: #adb7c7; }
.compose, .stack { display: grid; align-content: start; gap: 13px; }
.compose .panel-head { margin-bottom: 0; }
.field { min-width: 0; display: grid; gap: 6px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { font-size: .79rem; font-weight: 620; }
.field > label:first-child { display: flex; justify-content: space-between; gap: 5px; align-items: baseline; }
small { font-size: .72rem; font-weight: 450; color: var(--muted); }
input:not([type="radio"], [type="file"]), textarea, select { width: 100%; color: inherit; border: 1px solid var(--line); background: var(--field); border-radius: 8px; padding: 9px 10px; min-height: 39px; font-size: .86rem; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #9ca8bb; }
.switch { border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 0; display: flex; background: var(--field); gap: 4px; }
.switch label { flex: 1; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.switch span { min-height: 33px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); }
.switch input:checked + span { background: #343041; color: #ffdda9; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); }
button, .button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 8px; padding: 7px 11px; font-size: .8rem; font-weight: 660; border: 1px solid transparent; border-radius: 8px; }
.primary { background: var(--accent); color: var(--ink); }
.primary:hover:not(:disabled) { background: #ffdaa1; }
.secondary { background: #242d3b; color: #edeff5; border-color: #455266; }
.secondary:hover:not(:disabled) { background: #334054; }
.wide { width: 100%; min-height: 42px; }
.button-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.upload-target { display: flex; align-items: center; gap: 9px; min-height: 53px; border: 1px dashed #64748b; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.upload-target:hover, #edit-inputs:focus-within .upload-target { border-color: var(--accent); }
.upload-target small { display: block; margin-top: 2px; }
.uploads:not(:empty) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.upload-card { margin: 0; min-width: 0; position: relative; }
.upload-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px; background: var(--field); }
.upload-card figcaption { font-size: .65rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-card button { position: absolute; top: 3px; right: 3px; min-height: 25px; min-width: 25px; padding: 2px; background: #10141c; color: white; }
.result { min-height: 100%; display: flex; flex-direction: column; }
.preview { flex: 1; min-height: 280px; display: grid; place-items: center; overflow: hidden; border: 1px solid #3c4658; border-radius: 11px; background: radial-gradient(circle, #495568 1px, transparent 1px) center / 17px 17px, #181e29; }
.preview-empty { max-width: 290px; display: grid; justify-items: center; gap: 8px; text-align: center; padding: 20px; }
.preview-empty p { font-size: .82rem; }
.preview-icon { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid #61503d; color: var(--accent); background: #302a2b; border-radius: 13px; margin-bottom: 5px; }
.preview-icon svg { width: 22px; height: 22px; }
.preview img { display: block; width: 100%; max-height: clamp(320px, 55vh, 680px); object-fit: contain; background: #141923; }
.result-footer { display: flex; align-items: center; justify-content: space-between; gap: 9px; flex-wrap: wrap; padding-top: 13px; font-size: .76rem; }
.notice { font-size: .82rem; border-radius: 8px; padding: 8px 10px; color: #d5dfef; background: #262f40; overflow-wrap: anywhere; }
.notice.error { color: var(--danger); background: #36252c; }
.notice.success { color: var(--success); background: #213332; }
#global-status { margin-top: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 14px; }
.metrics article { padding: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; min-width: 0; }
.metrics p { color: var(--muted); font-size: .75rem; }
.metrics strong { display: block; margin-top: 5px; font-size: clamp(1rem, 2.5vw, 1.7rem); overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .79rem; text-align: left; }
td, th { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); }
td:first-child { min-width: 150px; overflow-wrap: anywhere; }
td:not(:first-child) { white-space: nowrap; }
td small { display: block; margin-top: 3px; }
.key-list { padding: 0; margin: 0; list-style: none; }
.key-list li { display: grid; gap: 6px; border-top: 1px solid var(--line); padding: 11px 0; font-size: .83rem; overflow-wrap: anywhere; }
.key-list li > div { display: flex; justify-content: space-between; align-items: center; gap: 9px; flex-wrap: wrap; }
.key-list code, .folder { color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.key-list li button { justify-self: start; }
.issued { border-color: #725737; }
.issued p { color: var(--muted); font-size: .85rem; }
.issued input, .issued .button-row, .issued .notice { margin-top: 8px; }
.settings-panel > :not(:first-child) { margin-top: 12px; }
.rules { margin: 0; }
.rules dt { font-weight: 680; font-size: .87rem; margin-top: 12px; }
.rules dd { margin: 3px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.auth { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 24px; }
.auth-card { width: min(100%, 425px); z-index: 1; display: grid; gap: 13px; padding: clamp(20px, 6vw, 34px); border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.auth-card .brand { padding: 0; margin-bottom: 8px; }
.auth-card form { display: grid; gap: 8px; }
.auth-card form button { margin-top: 4px; justify-self: start; }
.auth-art { position: absolute; inset: 0; background: radial-gradient(circle at 50% 47%, #282334, #141923 62%); }
.auth-art span { position: absolute; top: 49%; left: 50%; width: min(90vw, 640px); aspect-ratio: 1; border: 1px solid #393344; transform: translate(-50%, -50%) rotate(45deg); border-radius: 16%; }
.auth-art span:nth-child(2) { width: min(75vw, 540px); }
.auth-art span:nth-child(3) { width: min(60vw, 440px); }
dialog { color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; max-width: min(90vw, 440px); padding: 18px; }
dialog p, dialog .button-row { margin-top: 10px; }
dialog::backdrop { background: #10141ccb; }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 175px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .workspace { padding-inline: 20px; }
  .studio-grid, .management-grid { grid-template-columns: minmax(265px, .85fr) minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 14px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); flex-flow: row wrap; align-items: center; justify-content: space-between; }
  .sidebar nav { display: flex; flex: 1 0 100%; order: 3; gap: 4px; flex-wrap: wrap; }
  .sidebar nav a { min-height: 34px; padding: 5px 7px; gap: 5px; font-size: .8rem; }
  .sidebar nav a svg, .sidebar-footer svg { width: 15px; height: 15px; }
  .nav-label { display: none; }
  .sidebar-footer { margin: 0; padding: 0; border: 0; }
  .quiet { min-height: 35px; padding: 5px 7px; font-size: .8rem; }
  .topbar { min-height: 43px; }
}
@media (max-width: 580px) {
  .workspace { padding-inline: 13px; }
  .studio-grid, .management-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview { min-height: 220px; }
}
td .job-error { white-space: normal; max-width: 200px; overflow-wrap: anywhere; }
.key-list li .key-actions { justify-content: flex-start; }
#key-dialog { padding: 0; width: min(90vw, 440px); }
#key-dialog .panel { border: 0; }
