:root {
    --primary: #5b36d9;
    --primary-dark: #4424b8;
    --primary-soft: #eeeafd;
    --ink: #182033;
    --muted: #687089;
    --line: #e6e8f0;
    --surface: #ffffff;
    --background: #f5f6fa;
    --success: #14845c;
    --success-soft: #e8f7f0;
    --warning: #a96505;
    --warning-soft: #fff5dc;
    --danger: #c73d4d;
    --danger-soft: #fdebeb;
    --sidebar: #17152c;
    --shadow: 0 10px 35px rgba(28, 27, 56, .08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-size: 16px;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--background);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.04em;
}

.brand > span:last-child > span {
    color: #a994ff;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, #7b5af0, #4c2dc7);
    box-shadow: 0 8px 22px rgba(91, 54, 217, .35);
    color: white;
    font-size: 1.05rem;
}

.sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    display: flex;
    width: 254px;
    flex-direction: column;
    padding: 24px 17px 20px;
    background: var(--sidebar);
    color: #d8d5e8;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 29px;
}

.sidebar-close {
    display: none;
    border: 0;
    background: transparent;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
}

.nav-list {
    display: grid;
    gap: 7px;
}

.nav-link {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 13px;
    padding: 10px 13px;
    border-radius: 13px;
    color: #aaa7bd;
    font-size: .94rem;
    font-weight: 600;
    transition: .2s ease;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(123, 90, 240, .9), rgba(83, 47, 203, .9));
    box-shadow: 0 9px 24px rgba(45, 26, 119, .35);
}

.nav-icon {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    font-size: 1.16rem;
}

.sidebar-user {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 15px 8px 0;
    border-top: 1px solid rgba(255, 255, 255, .09);
}

.avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    background: #ece7ff;
    color: var(--primary-dark);
    font-weight: 800;
}

.user-copy {
    min-width: 0;
}

.user-copy strong,
.user-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-copy strong {
    color: #fff;
    font-size: .87rem;
}

.user-copy span {
    color: #8f8ba1;
    font-size: .76rem;
}

.icon-button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .07);
    color: #ddd9ee;
    cursor: pointer;
}

.app-main {
    min-height: 100vh;
    margin-left: 254px;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    min-height: 70px;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    border-bottom: 1px solid rgba(230, 232, 240, .8);
    background: rgba(245, 246, 250, .88);
    backdrop-filter: blur(14px);
}

.topbar-date {
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
}

.topbar-role {
    padding: 7px 11px;
    border: 1px solid #dfd9fa;
    border-radius: 999px;
    background: #f0edfc;
    color: var(--primary-dark);
    font-size: .78rem;
    font-weight: 750;
}

.menu-button {
    display: none;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1.45rem;
    cursor: pointer;
}

.content {
    width: min(1380px, 100%);
    min-height: calc(100vh - 116px);
    margin: 0 auto;
    padding: 34px;
}

.footer {
    padding: 0 34px 26px;
    color: #9298a8;
    font-size: .78rem;
    text-align: center;
}

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

.eyebrow {
    margin: 0 0 5px;
    color: var(--primary);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;
    font-size: clamp(1.7rem, 3vw, 2.25rem);
    line-height: 1.13;
    letter-spacing: -.045em;
}

h2 {
    margin-bottom: 4px;
    font-size: 1.15rem;
    letter-spacing: -.025em;
}

h3 {
    font-size: 1rem;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(310px, .8fr);
    gap: 22px;
}

.stack {
    display: grid;
    align-content: start;
    gap: 22px;
}

