:root {
    --brand: #1261a6;
    --brand-dark: #0d477a;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #d8dee8;
    --soft: #f5f7fb;
    --field-border: #7aa7d4;
    --field-border-hover: #3f82bd;
    --field-focus: #1261a6;
    --field-ring: rgba(18, 97, 166, .18);
}

html {
    overflow-y: scroll;
}

body {
    background: var(--soft);
    color: var(--ink);
    font-size: 14px;
    min-height: 100vh;
}

.bg-primary {
    background: var(--brand) !important;
}

.sticky-top {
    z-index: 1030;
}

.app-footer {
    background: #fff;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    padding: 12px 16px;
    text-align: center;
}

.login-shell {
    min-height: calc(100vh - 90px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 32px;
}

.login-card h1 {
    font-size: 22px;
    margin: 0;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
select,
textarea {
    background-color: #fff;
    border: 2px solid var(--field-border);
    border-radius: 7px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .75), 0 1px 2px rgba(31, 41, 55, .06);
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not(:disabled):not([readonly]):hover,
select:not(:disabled):hover,
textarea:not(:disabled):not([readonly]):hover {
    border-color: var(--field-border-hover);
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):focus,
select:focus,
textarea:focus {
    background-color: #fff;
    border-color: var(--field-focus);
    box-shadow: 0 0 0 4px var(--field-ring), 0 2px 8px rgba(18, 97, 166, .12);
}

input[readonly],
input:disabled,
select:disabled,
textarea[readonly],
textarea:disabled {
    background-color: #eef3f8;
    border-color: #aebdcb;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--field-focus);
}

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

.page-title h1 {
    font-size: 24px;
    margin: 0;
}

.page-title p {
    margin: 4px 0 0;
    color: var(--muted);
}

.panel,
.metric {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.panel h2 {
    font-size: 18px;
    margin-bottom: 14px;
}

.panel h3 {
    font-size: 15px;
}

.metric span,
.label-value span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.metric strong {
    display: block;
    font-size: 30px;
    margin-top: 6px;
}

.metric.compact strong {
    font-size: 20px;
}

.label-value strong {
    font-size: 18px;
}

.table th {
    white-space: nowrap;
    background: #eef3f9;
    font-weight: 700;
}

.table td {
    vertical-align: middle;
}

.report-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.slip,
.paysheet {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.slip {
    max-width: 900px;
    margin: 0 auto;
}

.slip h1,
.paysheet h1 {
    font-size: 20px;
    margin-bottom: 4px;
}

.slip h2,
.paysheet h2 {
    font-size: 16px;
    margin-bottom: 0;
}

.net-box {
    border: 2px solid var(--brand);
    color: var(--brand-dark);
    font-size: 20px;
    font-weight: 700;
    padding: 12px;
    text-align: right;
    margin-top: 14px;
}

.signature-row {
    display: flex;
    justify-content: space-between;
    margin-top: 70px;
}

.signature-row span {
    width: 220px;
    border-top: 1px solid #333;
    text-align: center;
    padding-top: 8px;
}

.paysheet-table {
    font-size: 11px;
}

.paysheet-table th,
.paysheet-table td {
    text-align: right;
}

.paysheet-table th:nth-child(1),
.paysheet-table th:nth-child(2),
.paysheet-table td:nth-child(1),
.paysheet-table td:nth-child(2) {
    text-align: left;
}

.signature-cell {
    min-width: 90px;
}

.payroll-entry-table input {
    min-width: 110px;
}

.portal-pin-input {
    min-width: 92px;
    width: 92px;
}

.employee-login-card {
    text-align: left;
}

.portal-lock-icon {
    align-items: center;
    background: #e8f2fb;
    border-radius: 50%;
    display: flex;
    font-size: 24px;
    height: 52px;
    justify-content: center;
    margin-bottom: 18px;
    width: 52px;
}

.portal-login-pin {
    font-size: 20px;
    letter-spacing: .5em;
}

.portal-help {
    font-size: 12px;
    margin: 20px 0 0;
    text-align: center;
}

.portal-welcome {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.portal-welcome h1 {
    font-size: 24px;
    margin: 3px 0;
}

.portal-net-metric {
    border-color: #88c7aa;
    background: #f2fbf6;
}

.portal-brand-short {
    display: none;
}

.portal-filter-button {
    min-height: 42px;
}

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

.employee-slip {
    margin-bottom: 24px;
}

.paysheet-print-sheet {
    max-width: 1280px;
    margin: 0 auto;
}

.paysheet-excel-table {
    table-layout: fixed;
    width: 100%;
    border-color: #111;
}

.paysheet-excel-table th,
.paysheet-excel-table td {
    border-color: #111 !important;
    color: #111;
    padding: 3px 4px;
    vertical-align: middle;
}

.paysheet-excel-table th {
    background: #fff;
    text-align: center;
}

.paysheet-excel-table .sheet-title {
    font-size: 17px;
    font-weight: 700;
    text-align: center !important;
}

.paysheet-excel-table .sheet-subtitle {
    font-size: 13px;
    text-align: left !important;
}

.paysheet-excel-table .center {
    text-align: center !important;
}

.paysheet-excel-table .num {
    text-align: right !important;
}

.paysheet-excel-table .name-cell {
    text-align: left !important;
    font-weight: 600;
}

.paysheet-excel-table .sub-name {
    font-weight: 400;
}

.paysheet-excel-table .sn-col {
    width: 32px;
}

.paysheet-excel-table .name-col {
    width: 150px;
}

.paysheet-excel-table .installment-col {
    width: 34px;
}

.paysheet-excel-table .gross-col,
.paysheet-excel-table .payable-col {
    width: 72px;
}

.paysheet-excel-table .signature-col,
.paysheet-excel-table .signature-cell {
    width: 90px;
}

.paysheet-excel-table .employee-break-row td {
    border-bottom-width: 2px !important;
}

@media (max-width: 768px) {
    .page-title,
    .report-heading,
    .signature-row {
        align-items: stretch;
        flex-direction: column;
    }

    .login-card {
        padding: 22px;
    }

    .employee-portal-page {
        font-size: 15px;
    }

    .employee-portal-page main.container-xl {
        padding: 16px 12px !important;
    }

    .employee-portal-page .navbar .container-xl {
        flex-wrap: nowrap;
        padding-left: 12px;
        padding-right: 12px;
    }

    .employee-portal-page .navbar-brand {
        font-size: 17px;
        margin-right: 8px;
    }

    .employee-portal-page .btn,
    .employee-portal-page .form-control,
    .employee-portal-page .form-select {
        min-height: 44px;
    }

    .employee-login-card {
        border: 0;
        border-radius: 14px;
        padding: 26px 20px;
        width: 100%;
    }

    .employee-login-card h1 {
        font-size: 24px;
    }

    .portal-welcome {
        align-items: flex-start;
        border-radius: 12px;
        padding: 16px;
    }

    .portal-welcome h1 {
        font-size: 20px;
        overflow-wrap: anywhere;
    }

    .employee-portal-page .panel {
        border-radius: 12px;
        padding: 16px;
    }

    .portal-filter-form {
        --bs-gutter-x: 10px;
        --bs-gutter-y: 12px;
    }

    .portal-filter-form .form-label {
        font-size: 13px;
        font-weight: 600;
    }

    .portal-filter-button {
        width: 100%;
    }

    .portal-stat-grid {
        gap: 8px;
    }

    .portal-stat-grid .metric {
        border-radius: 10px;
        min-width: 0;
        padding: 12px 9px;
    }

    .portal-stat-grid .metric span {
        font-size: 10px;
        letter-spacing: 0;
    }

    .portal-stat-grid .metric strong {
        font-size: clamp(14px, 4.2vw, 19px);
        overflow-wrap: anywhere;
    }

    .employee-portal-page .panel > .table-responsive {
        overflow: visible;
    }

    .employee-portal-page .panel > .table-responsive > .table thead {
        display: none;
    }

    .employee-portal-page .panel > .table-responsive > .table,
    .employee-portal-page .panel > .table-responsive > .table tbody,
    .employee-portal-page .panel > .table-responsive > .table tr,
    .employee-portal-page .panel > .table-responsive > .table td {
        display: block;
        width: 100%;
    }

    .employee-portal-page .panel > .table-responsive > .table tr {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 12px;
    }

    .employee-portal-page .panel > .table-responsive > .table td {
        align-items: center;
        border: 0;
        display: flex;
        justify-content: space-between;
        padding: 5px 0;
        text-align: right !important;
    }

    .employee-portal-page .panel > .table-responsive > .table td[data-label]::before {
        color: var(--muted);
        content: attr(data-label);
        font-size: 12px;
        font-weight: 600;
        margin-right: 12px;
        text-align: left;
    }

    .employee-portal-page .panel > .table-responsive > .table .portal-slip-action {
        border-top: 1px solid var(--line);
        margin-top: 8px;
        padding-top: 12px;
    }

    .portal-slip-action .btn {
        width: 100%;
    }

    .employee-slip {
        border-radius: 12px;
        padding: 16px;
    }

    .employee-slip h1 {
        font-size: 16px;
    }

    .employee-slip h2 {
        font-size: 15px;
    }

    .employee-slip .row.mb-3 > div {
        margin-bottom: 5px;
    }

    .employee-slip .table {
        font-size: 13px;
    }

    .employee-slip .table td {
        padding: 7px;
    }

    .employee-slip .net-box {
        font-size: 18px;
        text-align: center;
    }
}

@media (max-width: 380px) {
    .portal-brand-full {
        display: none;
    }

    .portal-brand-short {
        display: inline;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 8mm;
    }

    body {
        background: #fff;
        font-size: 11px;
    }

    .no-print,
    nav,
    .alert {
        display: none !important;
    }

    main.container-fluid {
        padding: 0 !important;
    }

    body.employee-portal-page main.container-xl {
        max-width: none;
        padding: 0 !important;
    }

    .panel,
    .slip,
    .paysheet {
        border: 0;
        border-radius: 0;
        padding: 0;
    }

    .table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
    }

    .slip {
        max-width: none;
    }

    .paysheet-excel-table {
        font-size: 9px;
    }

    .paysheet-excel-table th,
    .paysheet-excel-table td {
        padding: 2px 3px;
    }

    .paysheet-excel-table .sheet-title {
        font-size: 14px;
    }

    .paysheet-excel-table .sheet-subtitle {
        font-size: 10px;
    }
}

@media print {
    body.salary-slip-page {
        font-size: 10px;
    }

    body.salary-slip-page .slip {
        box-sizing: border-box;
        height: 132mm;
        max-height: 132mm;
        max-width: none;
        overflow: hidden;
        padding: 5mm;
        page-break-after: always;
    }

    body.salary-slip-page .slip h1 {
        font-size: 14px;
    }

    body.salary-slip-page .slip h2 {
        font-size: 12px;
    }

    body.salary-slip-page .slip .mb-3 {
        margin-bottom: 6px !important;
    }

    body.salary-slip-page .slip .row.g-3 {
        --bs-gutter-x: 8px;
        --bs-gutter-y: 4px;
    }

    body.salary-slip-page .slip h3 {
        font-size: 11px;
        margin-bottom: 3px;
    }

    body.salary-slip-page .slip .table {
        font-size: 9px;
        margin-bottom: 4px;
    }

    body.salary-slip-page .slip .table td {
        padding: 1px 4px;
    }

    body.salary-slip-page .net-box {
        font-size: 13px;
        margin-top: 4px;
        padding: 5px 8px;
    }

    body.salary-slip-page .signature-row {
        margin-top: 16mm;
    }

    body.salary-slip-page .signature-row span {
        width: 55mm;
        padding-top: 4px;
    }
}
