:root {
  color-scheme: dark;
  --back: #131513;
  --header: #191b18;
  --panel: #1b1e1a;
  --soft-panel: #21241e;
  --line: #363c31;
  --text: #f1f2e8;
  --muted: #a7ae9d;
  --green: #dcfa8b;
  --red: #ff8e77;
  --radius: 12px;
  font: 15px system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--back); color: var(--text) }
button, input, select { font: inherit }
button, select { cursor: pointer }
button { color: inherit }
button:disabled { cursor: default; opacity: .5 }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 3px }
a { color: inherit }
h1, h2, h3, p { margin: 0 }
h1 { font-size: clamp(2rem, 5.5vw, 3.65rem); font-weight: 660; line-height: 1.02; letter-spacing: -.065em }
h2 { font-size: 1.13rem; letter-spacing: -.025em }
h3 { font-size: .93rem; font-weight: 650 }
small { color: var(--muted) }

.app-header { min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 0 max(26px, calc((100vw - 1320px) / 2)); background: var(--header); border-bottom: 1px solid var(--line) }
.wordmark { background: transparent; border: 0; padding: 0; display: inline-flex; width: fit-content; gap: 10px; align-items: center; white-space: nowrap; font-weight: 730; font-size: 1.24rem; letter-spacing: -.065em }
.mark { width: 32px; height: 32px; background: var(--green); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 2.4px }
.mark i { display: block; width: 2px; background: #222b10; height: 8px; border-radius: 4px }
.mark i:nth-child(2n) { height: 13px }
.mark i:nth-child(3) { height: 18px }
nav { display: flex; gap: 4px; border: 1px solid var(--line); border-radius: 9px; padding: 4px }
nav button { background: transparent; border: 0; border-radius: 6px; padding: 7px 15px; color: var(--muted); font-weight: 600 }
nav button[aria-current] { background: #343b2b; color: var(--green) }
.join-button { justify-self: end }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 8px 13px; min-height: 36px; border: 1px solid transparent; border-radius: 7px; font-size: .88rem; font-weight: 650; white-space: nowrap }
.primary { background: var(--green); color: #232b13 }
.primary:hover { background: #ebffb8 }
.secondary { background: #242821; border-color: var(--line) }
.secondary:hover { background: #30372a }
.danger { color: var(--red); border-color: #573e32; background: #30251f }
.icon { border: 1px solid var(--line); background: transparent; border-radius: 7px; height: 32px; min-width: 32px }
.active-button { color: var(--green); border-color: #657343; background: #333c24 }

main { width: min(1320px, calc(100% - 52px)); margin: 0 auto; flex: 1; padding: 34px 0 46px }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 4px 0 28px }
.hero p { color: var(--muted); margin-top: 10px; max-width: 56ch }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: .73rem; text-transform: uppercase; font-weight: 720; letter-spacing: .1em; color: var(--muted) }
.eyebrow i, .status i { width: 7px; height: 7px; border-radius: 50%; background: #819467 }
.eyebrow.live { color: var(--red) }
.eyebrow.live i { background: var(--red) }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 330px); gap: 18px; align-items: start }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0 }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px }
.panel p { color: var(--muted); line-height: 1.5 }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px }
.modes, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px }
.modes button { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: .82rem; color: var(--muted) }
.modes button[aria-pressed=true] { background: #354226; color: var(--green); border-color: #596c3c }
.mixer { padding: 17px 17px 12px }
.mixer-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 31%); gap: 10px }
.mixer-console { display: flex; gap: 10px; padding: 0 1px 7px; overflow-x: auto; align-items: stretch }
.mixer-outputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-bottom: 7px }
.channel, .output { flex: 0 0 136px; border: 1px solid var(--line); border-radius: 8px; padding: 11px 8px; background: #242822; min-width: 0 }
.output { background: #2d3524; flex-basis: 145px }
.channel h3, .output h3 { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; padding: 0 2px }
.channel small, .output small { display: block; line-height: 1; margin: 5px 2px 0; font-size: .72rem }
.fader-wrap { display: flex; justify-content: center; align-items: stretch; gap: 10px; height: 109px; margin: 11px 0 9px }
.fader-wrap input { writing-mode: vertical-lr; direction: rtl; width: 22px; margin: 0; accent-color: var(--green) }
.meter { width: 8px; border-radius: 2px; align-self: stretch; background: #151a14; overflow: hidden; display: flex; align-items: end }
.meter span { height: 0; width: 100%; background: linear-gradient(0deg, #88b84f, #ddfb89 80%, #ffc479); transition: height 95ms linear }
.channel-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 4px }
.channel-buttons button { font-size: .72rem; background: #1b1f19; border: 1px solid var(--line); border-radius: 4px; min-height: 24px; padding: 2px }
.channel-buttons button[aria-pressed=true] { color: var(--green); background: #3d4b2b; border-color: #657747 }
.channel-buttons button[data-prop=onAir][aria-pressed=true] { color: #ffc6b5; background: #4e3329; border-color: #815443 }
.mixer-placeholder { display: grid; place-content: center; text-align: center; min-width: 145px; padding: 8px; color: var(--muted); border: 1px dashed var(--line); border-radius: 7px }

.row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px }
.list { display: grid; gap: 0; padding: 0; margin: 0; list-style: none }
.list li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding: 9px 0 }
.list li:first-child { border-top: 0; padding-top: 0 }
.list li:last-child { padding-bottom: 0 }
.list strong, .track-info strong { display: block; overflow-wrap: anywhere }
.track-info { min-width: 0 }
.track-deck { display: grid; gap: 12px }
.timeline { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums }
input[type=range] { width: 100%; accent-color: var(--green) }
.track-action { overflow-wrap: anywhere; text-align: left; border: 0; padding: 2px 0; color: var(--text); background: transparent }
.track-action:hover { text-decoration: underline }
.settings { display: grid; gap: 9px }
label { display: grid; gap: 5px; font-size: .84rem; color: var(--muted) }
label.inline { display: flex; align-items: center; gap: 7px }
input:not([type=checkbox],[type=range]), select { width: 100%; min-height: 37px; border: 1px solid var(--line); border-radius: 6px; background: #161a15; color: var(--text); padding: 6px 9px }
.invite { overflow: hidden; text-overflow: ellipsis; width: 100%; color: var(--muted); margin-top: 8px; font-size: .8rem; white-space: nowrap }
.pill { padding: 3px 7px; border-radius: 4px; color: var(--green); background: #2f3c21; font-size: .74rem; white-space: nowrap }
.pill.off { color: var(--muted); background: #2b2f28 }
.pill.live { color: var(--red); background: #3c2922 }
.empty { padding: 4px 0 }
footer { display: flex; gap: 10px; justify-content: space-between; background: var(--header); border-top: 1px solid var(--line); padding: 11px max(26px, calc((100vw - 1320px) / 2)); color: var(--muted); font-size: .78rem }
.status { display: inline-flex; gap: 8px; align-items: center }
dialog { width: min(410px, calc(100% - 28px)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); padding: 20px }
dialog::backdrop { background: #000a }
dialog form { display: grid; gap: 12px }
dialog .panel-title { margin: 0 }
#notice { position: fixed; z-index: 2; right: 22px; bottom: 48px; max-width: min(420px, calc(100% - 44px)); background: #2b3125; padding: 11px 16px; border: 1px solid #5d6a4e; border-radius: 8px }
#notice.error, #join-error { color: var(--red) }
.footer-button { background: transparent; border: 0; text-decoration: underline; color: var(--text) }
#server-error { color: var(--red) }

@media (max-width: 790px) {
  main { width: calc(100% - 30px); padding-top: 23px }
  .columns { grid-template-columns: minmax(0, 1fr) }
  .app-header { padding: 11px 15px; grid-template-columns: 1fr auto; gap: 9px }
  nav { order: 3; grid-column: 1 / -1; justify-content: stretch }
  nav button { flex: 1 }
  .hero { flex-wrap: wrap; gap: 12px; padding-bottom: 19px }
  .panel, .mixer { padding: 12px }
  .mixer-layout { grid-template-columns: minmax(0, 1fr) }
  .mixer-outputs .fader-wrap { height: 70px }
  footer { padding-right: 15px; padding-left: 15px }
}
[hidden] { display: none !important }
.auth-link { background: none; border: 0; color: var(--green); padding: 6px 0; margin-right: 10px; text-decoration: underline; text-underline-offset: 3px }
.auth-error { color: var(--red) }
.reset-panel { max-width: 460px }
.tenant-settings { grid-template-columns: repeat(2, minmax(105px, 1fr)) auto; align-items: end }
#admin-status { margin: 12px 0 }
@media (max-width: 620px) {
  .tenant-settings { grid-template-columns: 1fr; width: 100% }
}
