:root {
  --navy: #0b1f3a;
  --navy-2: #12345d;
  --teal: #0f9f9a;
  --teal-2: #dff7f5;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d9e2ef;
  --text: #172033;
  --muted: #66758d;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --shadow: 0 12px 35px rgba(11, 31, 58, .08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.26), transparent 40%),
    radial-gradient(circle at bottom left, rgba(14,165,233,.16), transparent 36%),
    #020617;
}
.login-shell {
  width: min(960px, 100%); display: grid; grid-template-columns: 1.05fr 1fr;
  border-radius: 16px; overflow: hidden; background: white;
  box-shadow: 0 30px 70px -25px rgba(2,6,23,.75);
}
.login-brand {
  background: linear-gradient(155deg, #1d4ed8, #1e3a8a 58%, #172554);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 42px 44px;
}
.login-brand-top { display: flex; align-items: center; gap: 14px; }
.login-logo { width: 52px; height: 52px; border-radius: 12px; background: rgba(255,255,255,.12); padding: 6px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.login-wordmark { font-weight: 800; letter-spacing: .06em; font-size: 19px; }
.login-eyebrow { color: #bfdbfe; font-size: 12px; font-weight: 700; letter-spacing: .1em; margin: 0 0 14px; }
.login-brand h1 { margin: 0; font-size: 30px; line-height: 1.22; letter-spacing: -.01em; }
.login-tagline { color: rgba(219,234,254,.85); font-size: 14px; line-height: 1.65; margin: 16px 0 0; }
.login-footnote { color: rgba(219,234,254,.55); font-size: 12px; margin: 0; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 44px 48px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { margin: 0 0 6px; color: var(--navy); font-size: 24px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.login-form label { margin-bottom: 18px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 78px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--teal); font-size: 12px; font-weight: 800;
  min-height: 30px; padding: 4px 10px; border-radius: 6px;
}
.password-toggle:hover { background: var(--teal-2); }
.login-submit { width: 100%; margin-top: 4px; }
.login-hint { color: var(--muted); text-align: center; font-size: 12px; margin: 20px 0 0; }
@media (max-width: 780px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 30px 28px; gap: 26px; }
  .login-brand h1 { font-size: 24px; }
  .login-panel { padding: 32px 28px; }
}
.app { min-height: 100vh; display: flex; }
.sidebar { width: 278px; background: var(--navy); color: white; position: sticky; top: 0; height: 100vh; overflow: auto; padding: 18px 14px; flex: 0 0 278px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 8px 10px 18px; border-bottom: 1px solid rgba(255,255,255,.14); margin-bottom: 12px; }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.1); padding: 5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); flex: 0 0 auto; }
.brand strong { display: block; font-size: 17px; letter-spacing: .04em; line-height: 1.2; }
.brand span { color: rgba(255,255,255,.7); font-size: 11px; letter-spacing: .04em; }
.nav-group { margin: 14px 0; }
.nav-title { color: rgba(255,255,255,.54); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 13px; border-radius: 8px; color: rgba(255,255,255,.84); font-size: 14px; transition: .18s ease; position: relative; }
.nav a:hover { background: rgba(15,159,154,.16); color: #fff; }
.nav a.active { background: rgba(15,159,154,.2); color: #fff; font-weight: 700; }
.nav a.active::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 3px; background: var(--teal); }
.main { min-width: 0; flex: 1; }
.topbar { min-height: 70px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 22px; margin: 0; color: var(--navy); }
.crumb { color: var(--muted); font-size: 13px; }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.userbox-satuan { display: inline-flex; align-items: center; gap: 6px; }
.userbox-id { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.userbox-name { color: var(--navy); font-weight: 700; font-size: 13px; }
.userbox-email { font-size: 11px; }
.role-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 800; border: 1px solid transparent; }
.role-badge.admin { background: rgba(29,78,216,.1); color: #1d4ed8; border-color: rgba(29,78,216,.25); }
.role-badge.staf { background: #eef2ff; color: #4338ca; border-color: rgba(67,56,202,.25); }
.role-badge.pimpinan { background: #fffbeb; color: #b45309; border-color: rgba(180,83,9,.3); }
.role-badge.direktorat { background: #ecfdf5; color: #047857; border-color: rgba(4,120,87,.3); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--teal-2); color: var(--teal); display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }
.content { width: 100%; max-width: 1600px; margin: 0 auto; padding: 20px 24px 44px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(280px, .8fr) minmax(420px, 1.4fr); align-items: stretch; }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card, .stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.card { padding: 18px; overflow: hidden; }
.stat { min-height: 126px; padding: 17px; transition: .18s ease; display: block; }
.stat:hover { transform: translateY(-2px); border-color: rgba(15,159,154,.5); }
.stat span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 12px; font-size: clamp(24px, 3vw, 36px); color: var(--navy); line-height: 1; }
.stat em { display: block; margin-top: 8px; color: var(--muted); font-style: normal; font-size: 12px; }
.metric-icon { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--teal-2); color: var(--teal); font-weight: 800; font-style: normal; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.card-head h2 { margin: 0; color: var(--navy); font-size: 17px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.chart-card { height: 360px; min-height: 360px; }
.chart-wrapper { position: relative; width: 100%; height: 292px; }
.chart-wrapper.small { height: 280px; }
canvas { max-width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 10px 11px; color: var(--text); font: inherit; }
textarea { min-height: 92px; resize: vertical; }
.button, button { border: 1px solid var(--line); background: white; color: var(--navy); border-radius: 8px; padding: 10px 13px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; }
.button.primary, button.primary { background: var(--teal); border-color: var(--teal); color: white; }
.button.danger { color: var(--danger); border-color: rgba(180,35,24,.35); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { position: sticky; top: 0; background: #f8fbff; color: var(--navy); z-index: 1; }
tr:hover td { background: #fbfdff; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; background: #eef4ff; color: var(--navy); }
.badge.baik, .badge.siap, .badge.selesai { background: #dcfae6; color: var(--success); }
.badge.rusak_ringan, .badge.sebagian, .badge.terjadwal { background: #fff1d6; color: var(--warning); }
.badge.rusak_berat, .badge.rusak, .badge.tidak_siap, .badge.terlambat { background: #fee4e2; color: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 26px; }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); background: white; }
.flash.success { border-color: #abefc6; color: var(--success); }
.flash.error { border-color: #fecdca; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.full { grid-column: 1 / -1; }
.drawer { background: #f8fbff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: white; }
.notif-item.unread { background: #f0f9ff; border-color: rgba(15,159,154,.4); }
.notif-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.notif-type { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--teal); background: var(--teal-2); border-radius: 999px; padding: 2px 9px; }
.notif-title { font-weight: 700; color: var(--navy); }
.notif-body { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.small-button { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.row-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.row-actions a { color: var(--teal); font-weight: 700; }
.inline-form { display: inline; }
.inline-form button.link, button.link { background: none; border: 0; padding: 0; min-height: 0; font-weight: 700; cursor: pointer; }
button.link.danger { color: var(--danger); }
.csv-example { background: #f8fbff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12px; overflow: auto; white-space: pre; }
code { background: #eef2f7; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.mobile-toggle { display: none; }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .three { grid-template-columns: 1fr; }
  .chart-card { height: auto; min-height: 350px; }
}
@media (max-width: 780px) {
  .app { display: block; }
  .sidebar { display: none; width: 100%; height: auto; position: static; }
  .userbox-satuan, .userbox-id { display: none; }
  .topbar h1 { font-size: 18px; }
  .sidebar.open { display: block; }
  .mobile-toggle { display: inline-flex; }
  .topbar { padding: 12px 14px; }
  .content { padding: 14px; }
  .kpis, .form-grid { grid-template-columns: 1fr; }
  table { min-width: 0; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap th, .table-wrap td { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tr { border-bottom: 1px solid var(--line); padding: 8px; }
  .table-wrap td { border: 0; padding: 7px 6px; }
}
