@font-face {
  font-family: "OKXSans";
  src: url("fonts/OKXSans-Regular.woff2") format("woff2");
  font-weight: 400;
}
@font-face {
  font-family: "OKXSans";
  src: url("fonts/OKXSans-300.woff2") format("woff2");
  font-weight: 300;
}
@font-face {
  font-family: "OKXSans";
  src: url("fonts/OKXSans-500.woff2") format("woff2");
  font-weight: 500;
}
@font-face {
  font-family: "OKXSans";
  src: url("fonts/OKXSans-600.woff2") format("woff2");
  font-weight: 600;
}
@font-face {
  font-family: "ok-f5350cc488";
  src: url("fonts/ok-f5350cc488-Regular.woff2") format("woff2");
  font-weight: 700;
}

:root {
  --background: #ffffff;
  --surface: #030303;
  --surface-2: #f5f5f5;
  --text-primary: #121212;
  --text-muted: #929292;
  --accent: #bcff2f;
  --border: #5e5e5e;
  --border-soft: #ebebeb;
  --card-border: #262626;
  --nav-bg: rgba(255,255,255,.88);
  --success: #31bd65;
  --warning: #ffb117;
  --danger: #eb4b6d;
  --radius: 18px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.165,.84,.44,1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #030303;
    --surface: #1a1a1a;
    --surface-2: #141414;
    --text-primary: #f5f5f5;
    --text-muted: #929292;
    --border: #393939;
    --border-soft: #262626;
    --card-border: #2e2e2e;
    --nav-bg: rgba(3,3,3,.86);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background: #030303;
  --surface: #1a1a1a;
  --surface-2: #141414;
  --text-primary: #f5f5f5;
  --text-muted: #929292;
  --border: #393939;
  --border-soft: #262626;
  --card-border: #2e2e2e;
  --nav-bg: rgba(3,3,3,.86);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; min-width: 320px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text-primary);
  font-family: "OKXSans", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 200ms var(--ease), color 200ms var(--ease);
}
h1, h2, h3 {
  font-family: "ok-f5350cc488", "OKXSans", sans-serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -.01em;
}
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Owner auth ---------- */
.auth-layer {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(3,3,3,.72);
  backdrop-filter: blur(14px);
}
.auth-card {
  width: min(420px, calc(100% - 32px));
  display: grid; gap: 14px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: 0 22px 70px rgba(0,0,0,.28);
}
.auth-card .brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
}
.auth-card .brand-mark span { width: 11px; height: 11px; border-radius: 3px; background: var(--accent); }
.auth-card label { display: grid; gap: 6px; color: var(--text-muted); font-size: 13px; }
.auth-card h1 { font-size: 20px; }
.auth-card p { margin: 0; color: var(--text-muted); line-height: 1.5; }
.auth-card .eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.auth-card output {
  display: block; min-height: 18px; color: var(--danger); font-size: 12px;
}
.owner-session {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 8px; font-size: 12px;
}
.owner-session > span:nth-child(2) { min-width: 0; flex: 1; }
.owner-session b, .owner-session small { display: block; }
.owner-session small { margin-top: 2px; color: var(--text-muted); font-size: 10px; }
.live-dot {
  display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 10px var(--success);
}
.text-button {
  min-height: auto; padding: 3px; border: 0; background: transparent; color: var(--accent);
  font-size: 12px; font-weight: 700;
}

/* ---------- Shell ---------- */
.ws-shell { display: flex; min-height: 100vh; align-items: flex-start; }

.ws-sidebar {
  width: 258px; flex: none;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 20px 14px;
  border-right: 1px solid var(--border-soft);
  background: var(--surface-2);
  transition: width 200ms var(--ease), padding 200ms var(--ease), opacity 150ms var(--ease);
}
.ws-shell.sidebar-collapsed .ws-sidebar {
  width: 0; padding-left: 0; padding-right: 0; border-right: 0; opacity: 0; overflow: hidden;
}
.sidebar-toggle {
  width: 36px; height: 36px; flex: none; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 150ms var(--ease);
}
.sidebar-toggle:hover { border-color: var(--accent); }
.sidebar-toggle svg { width: 18px; height: 18px; }
.ws-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 22px;
  font-family: "ok-f5350cc488", sans-serif;
  font-weight: 700; font-size: 15px;
}
.ws-brand .brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
}
.ws-brand .brand-mark span { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }

