/* ============================================================
   APPNET — Template Preview  ·  "Nusantara" theme
   Light / Dark via CSS custom properties.
   Toggle: <html data-theme="dark"> (JS) — default follows OS.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;

  /* Brand */
  --brand:          #d9541e;
  --brand-strong:   #b0400f;
  --brand-soft:     #fdeadf;
  --brand-contrast: #ffffff;

  /* Surfaces */
  --page:      #f4f6f9;
  --surface:   #ffffff;
  --surface-2: #f8f9fb;
  --sidebar:   #ffffff;
  --topbar:    rgba(255, 255, 255, .85);

  /* Ink */
  --ink:       #10151b;
  --ink-2:     #4c5560;
  --muted:     #8a929e;

  /* Lines & shadows */
  --border:      #e5e8ee;
  --border-soft: #eef0f4;
  --ring:        rgba(217, 84, 30, .25);
  --shadow-sm: 0 1px 2px rgba(16, 21, 27, .05);
  --shadow-md: 0 6px 24px -8px rgba(16, 21, 27, .12);

  /* Status (fixed — icon + label always accompany color) */
  --st-good:       #0ca30c;
  --st-good-soft:  #e2f5e2;
  --st-warn:       #b97800;
  --st-warn-soft:  #fdf0d3;
  --st-serious:      #cf5426;
  --st-serious-soft: #fcebe3;
  --st-crit:       #d03b3b;
  --st-crit-soft:  #fbe6e6;
  --st-off:        #667085;
  --st-off-soft:   #eceef2;

  /* Chart ink (dataviz tokens) */
  --viz-series-1: #d9541e;
  --viz-grid:     #e1e0d9;
  --viz-axis:     #c3c2b7;
  --viz-label:    #898781;

  /* Metrics */
  --radius:    14px;
  --radius-sm: 9px;
  --sidebar-w: 264px;
  --topbar-h:  64px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

/* Dark tokens — one block, applied two ways (OS preference + manual toggle) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand:          #f07a3c;
    --brand-strong:   #f9a377;
    --brand-soft:     #3a2317;
    --brand-contrast: #ffffff;

    --page:      #0c0f13;
    --surface:   #14181e;
    --surface-2: #1a1f26;
    --sidebar:   #101419;
    --topbar:    rgba(16, 20, 25, .85);

    --ink:   #eef1f5;
    --ink-2: #aeb6c0;
    --muted: #7d8590;

    --border:      #262c35;
    --border-soft: #1f242c;
    --ring:        rgba(240, 122, 60, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, .55);

    --st-good-soft:  rgba(12, 163, 12, .16);
    --st-warn:       #fab219;
    --st-warn-soft:  rgba(250, 178, 25, .14);
    --st-serious:      #ec835a;
    --st-serious-soft: rgba(236, 131, 90, .14);
    --st-crit-soft:  rgba(208, 59, 59, .16);
    --st-off:        #98a2b3;
    --st-off-soft:   rgba(152, 162, 179, .14);

    --viz-series-1: #f07a3c;
    --viz-grid:     #2c2c2a;
    --viz-axis:     #383835;
    --viz-label:    #898781;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand:          #f07a3c;
  --brand-strong:   #f9a377;
  --brand-soft:     #3a2317;
  --brand-contrast: #ffffff;

  --page:      #0c0f13;
  --surface:   #14181e;
  --surface-2: #1a1f26;
  --sidebar:   #101419;
  --topbar:    rgba(16, 20, 25, .85);

  --ink:   #eef1f5;
  --ink-2: #aeb6c0;
  --muted: #7d8590;

  --border:      #262c35;
  --border-soft: #1f242c;
  --ring:        rgba(240, 122, 60, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, .55);

  --st-good-soft:  rgba(12, 163, 12, .16);
  --st-warn:       #fab219;
  --st-warn-soft:  rgba(250, 178, 25, .14);
  --st-serious:      #ec835a;
  --st-serious-soft: rgba(236, 131, 90, .14);
  --st-crit-soft:  rgba(208, 59, 59, .16);
  --st-off:        #98a2b3;
  --st-off-soft:   rgba(152, 162, 179, .14);

  --viz-series-1: #f07a3c;
  --viz-grid:     #2c2c2a;
  --viz-axis:     #383835;
  --viz-label:    #898781;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  transition: background-color .25s ease, color .25s ease;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
img { max-width: 100%; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

::selection { background: var(--ring); }

/* Ikon Lucide (SVG stroke): ukuran ikut font-size elemen, warna ikut currentColor */
svg.lucide { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}
.content { padding: 24px 28px 48px; flex: 1; width: 100%; max-width: 1440px; margin-inline: auto; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform .25s ease, width .25s ease;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; white-space: nowrap; }
.brand-name small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

