:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eef0f5;
  --ink: #101a33;
  --ink-2: #4a5470;
  --ink-3: #8a92a8;
  --line: #e2e5ee;
  --brand: #13224a;
  --brand-2: #1d3270;
  --accent: #f2a43a;
  --accent-ink: #4a2c00;
  --good: #1f9d74;
  --good-bg: #e3f5ee;
  --warn: #c98510;
  --warn-bg: #fdf1dc;
  --bad: #d1495b;
  --bad-bg: #fbe7ea;
  --info: #2f6fed;
  --info-bg: #e5edfd;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 26, 51, .05), 0 4px 16px rgba(16, 26, 51, .04);
  --sidebar: 248px;
  --c-reels: #c2417a; --c-karusel: #7b5cd6; --c-post: #2f6fed; --c-video: #e8833a; --c-stories: #1f9d74;
  --c-shoot: #0e8fa8; --c-edit: #8a92a8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1224; --surface: #141c33; --surface-2: #1b2440; --ink: #eef1f8; --ink-2: #b4bbd0; --ink-3: #7c849c;
    --line: #262f4d; --brand: #0a1430; --brand-2: #22397d;
    --good-bg: #123a30; --warn-bg: #3a2c10; --bad-bg: #3d1820; --info-bg: #172a55;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0c1224; --surface: #141c33; --surface-2: #1b2440; --ink: #eef1f8; --ink-2: #b4bbd0; --ink-3: #7c849c;
  --line: #262f4d; --brand: #0a1430; --brand-2: #22397d;
  --good-bg: #123a30; --warn-bg: #3a2c10; --bad-bg: #3d1820; --info-bg: #172a55;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 800; }
h3 { font-size: 14px; font-weight: 700; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.hide-sm { }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); background: var(--brand); color: #dfe5f5; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; padding: 18px 14px; z-index: 30; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: #9aa6c8; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c3cbe2;
  font-weight: 600; margin-bottom: 2px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: var(--accent); color: var(--accent-ink); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 12px 8px; }
