@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --table: #e8ebee;
  --sheet: #f7f8f9;
  --sheet-2: #eef0f3;
  --ink: #12161b;
  --ink-2: #444c56;
  --ink-3: #6b7480;
  --line: #cfd5dc;
  --line-2: #e0e4e9;
  --accent: #2a49f0;
  --accent-ink: #ffffff;
  --accent-soft: #dfe5ff;
  --s-draft: #5b6470;
  --s-scheduled: #2a49f0;
  --s-publishing: #8a5a00;
  --s-published: #1c6e46;
  --s-failed: #b3261e;
  --s-missed: #96480a;
  --radius: 4px;
  --radius-lg: 8px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--table);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
}
table, .tnum, .cal-day-num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 40px; color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--sheet); font-weight: 560;
}
.btn:hover { background: #fff; border-color: #b6bec8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #1f3bd0; }
.btn.danger { color: var(--s-failed); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--sheet-2); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { padding: 0; width: 36px; justify-content: center; }
.btn.sm.icon { width: 30px; }

.field { display: grid; gap: 4px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="password"], input[type="search"], input[type="datetime-local"], input[type="time"], select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
input:disabled, textarea:disabled { background: var(--sheet-2); }
.hint { font-size: 13px; color: var(--ink-3); }
.hint.warn { color: var(--s-missed); }
.hint.bad { color: var(--s-failed); }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 0 20px; min-height: 52px;
  background: var(--ink); color: #eef1f5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; color: #fff; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.brand-mark i { background: #fff; display: block; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: 0.45; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a {
  color: #b9c1cb; text-decoration: none; padding: 15px 12px 13px; font-weight: 560;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav a:hover { color: #fff; }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }
.who { font-size: 13px; color: #b9c1cb; white-space: nowrap; }
.banners { display: grid; }
.banner {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 9px 20px; font-size: 14px; border-bottom: 1px solid var(--line);
  background: #fff7e0; color: #5c3d00;
}
.banner.bad { background: #fde8e6; color: #7a1a14; }
.banner a { color: inherit; font-weight: 650; }
main { flex: 1; padding: 20px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .grow { flex: 1; }
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-pad { padding: 16px; }

/* ---------- status chips ---------- */
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; color: var(--c, var(--ink-2)); }
.status[data-s="draft"] { --c: var(--s-draft); }
.status[data-s="scheduled"] { --c: var(--s-scheduled); }
.status[data-s="publishing"] { --c: var(--s-publishing); }
.status[data-s="published"] { --c: var(--s-published); }
.status[data-s="failed"] { --c: var(--s-failed); }
.status[data-s="missed"] { --c: var(--s-missed); }

/* ---------- calendar page ---------- */
.cal-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.side { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; overflow: hidden; }
.side-head { padding: 12px 12px 8px; display: grid; gap: 8px; border-bottom: 1px solid var(--line-2); }
.side-grid { overflow: auto; padding: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-content: start; }
.side-toggle { display: none; }
.cal-main { min-width: 0; }
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-bar h2 { font-size: 20px; min-width: 190px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.seg button { border: 0; background: transparent; min-height: 34px; padding: 0 12px; font-weight: 560; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--sheet); }
.dow { padding: 8px 8px; font-size: 12px; font-weight: 650; color: var(--ink-3); background: var(--sheet-2); border-bottom: 1px solid var(--line); }
.day {
  min-height: 118px; padding: 4px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  display: flex; flex-direction: column; gap: 3px; position: relative; background: var(--sheet);
}
.day:nth-child(7n+14) { border-right: 0; }
.day.other { background: var(--sheet-2); }
.day.past .num { color: var(--ink-3); }
.day.over, .slot.over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -3px; }
.day-top { display: flex; align-items: center; justify-content: space-between; }
.num { font-size: 13px; font-weight: 650; padding: 2px 5px; border-radius: 10px; }
.day.today .num { background: var(--accent); color: #fff; }
.add-day { opacity: 0; border: 0; background: transparent; width: 24px; height: 24px; border-radius: 4px; color: var(--ink-3); }
.day:hover .add-day, .add-day:focus-visible { opacity: 1; }
.add-day:hover { background: var(--sheet-2); }
.more { border: 0; background: transparent; text-align: left; font-size: 12px; color: var(--ink-3); padding: 1px 4px; }

.chip {
  display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; text-align: left;
  border: 1px solid var(--line); border-left: 3px solid var(--c, var(--s-draft)); border-radius: 3px; background: #fff;
  padding: 2px 5px 2px 2px; font-size: 12px; line-height: 1.2;
}
.chip[data-s="draft"] { --c: var(--s-draft); }
.chip[data-s="scheduled"] { --c: var(--s-scheduled); }
.chip[data-s="publishing"] { --c: var(--s-publishing); }
.chip[data-s="published"] { --c: var(--s-published); }
.chip[data-s="failed"] { --c: var(--s-failed); }
.chip[data-s="missed"] { --c: var(--s-missed); }
.chip:hover { border-color: #aeb7c2; border-left-color: var(--c); }
.chip.dragging { opacity: 0.4; }
.chip img, .chip .ph { width: 22px; height: 22px; object-fit: cover; border-radius: 2px; flex: none; background: var(--sheet-2); }
.chip .t { font-weight: 650; flex: none; }
.chip .tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); min-width: 0; }

.week { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--sheet); overflow: auto; max-height: calc(100vh - 190px); }
.week-grid { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 860px; }
.week-head { position: sticky; top: 0; z-index: 2; background: var(--sheet-2); padding: 8px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 650; }
.week-head.today { color: var(--accent); }
.hour { padding: 4px 6px; font-size: 12px; color: var(--ink-3); text-align: right; border-bottom: 1px solid var(--line-2); }
.slot { min-height: 54px; padding: 2px; border-left: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 2px; cursor: default; }
.slot.past { background: var(--sheet-2); }

/* ---------- library tiles ---------- */
.tile {
  position: relative; display: grid; gap: 3px; text-align: left; border: 0; padding: 0; background: transparent; min-width: 0;
}
.frame {
  position: relative; aspect-ratio: 1; background: #1a1f26; border-radius: 3px; overflow: hidden;
  border: 1px solid #1a1f26;
}
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .ph { display: grid; place-items: center; width: 100%; height: 100%; color: #8f99a6; font-size: 22px; }
.tile[draggable="true"] { cursor: grab; }
.tile:hover .frame { border-color: var(--accent); }
.tile.selected .frame { outline: 3px solid var(--accent); outline-offset: 1px; }
.badge {
  position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 650; padding: 1px 5px; border-radius: 3px;
  background: rgba(18, 22, 27, 0.82); color: #fff;
}
.badge.used { left: auto; right: 4px; bottom: auto; top: 4px; background: var(--s-published); }
.badge.sched { left: auto; right: 4px; bottom: auto; top: 4px; background: var(--s-scheduled); }
.tile .name { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .pick { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; accent-color: var(--accent); }
.tile-add { position: absolute; right: 4px; bottom: 22px; opacity: 0; }
.tile:hover .tile-add, .tile:focus-within .tile-add { opacity: 1; }
@media (hover: none) { .tile-add { opacity: 1; } .add-day { opacity: 1; } }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"] { max-width: 240px; }
.toolbar select { width: auto; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius-lg); padding: 22px; text-align: center; color: var(--ink-3); background: var(--sheet);
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.uploads { display: grid; gap: 6px; margin: 12px 0; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; padding: 8px 10px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
.bar { grid-column: 1 / -1; height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; }
.upload-row.err .msg { color: var(--s-failed); }
.selbar { position: sticky; bottom: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--ink); color: #fff; border-radius: var(--radius-lg); margin-top: 14px; }
.selbar .btn { background: transparent; color: #fff; border-color: #55606d; }
.selbar .btn:hover { background: #2a323b; }

.empty { text-align: center; padding: 42px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18, 22, 27, 0.55); display: grid; place-items: start center; overflow: auto; padding: 4vh 12px; z-index: 50; }
.modal { width: min(880px, 100%); background: var(--sheet); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.modal.narrow { width: min(520px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 18px; display: grid; gap: 16px; }
.modal-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--sheet-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-foot .grow { flex: 1; }
.composer { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.strip { display: flex; gap: 8px; flex-wrap: wrap; }
.strip .item { width: 86px; display: grid; gap: 3px; }
.strip .frame { aspect-ratio: 4 / 5; }
.strip .ctl { display: flex; justify-content: space-between; }
.strip .add { width: 86px; aspect-ratio: 4 / 5; border: 2px dashed var(--line); border-radius: 3px; background: transparent; color: var(--ink-3); }
.strip.over .add { border-color: var(--accent); background: var(--accent-soft); }
.seg-type { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-type button { border: 1px solid var(--line); background: #fff; border-radius: var(--radius); min-height: 34px; padding: 0 12px; font-weight: 560; }
.seg-type button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.counter { text-align: right; font-size: 12px; color: var(--ink-3); }
.counter.bad { color: var(--s-failed); font-weight: 650; }
.notice { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; background: #fde8e6; color: #7a1a14; border: 1px solid #f3c1bd; }
.notice.info { background: var(--accent-soft); color: #14257a; border-color: #bfcbff; }
.history { font-size: 13px; color: var(--ink-2); }
.history li { margin: 2px 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--ink-3); }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; max-height: 50vh; overflow: auto; }

/* ---------- templates ---------- */
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.tpl { padding: 12px 14px; display: grid; gap: 6px; }
.tpl pre { margin: 0; white-space: pre-wrap; font: inherit; color: var(--ink-2); max-height: 7.5em; overflow: hidden; }
.tpl .row { display: flex; gap: 6px; }
.stack { display: grid; gap: 10px; }

/* ---------- analytics ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile-stat { padding: 14px; }
.tile-stat .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.tile-stat .l { font-size: 13px; color: var(--ink-3); }
.tile-stat .d { font-size: 13px; color: var(--ink-2); }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.chart-card { padding: 14px 16px 12px; position: relative; }
.chart-card h3 { margin-bottom: 2px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--ink-3); font: 11px var(--font); }
.tooltip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 8px; border-radius: 4px; white-space: nowrap; z-index: 5; transform: translate(-50%, -100%); }
.heat { display: grid; grid-template-columns: 38px repeat(8, 1fr); gap: 2px; font-size: 11px; }
.heat .c { aspect-ratio: 1.5; border-radius: 2px; background: var(--sheet-2); position: relative; }
.heat .hl { color: var(--ink-3); align-self: center; text-align: right; padding-right: 4px; }
.heat .ch { color: var(--ink-3); text-align: center; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data td.num, table.data th.num { text-align: right; }
table.data img { width: 40px; height: 40px; object-fit: cover; border-radius: 3px; display: block; background: var(--sheet-2); }
.scroll-x { overflow-x: auto; }
.legend-note { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

/* ---------- settings / login ---------- */
.settings { display: grid; gap: 16px; max-width: 760px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--sheet-2); padding: 1px 5px; border-radius: 3px; }
.ok { color: var(--s-published); font-weight: 650; }
.bad-t { color: var(--s-failed); font-weight: 650; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; }
.login .brand { color: var(--ink); }
.login .brand-mark i { background: var(--ink); }

#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(460px, calc(100vw - 24px)); }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.bad { background: var(--s-failed); }

@media (max-width: 1000px) {
  .cal-layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; display: none; }
  .side.open { display: flex; }
  .side-toggle { display: inline-flex; }
  .side-grid { grid-template-columns: repeat(4, 1fr); max-height: 300px; }
  .composer { grid-template-columns: 1fr; }
  .charts, .cols { grid-template-columns: 1fr; }
  .day { min-height: 92px; }
}
@media (max-width: 640px) {
  main { padding: 12px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .who { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 1fr; }
  .chip .tx { display: none; }
  .day { min-height: 70px; }
  .side-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
button.frame { display: block; width: 100%; padding: 0; cursor: inherit; }
.btn.disabled { opacity: 0.5; pointer-events: none; }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--accent-ink); }

/* ---------- Assistant ---------- */
.ai-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.ai-chats { display: grid; gap: 6px; align-content: start; }
.ai-chat-row { display: flex; align-items: center; gap: 2px; border-left: 3px solid transparent; }
.ai-chat-row[aria-current="true"] { border-left-color: var(--accent); background: var(--sheet); }
.ai-chat-open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 6px 8px; cursor: pointer; font: inherit; color: var(--ink); display: grid; }
.ai-chat-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ai-chat-open small { color: var(--ink-3); }
.ai-main { display: grid; grid-template-rows: minmax(340px, 60vh) auto; overflow: hidden; }
.ai-thread { overflow-y: auto; padding: 16px; display: grid; gap: 12px; align-content: start; }
.ai-empty { max-width: 56ch; margin: 24px auto; display: grid; gap: 10px; }
.ai-suggest { display: grid; gap: 6px; justify-items: start; }
.ai-suggest .btn { text-align: left; height: auto; padding: 6px 10px; }
.ai-msg { max-width: 72ch; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: #fff; }
.ai-msg.user { justify-self: end; background: var(--accent-soft); border-color: transparent; }
.ai-msg.error { border-color: var(--s-failed); color: var(--s-failed); }
.ai-msg.waiting { color: var(--ink-3); }
.ai-msg p { margin: 0 0 8px; line-height: 1.5; }
.ai-msg p:last-child, .ai-msg li:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 4px; }
.md h4 { margin: 10px 0 4px; }
.md code { background: var(--sheet-2); padding: 1px 4px; border-radius: 3px; font-size: 0.92em; }
.ai-drafts { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.ai-compose { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 6px; background: var(--sheet); }
.ai-compose textarea { width: 100%; resize: vertical; }
.ai-compose-row { display: flex; gap: 12px; align-items: center; }
.ai-compose-row .hint { flex: 1; margin: 0; }
@media (max-width: 760px) { .ai-layout { grid-template-columns: 1fr; } .ai-chats { grid-auto-flow: column; overflow-x: auto; } }
.ai-chats { max-height: 70vh; overflow-y: auto; }

/* =====================================================================
   Premium pass: refined surfaces, depth, motion. Overrides the base above.
   ===================================================================== */
:root {
  --table: #eceef2;
  --sheet: #ffffff;
  --sheet-2: #f4f5f8;
  --line: #dde1e8;
  --line-2: #eaedf2;
  --ink: #0f131a;
  --ink-2: #3d4654;
  --ink-3: #69727f;
  --accent: #2f4cf5;
  --accent-soft: #e6eaff;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 1px rgba(16, 24, 40, 0.03);
  --shadow-2: 0 4px 12px rgba(16, 24, 40, 0.07), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-3: 0 18px 48px rgba(16, 24, 40, 0.18), 0 4px 12px rgba(16, 24, 40, 0.08);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
body { background: radial-gradient(1200px 500px at 70% -120px, #f8f9fc 0%, transparent 70%), var(--table); letter-spacing: -0.003em; -webkit-font-smoothing: antialiased; }
h1 { font-size: 26px; letter-spacing: -0.025em; }
h2 { letter-spacing: -0.02em; }
::selection { background: var(--accent-soft); }

/* top bar */
.topbar { min-height: 56px; background: linear-gradient(180deg, #151a23, #0f131a); border-bottom: 1px solid rgba(255, 255, 255, 0.06); gap: 26px; position: sticky; top: 0; z-index: 20; }
.nav { gap: 4px; }
.nav a { padding: 7px 13px; margin: 0; border: 0; border-radius: 999px; font-size: 14px; transition: background 0.15s var(--ease), color 0.15s var(--ease); }
.nav a:hover { background: rgba(255, 255, 255, 0.07); }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.who { padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }
.brand-mark i { border-radius: 3px; }
.brand-mark i:first-child { background: var(--accent); box-shadow: 0 0 14px rgba(47, 76, 245, 0.7); }
main { padding: 26px 28px 40px; max-width: 1560px; width: 100%; margin: 0 auto; }
.banner { padding: 10px 28px; border-bottom: 0; }

/* buttons & fields */
.btn { border-radius: var(--radius); border-color: var(--line); background: linear-gradient(180deg, #fff, #f7f8fa); box-shadow: var(--shadow-1); transition: transform 0.12s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s, background 0.15s; }
.btn:hover { background: #fff; border-color: #c4cad4; box-shadow: var(--shadow-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-1); }
.btn.primary { background: linear-gradient(180deg, #4560ff, #2a45e8); border-color: #2238cc; box-shadow: 0 1px 2px rgba(34, 56, 204, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn.primary:hover { background: linear-gradient(180deg, #4a65ff, #2f4cf5); box-shadow: 0 6px 16px rgba(47, 76, 245, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger { color: var(--s-failed); }
input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="datetime-local"], input[type="time"], select, textarea {
  border-radius: var(--radius); border-color: var(--line); background: #fff; box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.04); transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47, 76, 245, 0.14); }
.field > label, .label { letter-spacing: 0; }

/* surfaces */
.panel { border-radius: var(--radius-lg); border-color: var(--line); box-shadow: var(--shadow-1); }
.tile-stat { padding: 18px 20px; transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease); }
.tile-stat:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.tile-stat .v { font-size: 32px; font-variant-numeric: tabular-nums; margin: 2px 0; }
.chart-card { padding: 18px 20px 14px; }
.banners { gap: 0; }
.notice { border-radius: var(--radius); }
.seg { border-radius: 999px; padding: 3px; gap: 2px; box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.05); background: #e9ecf1; border-color: transparent; }
.seg button { border-radius: 999px; min-height: 30px; transition: background 0.15s, box-shadow 0.15s; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-2); }
.seg-type button { border-radius: 999px; transition: all 0.15s var(--ease); }
.seg-type button[aria-pressed="true"] { background: var(--ink); box-shadow: var(--shadow-2); }

/* calendar */
.month, .week { border-radius: var(--radius-lg); box-shadow: var(--shadow-1); border-color: var(--line); }
.dow, .week-head { background: #fafbfc; font-size: 12px; letter-spacing: 0.01em; }
.day { padding: 6px; transition: background 0.15s; }
.day:hover { background: #fbfcff; }
.num { font-variant-numeric: tabular-nums; min-width: 24px; text-align: center; }
.day.today .num { box-shadow: 0 2px 8px rgba(47, 76, 245, 0.4); }
.day.over, .slot.over { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 6px; }
.chip { border-radius: 8px; border-color: var(--line); border-left-width: 3px; padding: 3px 7px 3px 4px; background: #fff; box-shadow: var(--shadow-1); transition: transform 0.12s var(--ease), box-shadow 0.15s var(--ease); }
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--line); border-left-color: var(--c); }
.chip img, .chip .ph { width: 26px; height: 26px; border-radius: 6px; }
.chip .t { font-variant-numeric: tabular-nums; }
.cal-layout { gap: 20px; }
.side { border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
.side-head { padding: 14px; background: #fafbfc; }
.side-grid { padding: 12px; gap: 10px; }

/* media tiles */
.frame { border-radius: 12px; border: 0; background: #1a1f26; box-shadow: var(--shadow-2); transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.35)); pointer-events: none; opacity: 0.8; }
.tile:hover .frame { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.tile.selected .frame { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile .name { padding: 2px 2px 0; }
.badge { z-index: 1; bottom: 7px; left: 7px; padding: 2px 8px; border-radius: 999px; background: rgba(15, 19, 26, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); font-variant-numeric: tabular-nums; }
.badge.used, .badge.sched { top: 7px; right: 7px; background: rgba(28, 110, 70, 0.9); }
.badge.sched { background: rgba(47, 76, 245, 0.92); }
.tile .pick { z-index: 2; top: 8px; left: 8px; border-radius: 6px; }
.tile-add { z-index: 2; right: 7px; bottom: 28px; }
.lib-grid { gap: 18px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.drop { border-radius: var(--radius-lg); border: 1.5px dashed #c3cad6; background: linear-gradient(180deg, #fff, #f8f9fc); padding: 28px; transition: all 0.2s var(--ease); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.005); }
.selbar { border-radius: var(--radius-lg); box-shadow: var(--shadow-3); }
.upload-row { border-radius: var(--radius); box-shadow: var(--shadow-1); }

/* modal */
.scrim { background: rgba(12, 16, 24, 0.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.18s var(--ease); }
.modal { border-radius: 20px; box-shadow: var(--shadow-3); border: 1px solid rgba(255, 255, 255, 0.6); animation: rise 0.22s var(--ease); }
.modal-head { padding: 18px 22px; border-bottom-color: var(--line-2); }
.modal-body { padding: 22px; }
.modal-foot { padding: 14px 22px; border-radius: 0 0 20px 20px; background: #fafbfc; border-top-color: var(--line-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.strip .frame { border-radius: 10px; }
.strip .add { border-radius: 10px; border-color: #c3cad6; }

/* cards: templates, competitors, stats */
.tpl { padding: 16px 18px; transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease); }
.tpl:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.empty { padding: 56px 24px; }
table.data th { padding: 10px 12px; letter-spacing: 0.01em; }
table.data td { padding: 9px 12px; }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: #fafbfd; }
table.data img { border-radius: 8px; }
.tooltip { border-radius: 8px; box-shadow: var(--shadow-3); padding: 8px 10px; }
.bar { border-radius: 999px; }
code { border-radius: 6px; }
.status, .chip { font-feature-settings: "tnum"; }

/* assistant */
.ai-main { box-shadow: var(--shadow-2); }
.ai-msg { border-radius: 16px; box-shadow: var(--shadow-1); border-color: var(--line-2); }
.ai-msg.user { background: linear-gradient(180deg, #4560ff, #2f4cf5); color: #fff; box-shadow: 0 4px 14px rgba(47, 76, 245, 0.3); }
.ai-msg.assistant:not(.waiting) { border-top-left-radius: 6px; }
.ai-msg.user { border-top-right-radius: 6px; }
.ai-msg.waiting p { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }
.ai-compose { background: #fafbfc; padding: 14px; }
.ai-chat-row { border-radius: 10px; border-left: 0; transition: background 0.15s; }
.ai-chat-row:hover { background: rgba(255, 255, 255, 0.7); }
.ai-chat-row[aria-current="true"] { background: #fff; box-shadow: var(--shadow-1), inset 3px 0 0 var(--accent); }
.ai-empty h3 { font-size: 22px; letter-spacing: -0.02em; }

/* login */
.login form { background: #fff; padding: 34px 30px; border-radius: 22px; box-shadow: var(--shadow-3); border: 1px solid var(--line-2); }
.login .brand-mark i:first-child { background: var(--accent); }
.login .brand-mark i { background: var(--ink); }

/* drag card (custom drag preview, see library.js) */
.drag-card {
  position: fixed; top: -400px; left: -400px; width: 230px; display: flex; gap: 10px; align-items: center; padding: 8px 12px 8px 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 34px rgba(16, 24, 40, 0.28); font: 13px var(--font); color: var(--ink);
}
.drag-card .thumb { position: relative; width: 54px; height: 54px; flex: none; border-radius: 10px; overflow: hidden; background: #1a1f26; display: grid; place-items: center; color: #fff; }
.drag-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drag-card .play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.28); font-size: 16px; }
.drag-card .meta { min-width: 0; display: grid; gap: 2px; }
.drag-card .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drag-card .sub { color: var(--ink-3); font-size: 12px; }
.drag-card .hintline { color: var(--accent); font-size: 12px; font-weight: 600; }
.tile.is-dragging .frame { opacity: 0.35; transform: scale(0.97); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 760px) { main { padding: 16px; } .topbar { gap: 12px; } }
