:root {
    --p-navy-980: #061124;
    --p-navy-940: #0a1b37;
    --p-blue-700: #1f5fd6;
    --p-blue-600: #2f6feb;
    --p-gold: #d3a137;
    --p-ink: #0b162e;
    --p-text: #263650;
    --p-muted: #6d7890;
    --p-line: #dbe4ef;
    --p-soft: #edf3fa;
    --p-card: #fff;
    --p-bg: #f3f6fb;
    --p-shadow: 0 18px 52px rgba(11, 31, 65, .09);
    --p-shadow-soft: 0 8px 26px rgba(11, 31, 65, .055);
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--p-text);
    background:
        radial-gradient(circle at 4% 0%, rgba(211,161,55,.12), transparent 29%),
        radial-gradient(circle at 92% 0%, rgba(47,111,235,.12), transparent 32%),
        linear-gradient(135deg, #fbfcfe 0%, var(--p-bg) 48%, #eef3f9 100%);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }
.portal-topbar {
    min-height: 76px;
    padding: 16px clamp(18px, 4vw, 54px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: rgba(255,255,255,.74);
    border-bottom: 1px solid rgba(219,228,239,.75);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    min-width: 0;
}
.portal-logo {
    width: 220px;
    max-width: 46vw;
    min-height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(255,255,255,.95);
    border-radius: 20px;
    padding: 10px 14px;
    box-shadow: var(--p-shadow-soft);
}
.portal-logo img { display: block; height: 44px; max-width: 100%; object-fit: contain; }
.portal-title { min-width: 0; }
.portal-title span {
    display: block;
    color: var(--p-muted);
    font-size: 10px;
    font-weight: 840;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.portal-title strong {
    display: block;
    color: var(--p-ink);
    font-size: 15px;
    letter-spacing: -.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.portal-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.portal-btn,
.portal-actions a,
.portal-actions button {
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid var(--p-line);
    background: rgba(255,255,255,.86);
    color: var(--p-navy-940);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 780;
    text-decoration: none;
    cursor: pointer;
}
.portal-btn.primary,
.portal-actions .primary {
    border-color: transparent;
    color: white;
    background: linear-gradient(135deg, var(--p-navy-940), var(--p-blue-700));
    box-shadow: 0 10px 22px rgba(31,95,214,.18);
}
.portal-main {
    width: min(1260px, calc(100% - 34px));
    margin: 30px auto 54px;
    flex: 1;
}
.portal-hero {
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    color: white;
    padding: clamp(28px, 5vw, 46px);
    background:
        radial-gradient(circle at 88% 18%, rgba(211,161,55,.28), transparent 26%),
        linear-gradient(135deg, #102a55 0%, #1f5fd6 100%);
    box-shadow: 0 22px 58px rgba(31,95,214,.18);
    margin-bottom: 18px;
}
.portal-hero .kicker,
.kicker {
    display: block;
    font-size: 10px;
    letter-spacing: .19em;
    text-transform: uppercase;
    font-weight: 850;
    color: rgba(255,255,255,.72);
    margin-bottom: 12px;
}
.portal-hero h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.02;
    letter-spacing: -.055em;
}
.portal-hero p {
    margin: 14px 0 0;
    max-width: 760px;
    color: rgba(255,255,255,.82);
    font-size: 15.5px;
    line-height: 1.65;
}
.portal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.portal-grid.three { grid-template-columns: repeat(3, 1fr); }
.portal-grid.two { grid-template-columns: repeat(2, 1fr); }
.portal-card {
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(219,228,239,.9);
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--p-shadow-soft);
}
.portal-card h2,
.portal-card h3 {
    margin: 0 0 10px;
    color: var(--p-ink);
    letter-spacing: -.035em;
}
.portal-card p { margin: 0; color: var(--p-muted); line-height: 1.58; }
.portal-kpi small {
    display: block;
    color: var(--p-muted);
    font-size: 11px;
    font-weight: 780;
    margin-bottom: 8px;
}
.portal-kpi strong {
    display: block;
    color: var(--p-ink);
    font-size: 30px;
    line-height: 1;
    letter-spacing: -.05em;
}
.portal-kpi span {
    display: block;
    margin-top: 8px;
    color: var(--p-muted);
    font-size: 12px;
}
.portal-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}
.portal-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--p-line);
    border-radius: 20px;
    background: white;
}
.portal-table th,
.portal-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf1f6;
    text-align: left;
    vertical-align: middle;
}
.portal-table th {
    color: #62718a;
    background: #f8fafc;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 850;
}
.portal-table td { color: var(--p-text); font-size: 13px; }
.portal-table tr:last-child td { border-bottom: 0; }
.portal-link { color: var(--p-blue-700); font-weight: 780; text-decoration: none; }
.portal-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    border: 1px solid #dce6f4;
    background: #f4f7fb;
    color: var(--p-navy-940);
    padding: 0 10px;
    font-size: 11px;
    font-weight: 820;
}
.portal-badge.good { background: #ecfdf3; color: #087443; border-color: #abefc6; }
.portal-badge.warn { background: #fff7e6; color: #a15c00; border-color: #fedf89; }
.portal-badge.danger { background: #fff1f0; color: #b42318; border-color: #fecdca; }
.portal-login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 26px;
}
.portal-login-shell {
    width: min(1050px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 420px;
    gap: 18px;
    align-items: stretch;
}
.portal-login-hero {
    border-radius: 30px;
    padding: clamp(30px, 5vw, 54px);
    color: white;
    background:
        radial-gradient(circle at 82% 12%, rgba(211,161,55,.26), transparent 30%),
        linear-gradient(135deg, #0b1f41 0%, #2f6feb 100%);
    box-shadow: 0 26px 68px rgba(11,31,65,.18);
}
.portal-login-logo {
    display: inline-flex;
    background: white;
    border-radius: 22px;
    padding: 14px 18px;
    margin-bottom: 36px;
    box-shadow: 0 16px 38px rgba(0,0,0,.14);
}
.portal-login-logo img { height: 50px; }
.portal-login-hero h1 { margin: 0; font-size: clamp(34px, 4.5vw, 54px); line-height: 1; letter-spacing: -.06em; }
.portal-login-hero p { margin: 18px 0 0; color: rgba(255,255,255,.78); line-height: 1.65; max-width: 650px; }
.portal-login-panel {
    border-radius: 30px;
    padding: 34px;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(255,255,255,.95);
    box-shadow: var(--p-shadow);
}
.portal-login-panel h2 { margin: 0 0 8px; color: var(--p-ink); font-size: 28px; letter-spacing: -.045em; }
.portal-login-panel p { margin: 0 0 24px; color: var(--p-muted); line-height: 1.55; }
.portal-field { margin-bottom: 16px; }
.portal-field label { display: block; color: var(--p-ink); font-size: 12px; font-weight: 830; margin-bottom: 8px; }
.portal-field input {
    width: 100%;
    height: 48px;
    border-radius: 15px;
    border: 1px solid var(--p-line);
    padding: 0 14px;
    font: inherit;
    color: var(--p-ink);
    background: white;
}
.portal-field input:focus { outline: none; border-color: var(--p-blue-600); box-shadow: 0 0 0 4px rgba(47,111,235,.12); }
.portal-error {
    background: #fff1f0;
    border: 1px solid #fecdca;
    color: #b42318;
    padding: 12px 14px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 720;
    margin-bottom: 16px;
}
.portal-footer { padding: 22px; color: var(--p-muted); text-align: center; font-size: 12px; }
.receipt-sheet {
    width: min(860px, calc(100% - 28px));
    margin: 26px auto;
    background: white;
    border-radius: 24px;
    padding: 34px;
    border: 1px solid var(--p-line);
    box-shadow: var(--p-shadow);
}
.receipt-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 24px; }
.receipt-head img { height: 52px; }
.receipt-number { text-align: right; color: var(--p-muted); }
.receipt-number strong { display: block; color: var(--p-ink); font-size: 22px; }
@media print {
    .portal-topbar, .portal-footer, .no-print { display:none !important; }
    body { background:white; }
    .receipt-sheet { box-shadow:none; border:0; margin:0; width:100%; }
}
@media (max-width: 920px) {
    .portal-grid, .portal-grid.three, .portal-grid.two { grid-template-columns: 1fr; }
    .portal-login-shell { grid-template-columns: 1fr; }
    .portal-title { display: none; }
}
