/* =============================================================================
   CONNECT design system — An SBS Product
   Tokens are sampled from the approved CONNECT logo (navy wordmark + gradient C).
   ============================================================================= */
:root {
  --navy: #041c43;
  --navy-700: #0b2a5c;
  --ink: #0e1a33;
  --ink-2: #3b4763;
  --muted: #66718c;
  --faint: #98a1b7;
  --line: #e5e8f0;
  --line-2: #eef0f6;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;

  --c-cyan: #19b9fe;
  --c-blue: #4763fc;
  --c-purple: #7b3fe4;
  --c-violet: #bc22e4;
  --c-magenta: #de18b9;
  --c-orange: #feab20;
  --brand-gradient: linear-gradient(135deg, #feab20 0%, #de18b9 32%, #bc22e4 52%, #4763fc 78%, #19b9fe 100%);
  --brand-soft: linear-gradient(135deg, rgba(222,24,185,.08), rgba(71,99,252,.08));

  --accent: #5b3fe4;
  --accent-ink: #4327c9;
  --accent-soft: #f0edff;

  --ok: #0f9d6b;      --ok-soft: #e7f7f0;
  --warn: #b7791f;    --warn-soft: #fdf4e3;
  --bad: #d23c4b;     --bad-soft: #fdecee;
  --info: #2b6be4;    --info-soft: #eaf1fe;

  --ig: #e1306c; --fb: #1877f2; --li: #0a66c2; --yt: #ff0000;

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(4,28,67,.05), 0 1px 1px rgba(4,28,67,.03);
  --sh-2: 0 4px 16px rgba(4,28,67,.07), 0 1px 3px rgba(4,28,67,.05);
  --sh-3: 0 18px 48px rgba(4,28,67,.16), 0 4px 12px rgba(4,28,67,.08);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 252px;
  --topbar: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; color: var(--navy); letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 750; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 13px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(91,63,228,.35); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.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)); }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 650; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none !important; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, var(--sh-1); }