.ws-nav { display: grid; gap: 3px; }
.ws-nav button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; border: none;
  padding: 11px 10px; border-radius: 14px;
  background: transparent; color: var(--text-muted);
  font-family: inherit; transition: background 150ms var(--ease), color 150ms var(--ease);
}
.ws-nav button .idx { width: 20px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.ws-nav button b { display: block; font-size: 13px; font-weight: 600; color: inherit; }
.ws-nav button small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 11px; }
.ws-nav button:hover { background: var(--border-soft); color: var(--text-primary); }
.ws-nav button.active { background: var(--surface); color: #fff; }
.ws-nav button.active b, .ws-nav button.active .idx { color: var(--accent); }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; margin-left: 5px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; vertical-align: middle;
}

.ws-sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-soft); color: var(--text-muted); font-size: 11px; line-height: 1.6; }

.ws-main { flex: 1; min-width: 0; }
.ws-topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 32px; border-bottom: 1px solid var(--border-soft);
  background: var(--nav-bg); backdrop-filter: blur(10px);
}
.ws-topbar h1 { font-size: 22px; }
.ws-topbar p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; background: var(--surface); color: #fff;
  font-size: 11px; font-weight: 600; margin-bottom: 8px;
}
.eyebrow-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.theme-toggle {
  width: 36px; height: 36px; flex: none; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

main.ws-view-wrap { width: min(1180px, 100%); margin: 0 auto; padding: 28px 32px 70px; }
.ws-view { display: grid; gap: 20px; }
.ws-view[hidden] { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  border: none; transition: opacity 150ms var(--ease), transform 150ms var(--ease), background 150ms var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #121212; }
.btn-primary:hover { opacity: .88; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-ghost:hover { background: var(--border-soft); }
.btn-dark { background: var(--surface); color: #fff; }
.btn-dark:hover { opacity: .88; }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--surface); color: #fff;
  border: 1px solid var(--card-border); border-radius: var(--radius); padding: 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.card h2, .card h3 { color: #fff; }
.card p { color: #929292; }
.card-light {
  background: var(--surface-2); color: var(--text-primary);
  border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 22px;
}
.card-light p { color: var(--text-muted); }
.panel { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 22px; }
.panel > p.hint { margin: 6px 0 16px; color: var(--text-muted); font-size: 13px; line-height: 1.6; }

/* ---------- Forms ---------- */
.field-grid { display: grid; gap: 14px; }
.field-grid.cols-2 { grid-template-columns: 1fr 1fr; }
label.field { display: grid; gap: 6px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.channel-card.is-future { opacity: .5; cursor: not-allowed; }

.split-choice { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: stretch; }
.split-choice-option { display: grid; gap: 6px; align-content: start; }
.split-choice-divider { width: 1px; background: var(--border-soft); }
.split-choice-badge {
  justify-self: start; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2); color: var(--text-muted);
}
.split-choice-badge-ai { background: var(--accent); color: #0a0a0a; }
@media (max-width: 900px) {
  .split-choice { grid-template-columns: 1fr; }
  .split-choice-divider { width: 100%; height: 1px; }
}

/* ---------- Dialogs ---------- */
dialog {
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  background: var(--background); color: var(--text-primary);
  padding: 24px; min-width: min(440px, calc(100% - 32px));
}
dialog::backdrop { background: rgba(0,0,0,.5); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 4px; }

/* ---------- Video variants (content review) ---------- */
.video-variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; }
.video-variant { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); overflow: hidden; background: var(--background); }
.video-variant.is-chosen { border-color: var(--success); }
.video-variant-frame {
  aspect-ratio: 9/16; max-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 10px, var(--border-soft) 10px, var(--border-soft) 20px);
  color: var(--text-muted); padding: 10px; text-align: center;
}
.video-variant-frame .play-icon { width: 30px; height: 30px; border-radius: 999px; background: var(--surface); color: var(--accent); display: grid; place-items: center; font-size: 12px; }
.video-variant-frame .frame-note { font-size: 10px; line-height: 1.4; }
.video-variant-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; font-size: 11px; }

/* ---------- Calendar ---------- */
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 6px; }
.calendar-dow { text-align: center; font-size: 11px; color: var(--text-muted); font-weight: 700; padding-bottom: 4px; }
.calendar-day {
  position: relative; min-height: 64px; border: 1px solid var(--border-soft); border-radius: 10px;
  background: var(--background); padding: 6px; font-size: 12px; text-align: left;
}
.calendar-day.has-posts { border-color: var(--accent); cursor: pointer; }
.calendar-day.has-posts:hover { background: var(--surface-2); }
.calendar-day .day-num { color: var(--text-muted); }
.calendar-day .day-badge {
  position: absolute; top: 6px; right: 6px; display: grid; place-items: center;
  width: 18px; height: 18px; border-radius: 999px; background: var(--accent); color: #121212;
  font-size: 10px; font-weight: 800;
}
input, select, textarea {
  width: 100%; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--background); color: var(--text-primary); padding: 10px 12px; font-size: 13px;
}
textarea { min-height: 84px; resize: vertical; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }

