:root {
    --ink: #18243a;
    --muted: #68758a;
    --line: #dfe5ec;
    --soft: #f3f6f9;
    --surface: #ffffff;
    --brand: #173c61;
    --brand-2: #24588d;
    --brand-3: #3f75a8;
    --brand-soft: #eaf2f8;
    --accent: #d90000;
    --actual: #ad6662;
    --actual-soft: #f5e9e8;
    --success: #176b4d;
    --success-soft: #eaf6f0;
    --warning: #8a5b00;
    --warning-soft: #fff6dc;
    --danger: #a93232;
    --shadow: 0 18px 50px rgba(36, 88, 141, .10);
    --shadow-soft: 0 8px 28px rgba(25, 47, 75, .055);
    --radius: 22px;
}

* { box-sizing: border-box; }

html {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: #fbfcfd;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 82% 0%, #eaf2f8 0, transparent 34%), #f7f9fb;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.topbar {
    height: 74px;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: minmax(260px,1fr) auto minmax(260px,1fr);
    align-items: center;
    gap: 24px;
    padding: 0 max(28px, calc((100vw - 1480px)/2));
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-brand { display:flex; align-items:center; gap:12px; min-width:0; }
.topbar-brand-copy { display:flex; flex-direction:column; min-width:0; }
.topbar-brand-copy strong { font-size:14px; letter-spacing:.01em; }
.topbar-brand-copy small { color:var(--muted); font-size:11px; margin-top:2px; }

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--brand), var(--brand-2));
    color: white;
    font-weight: 850;
    font-size: 18px;
    letter-spacing: -.04em;
    box-shadow: 0 10px 24px rgba(36,88,141,.22), inset 0 -3px 0 var(--accent);
    flex: 0 0 auto;
}

.brand-mark-auth { width:58px; height:58px; border-radius:17px; font-size:23px; }

