:root {
    color-scheme: light;
    --ink: #111827;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --panel: #ffffff;
    --soft: #f6f8fb;
    --soft-2: #eef3f8;
    --accent: #1e5f8a;
    --accent-dark: #154669;
    --red: #df2935;
    --green: #16804f;
    --green-dark: #0f6840;
    --blue: #1e5f8a;
    --blue-dark: #154669;
    --danger: #b42318;
    --warn: #a15c07;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ink);
    background:
        linear-gradient(180deg, #f9fbfd 0%, var(--soft) 260px),
        var(--soft);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 64px;
    padding: 10px 28px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 10px rgba(15, 23, 42, 0.04);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-decoration: none;
    white-space: nowrap;
}

.brand img {
    width: 190px;
    height: 54px;
    object-fit: contain;
    display: block;
}

.brand span {
    color: var(--ink);
    font-weight: 700;
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}

nav a {
    color: #334155;
    text-decoration: none;
    font-size: 12px;
    font-weight: 650;
    padding: 8px 10px;
    border-radius: 6px;
}

nav a:hover {
    color: var(--accent);
    background: #edf6fb;
}

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 22px 24px 42px;
}

h1 {
    margin: 0 0 14px;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: 0;
}

h2 {
    margin: 0 0 12px;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: 0;
}

p {
    margin: 0 0 12px;
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 16px;
    align-items: start;
}

.home-card {
    min-height: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 36px 24px;
    border: 1px solid #d7e4ec;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.98)),
        linear-gradient(135deg, #f9fbfd 0%, #eef8fc 100%);
    box-shadow: var(--shadow);
    text-align: center;
}

.home-logo {
    width: min(620px, 88%);
    max-height: 210px;
    object-fit: contain;
    margin-bottom: 8px;
}

.home-card h1 {
    margin-bottom: 0;
    font-size: 30px;
}

.home-copy {
    max-width: 560px;
    margin-bottom: 8px;
    font-size: 14px;
}

.apply-button {
    min-height: 54px;
    padding: 0 34px;
    background: var(--red);
    font-size: 16px;
    text-transform: uppercase;
    box-shadow: 0 10px 18px rgba(223, 41, 53, 0.22);
}

.apply-button:hover {
    background: #bf1f2a;
}

.contact-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 14px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
}

.contact-strip strong {
    color: var(--ink);
}

.contact-strip a {
    color: var(--accent);
    font-weight: 800;
    text-decoration: none;
}

.admin-link-card {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.045);
    text-align: center;
}

.admin-link-card span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.admin-link-card a {
    display: inline-flex;
    justify-content: center;
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 6px;
    background: #eef3f8;
    color: #334155;
    font-size: 12px;
    font-weight: 850;
    text-decoration: none;
}

.admin-link-card a:hover {
    background: #e0ebf3;
    color: var(--accent);
}

.request-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 18px 20px;
    border: 1px solid #c8e2ef;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #eef8fc 100%);
    box-shadow: var(--shadow);
}

.request-hero h1 {
    margin-bottom: 6px;
    font-size: 24px;
}

.request-hero p {
    margin-bottom: 0;
}

.hero-badge {
    flex: 0 0 auto;
    padding: 8px 10px;
    border-radius: 6px;
    background: #dff3ea;
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
}

.request-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    align-items: start;
}

.request-form {
    display: grid;
    gap: 14px;
}

.form-section {
    display: grid;
    gap: 13px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055);
}

.section-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.section-head > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.section-head h2 {
    margin: 0 0 3px;
    font-size: 15px;
}

.section-head p {
    margin: 0;
    font-size: 12px;
}

.request-form label strong {
    color: var(--danger);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding: 4px 0 0;
}

.button-large {
    min-height: 44px;
    padding: 0 20px;
    background: var(--green);
    font-size: 13px;
}

.policy-panel {
    position: sticky;
    top: 86px;
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.policy-panel h2 {
    margin-bottom: 2px;
}

.policy-item {
    padding: 11px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 6px;
    background: #fbfdff;
}

.policy-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 12px;
}

.policy-item p {
    margin: 0;
    font-size: 11px;
}

