/* MsMBILL PRO — tema navy & putih, responsif */
:root {
  --navy-900: #071426;
  --navy-800: #0B1F3A;
  --navy-700: #12294d;
  --navy-600: #1b3763;
  --blue-600: #2563EB;
  --blue-500: #3B82F6;
  --blue-50: #EFF5FF;
  --bg: #F3F6FC;
  --surface: #ffffff;
  --ink: #0F1B33;
  --ink-2: #33415C;
  --muted: #6B7A94;
  --line: #E3E9F2;
  --ok: #0E9F6E;
  --ok-bg: #E6F7F0;
  --warn: #B45309;
  --warn-bg: #FEF3E2;
  --danger: #C81E1E;
  --danger-bg: #FDECEC;
  --info: #1D4ED8;
  --info-bg: #E8EFFE;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 51, .05);
  --shadow: 0 1px 2px rgba(15, 27, 51, .04), 0 12px 28px -22px rgba(15, 27, 51, .45);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }
.ico { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 264px; flex: 0 0 264px;
  background: linear-gradient(185deg, var(--navy-800) 0%, var(--navy-900) 100%);
  color: #D7E2F5;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, .06);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue-500), #1E4FC4);
  color: #fff; box-shadow: 0 8px 18px -8px rgba(59, 130, 246, .9);
}
.brand-logo .ico { width: 22px; height: 22px; }
.brand-text b { display: block; font-size: 16px; color: #fff; letter-spacing: .01em; }
.brand-text b span { color: #7EB0FF; font-weight: 600; margin-left: 3px; }
.brand-text small { color: #8EA3C4; font-size: 11px; }
.nav { flex: 1 1 auto; overflow-y: auto; padding: 14px 12px 18px; }
.nav-sec {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: #6E82A4; padding: 14px 10px 6px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 3px;
  color: #C3D2E9; font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent; transition: .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .35), rgba(37, 99, 235, .08));
  color: #fff; border-left-color: var(--blue-500); font-weight: 600;
}
.nav-item .ico { width: 17px; height: 17px; opacity: .9; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(59, 130, 246, .22); color: #CFE0FF; font-weight: 700;
}
.user-meta b { display: block; font-size: 13px; color: #fff; }
.user-meta small { color: #8EA3C4; font-size: 11px; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px; background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.title-wrap h1 { font-size: 20px; }
.title-wrap p { margin: 2px 0 0; font-size: 12.5px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 24px 28px 36px; max-width: 1440px; width: 100%; }
.footer {
  margin-top: auto; padding: 14px 28px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(7, 20, 38, .45); z-index: 35; }
.scrim.show { display: block; }

/* ---------- Komponen ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 15.5px; }
.card-head .muted { font-size: 12.5px; }
.grid { display: grid; gap: 18px; }
/* Anak grid/flex harus boleh menyusut agar tabel lebar tidak mendorong halaman */
.grid > *, .stack > *, .grid-side > *, .main, .topbar, .title-wrap { min-width: 0; }
.card { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }

.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: flex-start; gap: 14px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--blue-500), transparent);
  opacity: .5;
}
.stat-link { color: inherit; transition: .16s; }
.stat-link:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); border-color: #CBD8EC; }
.stat-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; background: var(--blue-50); color: var(--blue-600); }
.stat-ico.tone-green { background: var(--ok-bg); color: var(--ok); }
.stat-ico.tone-amber { background: var(--warn-bg); color: var(--warn); }
.stat-ico.tone-red { background: var(--danger-bg); color: var(--danger); }
.stat-ico.tone-navy { background: #E9EEF8; color: var(--navy-700); }
.stat-body { min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-badge { position: absolute; top: 12px; right: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: #EFF2F7; color: var(--ink-2); white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #EEF1F6; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid transparent;
  font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: #EEF2F8; color: var(--ink-2); transition: .15s; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: #E3E9F3; text-decoration: none; }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(180deg, var(--blue-500), var(--blue-600)); color: #fff; box-shadow: 0 8px 18px -12px rgba(37, 99, 235, .95); }
.btn-primary:hover { background: linear-gradient(180deg, #2f74f0, #1d55d1); color: #fff; }
.btn-navy { background: var(--navy-800); color: #fff; }
.btn-navy:hover { background: var(--navy-700); color: #fff; }
.btn-outline { background: #fff; border-color: #D5DFEE; color: var(--ink-2); }
.btn-outline:hover { background: #F7FAFF; border-color: #BCCBE4; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #0B8A5F; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #A81818; color: #fff; }
.btn-warn { background: #F59E0B; color: #422006; }
.btn-warn:hover { background: #E08C05; color: #422006; }
.btn-ghost { background: rgba(255, 255, 255, .08); color: #D7E2F5; border-color: rgba(255,255,255,.12); }
.btn-ghost:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: #F5F8FE; }

.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th {
  text-align: left; padding: 11px 14px; background: #F7F9FD; color: var(--muted);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
table.table td { padding: 11px 14px; border-bottom: 1px solid #F0F3F9; vertical-align: middle; }
table.table tbody tr:hover { background: #FAFCFF; }
table.table tbody tr:last-child td { border-bottom: none; }
table.table td.right, table.table th.right { text-align: right; }
.t-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.cell-title { font-weight: 650; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.hint { color: var(--muted); font-size: 11.5px; }
.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #D9E2F0;
  background: #fff; font-family: inherit; font-size: 13.5px; color: var(--ink);
  transition: .15s; outline: none;
}
.input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59, 130, 246, .16); }
.input:disabled, .input[readonly] { background: #F5F7FB; color: var(--muted); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7A94' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: none; padding: 0; margin: 0 0 8px; }
legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 10px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--blue-600); }
.inline-form { display: inline; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ico { width: 34px; height: 34px; color: #B8C6DC; margin-bottom: 8px; }

.flash {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  margin-bottom: 18px; font-size: 13.5px; font-weight: 500; border: 1px solid transparent;
}
.flash .ico { width: 17px; height: 17px; }
.flash-ok { background: var(--ok-bg); color: #06614A; border-color: #C4EEDD; }
.flash-danger { background: var(--danger-bg); color: #8E1414; border-color: #F7D2D2; }
.flash-info { background: var(--info-bg); color: #17399E; border-color: #CFDCFB; }
.flash-warn { background: var(--warn-bg); color: #7C3E06; border-color: #F7E0BD; }
.flash-x { margin-left: auto; background: none; border: none; font-size: 20px; line-height: 1; color: inherit; cursor: pointer; opacity: .6; }
.flash-x:hover { opacity: 1; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; border-radius: 9px 9px 0 0; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; background: #F5F8FD; }
.tab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); background: #F5F8FD; }

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; font-weight: 550; word-break: break-word; }

.bar { height: 8px; border-radius: 999px; background: #EDF1F8; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue-500), var(--blue-600)); }
.bar.green > span { background: linear-gradient(90deg, #34D399, var(--ok)); }
.bar.amber > span { background: linear-gradient(90deg, #FBBF24, #D97706); }
.bar.red > span { background: linear-gradient(90deg, #F87171, var(--danger)); }

.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.donut-center { font-size: 12px; fill: var(--muted); }

.table-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.table-toolbar .field { margin-bottom: 0; min-width: 150px; }
.search-input { position: relative; min-width: 240px; flex: 1 1 240px; }
.search-input .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search-input .input { padding-left: 34px; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: #EEF2F8; color: var(--ink-2); }
.pill.active { background: var(--navy-800); color: #fff; }
.pill:hover { text-decoration: none; }

.note { background: #F8FAFE; border: 1px dashed #D8E2F2; border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--ink-2); }
.note b { color: var(--ink); }
pre.code {
  background: #0C1B31; color: #D6E4FA; padding: 14px 16px; border-radius: 12px; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6;
}
pre.code .c { color: #7E9AC0; }
code.inline { background: #EEF2F8; padding: 1px 6px; border-radius: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

.progress-ring { display: grid; place-items: center; }

.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 28px 18px;
  background:
    radial-gradient(900px 500px at 10% -10%, #DCE9FF 0%, transparent 60%),
    radial-gradient(700px 500px at 110% 10%, #E8EEFF 0%, transparent 55%),
    linear-gradient(180deg, #F3F6FC, #E9EFFA);
}
.auth-card {
  width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line);
  border-radius: 18px; padding: 30px 28px; box-shadow: 0 24px 60px -36px rgba(11, 31, 58, .55);
}
.auth-card h1 { font-size: 21px; margin-bottom: 6px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3B82F6, #1E40AF); font-weight: 800; font-size: 15px;
  box-shadow: 0 10px 22px -12px rgba(37, 99, 235, .9);
}
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-foot { margin-top: 18px; font-size: 12.5px; color: var(--muted); text-align: center; }

.print-only { display: none; }

/* ---------- Responsif ---------- */
.only-mobile { display: none; }
@media (max-width: 1100px) {
  .grid-side { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 12px 0 40px rgba(7, 20, 38, .3);
  }
  .sidebar.open { transform: translateX(0); }
  .only-mobile { display: grid; }
  .topbar { padding: 14px 16px; }
  .title-wrap h1 { font-size: 17px; }
  .content { padding: 18px 16px 30px; }
  .footer { padding: 12px 16px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .stat-value { font-size: 19px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .topbar-actions { width: 100%; margin-left: 0; }
  .table-toolbar .field, .search-input { min-width: 100%; }
}

/* ---------- Cetak ---------- */
@media print {
  .sidebar, .topbar, .footer, .no-print, .flash, .scrim { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .app-shell { display: block; }
  .card { border: none; box-shadow: none; padding: 0; }
  .print-only { display: block; }
  a { color: inherit; }
}
