:root {
    color-scheme: light;
    --bg: #f4f4f4;
    --panel: #ffffff;
    --ink: #202124;
    --muted: #70757a;
    --line: #e4e7ec;
    --soft: #f8fafc;
    --orange: #ff9f2e;
    --orange-dark: #f58612;
    --red: #f44336;
    --red-dark: #d82020;
    --yellow: #ffca3a;
    --green: #4cc464;
    --blue: #407bff;
    --teal: #0f7f78;
    --slate: #64748b;
    --shadow: 0 14px 34px rgba(17, 24, 39, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
}

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

button {
    border: 0;
    border-radius: 7px;
    background: var(--teal);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    min-height: 38px;
    padding: 9px 14px;
    white-space: nowrap;
}

button:hover {
    filter: brightness(0.95);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d9dee8;
    border-radius: 7px;
    background: #ffffff;
    color: var(--ink);
    margin-top: 6px;
    min-height: 38px;
    padding: 9px 11px;
}

label {
    color: #5f6673;
    display: block;
    font-size: 12px;
    font-weight: 600;
}

.login-page {
    min-height: 100vh;
    align-items: center;
    display: flex;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: min(430px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 32px;
}

.login-card h1 {
    margin: 14px 0 8px;
}

.login-card p {
    color: var(--muted);
    line-height: 1.5;
    margin-top: 0;
}

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

.login-card small {
    color: var(--muted);
    display: block;
    margin-top: 18px;
}

.brand-mark {
    align-items: center;
    background: var(--teal);
    border-radius: 8px;
    color: #ffffff;
    display: flex;
    font-weight: 700;
    height: 48px;
    justify-content: center;
    width: 48px;
}

.topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    min-height: 64px;
    padding: 12px min(4vw, 44px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar span {
    color: var(--muted);
    display: inline-block;
    margin-left: 12px;
}

.nav-tabs {
    align-items: center;
    display: flex;
    gap: 8px;
}

.nav-tabs a {
    border-radius: 999px;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    padding: 9px 13px;
    text-decoration: none;
}

.nav-tabs a.active {
    background: #fff0db;
    color: #c76105;
}

.shell {
    margin: 0 auto;
    max-width: 1780px;
    padding: 22px 28px 30px;
    width: 100%;
}

.dashboard-hero {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 26px;
    grid-template-columns: minmax(0, 1fr) 320px;
    margin-bottom: 18px;
    padding: 28px 32px;
}

.hero-main {
    display: grid;
    gap: 22px;
}

.hero-main h1,
.page-heading h1 {
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    margin: 4px 0 4px;
}

.hero-main p,
.page-heading p {
    color: var(--muted);
    margin: 0;
}

.eyebrow {
    color: #6b7280 !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.calendar-tile {
    align-items: center;
    background: var(--orange);
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(245, 134, 18, 0.24);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    min-height: 106px;
    padding: 22px 28px;
}

.calendar-tile span {
    font-size: 24px;
    font-weight: 700;
}

.calendar-tile strong {
    align-items: center;
    background: #ffffff;
    border-radius: 12px;
    color: var(--red);
    display: flex;
    font-size: 34px;
    height: 68px;
    justify-content: center;
    width: 68px;
}

.stat-stack {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr 1fr;
}

.metric {
    align-items: center;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.1);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 94px;
    padding: 16px;
    text-align: center;
}

.metric strong {
    font-size: 34px;
    line-height: 1;
}

.metric span {
    font-size: 12px;
    font-weight: 600;
    margin-top: 5px;
}

.metric.red {
    background: var(--red);
}

.metric.yellow {
    background: var(--yellow);
}

.metric.green {
    background: var(--green);
    grid-column: 1 / -1;
    min-height: 116px;
}

.alert,
.toast {
    border-radius: 10px;
    font-weight: 700;
    padding: 12px 15px;
}

.alert {
    margin-bottom: 14px;
}

.toast {
    box-shadow: 0 18px 48px rgba(17, 24, 39, 0.18);
    left: 50%;
    max-width: min(620px, calc(100vw - 32px));
    position: fixed;
    text-align: center;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    width: max-content;
    z-index: 30;
}

.toast.hide {
    opacity: 0;
    transform: translate(-50%, -44%);
}

.alert.error,
.toast.error {
    background: #fee2e2;
    color: #991b1b;
}

.alert.success,
.toast.success {
    background: #dcfce7;
    color: #166534;
}

.control-panel,
.panel,
.page-heading {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.control-panel {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1fr) 390px;
    margin-bottom: 18px;
    padding: 18px;
}

.absence-form {
    display: grid;
    gap: 12px;
    grid-template-columns: 1.15fr 0.88fr 0.7fr 1.2fr auto;
    align-items: end;
}

.period-form {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 0.82fr auto;
    align-items: end;
}

.panel {
    padding: 22px 24px;
}

.section-title {
    align-items: end;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 16px;
}

.section-title h2 {
    font-size: 26px;
    font-weight: 700;
    margin: 4px 0 0;
}

.section-title > strong {
    background: #eef6ff;
    border-radius: 999px;
    color: #075985;
    padding: 8px 12px;
}

.employee-report {
    max-height: 540px;
    overflow: auto;
}

.report-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(180px, 1fr) 120px minmax(230px, 1.2fr) 106px;
    padding: 14px 0;
}

.report-row.problem {
    background: linear-gradient(90deg, rgba(244, 67, 54, 0.08), rgba(255, 255, 255, 0));
    border-left: 5px solid var(--red);
    padding-left: 14px;
}

.employee-name strong {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

.employee-name span,
.report-count span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-top: 3px;
}

.report-count strong {
    color: var(--teal);
    display: block;
    font-size: 28px;
    font-weight: 700;
}

.report-count.red-text strong,
.report-conclusion {
    color: var(--red-dark);
    font-weight: 700;
}

.report-row:not(.problem) .report-conclusion {
    color: #15803d;
}

.detail-box {
    justify-self: end;
    width: 106px;
}

.detail-box[open] {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
}

.detail-box[open] summary {
    margin-left: auto;
    width: 106px;
}

.detail-box summary {
    background: var(--blue);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    padding: 10px 14px;
    text-align: center;
}

.detail-box summary::-webkit-details-marker {
    display: none;
}

.detail-content {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 10px;
    padding: 16px;
    width: 100%;
}

.detail-content p {
    line-height: 1.45;
    margin: 0 0 12px;
}

.date-list {
    display: grid;
    gap: 9px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.date-list li {
    align-items: center;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(190px, 1fr) auto auto;
    padding: 10px;
}

.date-list small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-top: 3px;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.pill,
.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    padding: 6px 9px;
}

.pill.normal {
    background: #dcfce7;
    color: #166534;
}

.pill.weekend {
    background: #ffedd5;
    color: #9a3412;
}

.pill.danger {
    background: #fee2e2;
    color: #991b1b;
}

.small-btn {
    min-height: 32px;
    padding: 7px 10px;
}

.danger {
    background: var(--red-dark);
}

.secondary {
    background: #334155;
}

.muted {
    background: var(--slate);
}

.restore {
    background: var(--green);
}

.empty-detail {
    color: var(--muted);
}

.page-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 28px 32px;
}

