/* InstaTrack — light workspace shell (sidebar + KPI + chart + cards).
   Adapted from the reference layout, tuned for social metrics monitoring. */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e6e9f2;
  --line-soft: #eef1f7;
  --ink: #0f172a;
  --ink-2: #475467;
  --ink-3: #5a6b82;
  --ink-4: #667085;
  --accent: #2f6bff;
  --accent-ink: #1d4ed8;
  --accent-soft: #eaf0ff;
  --good: #12b76a;
  --good-soft: #e7f8ef;
  --warn: #f79009;
  --bad: #f04438;
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #d7e2ff; }
* { scrollbar-width: thin; scrollbar-color: #d0d5e2 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d0d5e2; border: 3px solid transparent; background-clip: padding-box; border-radius: 999px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

.ic { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 15px; height: 15px; }

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, #2f6bff, #22c3ee); color: #fff; font-weight: 750; font-size: 12px;
}
.brand-name { font-weight: 700; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--ink-4); }

.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-4); padding: 0 8px; margin-bottom: 6px; }
.nav { display: grid; gap: 2px; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 9px; border: 0; background: transparent;
  color: var(--ink-2); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; width: 100%;
}
.nav a:hover, .nav button:hover { background: #f5f7fc; text-decoration: none; color: var(--ink); }
.nav .active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
#platform-nav button[aria-pressed="true"] {
  background: transparent; color: var(--accent-ink); font-weight: 620; box-shadow: inset 2px 0 0 var(--accent);
  border-radius: 0 8px 8px 0; padding-left: 12px;
}
#platform-nav button[aria-pressed="true"] .count { color: var(--accent-ink); }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.foot-link {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-2); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.foot-link:hover { background: #f5f7fc; color: var(--ink); }
.foot-link.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.foot-link .count { margin-left: auto; font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.foot-row { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.user { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.user-text { min-width: 0; display: grid; gap: 1px; }
.user-name { font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 11.5px; color: var(--ink-3); text-align: left; cursor: pointer; }
.link-btn:hover { color: var(--accent-ink); text-decoration: underline; }
.icon-btn {
  width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink-3); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: #cfd6e4; }

.main { min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 17px; font-weight: 660; }
.search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px;
  background: #f6f7fb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
.search input { border: 0; background: transparent; outline: none; font: inherit; width: 100%; color: var(--ink); }
.search input::placeholder { color: var(--ink-4); }
.spacer { flex: 1; }

.content { padding: 20px 24px 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
@media (prefers-reduced-motion: no-preference) {
  .content > * { animation: rise .4s var(--ease) both; }
  .content > *:nth-child(2) { animation-delay: .04s; }
  .content > *:nth-child(3) { animation-delay: .08s; }
  .content > *:nth-child(4) { animation-delay: .12s; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.card-head h2 { font-size: 15px; }
.card-head .spacer { flex: 1; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpis.kpis--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { padding: 15px 16px; }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12.5px; }
.kpi-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.kpi-value { margin-top: 8px; font-size: 27px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-foot { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 999px; font-weight: 600; font-size: 11.5px; }
.trend.up { background: var(--good-soft); color: #027a48; }
.trend.flat { background: #f2f4f7; color: var(--ink-3); }

/* grid */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }

/* chart */
.chart-box { position: relative; height: 268px; padding: 6px 4px 0; }
.chart-empty {
  position: absolute; inset: 10px; display: grid; place-content: center; justify-items: center; gap: 6px;
  text-align: center; border: 1px dashed var(--line); border-radius: var(--r-sm); background: #fbfcfe; padding: 18px;
}
.chart-empty strong { font-size: 13.5px; }
.chart-empty span { font-size: 12.5px; color: var(--ink-3); max-width: min(48ch, 100%); }

/* segmented */
.seg { display: inline-flex; background: #f2f4f7; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--ink-3);
  padding: 5px 10px; border-radius: 7px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08); font-weight: 600; }

/* account list */
.acct { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px 26px; padding: 14px 18px 18px; }
.acct-row { display: grid; gap: 6px; }
.acct-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.acct-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-meta { margin-left: auto; font-size: 12.5px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 7px; border-radius: 999px; background: #eef1f7; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2f6bff, #6ea0ff); }
.acct-sub { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* top posts */
.posts-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 16px 18px 18px; }
.post-card { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.post-thumb { height: 118px; background: #f2f4f7 center/cover no-repeat; display: grid; place-items: center; color: var(--ink-4); }
.post-body { padding: 10px 11px 12px; display: grid; gap: 6px; }
.post-title { font-size: 12.5px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 34px; }
.post-metrics { display: flex; gap: 10px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.post-metrics b { color: var(--ink); font-weight: 600; }

/* toolbar + table */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.toolbar .field { display: flex; flex-direction: column; gap: 4px; }
.toolbar label { font-size: 11px; color: var(--ink-4); }
select, input[type="date"], input[type="number"], input[type="search"] {
  font: inherit; font-size: 13px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; outline: none;
}
select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 9px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.btn:hover { border-color: #cfd6e4; color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #2559d8; border-color: #2559d8; color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.table-wrap { overflow: auto; min-width: 0; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0; background: #fbfcfe; color: var(--ink-4);
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--ink-2); }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.post-cell { display: flex; gap: 10px; align-items: center; min-width: 220px; }
.thumb { width: 38px; height: 38px; border-radius: 9px; background: #f2f4f7 center/cover no-repeat; display: grid; place-items: center; color: var(--ink-4); flex: 0 0 auto; border: 1px solid var(--line); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.caption { max-width: 330px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.meta-line { display: flex; gap: 6px; font-size: 12px; color: var(--ink-4); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: capitalize; }
.badge-reel, .badge-video { background: #eef2ff; color: #3538cd; }
.badge-image { background: #f2f4f7; color: #475467; }
.badge-carousel { background: #f4f0ff; color: #6941c6; }
.badge-tiktok { background: #f2f4f7; color: #111; }
.badge-instagram { background: #fdf2f8; color: #9d174d; }
.badge-all { background: #eef2ff; color: #3538cd; }
.badge-threads { background: #f2f4f7; color: #111; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-btn { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 7px; padding: 3px 9px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.row-btn:hover { border-color: #cfd6e4; color: var(--ink); text-decoration: none; }
.row-btn.danger { color: #b42318; }
.row-btn.danger:hover { background: #fef3f2; border-color: #fecdca; color: #912018; }

.pagination { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line-soft); }

.empty { padding: 42px 20px; text-align: center; }
.empty h3 { font-size: 14px; margin-bottom: 6px; }
.empty p { color: var(--ink-3); font-size: 12.5px; max-width: 46ch; margin: 0 auto 12px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: #f2f4f7; color: var(--ink-2); font-size: 12px; font-weight: 500; }
.pill-good { background: var(--good-soft); color: #027a48; }
.pill-bad { background: #fef3f2; color: #912018; }
.pill-warn { background: #fffaeb; color: #b54708; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* modal + drawer */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(16,24,40,.45); display: grid; place-items: center; padding: 20px; }
.overlay[hidden] { display: none; }
.modal { width: min(480px, 100%); background: #fff; border-radius: 16px; box-shadow: 0 20px 48px rgba(16,24,40,.18); padding: 22px; }
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.modal .muted { font-size: 13px; margin-bottom: 16px; }
.modal label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.modal input { width: 100%; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.hint { margin-top: 8px; font-size: 12px; color: var(--ink-4); }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 45; width: min(520px, 100%); background: #fff; border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(16,24,40,.12); transform: translateX(102%); transition: transform .24s var(--ease); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 16px 18px; overflow: auto; display: grid; gap: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box { background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat-box .label { font-size: 11px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .04em; }
.stat-box .value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pts { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pts th { text-align: right; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-4); padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.pts th:first-child { text-align: left; }
.pts td { text-align: right; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.pts td:first-child { text-align: left; color: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px); background: #101828; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b42318; }

.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.4); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.menu-btn { display: none; }
.backdrop {
  position: fixed; inset: 0; z-index: 45; background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(2px);
}
.backdrop[hidden] { display: none; }

/* layar sangat lebar: jaga panjang baris tetap nyaman dibaca */
@media (min-width: 1500px) {
  .content { max-width: 1440px; margin: 0 auto; width: 100%; }
  .topbar, .filterbar { padding-left: max(24px, calc((100vw - 1440px) / 2 + 24px)); padding-right: max(24px, calc((100vw - 1440px) / 2 + 24px)); }
}

/* ---- tablet & kecil ---- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-box { height: 240px; }
}

/* ---- mobile: sidebar jadi drawer ---- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: grid; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: min(280px, 84vw); height: 100dvh;
    transform: translateX(-102%); transition: transform .22s var(--ease);
    box-shadow: 0 0 0 1px var(--line), 24px 0 48px rgba(16, 24, 40, .18);
    overflow-y: auto;
  }
  .sidebar.open { transform: none; }
  .sidebar .nav, .sidebar .nav-label, .side-foot { display: revert; }
  .side-foot { margin-top: auto; }

  .topbar { padding: 10px 14px; gap: 8px; }
  .page-title { font-size: 15px; }
  .search { order: 3; flex: 1 1 100%; max-width: none; }
  .topbar .spacer { display: none; }
  .content { padding: 14px 14px 44px; gap: 12px; }
  .card-head { padding: 12px 14px; }
  .posts-grid { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .chart-box { height: 210px; }
  .kpi-value { font-size: 23px; }
  .toolbar { padding: 12px 14px; }
  .toolbar .field { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .toolbar .field select, .toolbar .field input { width: 100%; }
  .filterbar { padding: 8px 14px; }

  /* tabel: sembunyikan kolom sekunder, sisakan yang penting */
  #sec-tabel table th:nth-child(3), #sec-tabel table td:nth-child(3),
  #sec-tabel table th:nth-child(6), #sec-tabel table td:nth-child(6),
  #view-akun table th:nth-child(2), #view-akun table td:nth-child(2),
  #view-akun table th:nth-child(3), #view-akun table td:nth-child(3),
  #view-akun table th:nth-child(5), #view-akun table td:nth-child(5),
  #view-akun table th:nth-child(7), #view-akun table td:nth-child(7),
  #view-audit table th:nth-child(5), #view-audit table td:nth-child(5),
  #view-audit table th:nth-child(6), #view-audit table td:nth-child(6) { display: none; }

  thead th { padding: 9px 10px; }
  tbody td { padding: 9px 10px; }
  .caption { max-width: 42vw; }
  .row-actions { gap: 4px; }
  .row-btn { padding: 4px 7px; font-size: 11.5px; }
  .drawer { width: 100%; }
  .modal { padding: 18px; }
}

/* ---- layar sangat kecil ---- */
@media (max-width: 420px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 12px; }
  .kpi-value { font-size: 20px; }
  .kpi-top { font-size: 11.5px; gap: 6px; }
  .kpi-ic { width: 22px; height: 22px; }
  .kpi-foot { font-size: 11px; }
  .page-title { font-size: 14px; }
  .kpi-value { font-size: 21px; }
  .toolbar .field { flex: 1 1 100%; }
  .caption { max-width: 36vw; }
  .btn, .row-btn { padding: 6px 9px; }
}

/* ---------------- login ---------------- */
.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 28px 20px;
  background:
    radial-gradient(900px 520px at 12% -10%, #e8efff 0%, rgba(232,239,255,0) 62%),
    radial-gradient(760px 520px at 92% 108%, #e9f8f1 0%, rgba(233,248,241,0) 60%),
    var(--bg);
}
.auth-shell {
  width: min(400px, 100%); display: grid; grid-template-columns: 1fr;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .10); overflow: hidden;
}
.auth-brand { padding: 34px 32px; border-right: 1px solid var(--line); background: linear-gradient(180deg, #fbfcff, #f6f8fd); }
.auth-brand .brand-mark { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 16px; }
.auth-brand h1 { font-size: 21px; letter-spacing: -.02em; }
.brand-tag { margin-top: 8px; color: var(--ink-3); font-size: 13.5px; max-width: 34ch; }
.brand-points { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 11px; }
.brand-points li { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.brand-points .ic { color: var(--accent); margin-top: 1px; }
.auth-form { padding: 34px 32px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h2 { font-size: 18px; }
.auth-form .sub { margin: 6px 0 18px; color: var(--ink-3); font-size: 13px; }
.auth-form label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.auth-form input { width: 100%; }
.auth-form .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 10px; }
.auth-error { margin-top: 12px; font-size: 12.5px; }
.auth-foot { margin-top: 16px; font-size: 11.5px; color: var(--ink-4); }
@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px; }
  .auth-form { padding: 24px; }
}

/* audit log */
.audit-msg { font-size: 12.5px; color: var(--ink-2); max-width: 62ch; overflow-wrap: anywhere; }
code.small { font-size: 11.5px; background: #f4f6fb; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--ink-2); }
.nav .count.bad { color: #b42318; font-weight: 700; }

/* login form (kelas yang dipakai template) */
.auth-card { padding: 34px 32px; display: flex; flex-direction: column; justify-content: center; }
.auth-card h2 { font-size: 18px; letter-spacing: -.02em; }
.auth-card > .muted { margin: 6px 0 4px; font-size: 13px; }
.auth-card form { margin-top: 14px; display: grid; gap: 4px; }
.auth-card label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.auth-card input {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
}
.auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,107,255,.14); }
.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { padding-right: 62px; }
.ghost-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--accent-ink);
  font: inherit; font-size: 12px; font-weight: 600; padding: 6px 8px; border-radius: 7px; cursor: pointer;
}
.ghost-btn:hover { background: var(--accent-soft); }
.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 10px; padding: 10px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.primary-btn:hover { background: #2559d8; border-color: #2559d8; }
.primary-btn[disabled] { opacity: .6; cursor: progress; }
.alert {
  margin-top: 12px; padding: 9px 12px; border-radius: 9px;
  background: #fef3f2; border: 1px solid #fecdca; color: #912018; font-size: 12.5px;
}
.foot-note { margin-top: 16px; font-size: 11.5px; color: var(--ink-4); line-height: 1.5; }


/* ---------------- dark mode ---------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1018;
  --card: #121a26;
  --line: #22303f;
  --line-soft: #1b2734;
  --ink: #e9eff7;
  --ink-2: #bcc8d8;
  --ink-3: #a3b1c4;
  --ink-4: #93a2b6;
  --accent: #5b8cff;
  --accent-ink: #a9c2ff;
  --accent-soft: #17233a;
  --good: #3ddc97;
  --good-soft: #102b23;
  --warn: #fdb022;
  --bad: #ff8a80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .45);
}
[data-theme="dark"] .topbar { background: rgba(18, 26, 38, .86); }
[data-theme="dark"] .search,
[data-theme="dark"] .seg,
[data-theme="dark"] .thumb,
[data-theme="dark"] .post-thumb,
[data-theme="dark"] .bar,
[data-theme="dark"] .stat-box,
[data-theme="dark"] .chart-empty { background: #0f1620; }
[data-theme="dark"] .bar span { background: linear-gradient(90deg, #3f6fe0, #6f9bff); }
[data-theme="dark"] .seg button { color: var(--ink-3); }
[data-theme="dark"] .seg button[aria-pressed="true"] { background: #1c2836; color: var(--ink); box-shadow: none; }
[data-theme="dark"] thead th { background: #0f1620; color: var(--ink-3); }
[data-theme="dark"] tbody tr:hover { background: #17202c; }
[data-theme="dark"] tbody td { border-color: var(--line-soft); }
/* input teks/email/password: latar ikut gelap supaya teks tidak hilang */
[data-theme="dark"] .auth-card input,
[data-theme="dark"] .modal input,
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input:not([type]),
[data-theme="dark"] textarea {
  background: #0f1620;
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .auth-card input::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--ink-4); }

[data-theme="dark"] .btn,
[data-theme="dark"] .row-btn,
[data-theme="dark"] select,
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] .modal,
[data-theme="dark"] .drawer,
[data-theme="dark"] .icon-btn { background: #16202c; color: var(--ink-2); border-color: var(--line); }
[data-theme="dark"] .btn:hover,
[data-theme="dark"] .row-btn:hover { border-color: #33445a; color: var(--ink); }
[data-theme="dark"] .btn-primary { background: var(--accent); border-color: var(--accent); color: #08111f; }
[data-theme="dark"] .btn-primary:hover { background: #4d7ef5; border-color: #4d7ef5; color: #08111f; }
[data-theme="dark"] .nav a:hover,
[data-theme="dark"] .nav button:hover,
[data-theme="dark"] .foot-link:hover { background: #17202c; }
[data-theme="dark"] .nav .active,
[data-theme="dark"] .foot-link.active { background: var(--accent-soft); color: var(--accent-ink); }
[data-theme="dark"] .pill { background: #16202c; color: var(--ink-2); }
[data-theme="dark"] .pill-good { background: #102b23; color: #6ee7b7; }
[data-theme="dark"] .pill-bad { background: #2c1616; color: #ffb4ad; }
[data-theme="dark"] .pill-warn { background: #2b2211; color: #fec84b; }
[data-theme="dark"] .trend.up { background: #102b23; color: #6ee7b7; }
[data-theme="dark"] .trend.flat { background: #17202c; color: var(--ink-3); }
[data-theme="dark"] .badge-reel,
[data-theme="dark"] .badge-video { background: #1b2440; color: #b3c4ff; }
[data-theme="dark"] .badge-image { background: #1b2734; color: var(--ink-2); }
[data-theme="dark"] .badge-carousel { background: #241f38; color: #cbb8ff; }
[data-theme="dark"] .badge-instagram { background: #2c1626; color: #f9a8d4; }
[data-theme="dark"] .badge-tiktok,
[data-theme="dark"] .badge-threads { background: #1b2734; color: var(--ink); }
[data-theme="dark"] code.small { background: #0f1620; color: var(--ink-2); }
[data-theme="dark"] .toast { background: #1c2836; color: var(--ink); }
[data-theme="dark"] .overlay { background: rgba(4, 8, 14, .7); }
[data-theme="dark"] * { scrollbar-color: #33445a transparent; }
[data-theme="dark"] *::-webkit-scrollbar-thumb { background: #33445a; }
[data-theme="dark"] .auth-body {
  background:
    radial-gradient(900px 520px at 12% -10%, #16233a 0%, rgba(22, 35, 58, 0) 62%),
    radial-gradient(760px 520px at 92% 108%, #102b23 0%, rgba(16, 43, 35, 0) 60%),
    var(--bg);
}
[data-theme="dark"] .auth-brand { background: linear-gradient(180deg, #121a26, #0e1620); }
[data-theme="dark"] .ghost-btn:hover { background: var(--accent-soft); }
[data-theme="dark"] .kpi-ic { background: var(--accent-soft); color: var(--accent-ink); }

/* bar filter aktif */
.filterbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 24px; background: var(--card); border-bottom: 1px solid var(--line);
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500;
}
.chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; opacity: .7; }
.chip button:hover { opacity: 1; }
