/* Auto Poster — gaya "accent ladder" (taste-skill): satu hue biru dari logo aifisien.id,
   penuh hanya di tanda kecil (tombol utama, data, ikon menu aktif), tint pucatnya di area. */
:root {
  --ground: #f7f9fc;          /* satu langkah ke arah tint biru */
  --surface: #ffffff;
  --raised: #f3f5f8;
  --active: #e9edf3;
  --border: #e5e7eb;
  --rule: #f0f2f5;
  --control: #d1d5db;
  --text: #111827;
  --muted: #5f6672;
  --faint: #6b7280;
  --accent: #1f5fd6;
  --accent-soft: #eef4fe;
  --accent-track: #d7e4fb;
  --accent-ink: #163f8c;
  --primary-ink: #ffffff;
  --positive: #247b50;
  --negative: #c4242a;
  --warning: #92400e;
  --pill-positive-bg: #dcfce7; --pill-positive-ink: #14532d;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;  --pill-warning-ink: #92400e;
  --pill-neutral-bg: #f3f4f6;  --pill-neutral-ink: #374151;
  --pill-accent-bg: #eef4fe;   --pill-accent-ink: #163f8c;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-chip: 4px;
  --gap: 24px;
  --pad: 24px;
  --card-pad: 20px;
  --control-height: 32px;
  --sidebar-width: 232px;
  --font: "DM Sans", Inter, system-ui, sans-serif;
  --fs-title: 28px;
  --fs-section: 16px;
  --fs-kpi: 24px;
  --fs-body: 14px;
  --fs-small: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--fs-body)/20px var(--font);
}
.num, .kpi-value, .table td, .stat strong { font-variant-numeric: tabular-nums; }
a { color: var(--accent-ink); }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell: open plane ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 12px 16px; border-right: 1px solid var(--border); background: var(--ground);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.mark {
  width: 32px; height: 32px; flex: none; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -0.02em;
}
.mark.small { width: 24px; height: 24px; border-radius: 6px; font-size: 12px; }
.brand-name { font-weight: 600; font-size: 15px; line-height: 20px; }
.brand-scope { color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { color: var(--muted); font-size: var(--fs-small); padding: 18px 10px 6px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px;
  background: none; border: 0; border-radius: var(--radius-control); color: var(--muted);
  font: 400 var(--fs-body)/20px var(--font); text-align: left; cursor: pointer;
}
.nav button:hover { background: var(--raised); color: var(--text); }
.nav button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.nav button[aria-selected="true"] svg { color: var(--accent); }
.sidebar-foot { margin-top: auto; padding-top: 12px; }
.status { list-style: none; margin: 0 0 14px; padding: 0 10px; display: grid; gap: 6px; font-size: var(--fs-small); }
.status li { display: flex; align-items: center; gap: 8px; color: var(--muted); line-height: 16px; }
.status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.status .ok .dot { background: var(--positive); }
.status .bad .dot { background: var(--negative); }
.status .bad { color: var(--negative); }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--border); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 12px;
}
.user-meta { display: grid; line-height: 16px; font-size: 13px; }
.user-meta span { color: var(--muted); font-size: var(--fs-small); }
.user-actions { display: flex; gap: 12px; padding: 0 10px; }

.topbar { display: none; }
.canvas { min-width: 0; }
main { padding: 32px var(--pad) 64px; max-width: 1360px; }

/* ---------- Judul halaman ---------- */
.title-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px 24px; margin-bottom: var(--gap); }
h1, .page-title { margin: 0; font-size: var(--fs-title); line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }
.subline { margin: 4px 0 0; color: var(--muted); font-size: 15px; line-height: 22px; max-width: 72ch; }
.subline b { color: var(--text); font-weight: 500; }
.title-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stamp { color: var(--muted); font-size: var(--fs-small); }
h2 { margin: 0; font-size: var(--fs-section); line-height: 24px; font-weight: 600; }
h3 { margin: 0; font-size: 14px; font-weight: 600; }