.sidebar-nav { overflow-y: auto; padding: 14px 12px 24px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

.nav-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 18px 12px 7px;
}
.nav-item { list-style: none; }
.sidebar-nav ul { margin: 0; padding: 0; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  position: relative;
  transition: background-color .15s, color .15s;
}
.nav-link .lucide { font-size: 18px; width: 20px; text-align: center; flex-shrink: 0; color: var(--muted); transition: color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link:hover .lucide { color: var(--ink-2); }
.nav-link.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.nav-link.active .lucide { color: var(--brand); }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.nav-link .nav-badge {
  margin-left: auto;
  background: var(--st-crit);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 7px;
}
.nav-link .nav-caret { margin-left: auto; font-size: 15px; color: var(--muted); transition: transform .2s; }
.nav-item.open > .nav-link .nav-caret { transform: rotate(90deg); }

.nav-sub { display: none; padding-left: 30px !important; }
.nav-item.open > .nav-sub { display: block; }
.nav-sub .nav-link { padding: 7px 12px; font-size: 13.5px; }
.nav-sub .nav-link::after {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border);
  position: absolute;
  left: -14px; top: 50%;
  transform: translateY(-50%);
}
.nav-sub .nav-link.active::after { background: var(--brand); }
.nav-sub .nav-link.active::before { display: none; }

