:root {
    --bg: #f4f2ed;
    --panel: #ffffff;
    --ink: #1d2523;
    --muted: #64706c;
    --line: #d9ded8;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --accent: #c2410c;
    --danger: #b91c1c;
    --good: #15803d;
    --shadow: 0 18px 55px rgba(21, 32, 29, 0.12);
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
}

input,
select,
button {
    font: inherit;
}

.shell,
.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.home {
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 46%),
        linear-gradient(315deg, rgba(194, 65, 12, 0.12), transparent 36%),
        var(--bg);
}

.hero {
    min-height: 42vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 48px 0 28px;
}

.hero h1,
.toolbar h1,
.auth-panel h1 {
    margin: 0;
    line-height: 1.03;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 7rem);
}

.lead {
    max-width: 560px;
    color: var(--muted);
    font-size: 1.2rem;
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0;
    color: var(--brand-dark);
    font-weight: 800;
}

.button,
.icon-button {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    min-height: 42px;
    border-radius: 8px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    font-weight: 750;
}

.button.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: white;
}

.link-grid,
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.tool-card,
.summary-card,
.panel {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tool-card {
    min-height: 158px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
}

.tool-card small,
.summary-card small,
.toolbar p,
.auth-panel p {
    color: var(--muted);
}

.tool-card.muted {
    box-shadow: none;
    opacity: 0.72;
}

.tool-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #d9f3ef;
    color: var(--brand-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

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

.auth-panel {
    width: min(420px, 100%);
    padding: 28px;
}

.stack,
.auth-panel {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--ink);
    padding: 8px 10px;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 700;
}

.alert.error {
    background: #fee2e2;
    color: #7f1d1d;
}

.alert.success {
    background: #dcfce7;
    color: #14532d;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(244, 242, 237, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    min-height: 64px;
    padding: 0 max(16px, calc((100vw - 1180px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    font-weight: 900;
    text-decoration: none;
}

.topbar nav {
    display: flex;
    gap: 16px;
    align-items: center;
    color: var(--muted);
}

.app-shell {
    padding: 28px 0 48px;
    display: grid;
    gap: 18px;
}

.toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.toolbar h1 {
    font-size: clamp(2rem, 5vw, 4rem);
}

.period-form {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) 95px auto;
    gap: 8px;
    align-items: center;
}

.summary-card {
    padding: 18px;
    box-shadow: none;
}

.summary-card strong {
    display: block;
    margin-top: 6px;
    font-size: 1.8rem;
}

.positive {
    color: var(--good);
}

.negative {
    color: var(--danger);
}

.month-tabs {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 6px;
}

.month-tabs a {
    min-height: 38px;
    border: 1px solid var(--line);
    background: white;
    border-radius: 8px;
    display: grid;
    place-items: center;
    text-decoration: none;
    font-weight: 800;
    color: var(--muted);
}

.month-tabs a.active {
    color: white;
    border-color: var(--brand);
    background: var(--brand);
}

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

.attendance-table {
    width: 100%;
    min-width: 960px;
    border-collapse: collapse;
}

.attendance-table th,
.attendance-table td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: middle;
}

.attendance-table th {
    font-size: 0.8rem;
    color: var(--muted);
    background: #f9faf8;
}

.attendance-table tr.today {
    background: #ecfdf5;
}

.attendance-table tr.weekend {
    color: #777;
    background: #fafafa;
}

.attendance-table td:first-child {
    width: 76px;
}

.attendance-table td:first-child strong,
.attendance-table td:first-child small {
    display: block;
}

.attendance-table td:first-child small {
    color: var(--muted);
}

.attendance-table input,
.attendance-table select {
    min-width: 86px;
}

.attendance-table input[name="note"] {
    min-width: 180px;
}

.hours {
    font-weight: 900;
}

.row-actions {
    display: flex;
    gap: 6px;
    min-width: 150px;
}

.icon-button {
    width: 42px;
    padding: 0;
    font-size: 0.82rem;
}

.icon-button.quiet {
    color: var(--brand-dark);
}

.icon-button.danger {
    border-color: #fecaca;
    color: var(--danger);
}

@media (max-width: 760px) {
    .hero,
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .period-form {
        grid-template-columns: 1fr 90px;
    }

    .period-form .button {
        grid-column: 1 / -1;
    }

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

    .table-wrap {
        overflow: visible;
        background: transparent;
        border: 0;
    }

    .attendance-table,
    .attendance-table tbody,
    .attendance-table tr,
    .attendance-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .attendance-table thead {
        display: none;
    }

    .attendance-table tr {
        margin-bottom: 12px;
        background: white;
        border: 1px solid var(--line);
        border-radius: 8px;
        overflow: hidden;
    }

    .attendance-table td {
        display: grid;
        grid-template-columns: 90px 1fr;
        gap: 10px;
        align-items: center;
    }

    .attendance-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 800;
    }

    .attendance-table .row-actions {
        grid-template-columns: 1fr;
        display: flex;
        justify-content: flex-end;
    }

    .attendance-table .row-actions::before {
        content: '';
    }

    .topbar {
        padding: 0 16px;
    }
}