.card {
    border: 1px solid rgba(226, 228, 237, .9);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card-pad {
    padding: 23px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 19px;
}

.section-heading h2,
.section-heading h3 {
    margin-bottom: 2px;
}

.section-heading p {
    font-size: .86rem;
}

.attendance-card {
    position: relative;
    overflow: hidden;
    padding: 27px;
    border: 0;
    background: linear-gradient(135deg, #20203a 0%, #2c245c 58%, #5831c9 100%);
    color: #fff;
    box-shadow: 0 18px 45px rgba(53, 37, 122, .22);
}

.attendance-card::after {
    position: absolute;
    top: -70px;
    right: -48px;
    width: 210px;
    height: 210px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 50%;
    box-shadow: 0 0 0 32px rgba(255, 255, 255, .035), 0 0 0 64px rgba(255, 255, 255, .025);
    content: '';
}

.attendance-label {
    position: relative;
    z-index: 1;
    color: #c9c2ec;
    font-size: .81rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.live-clock {
    position: relative;
    z-index: 1;
    margin: 9px 0 22px;
    font-size: clamp(2.3rem, 6vw, 4.25rem);
    font-weight: 800;
    letter-spacing: -.065em;
    line-height: 1;
}

.attendance-times {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 19px;
}

.time-box {
    padding: 13px 15px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 14px;
    background: rgba(255, 255, 255, .075);
}

.time-box span,
.time-box strong {
    display: block;
}

.time-box span {
    margin-bottom: 3px;
    color: #bcb6d6;
    font-size: .75rem;
}

.time-box strong {
    font-size: 1rem;
}

.attendance-action {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 13px;
}

.attendance-action .button {
    min-width: 145px;
}

.attendance-action small {
    color: #c8c3dc;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-size: .9rem;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.button:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 20px rgba(91, 54, 217, .21);
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button-light {
    background: #fff;
    color: #3d278e;
}

.button-light:hover {
    background: #f2efff;
}

.button-outline {
    border-color: var(--line);
    background: white;
    color: var(--ink);
}

.button-outline:hover {
    border-color: #cfc6f6;
    background: #f8f6ff;
    color: var(--primary-dark);
}

.button-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.button-danger:hover {
    background: #f8dfe2;
    box-shadow: none;
}

.button-success {
    background: var(--success);
}

.button-sm {
    min-height: 35px;
    padding: 7px 11px;
    border-radius: 9px;
    font-size: .78rem;
}

.button-block {
    width: 100%;
}

.button[disabled],
.button.disabled {
    opacity: .55;
    pointer-events: none;
}

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

.stat-card {
    padding: 20px;
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 19px;
}

.stat-icon {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
}

.stat-icon.green {
    background: var(--success-soft);
    color: var(--success);
}

.stat-icon.orange {
    background: var(--warning-soft);
    color: var(--warning);
}

.stat-icon.red {
    background: var(--danger-soft);
    color: var(--danger);
}

.stat-card strong {
    display: block;
    margin-bottom: 2px;
    font-size: 1.7rem;
    letter-spacing: -.04em;
}

.stat-card > span {
    color: var(--muted);
    font-size: .84rem;
    font-weight: 600;
}

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

.field {
    min-width: 0;
}

.field-full {
    grid-column: 1 / -1;
}

.field label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    color: #41485b;
    font-size: .84rem;
    font-weight: 700;
}

.field label small {
    color: var(--muted);
    font-weight: 500;
}

.input,
.select,
.textarea {
    width: 100%;
    border: 1px solid #dfe2eb;
    border-radius: 12px;
    outline: 0;
    background: #fff;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input,
.select {
    min-height: 46px;
    padding: 10px 13px;
}

.textarea {
    min-height: 102px;
    resize: vertical;
    padding: 12px 13px;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: #856ee1;
    box-shadow: 0 0 0 4px rgba(91, 54, 217, .1);
}

.input::placeholder,
.textarea::placeholder {
    color: #a1a6b3;
}

.range-wrap {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 14px;
    padding: 0 3px;
}

.range {
    width: 100%;
    accent-color: var(--primary);
}

.range-value {
    min-width: 49px;
    padding: 6px 8px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: .8rem;
    font-weight: 800;
    text-align: center;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 19px;
}

.task-list {
    display: grid;
    gap: 11px;
}

.task-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 15px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.task-item h3 {
    margin-bottom: 3px;
}

.task-item p {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: .87rem;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.progress-track {
    width: min(210px, 100%);
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e9eaf1;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7657ec, #5734d1);
}

.progress-number {
    color: var(--muted);
    font-size: .77rem;
    font-weight: 800;
}

.task-actions {
    display: flex;
    align-items: start;
    gap: 6px;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: .8rem;
    font-weight: 750;
    cursor: pointer;
}

.link-button.danger {
    color: var(--danger);
}

.badge {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #f0f1f5;
    color: #616879;
    font-size: .73rem;
    font-weight: 750;
    white-space: nowrap;
}

.badge::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: '';
}

.badge-active,
.badge-completed,
.badge-present {
    background: var(--success-soft);
    color: var(--success);
}

.badge-pending,
.badge-in_progress,
.badge-working {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-suspended,
.badge-absent {
    background: var(--danger-soft);
    color: var(--danger);
}

.table-card {
    overflow: hidden;
}

.table-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.table-header h2 {
    margin-bottom: 3px;
}

.table-header p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .85rem;
}

.table-scroll {
    overflow-x: auto;
}

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

th,
td {
    padding: 14px 17px;
    border-bottom: 1px solid #eceef3;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #fafafd;
    color: #747b8e;
    font-size: .73rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    color: #333a4c;
    font-size: .86rem;
}

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

tbody tr:hover td {
    background: #fcfbff;
}

.person-cell {
    display: flex;
    min-width: 180px;
    align-items: center;
    gap: 10px;
}

.person-cell .avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    font-size: .8rem;
}

.person-cell strong,
.person-cell span {
    display: block;
}

.person-cell span {
    color: var(--muted);
    font-size: .76rem;
}

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

.filter-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(145px, 1fr)) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 20px;
    padding: 17px;
}

.filter-bar .field label {
    font-size: .75rem;
}

.filter-bar .input,
.filter-bar .select {
    min-height: 42px;
}

.empty-state {
    padding: 38px 22px;
    color: var(--muted);
    text-align: center;
}

.empty-icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    place-items: center;
    border-radius: 15px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.4rem;
}

