:root {
  color-scheme: dark;
  --ground: #10151b;
  --sidebar: #131920;
  --panel: #19212a;
  --panel-deep: #161d25;
  --raised: #222d38;
  --border: #2c3a47;
  --text: #f1f5f8;
  --muted: #a5b4c1;
  --muted-strong: #c0ccd6;
  --accent: #79edca;
  --accent-bg: #19392f;
  --warning: #f8cf8d;
  --danger: #ffadad;
  --radius: 0.8rem;
  font-family: Inter, "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  background: var(--ground);
  color: var(--text);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 18rem; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--accent); text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
p { line-height: 1.55; }
button, .button {
  min-height: 2.55rem; border: 1px solid var(--border); padding: .53rem .82rem; border-radius: .56rem;
  background: var(--panel-deep); color: var(--text); display: inline-flex; gap: .48rem;
  align-items: center; justify-content: center; font-size: .875rem; font-weight: 600; text-align: center;
  line-height: 1.2; white-space: nowrap;
}
button:hover:not(:disabled), .button:hover { background: var(--raised); border-color: #476173; }
.primary { color: #10251f; background: var(--accent); border-color: var(--accent); font-weight: 720; }
.primary:hover:not(:disabled), .primary.button:hover { background: #a4f5dd; border-color: #a4f5dd; }
.ghost { background: transparent; border-color: transparent; color: var(--muted-strong); }
.danger { color: var(--danger); border-color: #66434a; background: #342428; }
.danger:hover:not(:disabled) { background: #4b2e35; border-color: #a36068; }
.icon-button { width: 2.5rem; padding: 0; font-size: 1.04rem; }
.small { min-height: 2.1rem; font-size: .875rem; padding: .35rem .6rem; }
.brand { color: var(--text); font-weight: 740; letter-spacing: -.03em; display: flex; gap: .6rem; align-items: center; font-size: 1.14rem; }
.brand-mark { width: 1.85rem; height: 1.85rem; display: inline-grid; place-items: center; border-radius: .5rem; background: var(--accent); color: #143229; flex: 0 0 auto; }
.brand-mark::before { content: ''; width: .88rem; height: .68rem; border: 1.65px solid currentColor; border-radius: .12rem; }
.brand-mark::after { content: ''; position: absolute; width: .22rem; height: .32rem; clip-path: polygon(0 0,100% 50%,0 100%); background: currentColor; }
.boot { display: flex; align-items: center; gap: .7rem; justify-content: center; min-height: 100vh; font-weight: 720; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 14.25rem minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.25rem .85rem .9rem; background: var(--sidebar); border-right: 1px solid var(--border); overflow: auto; }
.sidebar .brand { margin: .18rem .55rem 2rem; }
.sidebar-label { padding: .1rem .55rem .45rem; display: flex; justify-content: space-between; align-items: center; font-size: .875rem; font-weight: 650; color: var(--muted); }
.sidebar-label button { min-height: 1.8rem; width: 1.8rem; font-size: 1.18rem; }
.displays { display: grid; gap: .25rem; }
.display-link { display: flex; align-items: center; gap: .65rem; padding: .65rem .6rem; color: var(--muted-strong); border: 1px solid transparent; border-radius: .54rem; min-width: 0; line-height: 1.3; font-size: .9rem; }
.display-link:hover { background: var(--panel); color: var(--text); }
.display-link[aria-current] { background: #1a322c; border-color: #305248; color: var(--accent); }
.display-link .display-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.display-id { font-variant-numeric: tabular-nums; font-size: .78rem; color: var(--muted); }
.monitor { display: inline-block; width: .85rem; height: .62rem; border: 1.5px solid currentColor; border-radius: .13rem; position: relative; flex: 0 0 auto; }
.monitor::after { content: ''; position: absolute; width: .36rem; height: 1px; background: currentColor; top: calc(100% + .175rem); left: calc(50% - .18rem); }
.sidebar-footer { margin-top: auto; padding-top: 1rem; display: grid; gap: .5rem; }
.account { display: flex; gap: .62rem; align-items: center; min-width: 0; padding: .55rem; }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: #28433d; display: grid; place-items: center; flex: 0 0 auto; color: var(--accent); font-weight: 700; font-size: .8rem; }
.account-copy { min-width: 0; }
.account-email { color: var(--text); display: block; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.account-role { color: var(--muted); font-size: .77rem; }
.sidebar-footer .button, .sidebar-footer button { justify-content: flex-start; width: 100%; }
.workspace { min-width: 0; }
.topbar { height: 3.8rem; padding: 0 clamp(1rem,3vw,2.65rem); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .58rem; color: var(--muted); font-size: .875rem; }
.topbar strong { color: var(--text); font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { max-width: 96rem; margin: 0 auto; padding: 1.8rem clamp(1rem,3vw,2.65rem) 3rem; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .9rem; margin-bottom: 1.35rem; }
h1 { font-size: clamp(1.75rem,3vw,2.35rem); line-height: 1.12; letter-spacing: -.045em; }
.heading-meta { display: flex; align-items: center; gap: .7rem; margin-top: .46rem; color: var(--muted); font-size: .875rem; }
.header-actions, .toolbar, .button-row { display: flex; align-items: center; flex-wrap: wrap; gap: .53rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 19rem); gap: 1rem; align-items: start; }
.main-stack, .side-stack { min-width: 0; display: grid; gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-head { display: flex; gap: .75rem; justify-content: space-between; align-items: center; min-height: 3.15rem; padding: .7rem .9rem; }
.card h2 { font-size: .99rem; letter-spacing: -.014em; font-weight: 690; }
.card-note { color: var(--muted); font-size: .875rem; }
.preview-screen { position: relative; aspect-ratio: 16 / 9; background: #0a0e12; width: 100%; display: grid; place-items: center; overflow: hidden; }
.preview-screen img, .preview-screen video { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; }
.screen-empty { color: var(--muted-strong); text-align: center; padding: 1rem; display: grid; justify-items: center; gap: .62rem; }
.screen-empty .monitor { transform: scale(2); margin-bottom: .5rem; color: #6c8a9d; }
.screen-empty strong { font-size: 1.08rem; color: var(--text); }
.preview-details { min-height: 3.85rem; padding: .66rem .86rem; display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.preview-details .media-name { font-weight: 700; overflow-wrap: anywhere; }
.preview-details .card-note { font-size: .82rem; }
.status { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .42rem; border-radius: .3rem; background: #263442; color: var(--muted-strong); font-size: .78rem; line-height: 1.35; font-weight: 650; white-space: nowrap; }
.status.active { background: var(--accent-bg); color: var(--accent); }
.status.scheduled { background: #3c3426; color: var(--warning); }
.status.ended { background: #34303a; color: #d9bedc; }
.status.active::before { content: ''; width: .35rem; height: .35rem; background: var(--accent); border-radius: 50%; }
.queue-head { border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.queue { list-style: none; padding: .35rem .53rem .54rem; margin: 0; }
.queue-item { display: grid; grid-template-columns: 1.5rem minmax(0,1fr) auto; align-items: center; gap: .4rem; min-height: 4.4rem; padding: .36rem .32rem; border: 1px solid transparent; border-radius: .58rem; position: relative; }
.queue-item + .queue-item { border-top-color: #273440; }
.queue-item.is-selected { background: #20332e; border-color: #35564c; }
.queue-item.drop-before::before, .queue-item.drop-after::after { position: absolute; content: ''; height: 3px; background: var(--accent); left: .35rem; right: .35rem; border-radius: 9px; z-index: 2; }
.queue-item.drop-before::before { top: -2px; }
.queue-item.drop-after::after { bottom: -2px; }
.drag-handle { cursor: grab; color: #8fa6b7; text-align: center; user-select: none; font-weight: 700; letter-spacing: -.04em; }
.drag-handle:active { cursor: grabbing; }
.queue-item.is-dragging { opacity: .43; }
.sequence { font-size: .79rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.media-choice { background: transparent; border: 0; border-radius: .35rem; color: var(--text); min-width: 0; text-align: left; display: flex; justify-content: flex-start; padding: 0; gap: .68rem; white-space: normal; }
.media-choice:hover:not(:disabled) { background: #2a3b44; }
.thumb { width: 4.7rem; aspect-ratio: 16 / 10; flex: 0 0 auto; background: #121a22; border-radius: .36rem; border: 1px solid #314453; overflow: hidden; display: grid; place-items: center; color: #a8bac8; font-size: .96rem; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-copy { min-width: 0; display: grid; gap: .25rem; }
.media-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { color: var(--muted); display: flex; gap: .38rem; align-items: center; font-size: .8rem; font-weight: 500; flex-wrap: wrap; }
.row-tools { display: flex; gap: .18rem; align-items: center; }
.row-tools .icon-button { width: 2rem; min-height: 2.1rem; }
.details-button { width: 2rem; min-height: 2.1rem; padding: 0; font-weight: 700; font-size: 1.04rem; }
.empty-text { color: var(--muted); padding: 1.1rem .9rem 1.4rem; font-size: .9rem; line-height: 1.5; }
.side-card .card-head { min-height: 2.9rem; }
.side-card .card-body { padding: 0 .82rem .82rem; }
.drop-zone { display: flex; gap: .55rem; align-items: center; min-height: 3.3rem; padding: .64rem; border: 1px dashed #435766; border-radius: .55rem; background: #151e26; color: var(--muted-strong); font-size: .875rem; }
.drop-zone.is-over { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.drop-zone.is-over.trash { background: #462b31; border-color: var(--danger); color: var(--danger); }
.trash { margin-top: .6rem; }
.drop-icon { width: 1.65rem; text-align: center; flex: 0 0 auto; font-size: 1.18rem; color: inherit; }
.side-item { display: grid; grid-template-columns: minmax(0,1fr) auto; margin-top: .55rem; gap: .5rem; align-items: center; }
.side-item .thumb { width: 2.7rem; }
.side-item .media-choice { min-height: 2.2rem; }
.side-item .media-copy { font-size: .82rem; }
.card-divider { height: 1px; background: var(--border); margin: .75rem 0; }
.side-actions { display: flex; gap: .45rem; flex-wrap: wrap; }
.side-actions button { width: 100%; }
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 1.25rem; background: radial-gradient(ellipse at 52% 31%, #1a2c2e 0, var(--ground) 64%); }
.login-card { width: min(100%, 30rem); padding: clamp(1.45rem,5vw,2.4rem); background: var(--panel-deep); border: 1px solid var(--border); border-radius: 1rem; box-shadow: 0 1.6rem 4rem #05090e70; }
.login-card .brand { margin-bottom: 1.6rem; }
.login-card h1 { font-size: 2.1rem; margin-bottom: .48rem; }
.login-card p { color: var(--muted); margin-bottom: 1.3rem; }
.login-card .button { min-height: 2.9rem; }
.login-card .sign-error { color: var(--danger); font-size: .875rem; margin-top: .85rem; margin-bottom: 0; }
.empty-display { padding: 1.4rem; max-width: 40rem; }
.empty-display h2 { font-size: 1.2rem; margin-bottom: .4rem; }
.empty-display p { color: var(--muted); margin-bottom: .8rem; }
dialog { color: var(--text); background: var(--panel); border: 1px solid #425668; border-radius: .85rem; width: min(calc(100% - 2rem), 35rem); max-height: min(90vh, 49rem); padding: 0; box-shadow: 0 2rem 5rem #04080c99; }
dialog::backdrop { background: #080d13ad; }
.dialog-head, .dialog-body, .dialog-foot { padding: .95rem 1.05rem; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 1.21rem; letter-spacing: -.02em; }
.dialog-body { display: grid; gap: .86rem; }
.dialog-body p { color: var(--muted-strong); font-size: .9rem; }
.dialog-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--border); }
.field { display: grid; gap: .28rem; min-width: 0; }
.field label, .section-title { font-size: .875rem; font-weight: 650; color: var(--text); }
.field small, .form-note { color: var(--muted); font-size: .82rem; line-height: 1.45; }
input, select { width: 100%; min-width: 0; min-height: 2.5rem; color: var(--text); background: #111820; border: 1px solid #405263; border-radius: .45rem; padding: .48rem .56rem; font-size: .94rem; }
input[type=file] { padding: .65rem .55rem; border-style: dashed; }
input::file-selector-button { color: var(--text); background: var(--raised); border: 1px solid var(--border); border-radius: .3rem; padding: .2rem .4rem; margin-right: .4rem; }
.radio-tabs { display: flex; gap: .4rem; }
.radio-tabs button[aria-pressed=true] { background: var(--accent-bg); border-color: #4f8b7b; color: var(--accent); }
.form-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: .62rem; }
.form-error { color: var(--danger) !important; font-weight: 610; }
.progress { width: 100%; accent-color: var(--accent); height: .7rem; }
.clipboard-input { font-family: ui-monospace, monospace; font-size: .82rem; }
.copy-field { display: flex; gap: .48rem; }
.config { border: 1px solid var(--border); border-radius: .42rem; padding: .52rem; margin: 0; background: #111820; overflow: auto; font-size: .8rem; color: var(--accent); }
.grant-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: .45rem; font-size: .88rem; }
.grant-email { overflow-wrap: anywhere; }
.notice { position: fixed; z-index: 4; right: 1rem; bottom: 1rem; width: fit-content; max-width: min(36rem,calc(100% - 2rem)); border: 1px solid #436756; border-radius: .6rem; background: #203831; color: var(--text); padding: .75rem .95rem; box-shadow: 0 .7rem 2rem #080d1277; font-size: .91rem; }
.notice.error { background: #402a31; border-color: #83505a; }
@media (max-width: 1120px) {
  .layout { grid-template-columns: 11.4rem minmax(0,1fr); }
  .split { grid-template-columns: minmax(0, 1fr) minmax(13rem, 15rem); }
}
@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0,1fr); }
  .side-stack { grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; }
}
@media (max-width: 620px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: .65rem .75rem; border-right: 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; gap: .45rem; }
  .sidebar .brand { margin: 0; }
  .sidebar-label { display: none; }
  .displays { grid-row: 2; grid-column: 1 / -1; display: flex; overflow-x: auto; }
  .display-link { flex: 0 0 auto; padding: .44rem .56rem; max-width: 12rem; }
  .sidebar-footer { margin: 0; padding: 0; display: flex; align-items: center; }
  .sidebar-footer .account { display: none; }
  .sidebar-footer button { width: auto; min-height: 2.1rem; }
  .topbar { display: none; }
  .page { padding-top: 1.12rem; }
  .side-stack { grid-template-columns: minmax(0,1fr); }
  .thumb { width: 3.8rem; }
  .queue-item { grid-template-columns: 1.15rem minmax(0,1fr) auto; gap: .27rem; }
  .row-tools { gap: .05rem; }
  .row-tools .icon-button { width: 1.7rem; }
  .media-meta { gap: .25rem; }
  .media-choice { gap: .45rem; }
  .form-grid { grid-template-columns: minmax(0,1fr); }
}
.form-content { display: grid; gap: .82rem; }
.tv-settings > summary { cursor: pointer; color: var(--text); font-weight: 650; font-size: .875rem; }
.tv-settings[open] > :not(summary) { margin-top: .65rem; }
.thumb { position: relative; }
.thumb video { position: absolute; width: 100%; height: 100%; object-fit: cover; inset: 0; pointer-events: none; }
.thumb-play { z-index: 1; background: #081017b5; color: #f4f8fa; text-align: center; font-size: .7rem; line-height: 1.36rem; width: 1.36rem; border-radius: 50%; }
@media (min-width: 621px) { .sidebar-footer > button[data-action=create] { display: none; } }
