/* ==========================================
   SISTEM HPS - PREMIUM UI (Government/Enterprise)
   Antarmuka aplikasi penyusunan dan analisis HPS
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Main Theme Colors */
    --primary: #0d2137; /* Deep Navy */
    --primary-light: #1a365d;
    --primary-glow: rgba(13, 33, 55, 0.15);
    
    --accent: #b8860b; /* Gold/Accent */
    --success: #059669; /* Emerald Green */
    --danger: #ef4444;
    --warning: #d97706; /* Warm Amber */
    
    /* Backgrounds */
    --bg: #f4f7f9;
    --bg-dark: #0f172a;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    
    /* Borders & Shadows */
    --border: #e2e8f0;
    --border-focus: #1a365d;
    --shadow-sm: 0 1px 2px rgba(13, 33, 55, 0.05);
    --shadow: 0 4px 6px -1px rgba(13, 33, 55, 0.08), 0 2px 4px -1px rgba(13, 33, 55, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(13, 33, 55, 0.08), 0 4px 6px -2px rgba(13, 33, 55, 0.04);
    
    /* Text */
    --text-main: #1e293b;
    --text-sub: #475569;
    --text-muted: #94a3b8;
    
    /* Sizes & Misc */
    --radius: 8px;
    --radius-sm: 6px;
    --t: all 0.2s ease-in-out;
    --navy: #0d2137;
    --gold: #d4af37;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    padding-top: 80px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ======== NAVBAR ======== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: linear-gradient(90deg, #0d2137 0%, #172a45 100%);
    border-bottom: 2px solid var(--accent);
    height: 70px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
}
.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}
.navbar-logo .logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--accent), #d97706);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 800; color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.navbar-logo .logo-text {
    font-weight: 700; font-size: 1.1rem; color: #ffffff; letter-spacing: -0.2px;
}
.navbar-logo .logo-sub {
    font-size: 0.75rem; color: #94a3b8; display: block; margin-top: -2px; font-weight: 500;
}
.navbar-nav { display: flex; gap: 6px; }
.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--t);
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
}
.nav-link.active {
    background: var(--accent);
    color: #ffffff;
}

/* ======== PAGE LAYOUT ======== */
.page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}
.page-header {
    margin-bottom: 2rem;
}
.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}
.page-sub {
    color: var(--text-sub);
    font-size: 0.95rem;
    margin-top: 6px;
}

/* ======== CARD ======== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.card-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
}
.card-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--navy);
}
.card-body {
    padding: 1.75rem;
}

/* ======== FORM ELEMENTS ======== */
.form-grid {
    display: grid;
    gap: 1.5rem;
}
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.2px;
}
.form-control {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    background: var(--surface);
    transition: var(--t);
    width: 100%;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-muted); }

/* ======== DOCUMENT HEADER ======== */
.doc-header-block {
    text-align: center;
    padding: 2.5rem 1.75rem 2rem;
    border-bottom: 3px double var(--navy);
    background: var(--surface);
}
.doc-kop { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.5px; color: var(--navy); text-transform: uppercase; }
.doc-sub-kop { font-size: 0.9rem; color: var(--text-sub); margin-top: 6px; }
.doc-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--navy);
    margin-top: 2rem;
    padding: 12px 24px;
    border: 2px solid var(--navy);
    display: inline-block;
    border-radius: var(--radius-sm);
}

