:root {
    --bg: #f3f7fc;
    --bg-glow: #e7eef8;
    --card: #ffffff;
    --ink: #163056;
    --muted: #4a5870;
    --line: #d7e2f0;
    --teal: #e87822;
    --teal-bright: #f0913a;
    --teal-soft: #fff1e6;
    --blue: #1a3d73;
    --blue-dark: #122a52;
    --red: #e11d48;
    --amber: #d97706;
    --green: #059669;
    --sidebar: #122a52;
    --sidebar-2: #1a3d73;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(18, 42, 82, 0.06);
    --shadow-sm: 0 4px 14px rgba(18, 42, 82, 0.04);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Outfit", "Segoe UI", sans-serif;
    background:
        radial-gradient(900px 420px at 12% -10%, rgba(232, 120, 34, 0.12), transparent 55%),
        radial-gradient(700px 380px at 100% 0%, rgba(26, 61, 115, 0.1), transparent 50%),
        linear-gradient(180deg, var(--bg-glow), var(--bg));
    color: var(--ink);
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* Shell */
.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
.sidebar {
    background:
        linear-gradient(180deg, rgba(232, 120, 34, 0.16), transparent 28%),
        linear-gradient(165deg, var(--sidebar) 0%, #0d2144 100%);
    color: #cbd5e1;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(148, 163, 184, 0.08);
}
.brand {
    padding: 4px 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.brand-logo {
    display: block;
    width: 100%;
    height: 78px;
    object-fit: contain;
    background: transparent;
}
.brand strong {
    display: block;
    color: #fff;
    font-size: 1.12rem;
    letter-spacing: -0.02em;
    font-weight: 800;
}
.brand small {
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 500;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}
.nav-group { display: grid; gap: 4px; }
.nav-label {
    display: block;
    padding: 2px 12px 8px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #f0b27a;
}
.sidebar-nav a {
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
    color: #94a3b8;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}
.sidebar-nav a.is-active {
    background: var(--teal);
    color: #fff;
    box-shadow: none;
}
.nav-group-foot {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.nav-link-muted { color: #64748b !important; font-weight: 500 !important; }
.nav-link-danger { color: #fda4af !important; }
.nav-link-danger:hover { background: rgba(190, 18, 60, 0.25) !important; color: #fecdd3 !important; }
.sidebar-user {
    margin-top: auto;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.1);
    backdrop-filter: blur(8px);
}
.sidebar-user-name {
    display: block;
    color: #f8fafc;
    font-size: 0.9rem;
    font-weight: 700;
}
.sidebar-user-role {
    display: block;
    margin-top: 2px;
    font-size: 0.74rem;
    color: #64748b;
}
.admin-main {
    padding: 28px 30px 40px;
    min-width: 0;
}

/* Feedback */
.flash {
    display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
    padding: 13px 16px; border-radius: 14px; margin-bottom: 18px; font-size: 0.92rem;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }

/* Surfaces */
.card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 20px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}
.page-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}
.page-head h1 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
    font-weight: 800;
}
.page-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: var(--teal);
    color: #fff;
    box-shadow: 0 8px 18px rgba(232, 120, 34, 0.28);
}
.btn-primary:hover { background: #cf6416; }
.btn-ghost {
    background: #fff;
    border-color: var(--line);
    color: #475569;
}
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-amber {
    background: #fff7ed; color: #9a3412; border: 0;
    padding: 7px 11px; font-size: 0.75rem; border-radius: 9px; font-weight: 700;
}
.btn-danger {
    background: #fff1f2; color: #9f1239; border: 0;
    padding: 7px 11px; font-size: 0.75rem; border-radius: 9px; font-weight: 700;
}

/* Forms */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
label {
    display: grid;
    gap: 7px;
    font-size: 0.86rem;
    font-weight: 700;
    color: #334155;
}
input, select, textarea {
    width: 100%;
    border: 1px solid #d6dee8;
    border-radius: 12px;
    padding: 11px 13px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(232, 120, 34, 0.16);
}
input[readonly] { background: #f8fafc; color: #475569; }

.check-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.check-grid-docs {
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 4px;
}
.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.check-grid-docs .check-item {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.84rem;
    font-weight: 600;
}
.check-item input { width: auto; accent-color: var(--teal); }
.check-item.is-on {
    border-color: #f0b27a;
    background: #fff6ee;
    color: #9a4b12;
}
.check-inline {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--muted);
    margin-top: -6px;
}
.check-inline input { width: auto; accent-color: var(--teal); }
.field-hint {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    margin-top: -2px;
}
.iupts-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 20px 28px;
    align-items: start;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}
.iupts-panel-docs {
    border-left: 1px solid #eef2f7;
    padding-left: 22px;
}
.grid-1 { display: grid; gap: 16px; }
.inv-search { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.inv-search input[type="search"] { flex: 1; min-width: 180px; }
.inv-search select { min-width: 150px; }
.inv-items {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
    padding: 12px;
}
.inv-items-head, .inv-item-row {
    display: grid;
    grid-template-columns: 1.6fr 0.45fr 0.7fr 0.55fr auto;
    gap: 10px;
    align-items: center;
}
.inv-items-head {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #94a3b8;
    font-weight: 700;
    padding: 0 4px 8px;
}
.inv-item-row { margin-bottom: 8px; }
.inv-item-row .jumlah { font-size: 0.86rem; font-weight: 700; text-align: right; }
.text-right { text-align: right; }
.text-danger { color: #b91c1c; }
.inv-bottom {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.inv-summary {
    width: 280px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
    padding: 14px 16px;
}
.inv-sum-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.88rem;
    margin-bottom: 6px;
    color: var(--muted);
}
.inv-sum-grand {
    border-top: 1px solid #d6dee8;
    padding-top: 8px;
    margin-top: 4px;
    color: var(--ink);
    font-size: 0.95rem;
}
.badge-yes { background: #d1fae5; color: #047857; }
.badge-no { background: #e2e8f0; color: #64748b; }
@media (max-width: 1100px) {
    .iupts-layout { grid-template-columns: 1fr; }
    .iupts-panel-docs {
        border-left: 0;
        padding-left: 0;
        border-top: 1px solid #eef2f7;
        padding-top: 16px;
    }
    .check-grid-docs {
        grid-template-columns: 1fr 1fr;
        max-height: none;
    }
}
@media (max-width: 900px) {
    .check-grid { grid-template-columns: 1fr 1fr; }
    .inv-items-head, .inv-item-row { grid-template-columns: 1fr 1fr; }
    .inv-summary { width: 100%; }
}
@media (max-width: 640px) {
    .check-grid-docs { grid-template-columns: 1fr; }
}

.progress {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    min-width: 90px;
}
.progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--teal));
}
.step-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.step-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #cbd5e1;
}
.step-dot.on { background: var(--teal); }

/* Monitoring */
.mon-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 18px 8px;
    border-bottom: 1px solid #f1f5f9;
}
.mon-row:last-child { border-bottom: 0; }
.mon-row-info strong { display: block; font-size: 0.95rem; color: #0f172a; }
.mon-row-info .muted { font-size: 0.82rem; }
.mon-track { min-width: 0; }
.mon-track-line {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0;
}
.mon-node {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid #d1d5db;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    cursor: default;
}
.mon-node.is-on {
    background: var(--teal);
    border-color: var(--teal);
}
.mon-node.is-current {
    box-shadow: 0 0 0 4px rgba(232, 120, 34, 0.22);
}
.mon-conn {
    flex: 1 1 auto;
    height: 3px;
    min-width: 10px;
    background: #e5e7eb;
    display: block;
}
.mon-conn.is-on { background: var(--teal); }
.mon-track-meta {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #475569;
}
.mon-track-meta strong {
    color: #0f172a;
    font-weight: 800;
}
.mon-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border: 1px solid var(--line);
    border-radius: 14px;
    font-size: 0.78rem;
    color: #64748b;
}
.mon-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mon-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #d1d5db;
    display: inline-block;
}
.mon-legend i.on {
    background: var(--teal);
    border-color: var(--teal);
}
@media (max-width: 900px) {
    .mon-row { grid-template-columns: 1fr; gap: 10px; }
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.kpi {
    border-radius: 18px;
    padding: 18px;
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.kpi strong { display: block; font-size: 1.55rem; letter-spacing: -0.03em; }
.kpi span { font-size: 0.82rem; opacity: .92; }
.kpi-dark { background: linear-gradient(145deg, #1a3d73, #122a52); }
.kpi-blue { background: linear-gradient(145deg, #f0913a, #e87822); }
.kpi-green { background: linear-gradient(145deg, #34d399, #059669); }
.kpi-amber { background: linear-gradient(145deg, #fbbf24, #d97706); }
@media (max-width: 900px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
    text-align: left;
    font-size: 0.7rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #94a3b8;
    border-bottom: 1px solid var(--line);
    padding: 0 12px 12px 0;
}
td {
    border-bottom: 1px solid #f1f5f9;
    padding: 14px 12px 14px 0;
    vertical-align: top;
}
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.search input { max-width: 360px; }
.badge {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}
.badge-blue { background: #e7eef8; color: #1a3d73; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-gray { background: #e2e8f0; color: #475569; }

.section-title { display: flex; align-items: center; gap: 12px; margin: 24px 0 14px; }
.section-title h3 { margin: 0; font-size: 0.92rem; }
.section-title::after { content: ""; flex: 1; height: 1px; background: #f1f5f9; }
.summary {
    margin-top: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    font-size: 0.9rem;
}
.summary div { display: flex; justify-content: space-between; padding: 4px 0; }
.summary .grand {
    border-top: 1px solid var(--line);
    margin-top: 6px;
    padding-top: 8px;
    font-weight: 800;
    color: var(--teal);
}

/* Dashboard stats */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.stat {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--teal-bright), var(--blue));
    border-radius: 4px 0 0 4px;
}
.stat strong {
    display: block;
    font-size: 1.7rem;
    letter-spacing: -0.04em;
    font-weight: 800;
}
.stat span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
}

/* Login */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(700px 400px at 18% 8%, rgba(232, 120, 34, 0.34), transparent 58%),
        radial-gradient(640px 380px at 92% 88%, rgba(26, 61, 115, 0.45), transparent 55%),
        linear-gradient(160deg, #0d2144 0%, #1a3d73 58%, #e87822 160%);
}
.login-card {
    width: min(420px, 100%);
    background: rgba(255, 255, 255, 0.96);
    border-radius: 22px;
    padding: 30px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.4);
}
.login-logo {
    display: block;
    width: min(240px, 100%);
    height: auto;
    margin: 0 auto 16px;
}
.login-card h1 {
    margin: 0 0 6px;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
    font-weight: 800;
}
.login-card p { margin: 0 0 18px; color: var(--muted); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 92px; }
.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--blue);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 6px;
}
.login-back { width: 100%; margin-top: 10px; }
.alert-error {
    background: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecdd3;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}
.item-row {
    display: grid;
    grid-template-columns: 1.6fr 0.5fr 0.8fr auto;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.objek-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.objek-table th, .objek-table td {
    border: 1px solid var(--line);
    padding: 8px;
    vertical-align: middle;
}
.objek-table th {
    background: #f8fafc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #64748b;
}
.objek-table input, .objek-table select { padding: 8px 10px; border-radius: 10px; }
.objek-table .col-no { width: 48px; text-align: center; font-weight: 700; color: #64748b; }
.objek-table .col-aksi { width: 72px; text-align: center; }
.hint { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.empty { text-align: center; color: #94a3b8; padding: 28px 0; }
.note-box {
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; max-height: none; z-index: 5; }
    .admin-main { padding: 18px 16px 28px; }
    .grid-2, .grid-3, .stats, .item-row { grid-template-columns: 1fr; }
    .span-2, .span-3 { grid-column: auto; }
}