.btn-primary:hover { background: var(--navy-700); }
.btn-accent { background: var(--accent); color: #fff; } .btn-accent:hover { background: var(--accent-ink); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--sh-1); }
.btn-secondary:hover { border-color: #cfd5e3; background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); } .btn-ghost:hover { background: var(--line-2); }
.btn-danger { background: var(--bad); color: #fff; } .btn-danger:hover { filter: brightness(.95); }
.btn-danger-ghost { background: transparent; color: var(--bad); } .btn-danger-ghost:hover { background: var(--bad-soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-icon { width: 38px; padding: 0; } .btn-sm.btn-icon { width: 32px; } .btn-xs.btn-icon { width: 26px; }
.btn[disabled], .btn.is-loading { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err, .form-error { font-size: 12.5px; color: var(--bad); }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s; }
.input:hover, .select:hover, .textarea:hover { border-color: #cfd5e3; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(91,63,228,.12); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2366718c' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-sm, .select-sm { min-height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.select-sm { padding-right: 30px; background-position: right 9px center; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.counter { font-size: 11.5px; color: var(--muted); text-align: right; }
.counter.over { color: var(--bad); font-weight: 700; }
fieldset { border: 0; padding: 0; margin: 0; }

/* ---------- Cards, badges ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { flex: 1; min-width: 0; }
.card-body { padding: 16px 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: var(--line-2); color: var(--ink-2); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-soft); color: var(--ok); } .b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); } .b-info { background: var(--info-soft); color: var(--info); }
.b-accent { background: var(--accent-soft); color: var(--accent-ink); } .b-navy { background: var(--navy); color: #fff; }
.b-outline { background: transparent; border: 1px dashed #c4cad8; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.cap { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.cap.off { background: var(--line-2); color: var(--faint); text-decoration: line-through; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); }

/* Platform marks */
.pf { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; flex: none; }
.pf svg { width: 13px; height: 13px; }
.pf-lg { width: 36px; height: 36px; border-radius: 10px; } .pf-lg svg { width: 20px; height: 20px; }
.pf-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.pf-facebook { background: var(--fb); } .pf-linkedin { background: var(--li); } .pf-youtube { background: var(--yt); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--navy); display: inline-grid; place-items: center; font-weight: 750; font-size: 12px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; } .avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.acc { position: relative; display: inline-flex; }
.acc .pf { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 5px; border: 2px solid #fff; }
.acc .pf svg { width: 9px; height: 9px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; } .table tbody tr.clickable:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.na { color: var(--faint); font-style: italic; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; }
.sb-brand { height: var(--topbar); display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--line-2); }
.sb-brand img { height: 28px; width: auto; }
.sb-org { margin: 12px 12px 4px; }
.sb-org button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; text-align: left; }
.sb-org .org-logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-gradient); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.sb-group { margin-top: 14px; }
.sb-group-title { padding: 0 10px 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.sb-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; text-decoration: none !important; position: relative; }
.sb-link svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.sb-link:hover { background: var(--line-2); color: var(--ink); }
.sb-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.sb-link[aria-current="page"] svg { color: var(--accent); }
.sb-link[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-gradient); }
.sb-link .count { margin-left: auto; font-size: 11px; font-weight: 800; background: var(--bad); color: #fff; border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center; line-height: 18px; }
.sb-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--faint); }
.sb-foot strong { color: var(--muted); font-weight: 700; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); background: rgba(246,247,251,.85); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 28px; }
.topbar .menu-btn { display: none; }
.topbar .scope { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .scope .select { min-width: 200px; height: 38px; min-height: 38px; padding-top: 6px; padding-bottom: 6px; background-color: var(--surface); }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .pip { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.user-btn .name { font-weight: 650; font-size: 13px; max-width: 140px; }
.content { padding: 28px; max-width: 1440px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 220px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .select, .toolbar .input { width: auto; min-width: 140px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; border: 0; background: none; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--accent); }
.seg { display: inline-flex; padding: 3px; background: var(--line-2); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 650; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--navy); box-shadow: var(--sh-1); }

/* ---------- KPI & widgets ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .k-label { font-size: 12.5px; font-weight: 650; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 28px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi.attention .k-value { color: var(--bad); }
.kpi::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand-gradient); opacity: 0; }
.kpi.highlight::after { opacity: 1; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; } .list-item.clickable:hover { background: var(--surface-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 650; color: var(--ink); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .e-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); display: grid; place-items: center; color: var(--accent); }
.empty .e-icon svg { width: 22px; height: 22px; }
.empty h4 { color: var(--navy); font-size: 14.5px; }
.empty p { max-width: 420px; font-size: 13px; }
.unavailable { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed #d3d8e4; color: var(--muted); font-size: 12.5px; }
.unavailable svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice.info { background: var(--info-soft); color: #1d4ea8; } .notice.warn { background: var(--warn-soft); color: #8a5a12; }
.notice.bad { background: var(--bad-soft); color: #a52634; } .notice.ok { background: var(--ok-soft); color: #0b7350; }
.progress { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-gradient); border-radius: 99px; }
.spark { width: 100%; height: 48px; }
.chart { width: 100%; height: 220px; }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Skeleton ---------- */
.sk { background: linear-gradient(90deg, #eef0f5 0%, #f6f7fa 50%, #eef0f5 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-line { height: 12px; margin: 8px 0; } .sk-block { height: 90px; }

/* ---------- Modal / drawer / toast / menu ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4,28,67,.36); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); animation: pop .18s ease; }
.modal.lg { width: min(880px, 100%); } .modal.xl { width: min(1100px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer { width: min(560px, 100vw); height: 100vh; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--sh-3); animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: calc(100vw - 40px); }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 280px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--navy); color: #fff; box-shadow: var(--sh-3); font-size: 13.5px; animation: pop .2s ease; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: #4ade80; } .toast.bad { background: #7f1d2a; } .toast.warn svg { color: var(--c-orange); }
.menu { position: absolute; z-index: 120; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3); padding: 6px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--ink); font-size: 13.5px; text-decoration: none !important; }
.menu button:hover, .menu a:hover { background: var(--line-2); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 0; }
.menu svg { width: 16px; height: 16px; color: var(--muted); }

/* ---------- Calendar ---------- */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 8px 10px; font-size: 11.5px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-day { min-height: 124px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: #fbfbfd; } .cal-day.out .cal-date { color: var(--faint); }
.cal-day.today .cal-date { background: var(--navy); color: #fff; }
.cal-day.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -3px; }
.cal-date { align-self: flex-start; font-size: 12px; font-weight: 750; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.cal-add { margin-left: auto; opacity: 0; } .cal-day:hover .cal-add { opacity: 1; }
.ev { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 7px; font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); cursor: pointer; min-width: 0; }
.ev:hover { border-color: #c9cfdd; box-shadow: var(--sh-1); }
.ev .t { color: var(--muted); font-weight: 700; font-size: 11px; flex: none; font-variant-numeric: tabular-nums; }
.ev .pfs { display: flex; gap: 2px; flex: none; } .ev .pfs .pf { width: 14px; height: 14px; border-radius: 4px; } .ev .pfs .pf svg { width: 8px; height: 8px; }
.ev.st-draft, .ev.st-changes_requested { border-style: dashed; background: #fcfcfe; color: var(--ink-2); }
.ev.st-in_review, .ev.st-pending_client { border-left: 3px solid var(--warn); }
.ev.st-approved { border-left: 3px solid var(--info); }
.ev.st-scheduled, .ev.st-publishing { border-left: 3px solid var(--accent); background: #faf9ff; }
.ev.st-published { border-left: 3px solid var(--ok); }
.ev.st-failed, .ev.st-partially_published { border-left: 3px solid var(--bad); background: #fff8f8; }
.ev.st-cancelled, .ev.st-rejected, .ev.st-archived { opacity: .55; text-decoration: line-through; }
.ev.plan { border-style: dotted; background: transparent; color: var(--muted); font-weight: 600; }
.ev .flag { color: var(--bad); flex: none; } .ev .flag svg { width: 12px; height: 12px; }
.cal-week .cal-day { min-height: 420px; }
.cal-more { font-size: 11.5px; color: var(--accent-ink); font-weight: 700; cursor: pointer; padding: 0 6px; background: none; border: 0; text-align: left; }

/* ---------- Composer ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .9fr); gap: 20px; align-items: start; }
.variant-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.variant-tab { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 650; font-size: 12.5px; }
.variant-tab[aria-selected="true"] { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.variant-tab .vstat { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.variant-tab .vstat.ok { background: var(--ok); } .variant-tab .vstat.bad { background: var(--bad); }
.acct-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.acct-opt { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); min-width: 0; }
.acct-opt:hover { border-color: #c9cfdd; }
.acct-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.acct-opt.disabled { opacity: .5; cursor: not-allowed; }
.media-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.media-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--line-2); border: 1px solid var(--line); flex: none; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(4,28,67,.75); color: #fff; display: grid; place-items: center; cursor: pointer; }
.media-thumb .rm svg { width: 12px; height: 12px; }
.media-thumb .kind { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 800; color: #fff; background: rgba(4,28,67,.7); padding: 1px 5px; border-radius: 4px; text-transform: uppercase; }
.media-add { width: 84px; height: 84px; border-radius: 10px; border: 1.5px dashed #c4cad8; display: grid; place-items: center; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.preview-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.preview-card .pv-head { display: flex; align-items: center; gap: 10px; padding: 12px; }
.preview-card .pv-text { padding: 0 12px 12px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.preview-card .pv-media { background: #f1f2f6; aspect-ratio: 1 / 1; display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.preview-card .pv-media img, .preview-card .pv-media video { width: 100%; height: 100%; object-fit: cover; }
.preview-card .pv-media.wide { aspect-ratio: 16 / 9; } .preview-card .pv-media.tall { aspect-ratio: 9 / 16; max-height: 460px; }
.preview-card .pv-link { margin: 0 12px 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 12.5px; color: var(--muted); }
.validation { display: flex; flex-direction: column; gap: 4px; }
.validation li { color: var(--bad); font-size: 12.5px; }
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-item { display: flex; gap: 10px; }
.tl-item .tl-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); flex: none; }
.tl-item .tl-dot svg { width: 13px; height: 13px; }
.comment { display: flex; gap: 10px; }
.comment .bubble { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 12px; flex: 1; min-width: 0; }
.mention { color: var(--accent-ink); font-weight: 700; background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }

/* ---------- Library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.asset { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.asset:hover { box-shadow: var(--sh-2); border-color: #d2d7e3; }
.asset.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.asset .thumb { aspect-ratio: 1 / 1; background: #f0f2f7; display: grid; place-items: center; color: var(--faint); position: relative; overflow: hidden; }
.asset .thumb img, .asset .thumb video { width: 100%; height: 100%; object-fit: cover; }
.asset .thumb svg { width: 30px; height: 30px; }
.asset .meta { padding: 8px 10px; font-size: 12px; min-width: 0; }
.asset .meta .n { font-weight: 650; color: var(--ink); }
.asset .tagline { position: absolute; left: 6px; top: 6px; display: flex; gap: 4px; }
.dropzone { border: 2px dashed #c7cdda; border-radius: 16px; padding: 28px; text-align: center; color: var(--muted); background: var(--surface-2); transition: background .15s, border-color .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 0; min-height: calc(100vh - var(--topbar) - 170px); }
.inbox .ib-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: calc(100vh - var(--topbar) - 170px); }
.ib-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.ib-item:hover { background: var(--surface-2); }
.ib-item.active { background: var(--accent-soft); }
.ib-item.unread .ib-author { font-weight: 800; }
.ib-item .ib-body { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ib-detail { padding: 20px 24px; min-width: 0; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #eff1f6; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.kcol.drop { outline: 2px dashed var(--accent); }
.kcol h4 { display: flex; align-items: center; gap: 6px; padding: 2px 4px 4px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 6px; }
.kcard:hover { border-color: #c9cfdd; }
.kcard.overdue { border-left: 3px solid var(--bad); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::before { content: ""; position: absolute; width: 640px; height: 640px; right: -220px; top: -180px; border-radius: 50%; background: var(--brand-gradient); filter: blur(90px); opacity: .45; }
.auth-art > * { position: relative; }
.auth-art h2 { color: #fff; font-size: 34px; font-weight: 800; line-height: 1.15; max-width: 460px; }
.auth-art p { color: rgba(255,255,255,.75); max-width: 440px; margin-top: 14px; font-size: 15px; }
.auth-art .pfs { display: flex; gap: 10px; margin-top: 28px; }
.auth-art .pfs .pf { width: 40px; height: 40px; border-radius: 12px; } .auth-art .pfs .pf svg { width: 20px; height: 20px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: min(400px, 100%); }
.auth-card .logo { height: 40px; width: auto; margin-bottom: 30px; }
.auth-card h1 { font-size: 26px; }
.auth-card .lead { color: var(--muted); margin: 6px 0 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { height: 44px; }
.sbs { font-size: 11.5px; color: var(--faint); letter-spacing: .04em; }
.sbs b { color: var(--muted); }

/* ---------- Print (client reports) ---------- */
.report { background: #fff; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .report-page { break-after: page; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--sh-3); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(4,28,67,.32); z-index: 35; }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: grid; }
  .topbar .scope .select { min-width: 0; max-width: 46vw; }
  .content { padding: 20px 16px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox .ib-list { max-height: none; border-right: 0; }
  .inbox.show-detail .ib-list { display: none; } .inbox:not(.show-detail) .ib-detail { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .user-btn .name { display: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 20px; }
  .kpis, .g4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; } .kpi .k-value { font-size: 22px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-head div { padding: 6px 2px; text-align: center; font-size: 10px; }
  .cal-day { min-height: 74px; padding: 3px; }
  .cal-day .ev .label, .cal-day .ev .t { display: none; }
  .cal-day .ev { padding: 3px; justify-content: center; }
  .toolbar .select, .toolbar .input { min-width: 0; flex: 1 1 140px; }
  .modal { border-radius: 18px; }
  .overlay { padding: 10px; }
  .page-head { align-items: stretch; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 14px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); font-weight: 650; color: var(--muted); text-align: left; }
  .table.responsive td.num { text-align: right; }
  .toasts { left: 10px; right: 10px; bottom: 10px; } .toast { min-width: 0; max-width: none; }
  .topbar .scope .select { max-width: 40vw; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 640px) { .hide-sm { display: none; } }
.boot { display: grid; place-items: center; min-height: 100vh; }
.boot img { animation: bootpulse 1.2s ease-in-out infinite; }
@keyframes bootpulse { 50% { opacity: .4; transform: scale(.94); } }
.kpi .k-label svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
.user-btn > svg { width: 14px; height: 14px; color: var(--muted); }
.sb-org button > svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.kpi .k-sub.warn { color: var(--warn); font-weight: 600; }
.cap svg { width: 12px; height: 12px; }
.media-add svg { width: 22px; height: 22px; }
.small svg, .tiny svg, .validation svg, a > svg { width: 1.05em; height: 1.05em; vertical-align: -2px; flex: none; }
.btn svg { width: 16px; height: 16px; }
.btn-xs svg { width: 13px; height: 13px; }
.pf svg { width: 13px; height: 13px; } .pf-lg svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- Messages (direct messages) */
.msg-thread { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - var(--topbar) - 360px); min-height: 220px; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: min(78%, 520px); display: flex; flex-direction: column; gap: 2px; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg-body { padding: 8px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.msg.out .msg-body { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.msg-meta { font-size: 11.5px; color: var(--faint); }
.count-pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 760px) { .msg-thread { max-height: none; } .msg { max-width: 90%; } }

/* ---------------------------------------------------------------- Notifications panel */
.notif-panel { width: min(400px, calc(100vw - 20px)); padding: 4px; }
.notif-panel #np-list { max-height: min(60vh, 460px); overflow-y: auto; }
.notif-panel .np-foot { justify-content: center; font-weight: 650; color: var(--accent) !important; border-top: 1px solid var(--line-2); border-radius: 0 0 8px 8px; }
.list-item.notif { gap: 10px; }
.list-item.notif.unread { background: #fbfaff; }
.dot-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

.bar-row { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: 8px; align-items: center; padding: 3px 0; }
.bar-row .bar { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.bar-row .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------------------------------------------------------------- Guided tours */
.help-panel { width: min(400px, calc(100vw - 20px)); max-height: min(70vh, 560px); overflow-y: auto; }
.tour-layer { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
.tour-layer.dim { background: rgba(4, 28, 67, .32); }
.tour-ring { position: fixed; border-radius: 12px; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(4, 28, 67, .32); transition: all .2s ease; pointer-events: none; }
.tour-card { position: fixed; width: 330px; max-width: calc(100vw - 20px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-3); padding: 14px 16px; pointer-events: auto; outline: none; }
.tour-card.sheet { left: 10px !important; right: 10px; bottom: 10px; top: auto !important; width: auto; }
.tour-card .tour-x { width: 28px; height: 28px; }
@media (prefers-reduced-motion: reduce) { .tour-ring { transition: none; } }