.policy-item.annual { border-left-color: #1e5f8a; }
.policy-item.sick { border-left-color: #df2935; }
.policy-item.casual { border-left-color: #16804f; }
.policy-item.emergency { border-left-color: #a15c07; }

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.page-heading h1 {
    margin-bottom: 6px;
}

.page-heading p {
    margin-bottom: 0;
}

.summary-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.summary-pills span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 850;
}

.employee-add-panel {
    padding: 0;
    overflow: hidden;
}

.employee-add-panel > details > summary {
    padding: 15px 18px;
    background: #f8fbfd;
    color: var(--ink);
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}

.employee-form {
    padding: 16px;
}

.form-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.form-tab {
    display: grid;
    gap: 11px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.form-tab h2 {
    margin-bottom: 0;
    font-size: 13px;
}

.compact-grid {
    grid-template-columns: 1fr;
    gap: 9px;
}

.compact-grid input,
.compact-grid select,
.compact-grid textarea,
.allowance-grid input {
    min-height: 32px;
    padding: 7px 9px;
}

.allowance-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-row input {
    width: auto;
    min-height: 0;
}

.employee-list {
    display: grid;
    gap: 10px;
}

.employee-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.045);
    overflow: hidden;
}

.employee-card.inactive {
    opacity: 0.74;
}

.employee-summary {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) minmax(170px, 0.8fr) minmax(230px, 1fr);
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
}

.employee-summary h2 {
    margin: 7px 0 4px;
    font-size: 15px;
}

.employee-summary p {
    margin: 0;
    font-size: 12px;
}

.employee-mini,
.allowance-summary,
.doc-expiry-row,
.balance-strip {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.employee-mini span,
.allowance-summary span,
.doc-expiry-row span,
.balance-strip span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 750;
}

.allowance-summary span {
    background: #effaf4;
    color: #145c39;
}

.doc-expiry-row {
    padding: 0 16px 13px;
}

.doc-expiry-row strong {
    margin-right: 4px;
    color: var(--ink);
}

.employee-edit {
    border-top: 1px solid var(--line);
}

.employee-edit > summary {
    padding: 10px 16px;
    background: #f8fbfd;
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.balance-strip {
    padding: 2px 0 0;
}

.import-form,
.report-form {
    margin-top: 12px;
}

.report-panel select[multiple] {
    min-height: 138px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px 0 18px;
}

.report-summary div {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--muted);
    font-weight: 800;
}

.report-summary strong {
    display: block;
    margin-top: 4px;
    color: var(--ink);
    font-size: 20px;
}

.report-sheet h2 {
    margin-top: 18px;
}

.report-table {
    margin-bottom: 12px;
}

.report-table th {
    width: auto;
}

.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.045);
}

.metric strong {
    display: block;
    margin-top: 5px;
    color: var(--ink);
    font-size: 22px;
    line-height: 1.1;
}

form {
    display: grid;
    gap: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

label {
    display: grid;
    gap: 5px;
    color: #334155;
    font-weight: 750;
    font-size: 12px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30, 95, 138, 0.14);
}

textarea {
    min-height: 82px;
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 36px;
    padding: 0 13px;
    border: 0;
    border-radius: 6px;
    background: var(--green);
    color: white;
    font-weight: 800;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(22, 128, 79, 0.18);
}

button:hover,
.button:hover {
    background: var(--green-dark);
}

button.secondary,
.button.secondary {
    background: var(--blue);
    box-shadow: none;
}

button.secondary:hover,
.button.secondary:hover {
    background: var(--blue-dark);
}

button.danger {
    background: var(--danger);
    box-shadow: none;
}

button.danger:hover {
    background: #8f1d14;
}

button.small,
.button.small {
    min-height: 30px;
    padding: 0 10px;
    font-size: 11px;
}

.page-help {
    display: inline-block;
    margin: -4px 0 14px;
    padding: 8px 10px;
    border: 1px solid #c7e8d7;
    border-radius: 6px;
    background: #effaf4;
    color: #145c39;
    font-size: 12px;
    font-weight: 700;
}

.field-help {
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
}

.notice {
    padding: 10px 12px;
    border: 1px solid #f0d38a;
    border-radius: 6px;
    background: #fff9e8;
    color: #654500;
    font-size: 12px;
    font-weight: 650;
}