.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.channel-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--background); cursor: pointer;
}
.channel-card input { width: auto; }
.channel-card .name { font-weight: 600; font-size: 13px; }
.channel-card .status { display: block; margin-top: 2px; font-size: 11px; color: var(--text-muted); }

/* ---------- Tags / badges ---------- */
.tag { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tag-success { background: rgba(49,189,101,.15); color: var(--success); }
.tag-warning { background: rgba(255,177,23,.15); color: var(--warning); }
.tag-accent { background: rgba(188,255,47,.18); color: color-mix(in srgb, var(--accent) 60%, var(--text-primary)); }
.tag-danger { background: rgba(235,75,109,.15); color: var(--danger); }

/* ---------- KPI / stats ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.kpi-card { background: var(--surface); border-radius: var(--radius); padding: 20px; color: #fff; }
.kpi-card span { display: block; color: #929292; font-size: 12px; font-weight: 600; }
.kpi-card strong { display: block; margin-top: 8px; font-family: "ok-f5350cc488", sans-serif; font-size: 28px; color: var(--accent); }

/* ---------- Lists ---------- */
.card-list { display: grid; gap: 10px; }
.entity-card { padding: 14px 16px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--background); }
.entity-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.entity-card h3 { margin: 0; font-size: 14px; }
.entity-card p { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.entity-card footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.entity-card.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2); width: fit-content; }
.tabs button { border: 0; border-radius: 7px; padding: 8px 13px; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 600; font-family: inherit; }
.tabs button.active { background: var(--background); color: var(--text-primary); }

.segmented { display: flex; gap: 3px; margin-top: 10px; padding: 3px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2); width: fit-content; }
.segmented button { border: 0; border-radius: 6px; padding: 6px 10px; background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 600; font-family: inherit; cursor: pointer; }
.segmented button.active { background: var(--accent); color: #0a0a0a; }
.segmented button:disabled { cursor: not-allowed; }

.two-col { display: grid; grid-template-columns: 1.3fr .9fr; gap: 18px; align-items: start; }
.empty-state { padding: 22px; border: 1px dashed var(--border-soft); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 13px; line-height: 1.6; }

.status-line { display: block; min-height: 18px; color: var(--text-muted); font-size: 12px; margin-top: 8px; }
.status-line.error { color: var(--danger); }
.status-line.success { color: var(--success); }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: grid; gap: 8px; width: min(340px, calc(100% - 40px)); }
.toast { padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: 0 10px 30px rgba(0,0,0,.15); font-size: 13px; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--surface); flex: none; display: grid; place-items: center; color: var(--accent); font-weight: 700; font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media (max-width: 980px) {
  .ws-shell { flex-direction: column; }
  .ws-sidebar { width: 100%; height: auto; flex-direction: row; overflow-x: auto; overflow-y: visible; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .ws-shell.sidebar-collapsed .ws-sidebar { width: 100%; height: 0; padding: 0; border-bottom: 0; }
  .ws-nav { grid-auto-flow: column; }
  .ws-sidebar-footer { display: none; }
  .two-col, .field-grid.cols-2, .channel-grid, .kpi-grid { grid-template-columns: 1fr; }
}