.side-foot { margin-top: auto; padding-top: 14px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.05); }
.side-user .name { color: #fff; font-weight: 700; font-size: 13px; }
.side-user .role { font-size: 11px; color: #9aa6c8; }
.linkbtn { background: none; border: 0; color: #9aa6c8; cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.linkbtn:hover { color: #fff; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 18px 28px; position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
}
.topbar h1 { flex: 1; min-width: 0; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: inline-grid; place-items: center; position: relative; color: var(--ink-2); cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.badge-dot {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center;
}
.content { padding: 4px 28px 40px; }
.menu-btn { display: none; }

.bottom-nav { display: none; }

/* ---------- components ---------- */
.card {
  background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head a.more { color: var(--info); font-weight: 700; font-size: 13px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--brand-2); color: #fff; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.good { background: var(--good); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 9px; }
.btn svg { width: 16px; height: 16px; }

.alert { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; margin-bottom: 10px; font-weight: 600; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.good { background: var(--good-bg); color: var(--good); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert a { margin-left: auto; font-weight: 800; white-space: nowrap; }
.alert svg { width: 18px; height: 18px; flex: none; }

.stat .label { color: var(--ink-2); font-weight: 600; font-size: 13px; margin-top: 12px; }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0; }
.stat .hint { color: var(--ink-3); font-size: 12px; }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); }
.stat-icon svg { width: 18px; height: 18px; }
.stat.hero { background: linear-gradient(140deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; border: 0; }
.stat.hero .label, .stat.hero .hint { color: #b9c4e6; }
.stat.hero .pill { background: rgba(255,255,255,.12); color: #fff; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11px;
  font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.st-plan { background: var(--surface-2); color: var(--ink-2); }
.st-progress { background: var(--info-bg); color: var(--info); }
.st-review { background: var(--warn-bg); color: var(--warn); }
.st-done { background: var(--good-bg); color: var(--good); }
.fmt { color: #fff; }
.fmt-reels { background: var(--c-reels); } .fmt-karusel { background: var(--c-karusel); } .fmt-post { background: var(--c-post); }
.fmt-video { background: var(--c-video); } .fmt-stories { background: var(--c-stories); }
.fmt-shoot { background: var(--c-shoot); } .fmt-edit { background: var(--c-edit); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px;
  font-weight: 800; color: #fff; background: var(--brand-2); flex: none;
}
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.xs { width: 24px; height: 24px; font-size: 9px; }
.avatars { display: flex; }
.avatars > * { margin-left: -6px; border: 2px solid var(--surface); }
.avatars > *:first-child { margin-left: 0; }
.role {
  display: inline-grid; place-items: center; min-width: 34px; height: 20px; padding: 0 5px; border-radius: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: .03em; color: #fff;
}
.role-CEO { background: #13224a; } .role-MEN { background: #2f6fed; } .role-SMM { background: #c2417a; }
.role-DIZ { background: #7b5cd6; } .role-MON { background: #e8833a; } .role-KOP { background: #0e8fa8; }
.role-TRG { background: #d1495b; } .role-PRD { background: #1f9d74; }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--good); }
.bar.accent > span { background: var(--accent); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item .title { font-weight: 700; }
.list-item .sub { color: var(--ink-3); font-size: 12px; }
.date-box {
  width: 44px; flex: none; text-align: center; border-radius: 10px; background: var(--surface-2); padding: 5px 0;
}
.date-box b { display: block; font-size: 17px; line-height: 1.1; }
.date-box span { font-size: 10px; font-weight: 800; color: var(--ink-3); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; scrollbar-width: none; }
.tabs a {
  padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 700; color: var(--ink-2); white-space: nowrap; font-size: 13px;
}
.tabs a.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tabs a .c { margin-left: 4px; opacity: .6; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters .input { width: auto; min-width: 150px; height: 38px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg a { padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 12px; color: var(--ink-2); }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; font-weight: 800; }
.col-head .c { color: var(--ink-3); font-weight: 700; }
.kcard { display: block; background: var(--surface); border-radius: 12px; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); }
.kcard:hover { border-color: var(--ink-3); }
.kcard .t { font-weight: 700; margin-bottom: 3px; }
.kcard .p { color: var(--ink-3); font-size: 12px; margin-bottom: 9px; }
.kcard .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kcard .late { color: var(--bad); font-weight: 700; font-size: 12px; }
.add-link { display: block; text-align: center; padding: 8px; color: var(--ink-3); font-weight: 700; border-radius: 10px; }
.add-link:hover { background: var(--surface); color: var(--ink); }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.clickable:hover td { background: var(--surface-2); cursor: pointer; }
table.t tfoot td { font-weight: 800; border-top: 2px solid var(--line); }

/* forms */
.input, select.input, textarea.input {
  width: 100%; height: 42px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 12px; font: inherit; color: var(--ink);
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--info) 35%, transparent); border-color: var(--info); }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.field .help { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.field .err { color: var(--bad); font-size: 12px; margin-top: 4px; font-weight: 600; }
.field ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.field ul label { font-weight: 500; display: flex; gap: 8px; align-items: center; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
input[type=color].input { padding: 4px; width: 80px; }

/* detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv .k { color: var(--ink-3); }
.kv .v { font-weight: 700; text-align: right; }
.stepper { display: flex; gap: 4px; flex-wrap: wrap; }
.stepper form { display: contents; }
.stepper button {
  flex: 1; min-width: 90px; border: 0; padding: 10px 6px; border-radius: 10px; font: inherit; font-size: 12px;
  font-weight: 700; background: var(--surface-2); color: var(--ink-3); cursor: pointer;
}
.stepper button.past { background: var(--good-bg); color: var(--good); }
.stepper button.cur { background: var(--brand-2); color: #fff; }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment .body { background: var(--surface-2); padding: 9px 12px; border-radius: 12px; flex: 1; white-space: pre-wrap; }
.comment.sys .body { background: transparent; color: var(--ink-3); padding: 0; font-size: 12px; }
.pre { white-space: pre-wrap; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.check-row button.box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; padding: 0; color: #fff; }
.check-row button.box.on { background: var(--good); border-color: var(--good); }
.check-row .done { text-decoration: line-through; color: var(--ink-3); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--line); gap: 1px; }
.cal .wd { background: var(--surface-2); padding: 8px; font-size: 11px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; }
.cal .day { background: var(--surface); min-height: 120px; padding: 6px; }
.cal .day.out { background: var(--surface-2); opacity: .6; }
.cal .day .n { font-weight: 800; font-size: 12px; margin-bottom: 4px; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.cal .day.today .n { background: var(--accent); color: var(--accent-ink); }
.cal .ev { display: block; border-left: 3px solid var(--ink-3); background: var(--surface-2); border-radius: 6px; padding: 4px 6px; margin-bottom: 4px; font-size: 11px; }
.cal .ev b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev span { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ev-reels { border-color: var(--c-reels) !important; } .ev-karusel { border-color: var(--c-karusel) !important; }
.ev-post { border-color: var(--c-post) !important; } .ev-video { border-color: var(--c-video) !important; }
.ev-stories { border-color: var(--c-stories) !important; } .ev-shoot { border-color: var(--c-shoot) !important; }
.ev-edit { border-color: var(--c-edit) !important; border-left-style: dashed !important; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.bars .b { flex: 1; display: flex; gap: 3px; align-items: flex-end; height: 100%; }
.bars .b i { flex: 1; border-radius: 5px 5px 2px 2px; min-height: 2px; background: var(--good); }
.bars .b i.o { background: var(--accent); }
.bars-labels { display: flex; gap: 6px; margin-top: 6px; }
.bars-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); }
.ring { --p: 50; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring::after { content: attr(data-label); width: 92px; height: 92px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 22px; font-weight: 800; }

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

.fab { display: none; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at top, var(--brand-2), var(--brand) 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 22px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }

/* modal (details) */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 18, 40, .45); }
dialog .dlg { padding: 22px; max-height: 85vh; overflow-y: auto; }

.messages { margin-bottom: 12px; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(10,18,40,.45); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 21px; }
  .content { padding: 4px 16px 96px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .bottom-nav {
    display: flex; position: fixed; inset: auto 0 0 0; background: var(--surface); border-top: 1px solid var(--line);
    z-index: 25; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 4px 0; }
  .bottom-nav a.on { color: var(--brand-2); }
  .bottom-nav svg { width: 22px; height: 22px; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: 78px; width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 24; }
  .fab svg { width: 24px; height: 24px; }
  .topbar .btn.hide-sm { display: none; }
  .cal .day { min-height: 80px; padding: 3px; }
  .cal .ev span { display: none; }
  .cal .wd { font-size: 9px; padding: 6px 3px; }
}
