:root {
    /* Pertamina Patra Niaga palette */
    --pn-blue: #0a3d91;
    --pn-blue-500: #1250b0;
    --pn-blue-dark: #06255c;
    --pn-red: #e2231a;
    --pn-green: #00a34a;
    --pn-green-dark: #007a36;

    --bg: #eef2f8;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --ink: #14203a;
    --muted: #6b7a92;
    --border: #e6ebf3;
    --border-soft: #eef2f7;

    --shadow-sm: 0 2px 8px -3px rgba(16, 42, 90, 0.18);
    --shadow: 0 14px 40px -18px rgba(10, 61, 145, 0.28);
    --shadow-lg: 0 30px 60px -24px rgba(10, 61, 145, 0.38);
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar-w: 268px;
    --ease: cubic-bezier(.4, .14, .3, 1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01";
    letter-spacing: -0.01em;
    line-height: 1.55;
}

/* Display font for headings & brand */
h1, h2, h3, .brand-text strong, .auth-head h1, .stat-value,
.topbar-title h1, .section-head h2, .hero-card h2 {
    font-family: 'Sora', 'Manrope', sans-serif;
    letter-spacing: -0.025em;
    font-weight: 700;
}

a { text-decoration: none; }

::selection { background: rgba(10, 61, 145, .15); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd7e6; border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b4c1d6; }

/* ============ Animations ============ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes floatIn { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes popIn { 0% { opacity: 0; transform: translateY(-8px) scale(.96); } 100% { opacity: 1; transform: none; } }

.page-enter { animation: fadeUp .5s var(--ease) both; }

/* ============ Auth (login) ============ */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1100px 620px at 8% -10%, rgba(0, 163, 74, 0.28), transparent 55%),
        radial-gradient(1000px 520px at 112% 8%, rgba(226, 35, 26, 0.24), transparent 52%),
        radial-gradient(900px 900px at 50% 120%, rgba(74, 163, 255, 0.22), transparent 60%),
        linear-gradient(135deg, var(--pn-blue-dark), var(--pn-blue));
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.auth-shell::before, .auth-shell::after {
    content: ""; position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, .05); backdrop-filter: blur(2px);
}
.auth-shell::before { width: 320px; height: 320px; top: -80px; right: 12%; }
.auth-shell::after { width: 220px; height: 220px; bottom: -60px; left: 8%; }

