:root {
    --font-ui: "Segoe UI", Tahoma, Arial, sans-serif;
    --bg-page: #f1f4f9;
    --text: #1d3047;
    --text-muted: #5f7288;
    --border: #d4deea;
    --border-soft: #e5ebf3;
    --white: #ffffff;
    --primary-950: #0b1e36;
    --primary-900: #102743;
    --primary-800: #17375d;
    --primary-500: #3b6fa2;
    --gold-500: #c89b3c;
    --success: #207d60;
    --danger: #b74046;
    --warning: #b7771f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-ui);
    background:
        radial-gradient(circle at top right, #e0e8f4 0, transparent 36%),
        radial-gradient(circle at bottom left, #e7edf6 0, transparent 42%),
        var(--bg-page);
    color: var(--text);
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 286px;
    padding: 1.35rem 1.1rem;
    background:
        linear-gradient(145deg, rgba(255,255,255,0.05), transparent 40%),
        linear-gradient(180deg, var(--primary-800) 0%, var(--primary-950) 100%);
    color: #edf5ff;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.12);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.brand {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.14);
}

.brand-shell {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.brand-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    background: rgba(255,255,255,0.97);
    border-radius: 10px;
    padding: 0.25rem;
    box-shadow: 0 8px 18px rgba(6,19,34,0.22);
    flex: 0 0 auto;
}

.brand-title {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 0.18rem;
}

.brand-subtitle {
    font-size: 0.82rem;
    color: #bdd0e5;
    line-height: 1.45;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar a {
    color: #d9e8f6;
    text-decoration: none;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 600;
    transition: all 0.16s ease;
}

.sidebar a.active,
.sidebar a:hover {
    background: linear-gradient(90deg, rgba(200,155,60,0.28), rgba(255,255,255,0.08));
    border-color: rgba(205,169,92,0.38);
    color: #fff;
}

.content {
    flex: 1;
    min-width: 0;
    padding: 1.2rem 1.5rem 2rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 18px rgba(28,49,73,0.06);
}

.topbar-head {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.topbar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    padding: 0.22rem;
    border: 1px solid #d7e2ee;
}

.topbar h1 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    color: #17324d;
}

.topbar p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.user-pill {
    border: 1px solid #cfdae8;
    color: #334a63;
    background: #f2f7fc;
    border-radius: 999px;
    padding: 0.38rem 0.7rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

.page-intro,
.panel,
.stat-card,
.auth-card {
    position: relative;
    overflow: hidden;
}

.page-intro::before,
.panel::before,
.stat-card::before,
.auth-card::before {
    content: "";
    display: block;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--gold-500), var(--primary-500), rgba(59,111,162,0.22));
}

.page-intro,
.panel,
.stat-card,
.auth-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(19,35,56,0.05);
}

.page-intro {
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    background: linear-gradient(140deg, #ffffff 0%, #f6f9fd 100%);
}

.page-title-small {
    margin: 0 0 0.2rem;
    font-size: 1.02rem;
    color: #1b3553;
    font-weight: 700;
}

.page-subtitle-small,
.muted-copy {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.panel {
    padding: 20px;
    margin-bottom: 20px;
}

.panel-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.panel-grid.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6,minmax(0,1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 16px;
}

.stat-card span {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
}

.stat-card strong {
    font-size: 28px;
    color: #173550;
}

.filters,
.stack-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.filters {
    flex-direction: row;
    align-items: end;
    flex-wrap: wrap;
}

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

.span-2 { grid-column: span 2; }

label span {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd7e5;
    border-radius: 10px;
    box-sizing: border-box;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #7396bf;
    box-shadow: 0 0 0 0.16rem rgba(59,111,162,0.17);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #214a74;
    background: linear-gradient(180deg, #2d5b8a, #214a74);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    min-height: 42px;
    font-weight: 600;
}

.btn-outline {
    background: #fff;
    color: #17324d;
    border-color: #c9d7e6;
}

.btn-ghost {
    margin-top: auto;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    background: linear-gradient(180deg, #edf3fb 0%, #f5f8fd 100%);
    color: #3a536d;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

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

.data-table tr:hover td {
    background: #edf5fe;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    font-size: 0.75rem;
    font-weight: 650;
    background: #e5e7eb;
    color: #45576b;
    border: 1px solid transparent;
}

.badge-success {
    background: #e7f6ef;
    color: #1f7a57;
    border-color: #c2e7d8;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.details-grid div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #cde9da;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #f0c3c3;
}

.alert-warn {
    background: #fff7e7;
    color: #8a5a08;
    border-color: #eed49c;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(430px,100%);
    padding: 24px;
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
    padding: 0.35rem;
    border: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(19,35,56,0.08);
}

.hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
}

.simple-list {
    margin: 0;
    padding-left: 18px;
}

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

.row-actions form {
    margin: 0;
}

.top-gap { margin-top: 14px; }

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

.checkbox input { width: auto; }

.print-page {
    background: #fff;
    color: #1d3047;
}

.print-sheet {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px;
}

.payslip-head {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.print-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #d8e2ee;
    border-radius: 10px;
    padding: 4px;
}

.signature-grid {
    display: grid;
    gap: 24px;
    margin-top: 36px;
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f6f9fd;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.12);
    }
    .content { padding: 1rem 0.9rem 1.5rem; }
    .panel-grid.two,
    .form-grid,
    .details-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.9rem;
    }
    .topbar-head {
        width: 100%;
    }
    .topbar-logo {
        width: 42px;
        height: 42px;
    }
    .brand-logo {
        width: 48px;
        height: 48px;
    }
    .user-pill {
        white-space: normal;
    }
    .filters,
    .panel-actions,
    .row-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .btn, .btn-outline, .btn-ghost { width: 100%; }
    .panel { overflow-x: auto; }
    .data-table { min-width: 720px; }
}