.empty-state h3 {
    margin-bottom: 4px;
    color: var(--ink);
}

.empty-state p {
    max-width: 380px;
    margin: 0 auto;
    font-size: .87rem;
}

.flash-stack {
    position: fixed;
    z-index: 100;
    top: 18px;
    right: 18px;
    display: grid;
    width: min(390px, calc(100vw - 36px));
    gap: 8px;
}

.flash {
    display: grid;
    grid-template-columns: 29px minmax(0, 1fr) 25px;
    align-items: center;
    gap: 9px;
    padding: 12px 13px;
    border: 1px solid #dadde8;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 13px 36px rgba(26, 25, 49, .15);
}

.flash > span {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    font-weight: 900;
}

.flash-error > span {
    background: var(--danger-soft);
    color: var(--danger);
}

.flash p {
    margin: 0;
    font-size: .85rem;
}

.flash button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.auth-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px 18px;
    background:
        radial-gradient(circle at 8% 10%, rgba(110, 75, 232, .2), transparent 31%),
        radial-gradient(circle at 95% 90%, rgba(59, 186, 150, .13), transparent 29%),
        #f4f4fa;
}

.auth-shell {
    width: min(470px, 100%);
}

.brand-auth {
    justify-content: center;
    width: 100%;
    margin-bottom: 21px;
    color: var(--ink);
}

.auth-card {
    padding: 29px;
    border: 1px solid rgba(221, 222, 234, .9);
    border-radius: 23px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 22px 65px rgba(39, 34, 74, .12);
}

.auth-card h1 {
    margin-bottom: 8px;
    text-align: center;
}

.auth-lead {
    margin-bottom: 24px;
    color: var(--muted);
    font-size: .91rem;
    text-align: center;
}

.auth-form {
    display: grid;
    gap: 15px;
}

.password-wrap {
    position: relative;
}

.password-wrap .input {
    padding-right: 62px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: .76rem;
    font-weight: 750;
    transform: translateY(-50%);
    cursor: pointer;
}

.auth-foot {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: .86rem;
    text-align: center;
}

.auth-foot a {
    color: var(--primary);
    font-weight: 750;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #eadfab;
    border-radius: 12px;
    background: #fff9e8;
    color: #785608;
    font-size: .84rem;
}

.error-list {
    margin: 0 0 18px;
    padding: 12px 14px 12px 34px;
    border: 1px solid #f0cdd2;
    border-radius: 12px;
    background: var(--danger-soft);
    color: #992f3b;
    font-size: .84rem;
}

.summary-list {
    display: grid;
    gap: 11px;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--line);
}

.summary-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.summary-row span {
    color: var(--muted);
    font-size: .84rem;
}

.summary-row strong {
    font-size: .9rem;
}

.mobile-overlay {
    display: none;
}

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        grid-template-columns: repeat(2, minmax(145px, 1fr));
    }
}

@media (max-width: 820px) {
    .sidebar {
        width: min(290px, 86vw);
        transform: translateX(-105%);
        transition: transform .25s ease;
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close,
    .menu-button {
        display: block;
    }

    .mobile-overlay {
        position: fixed;
        z-index: 35;
        inset: 0;
        background: rgba(14, 13, 28, .48);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    body.menu-open .mobile-overlay {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .app-main {
        margin-left: 0;
    }

    .topbar {
        justify-content: flex-start;
        gap: 15px;
        padding: 0 20px;
    }

    .topbar-role {
        margin-left: auto;
    }

    .content {
        padding: 25px 20px;
    }

    .footer {
        padding-inline: 20px;
    }
}

@media (max-width: 620px) {
    .content {
        padding: 21px 14px;
    }

    .topbar {
        min-height: 64px;
        padding-inline: 14px;
    }

    .topbar-date {
        font-size: .78rem;
    }

    .topbar-role {
        padding: 6px 8px;
        font-size: .7rem;
    }

    .page-heading {
        display: block;
        margin-bottom: 20px;
    }

    .page-heading .button {
        width: 100%;
        margin-top: 14px;
    }

    .stats-grid,
    .form-grid,
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        gap: 11px;
    }

    .stat-card {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr);
        align-items: center;
        gap: 13px;
        padding: 15px;
    }

    .stat-top {
        margin: 0;
    }

    .stat-top > span:not(.stat-icon) {
        display: none;
    }

    .stat-card strong {
        font-size: 1.42rem;
    }

    .stat-card > span {
        grid-column: 2;
        margin-top: -17px;
    }

    .card-pad,
    .attendance-card,
    .auth-card {
        padding: 19px;
    }

    .attendance-times {
        margin-bottom: 15px;
    }

    .attendance-action {
        display: block;
    }

    .attendance-action .button {
        width: 100%;
    }

    .attendance-action small {
        display: block;
        margin-top: 9px;
        text-align: center;
    }

    .task-item {
        grid-template-columns: 1fr;
    }

    .task-actions {
        justify-content: flex-end;
    }

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

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

    .auth-body {
        align-items: start;
        padding-top: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