.auth-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255, 255, 255, .98);
    border-radius: 26px;
    box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: floatIn .6s var(--ease) both;
}
.brand-strip { background: linear-gradient(90deg, var(--pn-blue), var(--pn-green) 55%, var(--pn-red)); height: 6px; }
.auth-head { padding: 38px 38px 10px; text-align: center; }
.auth-logo { display: inline-flex; align-items: center; justify-content: center; width: auto; height: 110px; margin-bottom: 14px; }
.auth-logo .pertamina-mark { filter: drop-shadow(0 6px 12px rgba(10,61,145,.2)); }
.auth-head h1 { font-size: 1.75rem; font-weight: 800; margin: 0 0 5px; letter-spacing: .02em; }
.auth-head p { color: var(--muted); font-size: .92rem; margin: 0; }
.auth-head .auth-subtle { font-size: .78rem; margin-top: 4px; color: #9aa7bb; }
.auth-body { padding: 10px 38px 26px; }
.auth-body .form-label { font-weight: 600; font-size: .84rem; margin-bottom: 6px; color: #33415a; }

/* Input with leading icon + optional trailing toggle */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .affix-icon {
    position: absolute; left: 14px; display: inline-flex; color: #94a3b8; pointer-events: none;
    transition: color .2s var(--ease);
}
.input-affix .form-control {
    padding-left: 42px; padding-top: 11px; padding-bottom: 11px; width: 100%;
}
.input-affix:focus-within .affix-icon { color: var(--pn-blue); }
.input-affix .form-control[type="password"],
.input-affix input[data-password-input] { padding-right: 46px; }
.affix-toggle {
    position: absolute; right: 8px; border: none; background: none; cursor: pointer;
    color: #94a3b8; padding: 6px; border-radius: 8px; display: inline-flex;
    transition: color .15s var(--ease), background .15s var(--ease);
}
.affix-toggle:hover { color: var(--pn-blue); background: #eef3fb; }

.auth-alert { color: var(--pn-red); font-size: .86rem; margin-bottom: 12px; }
.auth-alert:not(:empty) {
    background: #fdeceb; border: 1px solid #f7c9c6; border-radius: 11px;
    padding: 10px 13px; font-weight: 500;
}
.auth-alert ul { margin: 0; padding-left: 18px; }

.auth-submit { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: .98rem; }
.auth-submit svg { transition: transform .2s var(--ease); }
.auth-submit:hover svg { transform: translateX(3px); }

.auth-foot { text-align: center; color: var(--muted); font-size: .74rem; padding: 0 38px 26px; }

/* ============ App shell ============ */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.scrim {
    position: fixed; inset: 0; background: rgba(6, 37, 92, .45);
    backdrop-filter: blur(2px); opacity: 0; pointer-events: none;
    transition: opacity .3s var(--ease); z-index: 40;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.sidebar {
    background:
        radial-gradient(600px 300px at 100% 0%, rgba(74,163,255,.16), transparent 60%),
        linear-gradient(185deg, var(--pn-blue), var(--pn-blue-dark));
    color: #eaf1ff;
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 12px 0 40px -30px rgba(6, 37, 92, .8);
    z-index: 50;
}

.brand { display: flex; align-items: center; gap: 13px; padding: 4px 8px 26px; }
.brand-logo {
    width: 48px; height: 48px; border-radius: 14px;
    background: #ffffff;
    display: grid; place-items: center; padding: 8px;
    box-shadow: 0 6px 16px -8px rgba(0,0,0,.4);
}
.brand-text strong { display: block; font-size: 1.1rem; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { color: #9fc0ff; font-size: .72rem; }

.nav-menu { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
    color: #7fa3e0; font-weight: 700; padding: 16px 14px 8px;
}
.nav-item {
    display: flex; align-items: center; gap: 13px;
    padding: 12px 14px; border-radius: 13px;
    color: #cddcff; font-weight: 600; font-size: .93rem;
    position: relative; transition: color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.nav-item .ico { flex-shrink: 0; opacity: .9; transition: transform .25s var(--ease); }
.nav-item:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav-item:hover .ico { transform: scale(1.08); }
.nav-item.active { background: #fff; color: var(--pn-blue); box-shadow: 0 12px 24px -12px rgba(0,0,0,.5); }
.nav-item.active::before {
    content: ""; position: absolute; left: -18px; top: 50%; transform: translateY(-50%);
    width: 5px; height: 24px; border-radius: 0 6px 6px 0; background: var(--pn-green);
}

.sidebar-footer { margin-top: auto; padding-top: 20px; }
.footer-card {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 13px 15px;
    border: 1px solid rgba(255,255,255,.08);
}
.footer-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pn-green); box-shadow: 0 0 0 4px rgba(0,163,74,.25); }
.footer-card strong { display: block; font-size: .82rem; }
.footer-card small { color: #9fc0ff; font-size: .7rem; }

.main { display: flex; flex-direction: column; min-height: 100vh; }

/* ============ Topbar ============ */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255, 255, 255, .8);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title h1 { font-size: 1.32rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.topbar-title .crumb { color: var(--muted); font-size: .78rem; margin: 1px 0 0; }

.menu-toggle {
    display: none; flex-direction: column; gap: 4px; justify-content: center;
    width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
    background: #fff; cursor: pointer;
}
.menu-toggle span { display: block; width: 18px; height: 2px; background: var(--pn-blue); margin: 0 auto; border-radius: 2px; }

/* User menu */
.user-menu { position: relative; }
.user-chip {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border: 1px solid var(--border); border-radius: 40px;
    padding: 6px 12px 6px 6px; cursor: pointer;
    transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.user-chip:hover { box-shadow: var(--shadow-sm); border-color: #d4deec; }
.user-chip:active { transform: scale(.98); }
.user-meta { text-align: left; line-height: 1.2; }
.user-name { display: block; font-weight: 700; font-size: .88rem; }
.user-role { font-size: .72rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.type-pill { background: #eaf1ff; color: var(--pn-blue); padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: .68rem; }
.chev { color: var(--muted); transition: transform .25s var(--ease); }
.user-dropdown.open ~ .chev, .user-chip:focus .chev { }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--pn-green), var(--pn-blue));
    color: #fff; font-weight: 800; display: grid; place-items: center; font-size: .95rem;
    box-shadow: 0 6px 14px -6px rgba(10,61,145,.6);
}
.avatar.lg { width: 48px; height: 48px; font-size: 1.15rem; }

.user-dropdown {
    position: absolute; right: 0; top: calc(100% + 12px);
    background: #fff; border: 1px solid var(--border); border-radius: 16px;
    box-shadow: var(--shadow-lg); width: 240px; padding: 8px;
    opacity: 0; transform: translateY(-8px) scale(.97); pointer-events: none;
    transition: all .2s var(--ease); transform-origin: top right; z-index: 60;
}
.user-dropdown.open { opacity: 1; transform: none; pointer-events: auto; animation: popIn .2s var(--ease); }
.dropdown-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.dropdown-head strong { display: block; font-size: .9rem; }
.dropdown-head small { color: var(--muted); font-size: .74rem; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; border-radius: 10px; border: none; background: none;
    font-weight: 600; font-size: .88rem; color: var(--ink); cursor: pointer;
    transition: background .15s var(--ease);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--pn-red); }
.dropdown-item.danger:hover { background: #fee9e8; }
.dropdown-item form { margin: 0; width: 100%; }

.content { padding: 28px 30px; flex: 1; }
.footer { padding: 16px 30px; color: var(--muted); font-size: .76rem; border-top: 1px solid var(--border); }

/* ============ Toast notes ============ */
.toast-note {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border-radius: 14px; margin-bottom: 20px;
    font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-sm);
    animation: popIn .35s var(--ease) both; transition: opacity .4s, transform .4s;
}
.toast-note.hide { opacity: 0; transform: translateY(-8px); }
.toast-note svg { flex-shrink: 0; }
.toast-note.success { background: #e7f8ee; color: var(--pn-green-dark); border: 1px solid #bfeacf; }
.toast-note.danger { background: #fdecec; color: var(--pn-red); border: 1px solid #f7c9c6; }

/* ============ Cards & stats ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface); border-radius: var(--radius); padding: 22px 24px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-card::after {
    content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
    border-radius: 50%; opacity: .1;
}
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.stat-card.blue::before { background: var(--pn-blue); } .stat-card.blue::after { background: var(--pn-blue); }
.stat-card.green::before { background: var(--pn-green); } .stat-card.green::after { background: var(--pn-green); }
.stat-card.red::before { background: var(--pn-red); } .stat-card.red::after { background: var(--pn-red); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 2px; }
.stat-card.blue .stat-icon { background: #e8effc; color: var(--pn-blue); }
.stat-card.green .stat-icon { background: #e4f7ed; color: var(--pn-green-dark); }
.stat-card.red .stat-icon { background: #fdeceb; color: var(--pn-red); }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat-value { font-size: 2.3rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.stat-sub { color: var(--muted); font-size: .76rem; }

.card-surface {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    padding: 26px;
}

.hero-card {
    margin-bottom: 24px; border: none; border-radius: var(--radius); padding: 30px 32px;
    color: #fff; position: relative; overflow: hidden;
    background:
        radial-gradient(500px 260px at 90% -20%, rgba(0,163,74,.4), transparent 60%),
        linear-gradient(120deg, var(--pn-blue-dark), var(--pn-blue-500));
    box-shadow: var(--shadow);
    animation: fadeUp .5s var(--ease) both;
}
.hero-card::after {
    content: ""; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 220px;
    border-radius: 50%; background: rgba(255,255,255,.06);
}
.hero-card h2 { margin: 0; font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; }
.hero-card p { margin: 8px 0 0; color: #cdddff; max-width: 640px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.18rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.section-head .sub { color: var(--muted); font-size: .85rem; margin: 3px 0 0; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border-soft); font-size: .9rem; }
table.data thead th { background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; }
table.data thead th:first-child { border-top-left-radius: 10px; }
table.data thead th:last-child { border-top-right-radius: 10px; }
table.data tbody tr { transition: background .15s var(--ease); }
table.data tbody tr:hover { background: #f4f8ff; }
table.data tbody tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ============ Badges & buttons ============ */
.badge-type { padding: 4px 11px; border-radius: 999px; font-size: .73rem; font-weight: 700; display: inline-block; }
.badge-yokke, .badge-tone-indigo { background: #e6e9ff; color: #3730a3; }
.badge-wide, .badge-tone-green { background: #dcf7e6; color: var(--pn-green-dark); }
.badge-tone-blue { background: #e8effc; color: var(--pn-blue); }
.badge-tone-red { background: #fdeceb; color: var(--pn-red); }
.badge-tone-amber { background: #fef3c7; color: #b45309; }
.badge-tone-teal { background: #d5f5f0; color: #0f766e; }
.badge-tone-purple { background: #f3e8ff; color: #7e22ce; }
.badge-role-admin { background: #fdeceb; color: var(--pn-red); }
.badge-role-op { background: #e8effc; color: var(--pn-blue); }
.badge-status-on { background: #e4f7ed; color: var(--pn-green-dark); padding: 3px 10px; border-radius: 999px; font-size: .73rem; font-weight: 700; }
.badge-status-off { background: #eef1f6; color: var(--muted); padding: 3px 10px; border-radius: 999px; font-size: .73rem; font-weight: 700; }

.btn { border-radius: 11px; font-weight: 600; transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease); }
.btn:active { transform: scale(.97); }
.btn-pn { background: var(--pn-blue); border-color: var(--pn-blue); color: #fff; box-shadow: 0 10px 22px -12px rgba(10,61,145,.8); }
.btn-pn:hover { background: var(--pn-blue-dark); border-color: var(--pn-blue-dark); color: #fff; box-shadow: 0 14px 26px -12px rgba(10,61,145,.9); }
.btn-pn-green { background: var(--pn-green); border-color: var(--pn-green); color: #fff; box-shadow: 0 10px 22px -12px rgba(0,163,74,.8); }
.btn-pn-green:hover { background: var(--pn-green-dark); border-color: var(--pn-green-dark); color: #fff; }
.btn-outline-pn { border: 1px solid var(--border); background: #fff; color: var(--pn-blue); }
.btn-outline-pn:hover { background: #eaf1ff; border-color: #cfe0ff; color: var(--pn-blue); }
.btn-icon { padding: 7px 12px; font-size: .82rem; border-radius: 10px; }
.btn-danger-soft { border: 1px solid var(--border); color: var(--pn-red); background: #fff; }
.btn-danger-soft:hover { background: #fdeceb; border-color: #f6cecb; }

.action-cell { display: flex; gap: 8px; }
.action-cell form { display: inline; margin: 0; }

/* ============ Forms ============ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-label { font-weight: 600; font-size: .84rem; margin-bottom: 7px; color: #33415a; }
.form-control, .form-select {
    border-radius: 11px; border: 1px solid var(--border); padding: 11px 13px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-control:focus, .form-select:focus { border-color: var(--pn-blue); box-shadow: 0 0 0 4px rgba(10,61,145,.1); }
.form-control::placeholder { color: #aab4c6; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.field-hint { color: var(--muted); font-size: .78rem; margin-top: 5px; }
.text-danger { color: var(--pn-red) !important; font-size: .82rem; }
.form-check-input:checked { background-color: var(--pn-blue); border-color: var(--pn-blue); }

/* ============ Toolbar, pager, tabs ============ */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 18px; }
.pager a, .pager span {
    padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border);
    color: var(--pn-blue); font-size: .85rem; font-weight: 600; background: #fff;
    transition: all .15s var(--ease);
}
.pager a:hover { background: #eaf1ff; border-color: #cfe0ff; }
.pager span.current { background: var(--pn-blue); color: #fff; border-color: var(--pn-blue); }
.pager span.disabled { color: var(--muted); background: var(--surface-2); }

.type-tabs { display: inline-flex; background: #e9eef6; border-radius: 13px; padding: 5px; gap: 4px; }
.type-tabs a { padding: 9px 18px; border-radius: 10px; font-weight: 700; font-size: .85rem; color: var(--muted); transition: all .2s var(--ease); }
.type-tabs a:hover { color: var(--pn-blue); }
.type-tabs a.active { background: #fff; color: var(--pn-blue); box-shadow: var(--shadow-sm); }

/* ============ Site picker ============ */
.site-results { border: 1px solid var(--border); border-radius: 12px; max-height: 240px; overflow-y: auto; margin-top: 8px; box-shadow: var(--shadow); animation: popIn .18s var(--ease); }
.site-results .row-item { padding: 11px 13px; border-bottom: 1px solid var(--border-soft); cursor: pointer; transition: background .12s var(--ease); }
.site-results .row-item:last-child { border-bottom: none; }
.site-results .row-item:hover, .site-results .row-item.selected { background: #eaf1ff; }
.site-results .row-item strong { display: block; font-size: .9rem; }
.site-results .row-item small { color: var(--muted); }
.selected-site { margin-top: 10px; padding: 11px 13px; background: var(--surface-2); border-radius: 11px; border: 1px dashed #cdd7e6; font-size: .88rem; }

/* ============ Responsive ============ */
@media (max-width: 992px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh;
        transform: translateX(-105%); transition: transform .32s var(--ease);
    }
    .sidebar.open { transform: none; }
    .menu-toggle { display: flex; }
}
@media (max-width: 640px) {
    .content { padding: 20px 16px; }
    .topbar { padding: 12px 16px; }
    .user-meta { display: none; }
    .user-chip { padding: 5px; border-radius: 50%; }
    .chev { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .hero-card { padding: 24px 20px; }
}

/* ============ Modal ============ */
.modal-content.crud-modal {
    border: none;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.crud-modal .modal-header {
    background: linear-gradient(120deg, var(--pn-blue-dark), var(--pn-blue-500));
    color: #fff;
    border-bottom: none;
    padding: 18px 24px;
}
.crud-modal .modal-title {
    font-family: 'Sora', 'Manrope', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.12rem;
}
.crud-modal .modal-header .btn-close {
    filter: invert(1) grayscale(1) brightness(1.6);
    opacity: .85;
}
.crud-modal .modal-body { padding: 24px; }
.modal-backdrop.show { opacity: .5; backdrop-filter: blur(3px); }

.modal-loading {
    display: flex; align-items: center; gap: 12px;
    color: var(--muted); font-weight: 600; padding: 30px 4px;
}
.modal-error {
    display: flex; align-items: flex-start; gap: 10px;
    background: #fdeceb; border: 1px solid #f7c9c6; color: var(--pn-red);
    border-radius: 11px; padding: 11px 14px; margin-bottom: 16px;
    font-weight: 500; font-size: .88rem; animation: popIn .2s var(--ease);
}
.modal-error svg { flex-shrink: 0; margin-top: 1px; }
.spinner {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2.5px solid #d7e0ee; border-top-color: var(--pn-blue);
    display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.site-results .row-item.muted { color: var(--muted); cursor: default; }
.site-results .row-item.muted:hover { background: transparent; }

/* Toggle switch accent */
.form-switch .form-check-input { width: 2.6em; height: 1.4em; cursor: pointer; }
.form-switch .form-check-input:checked { background-color: var(--pn-green); border-color: var(--pn-green); }

/* ============ Error pages ============ */
.error-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    max-width: 520px; margin: 40px auto; padding: 40px 34px; text-align: center;
    animation: floatIn .45s var(--ease) both;
}
.error-panel.error-standalone { margin: 8vh auto; }
.error-code {
    font-family: 'Sora', sans-serif; font-weight: 800; letter-spacing: -.04em;
    font-size: 3.6rem; line-height: 1; color: var(--pn-blue); margin-bottom: 10px;
}
.error-badge {
    width: 74px; height: 74px; border-radius: 20px; margin: 0 auto 18px;
    display: grid; place-items: center;
}
.error-badge.error-500 { background: #fdeceb; color: var(--pn-red); }
.error-badge.error-404 { background: #e8effc; color: var(--pn-blue); }
.error-badge.error-403 { background: #fef3c7; color: #b45309; }
.error-panel h1 { font-size: 1.4rem; font-weight: 800; margin: 0 0 8px; }
.error-panel p { color: var(--muted); margin: 0 auto 6px; max-width: 400px; }
.error-ref { font-size: .78rem; }
.error-ref code { background: var(--surface-2); padding: 2px 7px; border-radius: 6px; }
.error-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ============ Global loading ============ */
.route-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000;
    background: transparent; opacity: 0; transition: opacity .2s var(--ease);
    pointer-events: none;
}
.route-progress.active { opacity: 1; }
.route-progress-fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--pn-blue), var(--pn-green) 55%, var(--pn-red));
    box-shadow: 0 0 10px rgba(10, 61, 145, .5);
    transition: width .18s ease;
}

/* Button loading state (keeps label, adds spinner, dims) */
.btn.is-loading {
    position: relative; color: transparent !important; pointer-events: none;
}
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .55); border-top-color: #fff;
    animation: spin .6s linear infinite;
}
/* Spinner tone for light/outline buttons */
.btn-outline-pn.is-loading::after,
.btn-danger-soft.is-loading::after { border-color: rgba(10,61,145,.35); border-top-color: var(--pn-blue); }

/* Logo image (official file in wwwroot/img) */
.pertamina-logo-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.auth-logo .pertamina-logo-img { filter: drop-shadow(0 6px 12px rgba(10,61,145,.18)); }