.mini-stats {
    display: flex;
    gap: 12px;
}

.mini-stats div {
    background: #fff0db;
    border-radius: 12px;
    min-width: 92px;
    padding: 12px;
    text-align: center;
}

.mini-stats strong {
    display: block;
    font-size: 26px;
    font-weight: 700;
}

.mini-stats span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.employee-page-panel {
    display: grid;
    gap: 18px;
}

.add-employee-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.employee-table {
    display: grid;
    gap: 8px;
    max-height: 620px;
    overflow: auto;
}

.employee-table-head,
.employee-table-row {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(280px, 1fr) 110px 260px;
}

.employee-table-head {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    padding: 0 10px;
    text-transform: uppercase;
}

.employee-table-row {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
}

.employee-empty {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: var(--muted);
    padding: 22px;
    text-align: center;
}

.employee-edit {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.employee-edit input {
    margin-top: 0;
}

.status-pill.active {
    background: #dcfce7;
    color: #166534;
}

.status-pill.inactive {
    background: #e5e7eb;
    color: #475569;
}

.employee-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.setting-panel {
    align-items: start;
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
}

.setting-form {
    align-items: end;
    display: grid;
    gap: 12px;
}

.setting-preview {
    background: linear-gradient(135deg, #fff4e2, #ffffff);
    border: 1px solid #ffd8a8;
    border-radius: 14px;
    padding: 22px;
}

.setting-preview h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 10px;
}

.setting-preview p {
    color: var(--muted);
    margin: 0 0 10px;
}

.setting-preview strong,
.setting-preview span {
    display: block;
}

.setting-preview strong {
    color: #c76105;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.setting-preview span {
    color: var(--muted);
}

@media (max-width: 1040px) {
    .dashboard-hero,
    .control-panel,
    .absence-form,
    .period-form,
    .report-row,
    .setting-panel,
    .employee-table-head,
    .employee-table-row {
        grid-template-columns: 1fr;
    }

    .stat-stack {
        grid-template-columns: repeat(3, 1fr);
    }

    .metric.green {
        grid-column: auto;
        min-height: 94px;
    }

    .detail-box {
        justify-self: stretch;
        width: 100%;
    }
}

@media (max-width: 680px) {
    .topbar,
    .page-heading,
    .section-title,
    .date-list li,
    .add-employee-form,
    .employee-edit,
    .employee-actions {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .nav-tabs {
        flex-wrap: wrap;
    }

    .shell {
        padding: 14px 12px 24px;
    }

    .dashboard-hero,
    .panel,
    .page-heading {
        padding: 18px;
    }

    .hero-main h1,
    .page-heading h1 {
        font-size: 28px;
    }

    .calendar-tile {
        padding: 18px;
    }

    .stat-stack,
    .mini-stats {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* Final polish: wider dashboard and lighter typography. */
html,
body {
    width: 100%;
}

.shell {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: none !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
    width: 100% !important;
}

.dashboard-hero,
.control-panel,
.panel,
.page-heading {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: none !important;
    width: 100% !important;
}

.dashboard-hero {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px) !important;
}

.control-panel {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 430px) !important;
}

.report-row {
    grid-template-columns: minmax(260px, 1.1fr) 150px minmax(420px, 2fr) 120px !important;
}

.employee-report {
    max-height: none !important;
    overflow: visible !important;
}

body,
button,
input,
select,
textarea,
.nav-tabs a,
.employee-name strong,
.report-conclusion,
.section-title h2,
.hero-main h1,
.page-heading h1 {
    font-weight: 500;
}

.metric strong,
.calendar-tile strong,
.report-count strong,
.mini-stats strong,
.setting-preview strong {
    font-weight: 600;
}

.eyebrow,
label,
.metric span,
.employee-name span,
.report-count span,
.employee-table-head,
.mini-stats span {
    font-weight: 500;
}

@media (max-width: 1040px) {
    .dashboard-hero,
    .control-panel,
    .report-row {
        grid-template-columns: 1fr !important;
    }
}
