:root {
    --ink: #203242;
    --muted: #677781;
    --line: #e3ebee;
    --surface: #ffffff;
    --canvas: #f8fafb;
    --primary: #387e88;
    --primary-dark: #2d6973;
    --primary-soft: #e2f3f1;
    --danger: #a54553;
    --success: #267d6d;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--canvas); font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; }
.container { width: min(1120px, 90vw); margin: 0 auto; padding: 48px 0 72px; }
.container.narrow { width: min(820px, 90vw); }

/* Shared workspace shell */
body:has(> .topbar) { display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; }
body:has(> .topbar) > main.container { grid-column: 2; width: min(1380px, 100%); min-width: 0; margin: 0 auto; padding: 76px clamp(24px, 3vw, 48px) 68px; }
.topbar { position: sticky; top: 0; z-index: 20; grid-column: 1; grid-row: 1; width: 248px; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #f7fafb; }
.sidebar-brand { padding: 26px 20px 26px; }
.sidebar-brand > a { display: flex; align-items: center; gap: 5px; color: #172636; font-size: 1.5rem; font-weight: 800; text-decoration: none; letter-spacing: -.04em; }
.sidebar-brand img { width: 36px; height: 36px; }
.sidebar-brand small { display: block; margin: 3px 0 0 4px; color: #74848b; font-size: .61rem; font-weight: 700; letter-spacing: .06em; }
.workspace-profile { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 12px 12px; padding: 11px 8px; border-top: 1px solid var(--line); color: #354651; font-size: .79rem; font-weight: 650; }
.workspace-profile > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-avatar { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; color: #4a6b79; background: #e3eff5; font-size: .72rem; font-weight: 800; }
.sidebar-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 7px 11px 20px; }
.nav-label { margin: 23px 13px 9px; color: #89969c; font-size: .58rem; font-weight: 800; letter-spacing: .08em; }
.nav-links { display: flex; flex-direction: column; gap: 3px; }
.nav-links a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 12px; border-radius: 8px; color: #60737e; font-size: .85rem; font-weight: 550; text-decoration: none; transition: background .15s ease, color .15s ease; }
.nav-links a:hover, .nav-links a:focus-visible { color: #256f78; background: #edf5f5; }
.nav-links a[aria-current="page"] { color: #246f79; background: var(--primary-soft); font-weight: 750; }
.nav-icon { display: block; width: 19px; height: 19px; flex: 0 0 19px; color: #85a6ae; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-links a[aria-current="page"] .nav-icon { color: #398995; }
.nav-count { margin-left: auto; min-width: 20px; padding: 1px 5px; border-radius: 999px; color: #206b74; background: #d9eeec; text-align: center; font-size: .69rem; font-weight: 800; }
.logout-form { margin: 0; }
.sidebar-footer { padding: 13px 13px 23px; border-top: 1px solid var(--line); }
.link-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; color: #657782; background: none; text-align: left; cursor: pointer; font-size: .84rem; }
.link-button:hover { color: #246f79; background: #edf5f5; }

/* Headings, panels and tables */
h1, h2, h3 { color: var(--ink); line-height: 1.25; }
h1 { margin: 0 0 18px; font-size: clamp(1.85rem, 2.5vw, 2.35rem); letter-spacing: -.035em; font-weight: 760; }
h2 { margin: 0 0 10px; font-size: 1.08rem; }
h3 { margin: 0 0 8px; font-size: .96rem; }
.muted { color: var(--muted); }
.eyebrow { color: #829198; font-size: .67rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 21px; }
.page-heading h1 { margin-bottom: 0; }
.page-heading .eyebrow, .page-heading .muted, main.container > .eyebrow, main.container > h1 + .muted { display: none; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 13px; }
.card, .form-card, .table-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 1px 2px rgba(33, 67, 81, .025); }
.card, .form-card { padding: 22px; }
.link-card { position: relative; display: block; min-height: 95px; color: var(--ink); text-decoration: none; }
.link-card::after { content: "›"; position: absolute; right: 17px; top: 13px; color: #6b8792; font-size: 1.45rem; }
.link-card:hover { border-color: #bddbdb; background: #fbfdfd; }
.link-card p { display: none; }
.table-card { overflow: auto; }
.table-card > h2 { padding: 17px 18px 0; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid #edf1f3; text-align: left; vertical-align: top; }
th { color: #6e8189; background: #f5f9fa; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .035em; }
td { color: #455864; font-size: .82rem; }
td small { display: block; margin-top: 2px; color: #8b979c; font-size: .72rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfefe; }
.status { display: inline-block; padding: 3px 8px; border-radius: 999px; color: #55727a; background: #edf5f6; font-size: .66rem; font-weight: 750; white-space: nowrap; }
.status.large { padding: 6px 12px; font-size: .8rem; }
.status-approved, .status-completed { color: #24766a; background: #e7f4ee; }
.status-rejected, .status-cancelled, .status-deleted { color: #a64a55; background: #f9ebed; }
.status-submitted, .status-applied, .status-updated { color: #337f8b; background: #e6f4f5; }
.admin-stats { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); margin: 18px 0 24px; }
.admin-stats .card { display: flex; flex-direction: column; gap: 4px; min-height: 91px; }
.admin-stats strong { color: var(--primary); font-size: 1.35rem; }
.admin-stats span { color: #7b8b93; font-size: .7rem; }
.section-title { margin: 28px 0 12px; font-size: 1.05rem; }

/* Buttons and forms */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 8px 13px; border: 1px solid transparent; border-radius: 7px; font-size: .79rem; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; }
.button.primary { color: white; background: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: #316f78; background: #e8f3f2; }
.button.danger { color: var(--danger); background: #f9e9eb; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 17px 0; }
.actions form { margin: 0; }
.text-link { font-weight: 700; text-decoration: none; }
label, dt { display: block; margin-bottom: 5px; color: #526471; font-size: .77rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 37px; padding: 8px 10px; border: 1px solid #d3e0e4; border-radius: 6px; color: var(--ink); background: white; font-size: .82rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #d3efef; border-color: var(--primary); }
input[readonly] { color: #637780; background: #f2f5f6; }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-error { display: block; min-height: 1.1em; margin-top: 4px; color: var(--danger); font-size: .75rem; }
.help, .login-hint { color: var(--muted); font-size: .75rem; }
.filter-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; gap: 9px; margin-bottom: 17px; }
.filter-field { min-width: 0; }
.filter-field input, .filter-field select { width: 100%; }
.decision-stack { display: grid; gap: 7px; min-width: 260px; }
.decision-stack form { display: flex; gap: 7px; margin: 0; }
.decision-stack input { min-width: 120px; }
.inline-complete { display: flex; align-items: center; gap: 8px; flex: 1; }
.inline-complete input { min-width: 180px; }
.alert { margin: 0 0 17px; padding: 10px 13px; border: 1px solid #d7e7ea; border-radius: 8px; color: #45616c; background: #f0f7f9; font-size: .83rem; }
.alert.error { color: #8f3945; border-color: #efccd0; background: #fdf0f1; }
.alert.success { color: #236a5d; border-color: #c9e8dc; background: #eff9f3; }
.pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 15px 0; font-size: .79rem; }
.pagination select { width: auto; }
.empty { padding: 42px 24px; text-align: center; }
.empty p { margin: 0; color: var(--muted); font-size: .82rem; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; margin-bottom: 18px; }
dd { margin: 0; }
.preserve { white-space: pre-wrap; }
.timeline { position: relative; list-style: none; margin: 12px 0 0; padding: 0 0 0 27px; }
.timeline::before { content: ""; position: absolute; top: 8px; bottom: 12px; left: 6px; width: 2px; background: #d6e7e9; }
.timeline li { position: relative; margin: 0 0 15px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--primary); border: 2px solid white; box-shadow: 0 0 0 1px #a9d0d0; }
.timeline span { color: var(--muted); font-size: .77rem; margin-left: 8px; }
.timeline p { margin: 3px 0 0; color: var(--muted); }
.simple-list { margin: 0; padding-left: 20px; }
.training-allowance { padding: 17px 20px; margin: 14px 0; border: 1px solid var(--line); border-radius: 9px; background: white; }
.training-allowance p { margin: 5px 0; }
.heading-actions { display: flex; align-items: center; gap: 10px; }
.year-filter { display: flex; align-items: center; gap: 7px; }
.year-filter label { margin: 0; }
.year-filter select { width: auto; }
.allowance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 6px 0 18px; }
.allowance-card { padding: 17px 19px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.allowance-heading { display: flex; justify-content: space-between; gap: 8px; color: #60747d; font-size: .73rem; font-weight: 650; }
.allowance-heading span:last-child { color: #a0aeb4; font-weight: 500; }
.allowance-card strong { display: block; margin: 7px 0 12px; color: var(--ink); font-size: 1.27rem; line-height: 1.2; }
.allowance-card strong small { color: #71838a; font-size: .72rem; font-weight: 500; }
.allowance-card progress { display: block; width: 100%; height: 6px; appearance: none; border: 0; border-radius: 999px; background: #edf3f4; }
.allowance-card progress::-webkit-progress-bar { border-radius: 999px; background: #edf3f4; }
.allowance-card progress::-webkit-progress-value { border-radius: 999px; background: #71b8b4; }
.allowance-card progress::-moz-progress-bar { border-radius: 999px; background: #71b8b4; }

/* Dashboard cards match the simple Figma home layout. */
.dashboard-page h1 { margin: 0 0 38px; }
.dashboard-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 1040px; }
.action-card { display: grid; grid-template-columns: 56px minmax(0, 1fr) 20px; align-items: center; gap: 17px; min-height: 105px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; text-decoration: none; }
.action-card:hover { border-color: #c1dddf; background: #fcfefe; }
.action-card strong { font-size: .95rem; }
.queue-note { display: block; margin-top: 3px; color: var(--muted); font-size: .74rem; }
.review-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 1fr); align-items: start; gap: 18px; }
.review-main, .review-side { display: grid; gap: 16px; min-width: 0; }
.review-layout .card { margin: 0; }
.review-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 22px; }
.review-facts .wide { grid-column: 1 / -1; }
.review-facts dd { font-size: .87rem; }
.review-side .allowance-card { margin: 0 0 13px; }
.review-side .actions { margin-bottom: 0; }
.action-icon { display: grid; place-items: center; width: 55px; height: 55px; border-radius: 50%; color: #3b8e98; background: #e4f3f2; font-size: 1.65rem; font-family: Arial, sans-serif; }
.action-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.action-icon.blue { color: #6b8ea7; background: #e9f2f8; }
.action-arrow { justify-self: end; color: #68848d; font-size: 1.5rem; }

/* Login follows the same quiet visual language. */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 8px 28px rgba(30, 65, 80, .05); }
.login-brand { display: flex; align-items: center; gap: 5px; margin-bottom: 22px; color: var(--ink); font-size: 1.45rem; letter-spacing: -.04em; }
.login-brand img { width: 35px; height: 35px; }
.login-card h1 { margin-bottom: 23px; font-size: 1.55rem; }
.login-card label { margin-top: 14px; }
.login-card .button { width: 100%; margin-top: 19px; min-height: 40px; }
.login-switch { display: flex; justify-content: space-between; gap: 10px; margin-top: 23px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.login-switch a { white-space: nowrap; }

a:focus-visible, button:focus-visible { outline: 3px solid #87cbd0; outline-offset: 2px; }
@media (max-width: 900px) {
    body:has(> .topbar) { grid-template-columns: 74px minmax(0, 1fr); }
    .topbar { width: 74px; }
    .sidebar-brand { display: flex; justify-content: center; padding: 20px 8px; }
    .workspace-profile { justify-content: center; margin: 0 8px 8px; padding: 10px 0; }
    .workspace-profile > span:last-child, .nav-count { display: none; }
    .sidebar-brand strong, .sidebar-brand small, .nav-label, .nav-links a span:last-child, .sidebar-footer .link-button span:last-child { display: none; }
    .sidebar-scroll { padding-inline: 8px; }
    .nav-links a { justify-content: center; padding-inline: 8px; }
    .nav-icon { font-size: 1.3rem; }
    .sidebar-footer { padding-inline: 8px; }
    .sidebar-footer .link-button { justify-content: center; }
    .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .review-layout { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
    body:has(> .topbar) { display: block; }
    body:has(> .topbar) > main.container { width: 100%; padding: 24px 17px 50px; }
    .topbar { position: sticky; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0 10px; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: 0 5px 16px rgba(31, 65, 80, .05); }
    .sidebar-brand { display: block; padding: 7px 5px; }
    .sidebar-brand strong { display: inline; }
    .sidebar-brand small { display: none; }
    .sidebar-brand img { width: 31px; height: 31px; }
    .workspace-profile { order: 2; margin: 0 0 0 auto; padding: 0 5px; border: 0; }
    .workspace-profile > span:last-child { display: none; }
    .sidebar-scroll { order: 3; width: 100%; padding: 0 0 5px; overflow-x: auto; overflow-y: hidden; }
    .nav-links { display: inline-flex; flex-direction: row; width: max-content; margin-right: 12px; }
    .nav-links a { min-height: 35px; padding: 5px 9px; font-size: .73rem; }
    .nav-links a span:last-child { display: inline; }
    .nav-icon { width: 17px; flex-basis: 17px; font-size: 1.1rem; }
    .nav-label { display: none; }
    .sidebar-footer { order: 2; padding: 0; border: 0; }
    .sidebar-footer .link-button { padding: 6px; }
    .sidebar-footer .link-button span:last-child { display: none; }
    .dashboard-actions, .field-row, .detail-grid, .allowance-grid { grid-template-columns: 1fr; }
    .heading-actions { flex-wrap: wrap; }
    .dashboard-page h1 { margin-bottom: 24px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .card-grid { grid-template-columns: 1fr; }
    .filter-form { grid-template-columns: 1fr; }
}
