:root {
    color-scheme: light;
    --bg: #edf3ee;
    --bg-accent: #d9ead8;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --ink: #16342d;
    --muted: #62746d;
    --line: rgba(22, 52, 45, 0.12);
    --brand: #0e7a5f;
    --brand-2: #ff7b54;
    --danger: #b64242;
    --success: #2e8b57;
    --vacation: #d8f2c8;
    --sick: #ffe0d2;
    --holiday: #d6e7ff;
    --neutral: #ece8dc;
    --shadow: 0 28px 70px rgba(17, 43, 37, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 26%),
        linear-gradient(180deg, var(--bg-accent), var(--bg));
    color: var(--ink);
    font-family: "Avenir Next", "Segoe UI", sans-serif;
}

a {
    color: inherit;
}

.alerts {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 16px 20px 0;
}

.alert {
    max-width: 1240px;
    margin: 0 auto 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.alert.error {
    border-color: rgba(182, 66, 66, 0.35);
    color: var(--danger);
}

.alert.success {
    border-color: rgba(46, 139, 87, 0.35);
    color: var(--success);
}

.shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 26px 18px 56px;
}

.hero {
    display: grid;
    grid-template-columns: 1.4fr .9fr;
    gap: 20px;
    margin-bottom: 18px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

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

h1,
h2 {
    margin: 0;
    font-family: "Iowan Old Style", "Palatino Linotype", serif;
    letter-spacing: -.03em;
}

h1 {
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    line-height: .94;
}

h2 {
    font-size: 1.3rem;
}

.lede {
    max-width: 44rem;
    margin: 18px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.hero-actions {
    display: grid;
    gap: 12px;
    align-content: start;
}

.hero-pill,
.stat-card,
.panel,
.calendar-panel,
.toolbar,
.login-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.hero-pill {
    padding: 18px 20px;
}

.hero-pill span,
.stat-card span,
.help-text,
.empty-day,
.credentials-note,
.company-badge,
.week-marker span,
.day-name-mobile {
    color: var(--muted);
}

.hero-pill strong,
.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.2rem;
}

.ghost-button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

.ghost-button {
    background: rgba(14, 122, 95, 0.12);
    color: var(--brand);
}

button {
    background: linear-gradient(135deg, var(--brand), #159d79);
    color: #fff;
}

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

.stat-card {
    padding: 22px;
}

.stat-card strong {
    font-size: 2rem;
    font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

.toolbar {
    position: relative;
    z-index: 35;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 16px 18px;
    align-items: center;
    overflow: visible;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.month-picker {
    position: relative;
    z-index: 36;
}

.month-picker[open] {
    z-index: 38;
}

.month-picker summary {
    display: grid;
    gap: 4px;
    min-width: 220px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-strong);
    cursor: pointer;
    list-style: none;
}

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

.month-nav strong {
    font-size: 1.6rem;
    font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

.month-picker-form {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 39;
    width: 260px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.month-progress-card {
    flex: 1;
    display: grid;
    gap: 10px;
    min-width: 240px;
}

.month-progress-copy {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.month-progress-copy span {
    color: var(--muted);
}

.month-progress-copy strong {
    font-size: 1rem;
}

.month-progress-bar {
    height: 12px;
    border-radius: 999px;
    background: rgba(14, 122, 95, 0.12);
    overflow: hidden;
}

.month-progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--brand), #159d79);
}

.nav-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    text-decoration: none;
    background: var(--surface-strong);
    border: 1px solid var(--line);
}

.inline-form,
.stack-form {
    display: grid;
    gap: 10px;
}

.inline-form {
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, auto);
    align-items: center;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-strong);
    color: var(--ink);
    font: inherit;
}

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

.checkbox {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: .95rem;
}

.checkbox input {
    width: auto;
    min-height: 0;
}

.subscription-panel,
.subscription-actions {
    display: grid;
    gap: 10px;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, .95fr);
    gap: 18px;
}

.calendar-panel {
    padding: 14px;
    overflow: visible;
}