/* ======== TABLE ======== */
.table-wrapper { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.hps-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 1100px;
    background: var(--surface);
}
.hps-table thead th {
    background: var(--surface-alt);
    color: var(--navy);
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
}
.hps-table thead th:last-child { border-right: none; }
.hps-table tbody tr { transition: background 0.15s; }
.hps-table tbody tr:nth-child(even) { background: #f8fafc; }
.hps-table tbody tr:nth-child(odd) { background: #ffffff; }
.hps-table tbody tr:hover { background: #f1f5f9; }
.hps-table td {
    padding: 8px 10px;
    border: 1px solid var(--border);
    vertical-align: middle;
}
.hps-table tfoot td {
    padding: 12px 10px;
    border: 1px solid var(--border);
    font-weight: 600;
    background: var(--surface-alt);
}
.hps-table tfoot .total-row td {
    background: var(--navy);
    color: white;
    font-size: 0.95rem;
    border-color: var(--navy);
}

/* Table Inputs */
.hps-table td input[type="text"],
.hps-table td input[type="number"] {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    padding: 6px 8px;
    transition: var(--t);
    border-radius: 4px;
}
/* Hide spin buttons to save space in narrow columns */
.hps-table td input[type="number"]::-webkit-outer-spin-button,
.hps-table td input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.hps-table td input[type="number"] {
    -moz-appearance: textfield;
}
.hps-table td input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: white;
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.hps-table td input[readonly] { cursor: default; }
.hps-table td.num { text-align: center; }
.hps-table td.money { text-align: right; font-weight: 600; }
.hps-table td.money.green { color: var(--success); }
.hps-table td.money.blue { color: var(--navy); }
.hps-table td input.pct {
    text-align: center;
    color: var(--warning);
    font-weight: 600;
}

/* ======== BUTTONS ======== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--t);
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

.btn-primary { 
    background: linear-gradient(180deg, #1a365d 0%, #0d2137 100%);
    color: white; 
    border-color: #0d2137;
}
.btn-primary:hover { background: linear-gradient(180deg, #24487a 0%, #1a365d 100%); }

.btn-accent {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #d97706;
}
.btn-accent:hover { background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%); }

.btn-success {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #059669;
}
.btn-success:hover { background: linear-gradient(180deg, #34d399 0%, #10b981 100%); }

.btn-danger { 
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #dc2626;
}
.btn-danger:hover { background: linear-gradient(180deg, #f87171 0%, #ef4444 100%); }

.btn-ghost { background: var(--surface); color: var(--text-main); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-alt); border-color: #cbd5e1; }

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--navy);
}
.btn-outline:hover {
    background: var(--navy);
    color: white;
}

.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-icon-only {
    padding: 8px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    transition: var(--t);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
}
.btn-icon-only:hover { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }

/* ======== BADGES ======== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-blue { background: #e0f2fe; color: #0369a1; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-amber { background: #fef3c7; color: #b45309; }

/* ======== FOOTER TOTALS AREA ======== */
.totals-panel {
    background: var(--surface-alt);
    border-top: 1px solid var(--border);
    padding: 1.5rem 1.75rem;
    display: flex;
    justify-content: flex-end;
}
.totals-grid {
    display: grid;
    grid-template-columns: 200px 180px;
    gap: 8px 1.5rem;
    text-align: right;
}
.total-label { font-size: 0.9rem; color: var(--text-sub); font-weight: 500; }
.total-value { font-size: 0.95rem; font-weight: 600; color: var(--text-main); }
.total-row-main .total-label { font-size: 1.1rem; color: var(--navy); font-weight: 700; }
.total-row-main .total-value { font-size: 1.15rem; color: var(--navy); font-weight: 800; }

/* ======== MODAL ======== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 2000;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.65);
    z-index: 2000;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal.open { display: flex; }

.modal-content, .modal-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-box { max-width: 900px; }

.modal-header, .modal-head {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0d2137;
    color: white;
}
.modal-header h3, .modal-head h3 { color: white; font-size: 1.1rem; font-weight: 600; }

.close-btn, .modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    width: 32px; height: 32px;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    transition: var(--t);
}
.close-btn:hover, .modal-close:hover { background: rgba(255,255,255,0.25); }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}
.modal-search {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
.modal-search:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }

/* Catalog Table */
.catalog-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.catalog-table th {
    background: var(--surface-alt);
    color: var(--navy);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    text-align: left;
}
.catalog-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.catalog-table tbody tr { transition: var(--t); }
.catalog-table tbody tr:hover { background: #f8fafc; cursor: pointer; }
.catalog-table .price { font-weight: 600; color: var(--success); text-align: right; }
.catalog-table .add-btn {
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--t);
}
.catalog-table .add-btn:hover { background: #047857; box-shadow: var(--shadow-sm); }

/* ======== ACTION BAR ======== */
.action-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.action-bar-left { display: flex; gap: 12px; align-items: center; flex: 1; flex-wrap: wrap; }
.action-bar-right { display: flex; gap: 12px; }

/* ======== SETTING STRIP ======== */
.settings-strip {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 12px 1.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    font-size: 0.9rem;
}
.settings-strip label { font-weight: 600; color: var(--text-main); white-space: nowrap; }
.settings-strip input[type="number"] {
    width: 65px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--navy);
    text-align: center;
}
.settings-strip input[type="number"]:focus { outline: none; border-color: var(--border-focus); }
.settings-strip .sep { color: var(--text-muted); }

/* ======== SIGNATURE AREA ======== */
.signature-area {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: end;
    padding: 2.5rem 1.75rem;
    background: var(--surface);
}
.notes-col { font-size: 0.85rem; color: var(--text-sub); }
.notes-col h5 { font-size: 0.9rem; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }
.notes-col ul { padding-left: 1.2rem; line-height: 1.8; }
.sig-col { text-align: center; }
.sig-col p { font-size: 0.9rem; color: var(--text-sub); margin-bottom: 4px; }
.sig-col .sig-city { font-weight: 600; color: var(--text-main); }
.sig-col .sig-space { height: 80px; border-bottom: 1px solid var(--border-focus); margin: 15px auto; width: 220px; }
.sig-col .sig-name { font-weight: 600; font-size: 1rem; color: var(--navy); text-decoration: underline; }
.sig-col .sig-nip { font-size: 0.85rem; color: var(--text-sub); margin-top: 4px; }

/* ======== TOAST ======== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toast {
    background: var(--navy);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 300px;
    border-left: 4px solid transparent;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ======== ALERTS ======== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 1.75rem 1.25rem;
    display: none;
    line-height: 1.5;
}
.alert.show { display: flex; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; }

/* ======== ADMIN CATALOG PAGE ======== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--t);
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: #cbd5e1;
}
.stat-icon {
    width: 54px; height: 54px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}
.stat-icon.blue { background: #e0f2fe; color: #0369a1; }
.stat-icon.green { background: #d1fae5; color: #047857; }
.stat-icon.amber { background: #fef3c7; color: #b45309; }
.stat-num { font-size: 1.75rem; font-weight: 700; color: var(--navy); line-height: 1.2; }
.stat-lbl { font-size: 0.85rem; color: var(--text-sub); font-weight: 500; }

/* ======== UTILITIES ======== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-4 { padding-top: 1rem; }
.pb-1 { padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-4 { padding-bottom: 1rem; }
.w-full { width: 100%; }
.d-flex { display: flex; }
.d-none { display: none; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.flex-1 { flex: 1; }

/* ======== PRINT SPECIFIC ======== */
@media print {
    .navbar, .action-bar, .settings-strip, .btn,
    .btn-icon-only, .modal-overlay, .modal, .toast-container { display: none !important; }
    body { padding-top: 0; background: white; }
    .page-wrapper { padding: 0; max-width: none; }
    .card { border: none; box-shadow: none; margin-bottom: 0; }
    .card-header { padding: 0 0 1rem; border-bottom: 2px solid var(--navy); }
    .card-body { padding: 1rem 0; }
    .hps-table thead th { background: #0d2137 !important; color: white !important; -webkit-print-color-adjust: exact; }
    .hps-table tfoot .total-row td { background: #0d2137 !important; color: white !important; -webkit-print-color-adjust: exact; }
    .table-wrapper { border: none; }
}

/* Security, authentication and smart price analysis */
.nav-user{display:inline-flex;align-items:center;padding:.4rem .65rem;border-radius:999px;background:#eef2ff;color:#3730a3;font-size:.72rem;font-weight:700;white-space:nowrap}
.auth-page{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#eef2ff,#f8fafc);padding:1.5rem}
.auth-card{width:min(440px,100%);background:#fff;border:1px solid #e2e8f0;border-radius:18px;padding:2rem;box-shadow:0 20px 60px rgba(15,23,42,.12)}
.auth-card h1{text-align:center;margin:.8rem 0 .25rem;color:#0f3460}.auth-card p{text-align:center;color:#64748b;margin-bottom:1.25rem}.auth-card .form-control{margin-bottom:1rem}
.alert-danger{background:#fef2f2;color:#991b1b;border:1px solid #fecaca;padding:.8rem;border-radius:10px}.alert-success{background:#ecfdf5;color:#065f46;border:1px solid #a7f3d0;padding:.8rem;border-radius:10px}
.analysis-loading{padding:3rem;text-align:center;color:#475569;font-weight:600}
.analysis-summary-grid{display:grid;grid-template-columns:2fr 1fr .7fr .7fr;gap:1rem;align-items:end;margin-bottom:1rem}
.analysis-stat{border:1px solid #dbeafe;background:#eff6ff;border-radius:12px;padding:.75rem;display:flex;flex-direction:column;gap:.25rem}.analysis-stat span{font-size:.72rem;color:#64748b;text-transform:uppercase;letter-spacing:.04em}.analysis-stat strong{font-size:1.05rem;color:#1d4ed8}
.analysis-methods{display:flex;align-items:center;gap:1rem;flex-wrap:wrap;padding:.85rem;border:1px solid #e2e8f0;background:#f8fafc;border-radius:12px;margin-bottom:.75rem}.analysis-methods label{display:flex;align-items:center;gap:.35rem;font-weight:600;font-size:.84rem}.analysis-final-price{margin-left:auto;font-size:.9rem}.analysis-final-price strong{font-size:1.15rem;color:#047857}
.analysis-warning{padding:.7rem .85rem;background:#fffbeb;border:1px solid #fde68a;color:#92400e;border-radius:10px;margin-bottom:.75rem;font-size:.82rem}
.analysis-footer{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-top:1rem;padding-top:1rem;border-top:1px solid #e2e8f0}.analysis-footer small{color:#64748b;max-width:560px}.source-outlier{color:#b91c1c;font-weight:700}.source-ok{color:#047857;font-weight:600}
@media(max-width:900px){.analysis-summary-grid{grid-template-columns:1fr 1fr}.analysis-footer{align-items:flex-start;flex-direction:column}.navbar-inner{align-items:flex-start}.navbar-nav{overflow-x:auto;max-width:100%}.nav-user{display:none}}
.hps-row.unconfirmed-row { outline: 2px solid #f59e0b; outline-offset: -2px; background: #fffbeb; }

/* ==========================================================
   UNIFIED APPLICATION NAVIGATION v3
   Shared, responsive menu for every authenticated HPS page.
   ========================================================== */
:root {
    --app-header-height: 76px;
    --app-header-bg: #0b1f35;
    --app-header-bg-soft: #102a47;
    --app-header-line: rgba(255,255,255,.09);
    --app-header-text: #e8eef6;
    --app-header-muted: #9fb0c4;
    --app-accent: #d5a31a;
    --app-accent-soft: rgba(213,163,26,.16);
}

body {
    padding-top: var(--app-header-height);
}

.app-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1400;
    height: var(--app-header-height);
    background:
        radial-gradient(circle at 18% -120%, rgba(56,114,171,.32), transparent 44%),
        linear-gradient(108deg, var(--app-header-bg) 0%, var(--app-header-bg-soft) 100%);
    border-bottom: 1px solid rgba(213,163,26,.58);
    box-shadow: 0 8px 28px rgba(2,12,27,.18);
    color: var(--app-header-text);
}

.app-header__inner {
    width: min(1480px, 100%);
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 22px;
}

.app-brand {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 190px;
    color: #fff;
    text-decoration: none;
}

.app-brand__mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    background: linear-gradient(145deg, #e0af25, #b97c08);
    border: 1px solid rgba(255,255,255,.2);
    box-shadow: 0 7px 18px rgba(185,124,8,.25), inset 0 1px 0 rgba(255,255,255,.3);
}

.app-brand__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.app-brand__copy strong {
    color: #fff;
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: -.015em;
}

.app-brand__copy small {
    margin-top: 5px;
    color: var(--app-header-muted);
    font-size: .67rem;
    font-weight: 500;
    white-space: nowrap;
}

.app-nav {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
}

.app-nav__main {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.app-nav__link,
.app-nav__trigger {
    position: relative;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #cbd7e5;
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.app-nav__link:hover,
.app-nav__trigger:hover {
    color: #fff;
    background: rgba(255,255,255,.075);
    border-color: rgba(255,255,255,.07);
}

.app-nav__link.is-active,
.app-nav__group.is-active > .app-nav__trigger {
    color: #fff;
    background: var(--app-accent-soft);
    border-color: rgba(224,175,37,.24);
    box-shadow: inset 0 -2px 0 var(--app-accent);
}

.app-nav__icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    display: inline-grid;
    place-items: center;
    color: currentColor;
    opacity: .94;
}

.app-nav__icon svg,
.app-nav__chevron svg,
.app-user__chevron svg,
.app-nav-toggle svg,
.app-user__logout svg,
.app-nav__logout svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-nav__group,
.app-user {
    position: relative;
}

.app-nav__group > summary,
.app-user > summary {
    list-style: none;
}

.app-nav__group > summary::-webkit-details-marker,
.app-user > summary::-webkit-details-marker {
    display: none;
}

.app-nav__chevron {
    width: 14px;
    height: 14px;
    margin-left: -2px;
    color: #91a4b9;
    transition: transform .18s ease;
}

.app-nav__group[open] .app-nav__chevron,
.app-user[open] .app-user__chevron {
    transform: rotate(180deg);
}

.app-nav__dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    z-index: 30;
    width: 294px;
    padding: 9px;
    border: 1px solid #dfe7f0;
    border-radius: 14px;
    background: rgba(255,255,255,.985);
    box-shadow: 0 22px 55px rgba(5,22,42,.2), 0 2px 7px rgba(5,22,42,.08);
    color: var(--text-main);
    transform-origin: top left;
    animation: hpsMenuIn .16s ease-out;
}

.app-nav__dropdown--right {
    left: auto;
    right: 0;
    transform-origin: top right;
}

.app-nav__dropdown::before,
.app-user__menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 28px;
    width: 11px;
    height: 11px;
    background: #fff;
    border-left: 1px solid #dfe7f0;
    border-top: 1px solid #dfe7f0;
    transform: rotate(45deg);
}

.app-nav__dropdown--right::before {
    left: auto;
    right: 28px;
}

@keyframes hpsMenuIn {
    from { opacity: 0; transform: translateY(-5px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.app-nav__dropdown-label {
    display: block;
    padding: 5px 10px 8px;
    color: #8a99aa;
    font-size: .64rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.app-nav__dropdown-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border-radius: 10px;
    color: #24364a;
    text-decoration: none;
    transition: background .16s ease, color .16s ease;
}

.app-nav__dropdown-link:hover {
    color: #0b3158;
    background: #f1f6fb;
}

.app-nav__dropdown-link.is-active {
    color: #133f68;
    background: #edf4fb;
    box-shadow: inset 3px 0 0 var(--app-accent);
}

.app-nav__dropdown-link .app-nav__icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    padding: 8px;
    border-radius: 9px;
    color: #244e74;
    background: #e8f0f7;
}

.app-nav__dropdown-link > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.app-nav__dropdown-link strong {
    font-size: .79rem;
    font-weight: 700;
}

.app-nav__dropdown-link small {
    margin-top: 4px;
    color: #7a8999;
    font-size: .66rem;
    font-weight: 500;
}

.app-user {
    flex: 0 0 auto;
}

.app-user__summary {
    min-width: 194px;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 9px 5px 6px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 13px;
    background: rgba(255,255,255,.055);
    color: #fff;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.app-user__summary:hover,
.app-user[open] .app-user__summary {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.16);
}

.app-user__avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #10243a;
    background: linear-gradient(145deg, #f7df98, #d5a31a);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.app-user__copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-user__copy strong {
    max-width: 120px;
    overflow: hidden;
    color: #f8fbff;
    font-size: .72rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-user__copy small {
    margin-top: 5px;
    color: #9fb0c4;
    font-size: .62rem;
}

.app-user__chevron {
    width: 15px;
    height: 15px;
    color: #8fa3ba;
    transition: transform .18s ease;
}

.app-user__menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 31;
    width: 270px;
    padding: 10px;
    border: 1px solid #dfe7f0;
    border-radius: 14px;
    background: #fff;
    color: var(--text-main);
    box-shadow: 0 22px 55px rgba(5,22,42,.2), 0 2px 7px rgba(5,22,42,.08);
    animation: hpsMenuIn .16s ease-out;
}

.app-user__menu::before {
    left: auto;
    right: 26px;
}

.app-user__menu-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 7px 12px;
    border-bottom: 1px solid #edf1f5;
}

.app-user__avatar--large {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 12px;
}

.app-user__menu-head > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.app-user__menu-head strong {
    overflow: hidden;
    font-size: .82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-user__menu-head small {
    margin-top: 4px;
    color: #7b8999;
    font-size: .68rem;
}

.app-user__role {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 0;
    padding: 8px 9px;
    border-radius: 9px;
    background: #f6f8fb;
    color: #708094;
    font-size: .7rem;
}

.app-user__role strong {
    color: #29435e;
    font-size: .69rem;
}

.app-user__logout,
.app-nav__logout {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px;
    border-radius: 9px;
    color: #b4232e;
    font-size: .76rem;
    font-weight: 650;
    text-decoration: none;
    transition: background .16s ease;
}

.app-user__logout:hover,
.app-nav__logout:hover {
    background: #fff1f2;
}

.app-user__logout svg,
.app-nav__logout svg {
    width: 18px;
    height: 18px;
}

.app-nav-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 9px;
    background: rgba(255,255,255,.065);
    color: #fff;
    font: inherit;
    font-size: .75rem;
    font-weight: 700;
    cursor: pointer;
}

.app-nav-toggle svg {
    width: 19px;
    height: 19px;
}

.app-nav__mobile-account {
    display: none;
}

/* Standardized headings used by administration pages. */
.admin-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 1.4rem;
}

.admin-page-heading__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
    color: #9a6d00;
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-page-heading h1 {
    margin: 0;
    color: #15283d;
    font-size: 1.7rem;
    font-weight: 780;
    letter-spacing: -.035em;
}

.admin-page-heading p {
    margin-top: 5px;
    color: #637387;
    font-size: .88rem;
}

.admin-section-card {
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(22,45,70,.07);
}

.admin-section-card .card-header {
    padding: 1.15rem 1.4rem;
    background: linear-gradient(180deg, #fff, #fbfcfe);
}

.admin-section-title {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.admin-section-title strong {
    color: #1b3148;
    font-size: .95rem;
}

.admin-section-title small {
    margin-top: 4px;
    color: #77869a;
    font-size: .72rem;
    font-weight: 500;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.role-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 25px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
}

.role-badge { background: #edf4fb; color: #24527d; }
.status-pill.is-active { background: #eaf8f1; color: #14734b; }
.status-pill.is-inactive { background: #fff1f2; color: #b42332; }

@media (max-width: 1180px) {
    .app-header__inner {
        gap: 12px;
    }

    .app-brand {
        margin-right: auto;
    }

    .app-nav-toggle {
        display: inline-flex;
        order: 2;
    }

    .app-user {
        order: 3;
    }

    .app-nav {
        position: fixed;
        top: var(--app-header-height);
        right: 0;
        left: 0;
        z-index: 1399;
        max-height: calc(100vh - var(--app-header-height));
        display: block;
        padding: 15px 20px 20px;
        overflow-y: auto;
        border-top: 1px solid rgba(255,255,255,.07);
        background: linear-gradient(180deg, #102a47, #0b1f35);
        box-shadow: 0 18px 35px rgba(3,15,31,.25);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
    }

    .app-nav.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .app-nav__main {
        width: min(820px, 100%);
        margin: 0 auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .app-nav__link,
    .app-nav__trigger {
        width: 100%;
        min-height: 46px;
        justify-content: flex-start;
        padding: 0 13px;
        font-size: .82rem;
    }

    .app-nav__group {
        min-width: 0;
    }

    .app-nav__group .app-nav__chevron {
        margin-left: auto;
    }

    .app-nav__dropdown,
    .app-nav__dropdown--right {
        position: static;
        width: 100%;
        margin-top: 6px;
        padding: 7px;
        border-color: rgba(255,255,255,.08);
        border-radius: 10px;
        background: rgba(255,255,255,.97);
        box-shadow: none;
        animation: none;
    }

    .app-nav__dropdown::before {
        display: none;
    }
}

@media (max-width: 820px) {
    .app-header__inner {
        padding: 0 15px;
    }

    .app-user {
        display: none;
    }

    .app-nav__main {
        grid-template-columns: 1fr;
    }

    .app-nav__mobile-account {
        width: min(820px, 100%);
        margin: 14px auto 0;
        padding-top: 13px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        border-top: 1px solid rgba(255,255,255,.1);
    }

    .app-nav__mobile-identity {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 10px;
        color: #fff;
    }

    .app-nav__mobile-identity > span:last-child {
        min-width: 0;
        display: flex;
        flex-direction: column;
        line-height: 1.2;
    }

    .app-nav__mobile-identity strong {
        max-width: 210px;
        overflow: hidden;
        font-size: .76rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-nav__mobile-identity small {
        margin-top: 4px;
        color: #9fb0c4;
        font-size: .65rem;
    }

    .app-nav__logout {
        flex: 0 0 auto;
        color: #ffd4d9;
    }

    .admin-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    :root { --app-header-height: 68px; }

    .app-brand {
        min-width: 0;
    }

    .app-brand__mark {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        border-radius: 10px;
    }

    .app-brand__copy small {
        display: none;
    }

    .app-brand__copy strong {
        font-size: .9rem;
    }

    .app-nav-toggle span {
        display: none;
    }

    .app-nav-toggle {
        width: 40px;
        padding: 0;
        justify-content: center;
    }

    .app-nav {
        padding-right: 12px;
        padding-left: 12px;
    }

    .app-nav__mobile-account {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-nav__logout {
        width: 100%;
        justify-content: center;
        background: rgba(255,255,255,.06);
    }

    .admin-page-heading h1 {
        font-size: 1.45rem;
    }
}

@media print {
    .app-header { display: none !important; }
}