.topnav { display:flex; align-items:center; gap:8px; font-size:13px; font-weight:650; }
.topnav a { padding:10px 12px; border-radius:11px; color:#445a72; transition:.15s ease; }
.topnav a:hover { background:var(--brand-soft); color:var(--brand-2); }

.profile-menu { justify-self:end; position:relative; }
.profile-menu summary { list-style:none; cursor:pointer; }
.profile-menu summary::-webkit-details-marker { display:none; }
.topbar-profile {
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
    padding:6px 9px 6px 6px;
    border:1px solid transparent;
    border-radius:14px;
    transition:.15s ease;
}
.topbar-profile:hover, .profile-menu[open] .topbar-profile { background:var(--brand-soft); }
.profile-avatar {
    width:36px; height:36px; border-radius:50%; display:grid; place-items:center;
    background:linear-gradient(145deg,#dbe9f4,#f5f9fc); color:var(--brand); font-size:12px; font-weight:850;
}
.profile-copy { display:flex; flex-direction:column; text-align:right; min-width:0; }
.profile-copy strong { font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:190px; }
.profile-copy small { margin-top:2px; color:var(--muted); font-size:10px; }
.profile-caret { color:#8796a8; font-size:12px; }
.profile-dropdown {
    position:absolute; right:0; top:52px; width:210px; padding:8px;
    border:1px solid var(--line); border-radius:15px; background:#fff; box-shadow:var(--shadow); z-index:30;
}
.profile-dropdown a { display:flex; align-items:center; justify-content:space-between; padding:11px 12px; border-radius:10px; font-size:13px; }
.profile-dropdown a:hover { background:var(--soft); }
.role-badge {
    display:inline-flex; align-items:center; min-height:24px; padding:4px 8px; border-radius:99px;
    background:var(--actual-soft); color:#8d302d; font-size:9px; font-weight:850; text-transform:uppercase; letter-spacing:.05em;
}
.role-badge.subtle { background:var(--brand-soft); color:var(--brand-2); }

.page-shell { width:min(1480px, calc(100% - 40px)); margin:0 auto; padding:42px 0 64px; }
.footer { width:min(1480px, calc(100% - 40px)); margin:0 auto; padding:0 0 28px; display:flex; justify-content:space-between; color:#8b98a7; font-size:10px; }

.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:28px; }
.page-heading h1 { margin:4px 0 9px; font-size:clamp(30px,3vw,44px); line-height:1.06; letter-spacing:-.04em; }
.page-heading p { margin:0; color:var(--muted); font-size:13px; line-height:1.55; }
.eyebrow { color:var(--accent); letter-spacing:.14em; font-size:11px; font-weight:850; text-transform:uppercase; }

.context-strip {
    display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin:0 0 20px;
}
.context-pill {
    display:inline-flex; align-items:center; gap:7px; padding:7px 10px; border-radius:99px;
    border:1px solid #d8e2eb; background:rgba(255,255,255,.72); color:#52677f; font-size:11px; font-weight:700;
}
.context-pill strong { color:var(--brand); }
.dev-badge { background:#fff6dc; border-color:#ecd9a4; color:#7b5800; }

.kpi-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:14px; margin-bottom:20px; }
.kpi {
    background:rgba(255,255,255,.94); border:1px solid var(--line); border-radius:18px; padding:20px;
    box-shadow:var(--shadow-soft); min-width:0;
}
.kpi span, .kpi small { display:block; color:var(--muted); }
.kpi span { font-size:11px; margin-bottom:10px; font-weight:650; }
.kpi strong { display:block; font-size:clamp(20px,1.75vw,28px); letter-spacing:-.035em; color:var(--brand); white-space:nowrap; }
.kpi strong.small-value { font-size:15px; white-space:normal; overflow-wrap:anywhere; }
.kpi small { margin-top:8px; font-size:10px; line-height:1.4; }
.kpi.actual-kpi strong { color:#8f4a46; }
.kpi.success-kpi strong { color:var(--success); }
.kpi.warning-kpi { border-color:#ecd9a4; }
.admin-kpis { grid-template-columns:repeat(4,minmax(0,1fr)); }

.dashboard-grid { display:grid; grid-template-columns:1.45fr 1fr; gap:18px; align-items:start; }
.panel {
    background:rgba(255,255,255,.96); border:1px solid var(--line); border-radius:var(--radius); padding:22px;
    box-shadow:var(--shadow-soft); min-width:0;
}
.panel-wide { grid-row:span 2; }
.panel-head { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; margin-bottom:20px; }
.panel-head h2 { margin:0 0 5px; font-size:18px; letter-spacing:-.02em; }
.panel-head p { margin:0; color:var(--muted); font-size:11px; }
.legend { display:flex; gap:12px; color:var(--muted); font-size:10px; }
.legend span { display:inline-flex; align-items:center; gap:5px; }
.legend-box { width:9px; height:9px; border-radius:3px; }
.legend-box.budget, .bar.budget { background:var(--brand-2); }
.legend-box.actual, .bar.actual { background:var(--actual); }
.legend-box.scope, .bar.scope { background:#c8d4df; }

.month-chart { display:grid; gap:13px; }
.month-row { display:grid; grid-template-columns:68px 1fr; gap:12px; align-items:center; }
.month-label { font-size:11px; color:var(--muted); }
.month-bars, .hc-bars { display:grid; gap:5px; }
.bar-line, .hc-line { display:grid; grid-template-columns:minmax(0,1fr) 138px; gap:10px; align-items:center; min-height:16px; }
.bar-track { background:var(--soft); border-radius:7px; overflow:hidden; height:16px; }
.bar { height:16px; min-width:0; border-radius:6px; }
.bar-line span { font-size:10px; color:var(--muted); text-align:right; white-space:nowrap; }
.hc-chart { display:grid; gap:9px; }
.hc-row { display:grid; grid-template-columns:60px 1fr; gap:8px; align-items:center; font-size:10px; color:var(--muted); }
.hc-line { grid-template-columns:minmax(0,1fr) 48px; }
.hc-line b { font-size:10px; color:var(--ink); text-align:right; }

.table-scroll { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:11px; }
th { text-align:left; color:var(--muted); background:#f7f9fb; font-weight:750; }
th,td { padding:11px 10px; border-bottom:1px solid var(--line); vertical-align:top; }
tbody tr:hover { background:#fbfdff; }
td small { color:var(--muted); }
.num { text-align:right; white-space:nowrap; }
.status { display:inline-flex; border-radius:99px; padding:4px 8px; font-size:9px; font-weight:850; }
.status.pass { background:var(--success-soft); color:var(--success); }
.status.warn { background:var(--warning-soft); color:var(--warning); }
.status.fail { background:#f9e5e5; color:var(--danger); }

.filterbar {
    display:flex; align-items:flex-end; gap:10px; flex-wrap:wrap; padding:16px; margin-bottom:14px;
    border:1px solid var(--line); border-radius:17px; background:#fff;
}
.filter-field { display:flex; flex-direction:column; gap:6px; }
.filter-field label { color:var(--muted); font-size:10px; font-weight:750; }
select, .input {
    height:48px; border:1px solid #ccd7e1; border-radius:13px; padding:0 14px; outline:none; background:white; color:var(--ink);
}
select:focus, .input:focus { border-color:#6c96bb; box-shadow:0 0 0 4px #eaf2f8; }
.btn {
    border:0; border-radius:13px; min-height:46px; padding:12px 19px; font-weight:750;
    display:inline-flex; align-items:center; justify-content:center; cursor:pointer; transition:.15s ease;
}
.btn:hover { transform:translateY(-1px); }
.btn-primary { background:var(--brand-2); color:#fff; box-shadow:0 9px 24px rgba(36,88,141,.20); }
.btn-primary:hover { background:#1d4a75; }
.btn-secondary { background:var(--brand-soft); color:var(--brand); }
.btn-outline { background:white; color:var(--ink); border:1px solid var(--line); }
.btn-lg { min-height:54px; padding:14px 22px; }
.btn-block { width:100%; }

.form-stack { display:flex; flex-direction:column; gap:9px; margin-top:26px; }
.form-stack label { font-size:13px; font-weight:750; }
.validation-summary, .field-error { color:var(--danger); font-size:12px; }
.empty-state { text-align:center; padding:64px 24px; background:#fff; border:1px solid var(--line); border-radius:var(--radius); }
.empty-state p { color:var(--muted); }

/* JDApproval-aligned authentication composition */
.auth-page { background:#f2f6f9; }
.auth-page .page-shell { width:min(1120px, calc(100% - 32px)); padding:5vh 0; }
.auth-page .footer { display:none; }
.auth-shell-premium {
    min-height:740px; display:grid; grid-template-columns:1.04fr .96fr; border-radius:30px; overflow:hidden;
    box-shadow:var(--shadow); background:white; border:1px solid rgba(219,227,235,.9);
}
.auth-brand-panel {
    padding:62px; background:linear-gradient(145deg,#102e4b,#173c61 55%,#24588d); color:white;
    display:flex; flex-direction:column; justify-content:center; position:relative; overflow:hidden; isolation:isolate;
}
.auth-brand-panel-premium::before {
    content:""; position:absolute; z-index:0; width:66%; height:132%; top:-18%; right:-25%; transform:rotate(-27deg);
    border-radius:44px; background:linear-gradient(180deg,rgba(63,117,168,.42),rgba(63,117,168,.05));
}
.auth-brand-panel-premium::after {
    content:""; position:absolute; z-index:0; width:88%; height:42%; left:27%; bottom:-24%; transform:rotate(11deg);
    border-radius:50%; background:rgba(5,35,65,.25);
}
.auth-brand-panel > * { position:relative; z-index:1; }
.auth-brand-lockup { display:flex; align-items:center; gap:14px; margin-bottom:44px; }
.auth-brand-lockup > div { display:flex; flex-direction:column; }
.auth-brand-lockup strong { font-size:16px; }
.auth-brand-lockup small { margin-top:3px; color:#dceaf5; font-size:11px; }
.auth-kicker { color:#dceaf5; font-size:11px; font-weight:850; letter-spacing:.16em; }
.auth-kicker-rule { display:block; width:52px; height:3px; border-radius:99px; background:#74b5f1; margin:14px 0 20px; }
.auth-brand-panel h1 { max-width:520px; margin:0 0 18px; font-size:clamp(40px,4.1vw,56px); line-height:1.07; letter-spacing:-.045em; }
.auth-brand-panel > p { max-width:510px; margin:0 0 24px; color:#dce8f2; font-size:16px; line-height:1.62; }
.auth-feature-list { display:flex; flex-direction:column; gap:11px; margin-top:10px; }
.auth-feature { display:flex; align-items:flex-start; gap:13px; }
.auth-check {
    width:34px; height:34px; flex:0 0 34px; display:grid; place-items:center; border-radius:50%;
    background:rgba(101,176,239,.28); color:#fff; font-weight:900;
}
.auth-feature > div { display:flex; flex-direction:column; gap:3px; }
.auth-feature strong { font-size:13px; }
.auth-feature small { color:#dce8f2; font-size:11px; line-height:1.45; }
.auth-form-panel { padding:54px 62px; display:flex; flex-direction:column; justify-content:center; }
.auth-form-content { width:min(100%,500px); margin:0 auto; }
.auth-form-content h2 { margin:10px 0 15px; font-size:34px; letter-spacing:-.035em; }
.auth-form-intro { max-width:470px; font-size:14px; line-height:1.65; }
.auth-login-form { margin-top:30px; }
.input-with-icon { position:relative; }
.input-leading-icon {
    position:absolute; z-index:1; left:16px; top:50%; transform:translateY(-50%); width:20px; height:20px;
    display:grid; place-items:center; color:#7b8ea2; font-size:14px; font-weight:800; pointer-events:none;
}
.lock-icon { font-size:10px; }
.input.input-with-leading { width:100%; height:58px; padding-left:49px; border-radius:14px; font-size:15px; }
.auth-submit-btn { min-height:60px; margin-top:6px; gap:12px; border-radius:14px; font-size:14px; }
.auth-footnote { display:flex; justify-content:space-between; gap:14px; margin-top:28px; padding-top:18px; border-top:1px solid var(--line); color:#8a98a8; font-size:10px; }

.user-admin-grid { display:grid; grid-template-columns:1.25fr .75fr; gap:18px; align-items:start; }
.form-card { background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow-soft); }
.form-card h2 { margin:0 0 6px; font-size:18px; }
.form-card > p { margin:0 0 18px; color:var(--muted); font-size:11px; }

@media (max-width:1200px) {
    .kpi-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .topbar { grid-template-columns:minmax(220px,1fr) auto minmax(220px,1fr); }
}

@media (max-width:1000px) {
    .dashboard-grid, .user-admin-grid { grid-template-columns:1fr; }
    .panel-wide { grid-row:auto; }
    .auth-shell-premium { grid-template-columns:1fr; min-height:auto; }
    .auth-brand-panel { padding:40px; min-height:420px; }
    .auth-form-panel { padding:44px; }
    .profile-copy { display:none; }
}

@media (max-width:760px) {
    .topbar { height:auto; min-height:70px; grid-template-columns:1fr auto; padding:10px 14px; gap:10px; }
    .topnav { grid-column:1 / -1; order:3; width:100%; overflow-x:auto; }
    .topbar-brand-copy small { display:none; }
    .page-shell, .footer { width:min(100% - 20px,1480px); }
    .page-shell { padding:26px 0 44px; }
    .kpi-grid, .admin-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .bar-line { grid-template-columns:minmax(0,1fr) 105px; }
    .auth-page .page-shell { width:min(100% - 20px,1120px); padding:10px 0; }
    .auth-shell-premium { border-radius:20px; }
    .auth-brand-panel { min-height:360px; padding:32px 26px; }
    .auth-brand-panel h1 { font-size:36px; }
    .auth-form-panel { padding:34px 26px; }
    .auth-form-content h2 { font-size:29px; }
}

@media (max-width:520px) {
    .kpi-grid, .admin-kpis { grid-template-columns:1fr; }
    .page-heading { align-items:flex-start; flex-direction:column; }
    .month-row { grid-template-columns:52px 1fr; }
    .bar-line { grid-template-columns:minmax(0,1fr) 88px; }
    .auth-footnote { flex-direction:column; }
}