.calendar-head,
.calendar-week-row {
    display: grid;
    grid-template-columns: 84px repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.calendar-head {
    margin-bottom: 10px;
}

.calendar-head div {
    padding: 10px 8px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.calendar-body {
    display: grid;
    gap: 10px;
    overflow: visible;
}

.calendar-week-row {
    position: relative;
    overflow: visible;
}

.week-marker {
    display: grid;
    align-content: start;
    gap: 6px;
    padding: 16px 10px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(14, 122, 95, 0.08);
    text-align: center;
}

.week-marker strong {
    font-size: 1.7rem;
    font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

.day-card {
    position: relative;
    min-height: 150px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
    overflow: visible;
    z-index: 1;
}

.day-card.muted {
    opacity: .52;
}

.day-card:hover,
.day-card:focus-within {
    z-index: 12;
}

.day-card.today {
    border-color: rgba(14, 122, 95, 0.55);
    box-shadow: inset 0 0 0 1px rgba(14, 122, 95, 0.22);
}

.day-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.today-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(14, 122, 95, 0.14);
    color: var(--brand);
    font-size: .78rem;
    font-weight: 700;
}

.day-name-mobile {
    display: none;
    margin-bottom: 4px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.day-number {
    display: block;
    font-family: "Iowan Old Style", "Palatino Linotype", serif;
    font-size: 1.5rem;
}

.day-events {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: visible;
}

.event-chip {
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    font-size: .9rem;
}

.event-button {
    position: relative;
    width: 100%;
    min-height: 0;
    padding: 9px 10px;
    justify-content: start;
    align-items: start;
    text-align: left;
    background: transparent;
    color: inherit;
    overflow: visible;
    z-index: 1;
}

.event-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(30, 39, 46, 0.10);
    z-index: 30;
}

.event-button::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 12px;
    top: calc(100% + 8px);
    z-index: 31;
    width: min(260px, 70vw);
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(25, 35, 42, 0.96);
    color: #fff;
    font-size: .82rem;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity .16s ease, transform .16s ease;
}

.event-button:hover::after,
.event-button:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.event-button.tone-vacation {
    background: var(--vacation);
}

.event-button.tone-sick {
    background: var(--sick);
}

.event-button.tone-holiday {
    background: var(--holiday);
}

.event-button.tone-neutral {
    background: var(--neutral);
}

.event-chip strong {
    font-size: .92rem;
}

.tone-vacation {
    background: var(--vacation);
}

.tone-sick {
    background: var(--sick);
}

.tone-holiday {
    background: var(--holiday);
}

.tone-neutral {
    background: var(--neutral);
}

.sidebar,
.data-grid {
    display: grid;
    gap: 18px;
}

.panel {
    padding: 18px;
}

.panel header {
    margin-bottom: 14px;
}

.data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .94rem;
}

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

.table-editor {
    display: grid;
    gap: 10px;
}

.table-editor summary {
    cursor: pointer;
    color: var(--brand);
    font-weight: 700;
}

.compact-form {
    margin-top: 10px;
}

.inline-delete-form {
    margin-top: 10px;
}

.event-modal[hidden] {
    display: none;
}

.event-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.event-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(25, 35, 42, 0.42);
    backdrop-filter: blur(6px);
}

.event-modal-card {
    position: relative;
    z-index: 1;
    width: min(720px, calc(100vw - 28px));
    margin: min(8vh, 60px) auto;
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    min-height: 40px;
    background: rgba(14, 122, 95, 0.12);
    color: var(--brand);
}

.event-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.event-meta span,
.event-notes span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.event-notes {
    margin-top: 18px;
}

.event-notes p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.6;
}

.event-edit-form {
    margin-top: 18px;
}

.event-delete-form {
    margin-top: 18px;
}

.danger-button {
    background: linear-gradient(135deg, #c74a3a, #a8322b);
}

.modal-open {
    overflow: hidden;
}

.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 18px;
}

.login-card {
    width: min(560px, 100%);
    padding: 32px;
}

.login-form {
    margin-top: 20px;
}

.company-badge,
.credentials-note {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(14, 122, 95, 0.08);
}

.credentials-note {
    margin-top: 18px;
    font-size: .92rem;
    line-height: 1.6;
}

@media (max-width: 1180px) {
    .hero,
    .workspace,
    .data-grid,
    .top-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .calendar-head {
        display: none;
    }

    .calendar-week-row {
        grid-template-columns: 1fr;
    }

    .week-marker {
        grid-auto-flow: column;
        align-items: center;
        justify-content: center;
    }

    .day-name-mobile {
        display: block;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form {
        grid-auto-flow: row;
        grid-auto-columns: auto;
    }

    .month-progress-copy,
    .event-meta {
        grid-template-columns: 1fr;
        display: grid;
    }
}

@media (max-width: 680px) {
    .shell {
        padding: 16px 12px 32px;
    }

    .hero,
    .login-card {
        padding: 22px;
    }

    .month-picker summary,
    .month-picker-form,
    .event-modal-card {
        width: 100%;
    }
}
