@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: rgba(249, 115, 22, 0.14);
    --accent: #3b82f6;
    --ok: #22c55e;
    --warn: #f59e0b;
    --danger: #ef4444;
    --bg: #0a0b10;
    --surface: #14161d;
    --surface-2: #191b23;
    --text: #f2f3f7;
    --text-mute: #8b8d98;
    --border: rgba(255, 255, 255, 0.07);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -8px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.3), 0 18px 34px -12px rgba(0, 0, 0, 0.55);
    --font-display: 'Baloo 2', 'Plus Jakarta Sans', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #0d0e14;
    border-right: 1px solid var(--border);
    color: #c7c9d4;
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #fbbf24, var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 6px 16px -4px rgba(249, 115, 22, 0.55);
}

.nav-group { display: flex; flex-direction: column; gap: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14.5px;
    color: #9497a6;
    transition: background .15s, color .15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.nav-link:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(249,115,22,0.18), rgba(249,115,22,0.03)); color: var(--primary); font-weight: 700; }
.nav-link .ic { width: 18px; text-align: center; }

.sidebar-footer {
    margin-top: auto;
    font-size: 12px;
    color: #5f616e;
}

/* ===== Main content ===== */
.main {
    flex: 1;
    padding: 32px 40px 60px;
    max-width: 1200px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title { font-size: 26px; font-weight: 800; margin: 0 0 4px; color: #fff; }
.page-subtitle { color: var(--text-mute); font-size: 14.5px; margin: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: transform .1s, box-shadow .15s, background .15s;
    font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, #fbbf24, var(--primary)); color: #1a0d00; box-shadow: 0 6px 16px -6px rgba(249,115,22,.55); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 20px -8px rgba(249,115,22,.6); }
.btn-outline { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: rgba(239,68,68,0.15); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Stat cards ===== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-top: 3px solid var(--text-mute);
    position: relative;
}
.stat-card .label { font-size: 12.5px; color: var(--text-mute); font-weight: 600; margin-bottom: 8px; letter-spacing: .03em; text-transform: uppercase; }
.stat-card .value { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: #fff; }
.stat-card.accent-primary { border-top-color: var(--primary); }
.stat-card.accent-primary .value { color: var(--primary); }
.stat-card.accent-warn { border-top-color: var(--warn); }
.stat-card.accent-warn .value { color: var(--warn); }
.stat-card.accent-ok { border-top-color: var(--ok); }
.stat-card.accent-ok .value { color: var(--ok); }

/* ===== Filter bar ===== */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
    align-items: center;
}
.search-box {
    flex: 1;
    min-width: 220px;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.search-box input::placeholder { color: #6b6d78; }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.search-box .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-mute); }

.chip-filter {
    padding: 9px 15px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-mute);
    cursor: pointer;
    font-family: inherit;
}
.chip-filter.active { background: var(--primary); border-color: var(--primary); color: #1a0d00; font-weight: 700; }

/* ===== Site grid / cards ===== */
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}

.site-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-family: inherit;
    color: inherit;
}
.site-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: rgba(249,115,22,0.35); }

.site-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.site-name { font-weight: 700; font-size: 16px; margin: 0 0 2px; color: #fff; }
.site-id { font-size: 12.5px; color: var(--text-mute); }
.site-address { font-size: 13.5px; color: var(--text-mute); line-height: 1.5; min-height: 20px; }

.badge {
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.badge-pending { background: rgba(255,255,255,0.08); color: #a3a5b3; }
.badge-proses { background: rgba(245,158,11,0.16); color: #fbbf24; }
.badge-selesai { background: rgba(34,197,94,0.16); color: #4ade80; }

.progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--text-mute); }
.progress-track { height: 9px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.progress-low .progress-fill { background: linear-gradient(90deg, #fb923c, #f59e0b); }
.progress-mid .progress-fill { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.progress-complete .progress-fill { background: linear-gradient(90deg, #4ade80, #22c55e); }
.progress-low .progress-label .n { color: #f59e0b; }
.progress-mid .progress-label .n { color: #60a5fa; }
.progress-complete .progress-label .n { color: #4ade80; }

.site-card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-mute); border-top: 1px solid var(--border); padding-top: 12px; }

.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-mute);
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}
.empty-state .ic { font-size: 40px; margin-bottom: 12px; }

/* ===== Forms ===== */
.form-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 720px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 13.5px; font-weight: 600; color: var(--text); }
input[type=text], input[type=date], select, textarea {
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface-2);
    color: var(--text);
}
input::placeholder, textarea::placeholder { color: #6b6d78; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); background: #1c1e27; }
textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* Native <select> fallback styling (when JS disabled) */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8d98' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 38px;
    cursor: pointer;
}

/* Aesthetic native date input: dark calendar popup + custom icon treatment */
input[type=date] {
    color-scheme: dark;
    cursor: pointer;
}
input[type=date]::-webkit-calendar-picker-indicator {
    filter: invert(60%) sepia(60%) saturate(900%) hue-rotate(340deg) brightness(105%);
    cursor: pointer;
    opacity: 0.85;
    padding: 3px;
    border-radius: 6px;
    transition: opacity .15s, background .15s;
}
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: rgba(249,115,22,0.14); }

/* ===== Custom dropdown (progressive enhancement over <select>) ===== */
.custom-select { position: relative; }
.custom-select select { display: none; }
.csel-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.csel-trigger:hover { border-color: rgba(249,115,22,0.4); }
.custom-select.open .csel-trigger { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); background: #1c1e27; }
.csel-trigger .csel-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel-trigger .csel-value.placeholder { color: #6b6d78; }
.csel-trigger .csel-chevron {
    flex-shrink: 0;
    width: 16px; height: 16px;
    color: var(--text-mute);
    transition: transform .18s ease;
}
.custom-select.open .csel-chevron { transform: rotate(180deg); color: var(--primary); }

.csel-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    padding: 6px;
    max-height: 240px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-6px) scale(.98);
    pointer-events: none;
    transition: opacity .14s ease, transform .14s ease;
}
.custom-select.open .csel-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.csel-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
    transition: background .12s;
}
.csel-option:hover, .csel-option.highlighted { background: rgba(249,115,22,0.1); }
.csel-option.selected { color: var(--primary); font-weight: 600; background: var(--primary-light); }
.csel-option .csel-check { width: 15px; height: 15px; flex-shrink: 0; opacity: 0; color: var(--primary); }
.csel-option.selected .csel-check { opacity: 1; }
.csel-option.placeholder-opt { color: var(--text-mute); }

/* ===== Detail page: document checklist ===== */
.detail-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: flex-start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.info-card, .doc-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.info-card h3, .doc-card h3 { color: #fff; }
.info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-top: 14px; }
.info-item .k { font-size: 12px; color: var(--text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.info-item .v { font-size: 14.5px; font-weight: 600; margin-top: 2px; color: #f2f3f7; }

.doc-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.doc-item:last-child { border-bottom: none; }
.doc-thumb {
    width: 56px; height: 56px; border-radius: 10px; overflow: hidden;
    background: var(--primary-light); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 20px;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-info { flex: 1; min-width: 0; }
.doc-info .name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 7px; color: #f2f3f7; flex-wrap: wrap; }
.doc-info .meta { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.tag-wajib { font-size: 10.5px; background: rgba(239,68,68,0.16); color: #fca5a5; padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.tag-opsional { font-size: 10.5px; background: rgba(255,255,255,0.08); color: var(--text-mute); padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.doc-status-ok { color: var(--ok); font-size: 20px; }
.doc-actions { display: flex; gap: 6px; align-items: center; }

.upload-inline-form { display: flex; align-items: center; gap: 8px; }
.file-label {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px; background: var(--primary-light); color: var(--primary);
    font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.file-label:hover { background: rgba(249,115,22,0.22); }
.file-label input[type=file] { display: none; }

.big-progress { text-align: center; padding: 10px 0 6px; }
.big-progress .ring-num { font-family: var(--font-display); font-size: 44px; font-weight: 700; color: var(--primary); }
.big-progress .ring-sub { color: var(--text-mute); font-size: 13px; margin-top: 2px; }

.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: rgba(34,197,94,0.14); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.alert-error { background: rgba(239,68,68,0.14); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }

table.table { width: 100%; border-collapse: collapse; }
table.table th, table.table td { padding: 12px 10px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--border); color: var(--text); }
table.table th { color: var(--text-mute); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

@media (max-width: 760px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; padding: 14px 16px; }
    .nav-group { flex-direction: row; overflow-x: auto; }
    .sidebar-footer { display: none; }
    .main { padding: 20px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
}