/* ---------- Topbar (gaya "detached" ala Materialize) ----------
   Default: transparan, menyatu dengan latar halaman.
   Saat digulir (body.win-scrolled): jadi kartu melayang dengan
   sudut bawah membulat + bayangan, selebar area konten. */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 56px);
  max-width: calc(1440px - 56px);
  margin-inline: auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0 0 14px 14px;
  z-index: 40;
  /* padding ikut dianimasikan → isi navbar "geser dari pinggir ke tengah"
     saat digulir, sama seperti .window-scrolled milik Materialize */
  transition: background-color .25s ease, box-shadow .25s ease, padding .25s ease;
}
body.win-scrolled .topbar {
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding-inline: 24px;
}
.icon-btn {
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  font-size: 19px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.topbar-search, .search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 99px;
  padding: 8px 16px;
  width: min(340px, 100%);
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.topbar-search:focus-within, .search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.topbar-search input, .search-box input {
  border: none; outline: none; background: transparent;
  color: var(--ink); font: inherit; width: 100%;
}
/* search di area konten (filter tabel) — kotak, bukan pill */
.search-box {
  border-radius: var(--radius-sm);
  background: var(--surface);
  border-color: var(--border);
  padding: 8.5px 14px;
  width: min(280px, 100%);
}
.topbar-search kbd {
  font: 600 10.5px/1 var(--font);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 6px;
  color: var(--muted);
}
/* search di topbar: minimalis ala Materialize — ikon + teks tanpa kotak,
   kotaknya baru muncul saat fokus */
.topbar .topbar-search { background: transparent; border-color: transparent; padding: 8px 10px; }
.topbar .topbar-search:focus-within { background: var(--surface-2); border-color: var(--brand); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.topbar-user {
  display: flex;
  align-items: center;
  padding: 0;
  margin-left: 8px;
  border: none;
  background: none;
  cursor: pointer;
}
.topbar-user .avatar { position: relative; width: 38px; height: 38px; }
.topbar-user .avatar::after {
  content: "";
  position: absolute;
  right: 0; bottom: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--st-good);
  border: 2px solid var(--page);
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #7c5cd6);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.topbar-user .u-name { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.topbar-user .u-role { font-size: 11.5px; color: var(--muted); line-height: 1.2; }

/* theme toggle shows one icon per mode */
.icon-btn .ic-sun   { display: none; }
:root[data-theme="dark"] .icon-btn .ic-sun  { display: block; }
:root[data-theme="dark"] .icon-btn .ic-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .ic-sun  { display: block; }
  :root:not([data-theme="light"]) .icon-btn .ic-moon { display: none; }
}

/* ---------- Page head / breadcrumb ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 21px; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}
.breadcrumb .lucide { font-size: 13px; }
.breadcrumb .sep { opacity: .55; }
.breadcrumb .current { color: var(--ink-2); font-weight: 500; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h3 .lucide { color: var(--muted); font-size: 17px; }
.card-body { padding: 20px; }

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: 18px; }
.grid-tiles { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .grid-2-1 { grid-template-columns: 1fr; } }

/* ---------- Stat tiles ---------- */
.tile { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile-label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.tile-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.tile-value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 5px; }
.tile-value small { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.tile-foot { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.tile-foot a { font-weight: 500; }

.ti-brand   { background: var(--brand-soft);      color: var(--brand); }
.ti-good    { background: var(--st-good-soft);    color: var(--st-good); }
.ti-warn    { background: var(--st-warn-soft);    color: var(--st-warn); }
.ti-serious { background: var(--st-serious-soft); color: var(--st-serious); }
.ti-crit    { background: var(--st-crit-soft);    color: var(--st-crit); }
.ti-off     { background: var(--st-off-soft);     color: var(--st-off); }

.delta { font-size: 12px; font-weight: 650; display: inline-flex; align-items: center; gap: 2px; }
.delta.up   { color: var(--st-good); }
.delta.down { color: var(--st-crit); }

/* ---------- Badges (status = icon + label, never color alone) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3.5px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge .lucide { font-size: 13px; }
.badge-good    { background: var(--st-good-soft);    color: var(--st-good); }
.badge-warn    { background: var(--st-warn-soft);    color: var(--st-warn); }
.badge-serious { background: var(--st-serious-soft); color: var(--st-serious); }
.badge-crit    { background: var(--st-crit-soft);    color: var(--st-crit); }
.badge-off     { background: var(--st-off-soft);     color: var(--st-off); }
.badge-brand   { background: var(--brand-soft);      color: var(--brand); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: 600 13.5px/1 var(--font);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
  text-decoration: none;
}
.btn .lucide { font-size: 16px; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

.btn-primary { background: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-strong); color: var(--brand-contrast); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: var(--brand); color: var(--brand-contrast); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--st-crit); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-icon-sm {
  width: 30px; height: 30px; padding: 0;
  border-radius: 8px;
  font-size: 15px;
}
.btn-block { width: 100%; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.row-actions { display: flex; gap: 6px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.field label .req { color: var(--st-crit); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9.5px 13px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--ring);
}
.textarea { resize: vertical; min-height: 84px; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-icon { position: relative; }
.input-icon > .lucide {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 16px;
}
.input-icon .input { padding-left: 38px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; }
.switch .track {
  width: 40px; height: 22px;
  background: var(--border);
  border-radius: 99px;
  position: relative;
  transition: background-color .2s;
  flex-shrink: 0;
}
.switch .track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ---------- Filter bar ---------- */
.filter-head { flex-wrap: wrap; gap: 10px; }
.chip-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.chip-row .chip { flex-shrink: 0; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font: 600 12.5px/1 var(--font);
  padding: 8.5px 14px;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .cnt { font-weight: 700; opacity: .75; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; gap: 5px; }
.page-btn {
  min-width: 34px; height: 34px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font: 600 13px/1 var(--font);
  cursor: pointer;
  transition: all .15s;
}
.page-btn:hover { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: default; }

/* ---------- Chart ---------- */
.viz { position: relative; }
.viz svg { display: block; width: 100%; height: auto; }
.viz .bar { fill: var(--viz-series-1); rx: 4; cursor: pointer; transition: opacity .12s; }
.viz .bar.dim { opacity: .35; }
.viz .gridline { stroke: var(--viz-grid); stroke-width: 1; }
.viz .baseline { stroke: var(--viz-axis); stroke-width: 1; }
.viz .tick { font: 500 11px var(--font); fill: var(--viz-label); }
.viz-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-md);
  padding: 8px 12px;
  font-size: 12.5px;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity .12s;
  white-space: nowrap;
  z-index: 10;
}
.viz-tooltip .t-label { color: var(--muted); font-size: 11.5px; }
.viz-tooltip .t-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* status composition bar */
.compo { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--page); }
.compo > span { display: block; }
.compo-legend { display: flex; flex-wrap: wrap; gap: 14px 20px; margin-top: 14px; }
.compo-legend .lg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.compo-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.compo-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Progress ---------- */
.progress { height: 7px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }

/* ---------- Alert ---------- */
.alert {
  display: flex;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  align-items: flex-start;
}
.alert .lucide { font-size: 18px; margin-top: 1px; }
.alert-info { background: var(--brand-soft); color: var(--brand); }
.alert-warn { background: var(--st-warn-soft); color: var(--st-warn); }

/* ---------- Login page ---------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.auth-hero {
  background:
    radial-gradient(1000px 600px at 15% 10%, rgba(255,255,255,.14), transparent 55%),
    linear-gradient(150deg, #b0400f, #7a2a08 55%, #40160a);
  color: #fff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  inset: auto -120px -180px auto;
  width: 420px; height: 420px;
  border-radius: 50%;
  border: 60px solid rgba(255,255,255,.06);
}
.auth-hero .brand-row { display: flex; align-items: center; gap: 12px; }
.auth-hero .brand-mark { background: rgba(255,255,255,.15); backdrop-filter: blur(4px); }
.auth-hero h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.25; max-width: 420px; }
.auth-hero p { color: rgba(255,255,255,.72); max-width: 400px; }
.auth-hero .points { display: grid; gap: 12px; margin-top: 22px; }
.auth-hero .points li { list-style: none; display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.85); font-size: 14px; }
.auth-hero .points .lucide { color: #8fd18f; font-size: 17px; }
.auth-form-side {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: var(--page);
}
.auth-card { width: min(400px, 100%); }
.auth-card .card-body { padding: 30px 28px; }
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}

/* ---------- Map placeholder ---------- */
.map-ph {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 28px 28px;
  background-color: var(--surface-2);
  height: 230px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.map-ph .lucide { font-size: 30px; display: block; margin: 0 auto 6px; color: var(--brand); }

/* ---------- Footer ---------- */
.footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Sidebar collapse (desktop) & drawer (mobile) ---------- */
body.sb-collapsed .sidebar { width: 78px; }
body.sb-collapsed .main { margin-left: 78px; }
body.sb-collapsed .brand-name,
body.sb-collapsed .nav-link span,
body.sb-collapsed .nav-title,
body.sb-collapsed .nav-badge,
body.sb-collapsed .nav-caret,
body.sb-collapsed .nav-sub { display: none; }
body.sb-collapsed .nav-link { justify-content: center; padding: 11px; }
body.sb-collapsed .sidebar-brand { justify-content: center; padding: 0; }

.scrim {
  position: fixed; inset: 0;
  background: rgba(8, 10, 14, .5);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .main, body.sb-collapsed .main { margin-left: 0; }
  body.sb-open .sidebar { transform: translateX(0); width: var(--sidebar-w); }
  body.sb-open .scrim { opacity: 1; pointer-events: auto; }
  body.sb-open.sb-collapsed .brand-name,
  body.sb-open.sb-collapsed .nav-link span,
  body.sb-open.sb-collapsed .nav-title { display: block; }
  /* sejajarkan tepi navbar dengan tepi konten (padding .content = 16px) */
  .topbar { width: calc(100% - 32px); padding: 0; }
  body.win-scrolled .topbar { padding-inline: 12px; }
  .content { padding: 18px 16px 40px; }
  .topbar .topbar-search { display: none; } /* hanya search di topbar; search filter konten tetap tampil */

  /* Filter tabel: search penuh, chip digeser horizontal, dropdown penuh */
  .filter-head { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .filter-head .search-box { width: 100%; }
  .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .filter-head .select { width: 100% !important; }

  /* Tabel: paksa lebar minimum supaya scroll ke samping, bukan kolom remuk */
  .table-wrap .table { min-width: 860px; }
  .table-wrap .table th, .table-wrap .table td { white-space: nowrap; }

  /* Footer tabel (info + pagination) bertumpuk rapi */
  .table-foot { flex-direction: column; align-items: center; gap: 10px; text-align: center; }
  .table-foot .pagination { justify-content: center; flex-wrap: wrap; }

  .page-head { align-items: stretch; flex-direction: column; }
  .page-head > .d-flex { flex-wrap: wrap; }
}

/* ---------- Icon animations (gaya "animated icons") ----------
   Ikon hidup seperti animated icons Flaticon/Lordicon, tapi murni CSS
   pada ikon Remix yang sudah ada — tanpa aset eksternal.
   - Loop terus-menerus: ikon stat tile, brand, lonceng notifikasi, badge kritis
   - Saat hover: ikon menu sidebar, tombol, chip, aksi tabel
   Semua dimatikan otomatis jika user memilih "reduce motion". */

@keyframes ic-bob     { 0%,100% { transform: translateY(0) }   50% { transform: translateY(-3px) } }
@keyframes ic-pulse   { 0%,100% { transform: scale(1) }        50% { transform: scale(1.18) } }
@keyframes ic-wiggle  { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-12deg) } 75% { transform: rotate(12deg) } }
@keyframes ic-ring    { 0%,100% { transform: rotate(0) } 10% { transform: rotate(14deg) } 20% { transform: rotate(-12deg) }
                        30% { transform: rotate(9deg) } 40% { transform: rotate(-6deg) } 50% { transform: rotate(0) } }
@keyframes ic-spin    { to { transform: rotate(360deg) } }
@keyframes ic-radar   { 0% { box-shadow: 0 0 0 0 var(--ring) } 100% { box-shadow: 0 0 0 12px transparent } }
@keyframes ic-blink   { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
@keyframes ic-beat    { 0%,20%,100% { transform: scale(1) } 10% { transform: scale(1.22) } 15% { transform: scale(1.08) } }

/* Loop kontinu */
.brand-mark { animation: ic-radar 2.8s ease-out infinite; }
.brand-mark .lucide { display: inline-block; animation: ic-pulse 2.8s ease-in-out infinite; }

.tile-icon .lucide { display: inline-block; animation: ic-bob 2.6s ease-in-out infinite; }
.tile:nth-child(2) .tile-icon .lucide { animation-delay: .3s; }
.tile:nth-child(3) .tile-icon .lucide { animation-name: ic-blink; animation-delay: .1s; }
.tile:nth-child(4) .tile-icon .lucide { animation-name: ic-wiggle; animation-duration: 3s; }
.tile:nth-child(5) .tile-icon .lucide { animation-name: ic-blink; animation-delay: .5s; }
.tile:nth-child(6) .tile-icon .lucide { animation-delay: .6s; }
.tile:nth-child(7) .tile-icon .lucide { animation-delay: .9s; }
.tile:nth-child(8) .tile-icon .lucide { animation-name: ic-beat; animation-duration: 2.2s; }

.ic-bell { display: inline-block; transform-origin: top center; animation: ic-ring 3.5s ease-in-out infinite; }
.badge-crit .lucide, .badge-warn .lucide { display: inline-block; animation: ic-blink 1.8s ease-in-out infinite; }
.alert .lucide { animation: ic-pulse 2.4s ease-in-out infinite; }

/* Saat hover / aktif */
.nav-link .lucide { transition: transform .2s; }
.nav-link:hover .lucide { animation: ic-wiggle .5s ease-in-out; }
.nav-link.active .lucide { animation: ic-bob 2.2s ease-in-out infinite; }

.btn .lucide, .chip .lucide, .page-btn .lucide { display: inline-block; }
.btn:hover .lucide { animation: ic-wiggle .45s ease-in-out; }
.btn:hover .ic-refresh,
.btn-soft:hover .ic-refresh { animation: ic-spin .7s linear; }
.chip:hover .lucide { animation: ic-pulse .4s ease-in-out; }
.btn-icon-sm:hover .lucide { animation: ic-pulse .35s ease-in-out; }

/* Micro-interaction ikon navbar (ala Materialize):
   ikon "pop" membal saat hover, hamburger berputar, globe berputar penuh,
   ikon tema berputar masuk saat mode diganti, avatar membesar halus. */
@keyframes ic-theme-in { from { transform: rotate(-100deg) scale(.4); opacity: 0 } to { transform: rotate(0) scale(1); opacity: 1 } }

.icon-btn .lucide { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.icon-btn:hover .lucide { transform: scale(1.22); }
.icon-btn:hover .ic-menu { transform: scale(1.1) rotate(90deg); }
.icon-btn:hover .ic-globe { animation: ic-spin .6s ease-in-out; }
.icon-btn:hover .ic-bell { animation-duration: 1.2s; }
.icon-btn .ic-sun, .icon-btn .ic-moon { animation: ic-theme-in .45s cubic-bezier(.34, 1.56, .64, 1); }
.topbar-user .avatar { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s; }
.topbar-user:hover .avatar { transform: scale(1.1); box-shadow: 0 0 0 3px var(--ring); }
.topbar-search:focus-within .lucide { animation: ic-pulse .4s ease-in-out; }

/* Hormati preferensi aksesibilitas */
@media (prefers-reduced-motion: reduce) {
  .brand-mark, .brand-mark .lucide, .tile-icon .lucide, .icon-btn .lucide, .badge .lucide, .alert .lucide,
  .nav-link .lucide, .btn .lucide, .chip .lucide { animation: none !important; }
}

/* ---------- Utilities ---------- */
.mt-1 { margin-top: 6px; }  .mt-2 { margin-top: 12px; }  .mt-3 { margin-top: 18px; }  .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.text-muted { color: var(--muted); }
.text-2 { color: var(--ink-2); }
.fw-600 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.d-flex { display: flex; }
.ai-center { align-items: center; }
.jc-between { justify-content: space-between; }
.gap-2 { gap: 10px; }
.w-100 { width: 100%; }
