:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --panel-2: #f9fafb;

    --text: #1f2937;
    --text-hover: #f5f7fa;
    --muted: #6b7280;

    --border: #e5e7eb;

    --link: #1f2937;
    --link-hover: #111827;

    --hover-bg: #f3f4f6;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.no-scroll {
    overflow: hidden;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.brand a {
    font-weight: 600;
    letter-spacing: .2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    color: var(--muted);
    font-size: 14px;
}

.btn-link, .icon-btn {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
}

.btn-link:hover, .icon-btn:hover {
    background: var(--hover-bg);
    text-decoration: none;
    color: var(--text-hover);
}

.mobile-only {
    display: none;
}

.content {
    flex: 1;
    display: flex;
    min-height: 0;
}

.sidebar {
    width: 260px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 14px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav-link {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: var(--text);
    font-size: 14px;
}

.nav-link:hover {
    background: var(--hover-bg);
    border-color: var(--border);
    text-decoration: none;
}

.nav-sep {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.main {
    flex: 1;
    padding: 20px;
    min-width: 0;
}

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 40;
}

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

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

.row {
    display: grid;
    gap: 8px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.card.fullwidth {
    width: 100%;
}

.page-center {
    min-height: calc(100vh - 56px);
    display: grid;
    place-items: center;
    padding: 24px;
}

.card-title {
    margin: 0 0 6px 0;
    font-size: 18px;
    font-weight: 650;
}

.card-subtitle {
    margin: 0 0 14px 0;
    color: var(--muted);
    font-size: 14px;
}

form {
    margin: 0;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input::placeholder, textarea::placeholder {
    color: #9ca3af;
}

input:focus, select:focus, textarea:focus {
    border-color: #93c5fd; /* light blue */
    box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.35);
}

input:disabled, select:disabled, textarea:disabled {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

input[readonly], textarea[readonly] {
    background: #f9fafb;
}

input[type="checkbox"], input[type="radio"] {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.form-help, .help-text, small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

ul, ol {
    padding-left: 18px;
}

li {
    margin: 4px 0;
}

.form-error, .form-errors, ul[role="alert"], ul.form-errors, ul li {
    font-size: 13px;
}

.form-error, .form-errors, ul[role="alert"] {
    color: #b42318;
}

.alert {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
}

.alert-danger {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--hover-bg);
    text-decoration: none;
    color: var(--text);
}

.btn-primary {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.btn-primary:hover {
    background: var(--hover-bg);
    border-color: var(--text);
    color: var(--text);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

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

.nav-link.is-active {
    background: #e5e7eb;
    border-color: var(--border);
    font-weight: 600;
}

.nav-link.is-active:hover {
    background: #e5e7eb;
}

/* =========================
   Time Tracking Overview
   ========================= */

.tt-page {
    max-width: 1100px;
}

.tt-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.tt-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.tt-subtitle {
    margin: 6px 0 0 0;
    color: var(--muted);
    font-size: 14px;
}

.tt-year-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tt-empty {
    margin: 0;
    color: var(--muted);
}

.tt-months {
}

.tt-month summary {
    list-style: none;
    cursor: pointer;
}

.tt-month summary::-webkit-details-marker {
    display: none;
}

.tt-month-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.tt-month-left {
    display: grid;
    gap: 4px;
}

.tt-month-title {
    font-size: 16px;
    font-weight: 700;
}

.tt-month-meta {
    font-size: 12px;
    color: var(--muted);
}

.tt-month-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tt-kpi {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-2);
    min-width: 96px;
    text-align: right;
}

.tt-kpi-label {
    font-size: 12px;
    color: var(--muted);
}

.tt-kpi-value {
    font-size: 14px;
    font-weight: 700;
}

.tt-month[open] .tt-month-summary {
    margin-bottom: 12px;
}

.tt-month-body {
    margin-top: 12px;
}

.tt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tt-table th,
.tt-table td {
    padding: 10px 10px;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

.tt-table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-weight: 700;
    color: var(--text);
}

.tt-right {
    text-align: right;
}

.tt-day-date {
    font-weight: 600;
}

.tt-day-weekday {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.tt-delta-pos {
    color: #166534;
}

.tt-delta-neg {
    color: #991b1b;
}

.tt-delta-zero {
    color: var(--muted);
}

.tt-empty-month {
    padding: 10px 2px;
    color: var(--muted);
    font-size: 14px;
}

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

.tt-actions-right {
    justify-content: flex-end;
}

.tt-row-actions {
    display: inline-flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.tt-inline-form {
    display: inline;
}

.btn-danger {
    border-color: #fecaca;
    color: #991b1b;
    background: #fff1f2;
}

.btn-danger:hover {
    background: #ffe4e6;
    text-decoration: none;
}

.tt-day--workday {
    background: transparent;
}

.tt-day--offday {
    background: #f8fafc;
}

.tt-day--empty td {
    color: var(--muted);
}

.tt-table tbody tr.tt-day:hover {
    background: var(--hover-bg);
}

.tt-day--offday:hover {
    background: #eef2f7;
}

.tt-row-not-applicable {
    background: var(--text-hover);
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

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

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

.card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fff;
}

.muted {
    color: #6b7280;
}

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

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

.table__right {
    text-align: right;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #111827;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    filter: brightness(1.05);
}

.btn--ghost {
    background: transparent;
    color: #111827;
}

.btn--danger {
    background: #b91c1c;
    border-color: #991b1b;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid #ddd;
}

.badge--pending {
    background: #fff7ed;
    border-color: #fdba74;
}

.badge--approved {
    background: #ecfdf5;
    border-color: #34d399;
}

.badge--rejected {
    background: #fef2f2;
    border-color: #fca5a5;
}

.badge--cancelled {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.hint {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
    max-width: 360px;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

input, select, textarea {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
}

.inline-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.input--small {
    width: 220px;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.check input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

code {
    padding: 2px 6px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
}

@media (max-width: 800px) {
    .tt-kpi {
        min-width: 84px;
    }

    .tt-table th:nth-child(2),
    .tt-table td:nth-child(2),
    .tt-table th:nth-child(3),
    .tt-table td:nth-child(3) {
        display: none;
    }
}

@media (max-width: 900px) {
    .mobile-only {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        height: calc(100vh - 56px);
        transform: translateX(-105%);
        transition: transform 180ms ease;
        z-index: 50;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    }

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