:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-muted: #eef2f6;
    --text: #1f2933;
    --muted: #667085;
    --line: #d9e0e8;
    --primary: #146c72;
    --primary-dark: #0e4f54;
    --danger: #b42318;
    --success: #087443;
    --warning: #9a6700;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

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

.topbar {
    align-items: center;
    background: #17212b;
    color: #fff;
    display: flex;
    gap: 24px;
    min-height: 64px;
    padding: 0 28px;
}

.brand {
    align-items: center;
    background: var(--primary);
    border-radius: 6px;
    display: inline-flex;
    font-weight: 800;
    gap: 0;
    min-height: 36px;
    justify-content: center;
    letter-spacing: 0;
    padding: 0 12px;
    width: auto;
}

.brand span {
    color: #c8f7d7;
}

.brand em {
    background: rgba(255, 255, 255, .16);
    border-radius: 4px;
    font-size: 11px;
    font-style: normal;
    margin-left: 8px;
    padding: 2px 5px;
}

.topbar nav {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 6px;
}

.topbar nav a,
.account a {
    border-radius: 6px;
    color: #dbe4ed;
    padding: 8px 10px;
}

.topbar nav a:hover,
.account a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.account {
    align-items: center;
    display: flex;
    gap: 12px;
    white-space: nowrap;
}

.account-name {
    font-weight: 750;
}

.avatar {
    align-items: center;
    aspect-ratio: 1;
    background: #d8ecef;
    border: 1px solid #b7d2d7;
    border-radius: 50%;
    color: var(--primary-dark);
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 850;
    justify-content: center;
    object-fit: cover;
    overflow: hidden;
    text-transform: uppercase;
}

.avatar--sm {
    font-size: 12px;
    height: 34px;
    width: 34px;
}

.avatar--md {
    font-size: 14px;
    height: 44px;
    width: 44px;
}

.avatar--lg {
    font-size: 22px;
    height: 72px;
    width: 72px;
}

.avatar--xl {
    font-size: 32px;
    height: 112px;
    width: 112px;
}

.page {
    margin: 0 auto;
    max-width: 1220px;
    padding: 28px;
}

.auth-page {
    align-items: center;
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
    min-height: 100vh;
    padding: 24px;
}

.auth-hero {
    max-width: 620px;
}

.auth-hero h1 {
    font-size: 54px;
    margin-bottom: 14px;
}

.auth-hero p {
    color: var(--muted);
    font-size: 18px;
    max-width: 520px;
}

.auth-kicker {
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .2em;
    margin-bottom: 16px;
}

.auth-kicker span {
    color: var(--primary);
}

.auth-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.auth-stats span {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    padding: 10px 12px;
}

.auth-stats strong {
    color: var(--primary);
    margin-right: 8px;
}

.auth-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    max-width: 420px;
    padding: 28px;
    width: 100%;
}

.auth-box-head {
    margin-bottom: 18px;
}

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

h1,
h2,
h3 {
    line-height: 1.2;
    margin: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 20px;
    margin-bottom: 14px;
}

h3 {
    font-size: 16px;
}

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

.panel-label {
    color: var(--primary);
    display: inline-flex;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .12em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.workspace-tabs {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    overflow-x: auto;
    padding: 6px;
}

.workspace-tabs a,
.workspace-tabs button {
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    min-height: auto;
    padding: 9px 13px;
    white-space: nowrap;
}

.workspace-tabs a:hover,
.workspace-tabs a.active,
.workspace-tabs button:hover,
.workspace-tabs button.active {
    background: var(--surface-muted);
    border: 0;
    color: var(--text);
}

.tab-panel[hidden] {
    display: none !important;
}

.tab-panel {
    display: block;
}

.grid {
    display: grid;
    gap: 16px;
}

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

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

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

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.section-head {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.compact-title {
    align-items: start;
    margin-bottom: 10px;
}

.compact-title p {
    margin: 4px 0 0;
}

.profile-greeting {
    align-items: center;
    display: flex;
    gap: 16px;
    min-width: 0;
}

.profile-greeting h1 a:hover {
    color: var(--primary);
}

.profile-greeting .muted {
    margin: 5px 0 0;
}

.dashboard-greeting {
    align-items: center;
}

.profile-layout {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(240px, 320px) minmax(0, 760px);
}

.profile-summary {
    display: grid;
    gap: 12px;
    justify-items: start;
}

.profile-summary h2,
.profile-summary p {
    margin: 0;
}

.profile-form {
    max-width: none;
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

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

.name-cell strong,
.name-cell .muted {
    display: block;
}

.name-cell .muted {
    font-size: 13px;
}

.hidden-field {
    display: none;
}

.overview-metrics .card {
    min-height: 170px;
}

.metric {
    font-size: 30px;
    font-weight: 800;
    margin-top: 8px;
}

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

.table-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 280px;
}

.table-actions form {
    margin: 0;
}

.button,
button {
    align-items: center;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    gap: 6px;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
}

.button:hover,
button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.workspace-tabs button,
.workspace-tabs button:hover {
    background: transparent;
    border: 0;
    color: var(--muted);
    min-height: auto;
}

.workspace-tabs button.active,
.workspace-tabs button.active:hover,
.workspace-tabs button:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.button-secondary,
button.secondary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}

.button-secondary:hover,
button.secondary:hover {
    background: var(--surface-muted);
    border-color: var(--line);
    color: var(--text);
}

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

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

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

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

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

th {
    background: #f0f4f8;
    color: #344054;
    font-size: 13px;
    font-weight: 800;
}

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

.badge {
    background: var(--surface-muted);
    border-radius: 999px;
    color: #344054;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 8px;
}

.badge-success {
    background: #dcfae6;
    color: var(--success);
}

.badge-warning {
    background: #fff4d6;
    color: var(--warning);
}

.badge-danger {
    background: #fee4e2;
    color: var(--danger);
}

.flash {
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.flash-success {
    background: #dcfae6;
    color: var(--success);
}

.flash-error,
.flash-danger {
    background: #fee4e2;
    color: var(--danger);
}

.form-shell {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    max-width: 760px;
    padding: 20px;
}

form > div {
    margin-bottom: 14px;
}

label {
    display: block;
    font-weight: 800;
    margin-bottom: 6px;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
    width: 100%;
}

input[type="checkbox"] {
    min-height: auto;
    width: auto;
}

form ul {
    color: var(--danger);
    margin: 4px 0 0;
    padding-left: 18px;
}

.checkbox-list,
#project_form_employees {
    display: grid;
    gap: 8px;
}

#project_form_employees > div {
    align-items: center;
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

#project_form_employees input[type="checkbox"] {
    flex: 0 0 auto;
    height: 18px;
    margin: 0;
    width: 18px;
}

