:root {
  --bg: #f4f6fa; --panel: #fff; --ink: #0b1b33; --muted: #5b6b85; --line: #dfe5ee; --accent: #0e7a6e; --accent-2: #2dd4bf;
  --warn: #b45309; --danger: #b91c1c; --navy: #0b1b33;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* auth */
body.auth { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.auth-card { width: min(420px, 92vw); background: #fff; border-radius: 14px; padding: 30px; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card p { margin: 0; }
.auth-card label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.auth-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.alert { background: #fef2f2; color: var(--danger); border-radius: 8px; padding: 8px 12px; }

.primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.primary:disabled { background: #9fb8b4; cursor: default; }
.ghost, .btn { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.btn:hover, .ghost:hover { border-color: #b9c4d6; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.danger { color: var(--danger); }
.btn.icon { width: 30px; height: 30px; padding: 0; justify-content: center; }

/* layout */
.top { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 18px; background: var(--navy); color: #fff; }
.top .muted { color: #a9b8d0; }
.top .ghost { background: transparent; color: #dbe5f5; border-color: #2a4470; }
.grow { flex: 1; }
.dirty { color: #fbbf24; font-weight: 600; font-size: 13px; }
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 56px); }
.side { background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; }
.side h6 { margin: 14px 8px 6px; font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.side a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 13px; }
.side a:hover { background: #f1f5f9; }
.side a.on { background: #e6f4f1; color: var(--accent); font-weight: 600; }
.side .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.side .uid { font-weight: 600; font-size: 12px; min-width: 54px; }
.side .warn { margin-left: auto; color: var(--warn); font-size: 11px; }
.main { padding: 22px 28px 80px; min-width: 0; }
h1.page { margin: 0 0 4px; font-size: 22px; }
.lead { margin: 0 0 18px; color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card > h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card > h3 .tag { font-size: 11px; background: #fff7ed; color: var(--warn); border-radius: 5px; padding: 2px 7px; font-weight: 700; letter-spacing: .05em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.full { grid-column: 1 / -1; }
.f { display: grid; gap: 5px; }
.f > span { font-size: 12px; font-weight: 600; color: #33435d; }
.f > small { color: var(--muted); font-size: 11.5px; }
.f input[type=text], .f input[type=password], .f input[type=number], .f select, .f textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.f textarea { resize: vertical; line-height: 1.45; }
.f input:focus, .f select:focus, .f textarea:focus { outline: 2px solid #99e3d8; border-color: var(--accent); }
.f.check { display: flex; align-items: center; gap: 8px; }
.f.check span { font-weight: 500; }
.f input[type=color] { width: 60px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
textarea.hi { font-family: "Nirmala UI", "Mangal", "Segoe UI", sans-serif; }

table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { background: #f8fafc; font-size: 12px; color: var(--muted); font-weight: 600; }
table.list tr.gaprow td { background: #f8fafc; font-weight: 700; font-size: 12px; letter-spacing: .06em; }
table.list td .acts { display: flex; gap: 4px; justify-content: flex-end; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill.pub { background: #e6f4f1; color: var(--accent); }
.pill.draft { background: #fff7ed; color: var(--warn); }
.pill.warn { background: #fff7ed; color: var(--warn); }
.pill.int { background: #fef3c7; color: #92400e; }

/* slides */
.slide-card { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: #fff; }
.slide-card.open { border-color: #9cc9c2; box-shadow: 0 4px 18px rgba(14,122,110,.08); }
.slide-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; }
.slide-head .n { width: 26px; height: 26px; border-radius: 7px; background: #eef2f7; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.slide-head .kind { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); min-width: 64px; }
.slide-head .ph { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #0b1b33; }
.slide-head .t { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide-head img { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.slide-head .acts { display: flex; gap: 4px; }
.slide-body { border-top: 1px solid var(--line); padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slide-body .col { display: grid; gap: 12px; align-content: start; }

.shot-ed { position: relative; background: #0b1730; border-radius: 8px; min-height: 180px; display: grid; place-items: center; overflow: hidden; user-select: none; }
.shot-ed .frame { position: relative; line-height: 0; cursor: crosshair; }
.shot-ed img { max-width: 100%; max-height: 360px; display: block; }
.shot-ed .hs { position: absolute; border: 3px solid #2dd4bf; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(3,10,24,.45); pointer-events: none; }
.shot-ed .empty { color: #a9b8d0; text-align: center; padding: 30px; line-height: 1.6; }
.drop { border: 2px dashed #9cc9c2; border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); background: #f8fffd; }
.drop.over { background: #e6f4f1; }

.audio-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.audio-row b { min-width: 92px; }
.audio-row .file { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.say-row { display: flex; gap: 6px; flex-wrap: wrap; }

.case-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 10px; background: #fbfcfe; }
.case-card .head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast.err { background: var(--danger); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .slide-body, .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* brand */
.brand-logo { height: 26px; display: block; }
.auth-card .card-logo { height: 34px; display: block; margin-bottom: 4px; }
.top .brand-logo { height: 24px; }

/* access gate */
body.gate { display: block; min-height: 100vh; background: radial-gradient(1200px 600px at 10% 0%, #13305c 0%, var(--navy) 55%); color: #fff; }
.gate-wrap { max-width: 1120px; margin: 0 auto; padding: 56px 24px 30px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; min-height: calc(100vh - 50px); }
.gate-logo { height: 46px; display: block; margin-bottom: 30px; }
.gate-intro .eyebrow { color: #2dd4bf; letter-spacing: .18em; font-weight: 700; font-size: 13px; margin: 0 0 10px; }
.gate-intro h1 { font-family: Cambria, Georgia, serif; font-size: clamp(30px, 4vw, 46px); line-height: 1.1; margin: 0 0 18px; }
.gate-intro p { font-size: 16px; line-height: 1.6; color: #dbe5f5; margin: 0 0 12px; }
.gate-intro .muted { color: #a9b8d0; }
.gate-card { color: var(--ink); width: 100%; }
.gate-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #eef2f7; border-radius: 10px; padding: 4px; gap: 4px; }
.gtab { border: 0; background: transparent; border-radius: 8px; padding: 9px; font-weight: 600; color: var(--muted); }
.gtab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.gpane { display: grid; gap: 12px; }
.gpane[hidden] { display: none; }
.gpane label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.gpane input, .gpane textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.gpane input[name=code] { font-size: 20px; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.gpane .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ok { background: #e6f4f1; color: var(--accent); border-radius: 8px; padding: 12px 14px; margin: 0; font-weight: 600; line-height: 1.5; }
.gate-foot { text-align: center; padding: 0 0 20px; }
.gate-foot a { color: #a9b8d0; font-size: 13px; }
@media (max-width: 860px) { .gate-wrap { grid-template-columns: 1fr; gap: 24px; padding-top: 28px; } .gpane .two { grid-template-columns: 1fr; } }

/* access admin */
.code { font-family: Consolas, monospace; font-weight: 700; letter-spacing: .06em; }
.pill.rej { background: #fef2f2; color: var(--danger); }
.pill.off { background: #eef2f7; color: var(--muted); }
textarea.invite { width: 100%; font-family: inherit; font-size: 13px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
