/* ============================================================
   SIMANDAR — style utama (responsif, tanpa framework eksternal)
   ============================================================ */
:root {
    --dark: #1c1917;
    --dark2: #292524;
    --orange: #ea580c;
    --orange-soft: #fff7ed;
    --teal: #0d9488;
    --green: #059669;
    --red: #dc2626;
    --amber: #d97706;
    --bg: #f5f5f4;
    --card: #ffffff;
    --line: #e7e5e4;
    --text: #292524;
    --muted: #78716c;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg); color: var(--text);
    min-height: 100vh; display: flex; flex-direction: column; font-size: 14.5px;
}

/* ---------- topbar ---------- */
.topbar { background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.topbar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.logo { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; background: var(--orange); display: flex; align-items: center; justify-content: center; }
.logo svg { width: 26px; height: 26px; color: #fff; }
.topbar-title h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.topbar-title p { margin: 2px 0 0; font-size: 11.5px; color: #d6d3d1; }
.topbar-user { margin-left: auto; text-align: right; font-size: 12px; color: #a8a29e; line-height: 1.45; }
.topbar-user .bandara { font-size: 13.5px; font-weight: 600; color: #fff; }
.role-pill { background: var(--orange); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 2px 8px; letter-spacing: .5px; }
.btn-logout {
    display: inline-flex; align-items: center; gap: 6px; margin-left: 14px;
    background: #44403c; color: #fff; text-decoration: none; border-radius: 8px;
    padding: 8px 12px; font-size: 12.5px; font-weight: 600; transition: background .15s;
}
.btn-logout:hover { background: var(--red); }
.btn-logout svg { width: 15px; height: 15px; }

.mainnav { border-top: 1px solid rgba(255,255,255,.08); }
.mainnav { display: flex; max-width: 1200px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
    color: #a8a29e; text-decoration: none; font-size: 13px; font-weight: 500;
    padding: 11px 14px; border-bottom: 2px solid transparent; white-space: nowrap; transition: all .15s;
}
.mainnav a:hover { color: #fff; background: var(--dark2); }
.mainnav a.aktif { color: #fff; border-bottom-color: var(--orange); }

/* ---------- konten umum ---------- */
.konten { max-width: 1200px; margin: 0 auto; width: 100%; padding: 20px 16px 28px; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { margin: 0 0 3px; font-size: 21px; }
.page-head .sub { margin: 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.flash { border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-size: 13.5px; font-weight: 500; }
.flash-sukses { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-gagal  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h3 { margin: 0 0 4px; font-size: 15.5px; }
.card .card-sub { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; }

.grid { display: grid; gap: 14px; }
.grid-kpi { grid-template-columns: repeat(5, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* KPI card */
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.kpi .kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.kpi .kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .kpi-ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex: 0 0 30px; }
.kpi .kpi-ico.i-orange { background: #ffedd5; color: var(--orange); }
.kpi .kpi-ico.i-green  { background: #d1fae5; color: var(--green); }
.kpi .kpi-ico.i-red    { background: #fee2e2; color: var(--red); }
.kpi .kpi-ico.i-amber  { background: #fef3c7; color: var(--amber); }
.kpi .kpi-ico.i-teal   { background: #ccfbf1; color: var(--teal); }
.kpi .kpi-value { font-size: 27px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -.5px; }
.kpi .kpi-note { font-size: 11.5px; color: var(--muted); }
.progress { height: 7px; background: #e7e5e4; border-radius: 99px; overflow: hidden; margin-top: 9px; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--orange); transition: width .3s; }
.progress > span.p-green { background: var(--green); }
.progress > span.p-amber { background: var(--amber); }
.progress > span.p-red   { background: var(--red); }
.progress > span.p-teal  { background: var(--teal); }

/* badge */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; border: 1px solid; white-space: nowrap; }
.badge-BAIK, .badge-AKTIF, .badge-SELESAI, .badge-SIAP, .badge-HADIR, .badge-DINAS_LUAR { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge-PERHATIAN, .badge-DIPROSES, .badge-IZIN, .badge-SAKIT, .badge-CUTI, .badge-PENANGANAN, .badge-MENDEKATI { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge-TEMUAN, .badge-OPEN, .badge-TIDAK_SIAP, .badge-TINGGI, .badge-ALPA, .badge-KEDALUWARSA { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.badge-RENDAH { background: #f0fdfa; color: #115e59; border-color: #99f6e4; }
.badge-SEDANG { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge-NONAKTIF { background: #f5f5f4; color: #57534e; border-color: #d6d3d1; }
.badge-TERJADWAL { background: var(--orange-soft); color: #9a3412; border-color: #fed7aa; }
.badge-SPOT_CHECK { background: #f0fdfa; color: #115e59; border-color: #99f6e4; }
.badge-INTERNAL { background: #f0fdfa; color: #115e59; border-color: #99f6e4; }
.badge-AVSEC { background: var(--orange-soft); color: #9a3412; border-color: #fed7aa; }

/* tabel */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.tbl th { background: #fafaf9; text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); border-bottom: 1px solid var(--line); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #f5f5f4; vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: #fafaf9; }
.tbl td .kecil { color: var(--muted); font-size: 11.5px; }

/* form */
form.blok { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .penuh { grid-column: 1 / -1; }
label { display: block; font-size: 12px; font-weight: 600; color: #44403c; margin-bottom: 5px; }
input[type=text], input[type=date], input[type=number], input[type=password], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid #d6d3d1; border-radius: 8px;
    font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #fdba74; border-color: var(--orange); }
textarea { min-height: 70px; resize: vertical; }

.btn {
    display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
    background: var(--orange); color: #fff; font-weight: 600; font-size: 13px;
    padding: 9px 16px; border-radius: 8px; text-decoration: none; transition: filter .15s;
}
.btn:hover { filter: brightness(.93); }
.btn.abu { background: #57534e; }
.btn.kuning { background: var(--amber); }
.btn.merah { background: var(--red); }
.btn.hijau { background: var(--green); }
.btn.outline { background: #fff; color: #44403c; border: 1px solid #d6d3d1; }
.btn.kecil { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filter-bar > div { min-width: 130px; }
.filter-bar label { font-size: 11px; }
.filter-bar input, .filter-bar select { padding: 7px 9px; font-size: 12.5px; }

/* checklist dinamis inspeksi */
.baris-item { display: grid; grid-template-columns: 1.1fr 1.6fr 130px 1.4fr auto; gap: 8px; margin-bottom: 8px; align-items: start; }

/* grafik batang CSS */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 8px 4px 0; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.chart-bar .bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.chart-bar .b { width: 34%; border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-bar .b.b1 { background: var(--orange); }
.chart-bar .b.b2 { background: #a8a29e; }
.chart-bar .b.b3 { background: var(--teal); }
.chart-bar .val { font-size: 10px; color: var(--muted); }
.chart-labels { display: flex; gap: 8px; margin-top: 6px; }
.chart-labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* daftar alert */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 10px; padding: 10px 4px; border-bottom: 1px dashed #e7e5e4; align-items: flex-start; }
.alert-list li:last-child { border-bottom: 0; }
.alert-list .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-top: 5px; flex: 0 0 9px; }
.alert-list .dot.sedang { background: var(--amber); }
.alert-list .t { font-weight: 600; font-size: 13px; }
.alert-list .d { font-size: 12px; color: var(--muted); }

/* login */
.login-body { background: linear-gradient(150deg, #1c1917 0%, #292524 60%, #442c1a 100%); }
.login-box { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.4); max-width: 400px; margin: 7vh auto; padding: 30px 28px; }
.login-box .brand { text-align: center; margin-bottom: 20px; }
.login-box .brand .logo { margin: 0 auto 10px; width: 54px; height: 54px; }
.login-box .brand h1 { margin: 0; font-size: 23px; }
.login-box .brand p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.login-note { background: var(--orange-soft); border: 1px dashed #fdba74; border-radius: 8px; padding: 10px 12px; font-size: 12px; color: #9a3412; margin-top: 14px; line-height: 1.5; }

/* footer */
.footer { background: var(--dark); color: #a8a29e; font-size: 11.5px; }
.footer { display: flex; justify-content: space-between; gap: 8px; padding: 12px 18px; flex-wrap: wrap; max-width: none; }
.footer span { max-width: 1200px; width: 100%; }
.footer span:first-child { flex: 1; }
.footer { padding-left: max(18px, calc((100% - 1200px)/2 + 16px)); padding-right: max(18px, calc((100% - 1200px)/2 + 16px)); }

/* responsif */
@media (max-width: 1024px) { .grid-kpi { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) {
    .grid-kpi, .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .baris-item { grid-template-columns: 1fr 1fr; }
    .topbar-user { display: none; }
    .btn-logout span { display: none; }
}
@media (max-width: 520px) { .grid-kpi, .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media print {
    .topbar, .footer, .btn, .filter-bar, .head-actions, form.blok { display: none !important; }
    body { background: #fff; }
    .card, .kpi { box-shadow: none; }
}

/* ---------- pemilih bandara aktif (topbar) ---------- */
.bandara-switch { display: flex; align-items: center; gap: 6px; }
.bandara-switch .bandara-label { font-size: 14px; line-height: 1; }
.bandara-switch select { max-width: 240px; padding: 5px 8px; font-size: 12.5px; font-weight: 600; color: var(--ink, #1c1917); }
.topbar-user { gap: 4px 14px; }
@media (max-width: 720px) { .bandara-switch select { max-width: 150px; font-size: 11.5px; } }