#project_form_employees label {
    display: inline-flex;
    font-weight: 700;
    margin: 0;
}

.stack {
    display: grid;
    gap: 16px;
}

.split {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) 340px;
}

.timer {
    font-variant-numeric: tabular-nums;
    font-size: 34px;
    font-weight: 850;
}

.project-list {
    align-items: start;
}

.project-card {
    min-height: 190px;
}

.detail-list {
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 14px 0 0;
    padding: 12px;
}

.detail-list div {
    min-width: 0;
}

.detail-list dt,
.detail-list dd {
    margin: 0;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.detail-list dd {
    font-weight: 850;
}

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

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

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

.request-item {
    align-items: center;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px;
}

.request-item p {
    margin: 3px 0 0;
}

.attendance-history {
    margin-top: 16px;
}

.timeline-card {
    overflow: hidden;
}

.timeline-head {
    align-items: start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.week-range {
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    padding: 7px 10px;
    white-space: nowrap;
}

.timeline-legend {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.timeline-legend span {
    align-items: center;
    color: var(--muted);
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    gap: 6px;
}

.attendance-timeline-table {
    min-width: 1120px;
}

.attendance-timeline-table th:nth-child(2),
.attendance-timeline-table td:nth-child(2) {
    min-width: 430px;
    width: 48%;
}

.daily-timeline {
    min-width: 400px;
}

.daily-timeline-scale {
    color: var(--muted);
    display: flex;
    font-size: 11px;
    font-weight: 800;
    justify-content: space-between;
    margin-bottom: 8px;
}

.daily-timeline-line {
    background: var(--line);
    border-radius: 999px;
    height: 4px;
    margin: 0 8px 12px;
    position: relative;
}

.timeline-dot {
    border: 2px solid var(--surface);
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
    height: 12px;
    width: 12px;
}

.daily-timeline-line .timeline-dot {
    box-shadow: 0 0 0 1px rgba(31, 41, 51, .18);
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
}

.event-check-in {
    background: var(--success);
}

.event-break-start {
    background: var(--warning);
}

.event-break-end {
    background: var(--primary);
}

.event-check-out {
    background: var(--danger);
}

.timeline-events {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.timeline-events span {
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    white-space: nowrap;
}

.timeline-events strong {
    color: var(--text);
}

.no-timeline-events {
    margin: 0;
}

.week-timeline {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(7, minmax(132px, 1fr));
    overflow-x: auto;
    padding: 6px 0 2px;
    position: relative;
}

.week-timeline::before {
    background: var(--line);
    content: "";
    height: 2px;
    left: 66px;
    position: absolute;
    right: 66px;
    top: 21px;
}

.timeline-day {
    min-width: 132px;
    padding: 34px 8px 4px;
    position: relative;
}

.day-dot {
    background: #cbd5e1;
    border: 4px solid var(--surface);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--line);
    height: 14px;
    left: 50%;
    position: absolute;
    top: 8px;
    transform: translateX(-50%);
    width: 14px;
    z-index: 1;
}

.timeline-day.is-today .day-dot,
.timeline-day.is-active .day-dot {
    background: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 0 0 5px rgba(20, 108, 114, .12);
}

.day-label {
    align-items: center;
    display: flex;
    gap: 6px;
    justify-content: center;
}

.day-label span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.day-label strong {
    align-items: center;
    background: transparent;
    border-radius: 6px;
    display: inline-flex;
    font-size: 15px;
    height: 25px;
    justify-content: center;
    min-width: 25px;
}

.timeline-day.is-today .day-label strong {
    background: var(--primary);
    color: #fff;
}

.day-status {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 850;
    margin-top: 5px;
    text-align: center;
}

.timeline-day.is-weekend .day-status {
    color: var(--warning);
}

.timeline-day.is-active .day-status {
    color: var(--success);
}

.day-time {
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    font-weight: 850;
    margin-top: 10px;
    text-align: center;
}

.day-meta {
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding: 9px;
}

.day-meta div {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.day-meta dt,
.day-meta dd {
    margin: 0;
}

.day-meta dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.day-meta dd {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.empty {
    color: var(--muted);
    padding: 18px;
}

@media (max-width: 820px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        padding: 14px 18px;
    }

    .account {
        justify-content: space-between;
    }

    .page {
        padding: 18px;
    }

    .page-title {
        display: grid;
    }

    .timeline-head {
        display: grid;
    }

    .dashboard-greeting {
        align-items: start;
    }

    .profile-greeting {
        align-items: start;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .form-grid,
    .leave-grid,
    .profile-layout,
    .split {
        grid-template-columns: 1fr;
    }

    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-hero h1 {
        font-size: 38px;
    }
}
