:root {
  --bg: #070912;
  --bg2: #0c1020;
  --panel: #111628;
  --panel2: #161c33;
  --line: rgba(255, 255, 255, .08);
  --line2: rgba(255, 255, 255, .14);
  --text: #eef1fa;
  --muted: #9aa3bd;
  --accent: #7c6cff;
  --accent2: #22d3c5;
  --ok: #3ee08f;
  --warn: #ffb547;
  --bad: #ff5d6c;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
code, .mono { font-family: "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-size: .92em; }
.upper { text-transform: uppercase; letter-spacing: .12em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.45; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 14px; }
h1, h2, h3 { letter-spacing: -.02em; margin: 0; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 26px; height: 26px; border-radius: 8px; background: conic-gradient(from 210deg, var(--accent), var(--accent2), var(--accent)); box-shadow: 0 0 24px rgba(124, 108, 255, .45); }
.word { font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.brand.big .mark { width: 40px; height: 40px; border-radius: 12px; }
.brand.big .word { font-size: 32px; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.2fr 1fr; }
.login-brand { padding: 8vh 6vw; display: flex; flex-direction: column; justify-content: center; gap: 22px;
  background: radial-gradient(900px 600px at 15% 10%, rgba(124, 108, 255, .30), transparent 60%),
              radial-gradient(700px 500px at 80% 95%, rgba(34, 211, 197, .18), transparent 60%), var(--bg2); border-right: 1px solid var(--line); }
.tagline { font-size: clamp(32px, 4vw, 54px); line-height: 1.08; background: linear-gradient(90deg, #fff, #c9ceff 60%, #9ff5ec); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { font-size: 18px; color: var(--muted); max-width: 520px; margin: 0; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-brand { padding: 48px 24px; } }

/* cards & forms */
.card { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.form { display: flex; flex-direction: column; gap: 14px; width: min(420px, 100%); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select { background: #0a0e1c; border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 108, 255, .25); }
input[type=number] { width: 80px; }
.btn { border: 1px solid var(--line2); background: var(--panel2); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; transition: transform .08s ease, background .2s; }
.btn:hover { background: #1d2442; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5b8cff); border-color: transparent; color: #fff; }
.btn.accent { background: linear-gradient(135deg, var(--accent2), #22a3d3); border-color: transparent; color: #04121a; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

/* app shell */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; color: var(--muted); cursor: pointer; font-weight: 600; }
.nav button:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav button.active { background: rgba(124, 108, 255, .16); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.org { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.live { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.live span { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.live.stale span { background: var(--bad); box-shadow: none; }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; } .nav { flex-direction: row; flex-wrap: wrap; } .side-foot { display: none; } .main { padding: 18px; } }

.view { display: flex; flex-direction: column; gap: 20px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.view-head p { margin: 4px 0 0; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; border: 1px solid var(--line2); background: rgba(255, 255, 255, .04); }
.pill.ok { color: var(--ok); border-color: rgba(62, 224, 143, .35); background: rgba(62, 224, 143, .08); }
.pill.warn { color: var(--warn); border-color: rgba(255, 181, 71, .35); background: rgba(255, 181, 71, .08); }
.pill.bad { color: var(--bad); border-color: rgba(255, 93, 108, .35); background: rgba(255, 93, 108, .08); }
.pill.info { color: #a9b4ff; border-color: rgba(124, 108, 255, .4); background: rgba(124, 108, 255, .1); }
.pill.ghost { color: var(--muted); }
.pill .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi .v { font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.kpi .l { color: var(--muted); font-size: 13px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 14px 52px; position: relative; color: var(--muted); }
.steps li b { color: var(--text); display: block; }
.steps li::before { content: counter(s); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(124, 108, 255, .18); color: #fff; font-weight: 700; font-size: 13px; }

/* screens */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.screen-card { display: flex; flex-direction: column; gap: 10px; }
.screen-card .name { font-weight: 700; font-size: 16px; }
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.empty { border: 1px dashed var(--line2); border-radius: var(--radius); padding: 36px; text-align: center; color: var(--muted); }

/* library */
.drop { border: 1.5px dashed var(--line2); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); background: rgba(124, 108, 255, .04); }
.drop.over { border-color: var(--accent); background: rgba(124, 108, 255, .12); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.thumb { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #000; }
.thumb .meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.thumb .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* playlists */
.pl-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .pl-layout { grid-template-columns: 1fr; } }
.pl-list { display: flex; flex-direction: column; gap: 6px; }
.pl-item { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.pl-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 108, 255, .18); }
.editor { display: flex; flex-direction: column; gap: 18px; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item { display: grid; grid-template-columns: 22px 120px 1fr auto auto; gap: 12px; align-items: center; background: #0b0f1e; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.item.dragging { opacity: .4; }
.item.over { border-color: var(--accent); }
.item img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; display: block; }
.item .grip { cursor: grab; color: var(--muted); user-select: none; text-align: center; }
.item .n { font-weight: 600; }
.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tray button { padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; position: relative; }
.tray button img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.tray button span { position: absolute; inset: auto 0 0 0; font-size: 11px; padding: 4px 6px; background: rgba(0, 0, 0, .65); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray button:hover { border-color: var(--accent2); }
.assign { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.assign label { flex-direction: row; align-items: center; gap: 10px; background: #0b0f1e; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); cursor: pointer; }
.assign input { width: 18px; height: 18px; accent-color: var(--accent); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.section-title h3 { font-size: 15px; }
.publishbar { position: sticky; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: rgba(17, 22, 40, .92); border: 1px solid var(--line2); backdrop-filter: blur(8px); box-shadow: var(--shadow); flex-wrap: wrap; }

/* activity */
.log { display: flex; flex-direction: column; }
.log .e { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log .e .when { color: var(--muted); font-size: 13px; }

/* dialog & toasts */
.dialog { border: 1px solid var(--line2); border-radius: 18px; background: var(--panel); color: var(--text); padding: 22px; box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(3, 5, 12, .7); backdrop-filter: blur(3px); }
.toasts { position: fixed; right: 18px; top: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--ok); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 380px; font-size: 14px; }
.toast.err { border-left-color: var(--bad); }

/* ---------- 0.2.0: inline controls, segmented buttons, screen telemetry ---------- */
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.inline select { padding: 6px 10px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 8px 12px; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line2); }
.seg button.on { background: rgba(124, 108, 255, .22); color: #fff; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.now { margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.now img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; display: block; background: #000; }
.now figcaption { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 12px; background: #0b0f1e; }
.now.small figcaption { flex-direction: column; gap: 0; }
.empty-now { display: grid; place-items: center; aspect-ratio: 16 / 9; color: var(--muted); font-size: 13px; border: 1px dashed var(--line2); border-radius: 12px; background: #0b0f1e; }
.hint { font-size: 13px; line-height: 1.5; color: #ffd9a8; background: rgba(255, 181, 71, .08); border: 1px solid rgba(255, 181, 71, .3); border-radius: 10px; padding: 10px 12px; }
.hint a { color: #fff; }
.warn-text { color: var(--warn); }
.events summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.events ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- Studio ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 1150px) { .studio { grid-template-columns: 1fr; } }
.studio-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.stage-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sstage { position: relative; margin: 0 auto; background: #000; border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 0 1px var(--line2); }
.sstage.landscape { width: 100%; aspect-ratio: 16 / 9; }
.sstage.portrait { height: min(70vh, 720px); aspect-ratio: 9 / 16; }
.sframe { position: absolute; inset: 0; }
.sslide { position: absolute; inset: 0; opacity: 0; transition: opacity .7s ease; }
.sslide.on { opacity: 1; }
.sslide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sbadge { position: absolute; left: 10px; top: 10px; font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 99px; background: rgba(5, 7, 13, .7); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(6px); }
.sstage:fullscreen { width: 100vw; height: 100vh; max-width: none; aspect-ratio: auto; border-radius: 0; }
.sstage.portrait:fullscreen .sframe { inset: 0 calc(50vw - 28.125vh); }
.sprogress, .sloop { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.sloop { height: 3px; }
.sbar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.sloop-fill { height: 100%; width: 0; background: rgba(255, 255, 255, .35); }
.scontrols { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sinfo { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.stitle { font-weight: 700; }
.filmstrip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.film { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: #0b0f1e; }
.film.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 108, 255, .2); }
.film-thumb { position: relative; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: #000; }
.film-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.film-thumb span { position: absolute; left: 6px; top: 6px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: rgba(0, 0, 0, .65); }
.film-dur { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; }
.film-dur input { width: 70px; padding: 6px 8px; }
.studio-side { position: sticky; top: 16px; }
.live-list { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.live-item { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: #0b0f1e; }
.live-thumb.portrait .now img, .live-thumb.portrait .empty-now { aspect-ratio: 9 / 16; max-height: 220px; margin: 0 auto; }

/* Stage 2: locations tree, location picker, content-check setting */
.locpick { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.locpick select, .tree select, input.num { background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 5px 8px; }
input.num { width: 90px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 18px; padding-left: 14px; border-left: 1px solid var(--line2); }
.tree li { margin: 6px 0; }
.tree .node { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .02); }
.tree .node .lvl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); min-width: 64px; }
.tree .node.inactive b { color: var(--muted); text-decoration: line-through; }
.tree .tv { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; padding: 4px 10px; }
/* ---- workspaces (NXSA business / NXIA community) ---- */
.ws-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.ws-badge { display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .04em; border: 1px solid var(--line2); }
.ws-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
body[data-ws="NXSA"] .ws-badge { color: #7fb2ff; border-color: rgba(91, 140, 255, .45); background: rgba(91, 140, 255, .12); }
body[data-ws="NXIA"] .ws-badge { color: #4fe3a1; border-color: rgba(62, 224, 143, .45); background: rgba(62, 224, 143, .12); }
body[data-ws="NXIA"] { --accent: #2fbf86; --accent2: #7fe0c0; }
body[data-ws="NXIA"] .nav button.active { background: rgba(47, 191, 134, .16); }
.ws-switch select { padding: 4px 8px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; }
.nav-label { margin: 14px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.status-note { border-left: 3px solid var(--warn); padding: 10px 14px; background: rgba(255, 181, 71, .06); border-radius: 8px; font-size: 13px; }
.status-note b { color: var(--text); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.tbl tr.fri td { background: rgba(62, 224, 143, .05); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.form-grid input, .form-grid select, .ann-form input, .ann-form textarea { padding: 8px 10px; background: #0b0f1e; border: 1px solid var(--line2); border-radius: 8px; color: var(--text); }
.ann-form textarea { min-height: 90px; font: inherit; }
.ann { display: flex; flex-direction: column; gap: 6px; }
.iq-name { width: 80px; }
.iq-val { width: 130px; }
.ann-form.form { width: auto; }

/* Jumu'ah Prayer page (NXIA): congregation rows, scheduled changes, TV-style preview */
.jm-rows { display: grid; gap: 10px; margin: 12px 0; }
.jm-row { display: grid; grid-template-columns: 150px 120px 150px 1fr; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line2); border-radius: 10px; background: rgba(255, 255, 255, .02); }
.jm-row b { font-size: 15px; }
.jm-row input[type=time], .jm-change input[type=date] { padding: 8px 10px; background: #0b0f1e; border: 1px solid var(--line2); border-radius: 8px; color: var(--text); }
.jm-row .req { font-size: 12px; color: var(--muted); }
.jm-row.off { opacity: .6; }
.jm-msg { color: var(--bad); font-size: 13px; }
.jm-preview { display: inline-block; min-width: 260px; padding: 12px 18px; border-radius: 14px; border: 1px solid rgba(201, 162, 92, .35); background: linear-gradient(180deg, #14110c, #0b0a07); color: #f3ead6; }
.jm-preview .h { font-size: 12px; font-weight: 800; letter-spacing: .3em; color: #c9a25c; text-transform: uppercase; margin-bottom: 6px; }
.jm-preview .r { font-size: 15px; padding: 2px 0; }
.jm-preview .r span { color: #c9a25c; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-right: 8px; }
.jm-sched { display: grid; gap: 10px; }
.jm-sched .item { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--line2); border-radius: 10px; }
.jm-change { border-top: 1px solid var(--line2); margin-top: 14px; padding-top: 14px; }