.table-wrap {
    overflow-x: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

th,
td {
    padding: 9px 11px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 12px;
}

th {
    background: var(--soft-2);
    color: #334155;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
}

.table-wrap thead th {
    border-bottom: 1px solid #cbd7e6;
}

tr:nth-child(even) td {
    background: #fbfdff;
}

tr:hover td {
    background: #f6fafc;
}

tr:last-child td {
    border-bottom: 0;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.proof-actions {
    display: grid;
    grid-template-columns: minmax(150px, 1fr);
    gap: 6px;
    margin-top: 8px;
    max-width: 240px;
}

.proof-actions input {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 11px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8eef8;
    color: #334155;
    font-size: 11px;
    font-weight: 800;
}

.status.approved {
    background: #dff3ea;
    color: var(--green);
}

.status.active {
    background: #dff3ea;
    color: var(--green);
}

.status.resigned {
    background: #eef2f7;
    color: #475569;
}

.status.terminated {
    background: #fde7e7;
    color: var(--danger);
}

.status.on_hold {
    background: #fff1d6;
    color: var(--warn);
}

.status.rejected {
    background: #fde7e7;
    color: var(--danger);
}

.status.pending {
    background: #fff1d6;
    color: var(--warn);
}

.status.manual {
    background: #edf6fb;
    color: var(--accent);
}

.status.medical-pending {
    background: #fff1d6;
    color: var(--warn);
}

.status.medical-received {
    background: #dff3ea;
    color: var(--green);
}

.status.medical-converted_to_cl {
    background: #e8eef8;
    color: var(--blue);
}

.status.medical-special_approved {
    background: #f1e8ff;
    color: #6d28d9;
}

.flash {
    margin-bottom: 16px;
    padding: 11px 13px;
    border-radius: 8px;
    border: 1px solid #b7e1c4;
    background: #ecf9f0;
    color: #195b37;
    font-weight: 700;
}

.flash.error {
    border-color: #f4b5b5;
    background: #fdeaea;
    color: var(--danger);
}

.note {
    color: var(--muted);
    font-size: 11px;
}

code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #334155;
}

.print-page {
    background: #e5e7eb;
    font-size: 12px;
}

.print-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 16px auto;
    padding: 14mm;
    background: #fff;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
}

.print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--ink);
}

.print-header img {
    width: 170px;
    height: auto;
}

.print-header h1 {
    margin: 0;
    font-size: 22px;
    text-align: right;
}

.print-header p {
    margin: 4px 0 0;
    text-align: right;
}

.print-status {
    margin: 14px 0;
    padding: 8px 10px;
    border: 1px solid #9ad7b5;
    border-radius: 6px;
    background: #ecf9f0;
    color: var(--green);
    font-size: 16px;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
}

.print-table {
    min-width: 0;
    border: 1px solid var(--line-strong);
}

.print-table th,
.print-table td {
    padding: 9px 10px;
    border: 1px solid var(--line-strong);
    font-size: 12px;
}

.print-table th {
    position: static;
    width: 22%;
    background: #f1f5f9;
    color: var(--ink);
    text-transform: none;
}

.signature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 34px;
}

.signature-grid div {
    min-height: 70px;
    padding-top: 44px;
    border-top: 1px solid var(--ink);
    text-align: center;
    font-weight: 750;
}

.print-button {
    margin-top: 22px;
}

@page {
    size: A4;
    margin: 10mm;
}

@media print {
    body.print-page {
        background: #fff;
    }

    .print-sheet {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .print-button {
        display: none;
    }

    .print-table th,
    .print-table td {
        padding: 7px 8px;
    }
}

@media (max-width: 920px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 18px;
        position: static;
    }

    .brand img {
        width: 158px;
        height: 45px;
    }

    .brand span {
        display: none;
    }

    nav {
        justify-content: flex-start;
    }

    .page {
        padding: 18px;
    }

    .grid,
    .home-hero,
    .request-layout,
    .page-heading,
    .employee-summary,
    .form-tabs,
    .form-grid {
        grid-template-columns: 1fr;
    }

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

    .allowance-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-card {
        min-height: 360px;
        padding: 28px 18px;
    }

    .home-card h1 {
        font-size: 26px;
    }

    .apply-button {
        width: 100%;
        max-width: 340px;
    }

    .request-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .policy-panel {
        position: static;
    }

    th {
        top: 0;
    }
}