/* ---------- Kartu & grid ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: var(--card-pad);
}
.card.tight { padding: 4px var(--card-pad) var(--card-pad); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.grid-2 { display: grid; gap: var(--gap); align-items: start; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.grid-2 > div { display: grid; gap: var(--gap); }
.ov-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.ov-main { display: grid; gap: var(--gap); min-width: 0; }
.rail-h { margin: 0 0 8px; }
.ov-rail .card { margin-top: 0; }

/* ---------- KPI: satu wadah dibagi garis ---------- */
.kpis {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  margin-bottom: 0;
}
.tab-panel > .kpis { margin-bottom: var(--gap); }
.kpi { padding: 16px var(--card-pad); border-left: 1px solid var(--border); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { color: var(--muted); font-size: var(--fs-body); line-height: 20px; }
.kpi-value { font-size: var(--fs-kpi); line-height: 32px; font-weight: 500; margin-top: 4px; letter-spacing: -0.01em; }
.kpi-value .unit { color: var(--muted); font-size: 14px; font-weight: 400; margin-left: 2px; }
.kpi-note { color: var(--muted); font-size: var(--fs-small); line-height: 16px; margin-top: 2px; }
.kpi.alert .kpi-value { color: var(--negative); }

/* ---------- Form ---------- */
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 500; margin-bottom: 8px; padding: 0; font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.row legend { width: 100%; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: flex; justify-content: space-between; gap: 8px; font-weight: 500; margin-bottom: 8px; }
.grid-fields { display: grid; gap: 0 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.colors { grid-template-columns: repeat(4, minmax(0, 1fr)); }
textarea, input:not([type]), input[type="text"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="file"], select {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--control); border-radius: var(--radius-control); padding: 7px 10px; min-height: 36px;
}
input[type="file"] { padding: 6px; }
textarea { resize: vertical; line-height: 20px; }
input[type="color"] { width: 100%; height: 36px; padding: 3px; border: 1px solid var(--control);
  border-radius: var(--radius-control); background: var(--surface); cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
textarea:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible,
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
:disabled { opacity: .75; cursor: not-allowed; }
.chip {
  display: inline-flex; gap: 8px; align-items: center; min-height: 32px;
  border: 1px solid var(--control); border-radius: var(--radius-control); padding: 4px 12px; cursor: pointer;
  background: var(--surface);
}
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.toggle, .switch { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; cursor: pointer; }
.switch { font-weight: 500; margin: 0; }
.counter { font-weight: 400; color: var(--muted); font-size: var(--fs-small); }
.counter.over, .hint.over { color: var(--negative); font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; line-height: 19px; margin: 0 0 16px; }
.notice {
  background: var(--pill-warning-bg); border: 1px solid #fde68a; color: var(--pill-warning-ink);
  border-radius: var(--radius-control); padding: 8px 12px; font-size: 13px; margin: 0 0 12px;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  border: 1px dashed var(--control); border-radius: var(--radius-card); padding: 20px 12px; cursor: pointer;
  background: var(--raised);
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone small { color: var(--muted); }
.dropzone input { display: none; }
.previews { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.previews li { position: relative; width: 72px; height: 90px; }
.previews img, .previews video { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.previews .idx { position: absolute; left: 4px; top: 4px; font-size: 11px; font-weight: 600;
  background: rgba(17,24,39,.7); color: #fff; border-radius: 3px; padding: 0 5px; }
.previews button { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; min-height: 0; padding: 0;
  border-radius: 50%; border: 0; background: rgba(17,24,39,.7); color: #fff; }
details { margin-top: 4px; }
summary { cursor: pointer; color: var(--accent-ink); font-size: 14px; margin-bottom: 10px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--raised);
  border-radius: var(--radius-control); padding: 10px 12px; overflow-x: auto; white-space: pre; margin: 0; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.upload-row { margin-bottom: 16px; font-size: 14px; }
.ghost-btn { display: inline-flex; align-items: center; height: var(--control-height); padding: 0 12px;
  border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface);
  font-weight: 500; font-size: 13px; cursor: pointer; }
.ghost-btn:hover { background: var(--raised); }
form h2:not(:first-child) { margin-top: 28px; }
form h2 { margin-bottom: 12px; }

/* ---------- Tombol: satu utama per layar ---------- */
button {
  font: 500 14px/20px var(--font); cursor: pointer; height: var(--control-height); padding: 0 14px;
  border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text); transition: background-color .12s, transform .06s;
}
button:hover { background: var(--raised); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--primary-ink); }
button.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
button.small { height: 28px; padding: 0 10px; font-size: 13px; }
button.block { width: 100%; margin-top: 12px; }
button.link { height: auto; padding: 0; border: 0; background: none; color: var(--accent-ink); font-size: 13px; }
button.link:hover { text-decoration: underline; background: none; }
button.ghost { background: var(--surface); }
form > button[type="submit"] { width: 100%; height: 36px; }
button:disabled { opacity: .55; cursor: progress; }
.msg { min-height: 20px; margin: 10px 0 0; font-size: 13px; }
.msg.err { color: var(--negative); }
.msg.ok { color: var(--positive); }

/* ---------- Daftar posting ---------- */
.history, .events, .users, .upcoming { list-style: none; padding: 0; margin: 0; }
.history { display: grid; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.post {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 14px 0; border-top: 1px solid var(--rule);
}
.post:first-child { border-top: 0; padding-top: 2px; }
.thumb {
  width: 56px; height: 70px; border-radius: 4px; overflow: hidden; background: var(--raised);
  display: grid; place-items: center; color: var(--muted); font-size: 11px; position: relative;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .count { position: absolute; right: 3px; bottom: 3px; font-size: 11px; font-weight: 600;
  background: rgba(17,24,39,.72); color: #fff; border-radius: 3px; padding: 0 4px; }
.post .when { font-weight: 600; font-size: 13px; color: var(--text); }
.post .topic { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; line-height: 20px; }
.post .caption { margin: 2px 0 0; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post .meta { font-size: var(--fs-small); color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.post.next { background: var(--accent-soft); margin: 0 calc(var(--card-pad) * -1); padding: 14px var(--card-pad);
  border-top: 0; border-radius: 0; }
.post.next .thumb { width: 72px; height: 90px; }
.post.next { grid-template-columns: 72px minmax(0, 1fr) auto; }
.slot-row .topic { color: var(--muted); }
.slot-thumb { border: 1px dashed var(--control); background: transparent; }
.post .actions button.link { height: auto; font-size: 13px; padding: 4px 0; text-align: right; }
.tag, .badge {
  display: inline-flex; align-items: center; flex: none; white-space: nowrap; height: 20px; padding: 0 7px;
  border-radius: var(--radius-chip); font-size: var(--fs-small); font-weight: 500;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink);
}
.tag.ai { background: var(--pill-accent-bg); color: var(--pill-accent-ink); }
.tag.wait, .badge.pending, .badge.publishing { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.badge.done { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.badge.error { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.badge.skipped { display: none; }
.badge a { color: inherit; text-decoration: none; }
.badge a:hover { text-decoration: underline; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.post .error-text, .error-text { font-size: 13px; color: var(--negative); margin: 8px 0 0; overflow-wrap: anywhere; }
.sources { font-size: 13px; margin-top: 6px; }
.sources summary { font-size: 13px; margin-bottom: 4px; }
.sources ul { margin: 0; padding-left: 18px; }
.sources a { color: var(--muted); overflow-wrap: anywhere; }
.post .actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.post .actions button { height: 28px; padding: 0 10px; font-size: 13px; }

/* Aktivitas */
.events li { padding: 10px 0; border-top: 1px solid var(--rule); font-size: 13px; line-height: 18px; overflow-wrap: anywhere; }
.events li:first-child { border-top: 0; }
.events li.error { color: var(--negative); }
.events .ev-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.events.all .ev-text { -webkit-line-clamp: unset; display: block; }
.events time { display: block; color: var(--muted); font-size: var(--fs-small); margin-bottom: 2px; }
.upcoming li { padding: 10px 0; border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.upcoming li:first-child { border-top: 0; }

/* Pengguna */
.users li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--rule);
}
.users li:first-child { border-top: 0; }
.users select { width: auto; min-height: 28px; padding: 3px 8px; }

/* ---------- Kalender ---------- */
.segmented { display: inline-flex; background: var(--raised); border-radius: var(--radius-control); padding: 2px; gap: 2px; }
.segmented button { height: 28px; border: 0; background: none; font-size: 13px; padding: 0 10px; }
.segmented button:hover { background: var(--surface); }
.calendar {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden;
}
.cal-day { padding: 10px; min-height: 260px; border-left: 1px solid var(--rule); min-width: 0; }
.calendar, .cal-item, .upcoming, .story-card, .post .when { font-variant-numeric: tabular-nums; }
.cal-day:first-child { border-left: 0; }
.cal-day.weekend { background: #fafbfc; }
.cal-head { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--muted);
  padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--rule); }
.cal-head b { color: var(--text); font-size: 18px; font-weight: 600; }
.cal-day.today .cal-head { border-bottom: 2px solid var(--accent); padding-bottom: 7px; }
.cal-day.today .cal-head b { color: var(--accent-ink); }
.cal-item {
  display: flex; gap: 8px; align-items: flex-start; width: 100%; height: auto; text-align: left;
  font: 400 12px/16px var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-chip);
  padding: 6px 8px; margin-bottom: 6px;
}
button.cal-item:hover { background: var(--raised); }
.cal-item.done { border-left-color: var(--border); background: var(--raised); }
.cal-item.error { border-left-color: var(--negative); }
.cal-item.slot { border: 1px dashed var(--control); color: var(--muted); background: transparent; }
.cal-item.story { border-left: 1px solid var(--border); }
.cal-item.story.done { background: var(--raised); }
.cal-thumb { width: 30px; height: 38px; flex: none; object-fit: cover; border-radius: 3px; background: var(--raised);
  display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.cal-topic { color: var(--muted); overflow-wrap: anywhere; }
.cal-empty { color: var(--faint); font-size: 12px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 14px; height: 10px; border-radius: 2px; border: 1px solid var(--border); display: inline-block; }
.cal-legend .k-post { border-left: 3px solid var(--accent); }
.cal-legend .k-done { background: var(--raised); }
.cal-legend .k-slot { border-style: dashed; border-color: var(--control); }
.cal-legend .k-story { background: var(--surface); }

/* ---------- Story ---------- */
.story-week { display: grid; }
.story-day { padding: 12px 0; border-top: 1px solid var(--rule); }
.story-day:first-child { border-top: 0; padding-top: 0; }
.story-day h3 { margin: 0 0 8px; text-transform: none; }
.story-day h3 span { color: var(--muted); font-weight: 400; }
.story-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; margin-bottom: 8px; font-size: 13px; }
.story-thumb { width: 54px; height: 96px; object-fit: cover; border-radius: 4px; background: var(--raised);
  display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.story-card .actions { display: flex; gap: 6px; margin-top: 6px; }
.story-day .empty { padding: 0; font-size: 13px; }

/* ---------- Insight ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table th { color: var(--muted); font-weight: 400; font-size: var(--fs-small); white-space: nowrap; border-bottom-color: var(--border); }
.table th.num, .table td.num { text-align: right; }
.table td:first-child, .table th:first-child { padding-left: 0; }
.table td:last-child, .table th:last-child { padding-right: 0; }
.table small { color: var(--muted); font-size: var(--fs-small); }
.table a { color: var(--accent-ink); text-decoration: none; }
.ins-topic { max-width: 320px; font-weight: 500; }
.dash { color: var(--faint); }
.bar { height: 4px; background: var(--rule); border-radius: 2px; margin-top: 6px; min-width: 56px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* ---------- Desain ---------- */
.design-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); }
.design-grid > .card:last-child, #tab-autopilot .grid-2 > div:last-child { position: sticky; top: 24px; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.preview-grid img { width: 100%; border-radius: 4px; display: block; background: var(--raised); }

/* ---------- Dialog ---------- */
dialog {
  width: min(560px, calc(100% - 32px)); border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface); color: var(--text); padding: 24px; box-shadow: 0 12px 32px rgba(17,24,39,.16);
}
dialog::backdrop { background: rgba(17,24,39,.4); }
dialog h2 { margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 28px; }
.login-card .brand { padding: 0 0 20px; }
.login-card h1 { font-size: 24px; line-height: 32px; }

/* ---------- Tablet & HP ---------- */
@media (max-width: 1180px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .calendar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cal-day { min-height: 0; border-top: 1px solid var(--rule); }
  .design-grid { grid-template-columns: minmax(0, 1fr); }
  .design-grid > .card:last-child, #tab-autopilot .grid-2 > div:last-child { position: static; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0; z-index: 20; height: 100%; width: 100%; border-right: 0;
    padding-top: 64px; transform: translateX(-100%); transition: transform .2s ease; visibility: hidden;
  }
  body.menu-open .sidebar { transform: none; visibility: visible; }
  body.menu-open { overflow: hidden; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: 48px;
    padding: 0 16px; background: var(--ground); border-bottom: 1px solid var(--border); font-weight: 600;
  }
  .menu-btn { width: 44px; height: 44px; margin-left: -12px; border: 0; background: none; padding: 0;
    display: grid; place-items: center; }
  .menu-btn svg { width: 20px; height: 20px; }
  main { padding: 20px 16px 48px; }
  h1 { font-size: 22px; line-height: 30px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 0; border-top: 1px solid var(--border); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--border); }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .calendar { grid-template-columns: minmax(0, 1fr); }
  .cal-day { border-left: 0; }
  .cal-day:first-child { border-top: 0; }
  .colors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  button, .chip, .nav button { min-height: 40px; }
  .nav button { height: 44px; }
  .post .actions { flex-direction: row; grid-column: 2 / -1; }
  .post, .post.next { grid-template-columns: 56px minmax(0, 1fr); }
  .post.next .thumb { width: 56px; height: 70px; }
}
@media (max-width: 640px) {
  /* Tabel insight bergeser di dalam bingkainya; kolom judul tetap terlihat. */
  .table th:first-child, .table td:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 180px; padding-right: 12px;
  }
  .table td, .table th { white-space: nowrap; }
  .table td:first-child { white-space: normal; }
}
@media (max-width: 520px) {
  .grid-fields { grid-template-columns: minmax(0, 1fr); }
  .users li { grid-template-columns: minmax(0, 1fr) auto; }
  .title-actions { width: 100%; }
  .title-actions .primary { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
