:root {
    --bg: #f6f4ef;
    --surface: #ffffff;
    --ink: #21201d;
    --muted: #74706a;
    --line: #e6e0d7;
    --primary: #2f6f63;
    --primary-strong: #24584f;
    --accent: #b86f4b;
    --danger: #b64242;
    --warning-bg: #fff7df;
    --shadow: 0 18px 45px rgba(35, 31, 25, 0.08);
}

* {
    box-sizing: border-box;
}

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

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

a:hover {
    color: var(--primary-strong);
}

h1,
h2 {
    margin: 0;
    line-height: 1.15;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    max-width: 820px;
    text-transform: capitalize;
}

h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

p {
    margin: 0;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 3rem);
    background: rgba(246, 244, 239, 0.9);
    border-bottom: 1px solid rgba(230, 224, 215, 0.7);
    backdrop-filter: blur(14px);
}

.brand {
    color: var(--ink);
    font-weight: 800;
    font-size: 1.05rem;
}

.nav,
.actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav a,
.link-button {
    font-weight: 650;
}

.nav a.is-active,
.nav a:hover,
.link-button:hover {
    color: var(--ink);
}

.link-button {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.page {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2.5rem 0 4rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: clamp(1.5rem, 5vw, 4rem);
    align-items: end;
    min-height: calc(100vh - 120px);
    padding-bottom: 3rem;
}

.hero-image {
    grid-column: 1 / -1;
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #efe8dd;
    box-shadow: var(--shadow);
    aspect-ratio: 16 / 9;
}

.hero-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hero-copy {
    align-self: center;
}

.lead {
    color: var(--muted);
    font-size: 1.18rem;
    max-width: 640px;
    margin: 1.35rem 0 1.7rem;
}

.eyebrow,
.panel-label {
    color: var(--accent);
    display: block;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 0.7rem;
    text-transform: uppercase;
}

.hero-panel,
.profile-note,
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-panel,
.profile-note {
    padding: 1.5rem;
}

.hero-panel strong,
.profile-note strong {
    display: block;
    font-size: 1.35rem;
    margin-bottom: 0.6rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.68rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-weight: 750;
    text-transform: capitalize;
}

.button:hover {
    background: var(--primary-strong);
    color: #fff;
}

.button.ghost {
    background: transparent;
    color: var(--primary);
}

.button.ghost:hover {
    background: #e7f0ed;
    color: var(--primary-strong);
}

.button.small {
    min-height: 36px;
    padding: 0.45rem 0.72rem;
}

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

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.feature-grid,
.dashboard-grid,
.grid-two,
.profile-shell {
    display: grid;
    gap: 1rem;
}

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

.feature-grid article {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.feature-grid p,
.muted,
small {
    color: var(--muted);
}

.auth-shell,
.grid-two,
.profile-shell {
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1fr);
    align-items: start;
}

.auth-shell {
    display: grid;
    gap: 2rem;
    padding-top: 5vh;
}

.auth-copy {
    padding-top: 2rem;
}

.profile-shell {
    gap: 1rem;
}

.card {
    padding: 1.25rem;
}

.form {
    display: grid;
    gap: 1rem;
}

label {
    display: grid;
    gap: 0.45rem;
    color: var(--ink);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 0.75rem 0.8rem;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(47, 111, 99, 0.15);
    border-color: var(--primary);
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.section-header h1,
.narrow h1 {
    font-size: clamp(1.8rem, 3vw, 3rem);
}
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--muted);
}
.alert,
.notice {
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.alert.success {
    background: #e4f3ea;
    color: #22543d;
}

.alert.error,
.notice.danger {
    background: #fbe8e8;
    color: #873232;
}

.notice {
    background: var(--warning-bg);
    border: 1px solid #f0ddb0;
}

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

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

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

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

td small {
    display: block;
    margin-top: 0.25rem;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: #faf7f0;
}

.calendar-card {
    margin-bottom: 1rem;
}

.calendar-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(130px, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
    overflow-x: auto;
}

.calendar-weekday,
.calendar-day {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.calendar-weekday {
    background: #fbf8f1;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
    padding: 0.65rem;
    text-transform: uppercase;
}

.calendar-day {
    min-height: 142px;
    padding: 0.65rem;
    background: #fff;
}

.calendar-day.is-empty {
    background: #f6f1e8;
}

.calendar-day > strong {
    display: block;
    margin-bottom: 0.5rem;
}

.calendar-items {
    display: grid;
    gap: 0.4rem;
}

.calendar-item {
    display: grid;
    gap: 0.12rem;
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    background: #eef7f4;
    color: var(--ink);
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
}

.calendar-item small {
    line-height: 1.3;
}

.calendar-item.pending {
    border-color: #c8952b;
    background: #fff6dc;
}

.calendar-item.completed {
    border-color: #2f8a62;
    background: #e8f6ee;
}

.calendar-item.expired {
    border-color: #7c756b;
    background: #f1eee8;
}

.calendar-item.rejected,
.calendar-item.cancelled {
    border-color: var(--danger);
    background: #fae8e8;
}

.payload {
    display: block;
    max-width: 360px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #4f4a43;
    font-size: 0.82rem;
}

.note-cell {
    min-width: 320px;
}

.note-cell strong {
    display: block;
    margin: 0.35rem 0 0.15rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    background: #ece8df;
    color: #59534a;
    font-size: 0.8rem;
    font-weight: 800;
}

.badge.pending {
    background: #fff0c7;
    color: #7b5612;
}

.badge.active {
    background: #dff0ff;
    color: #265a78;
}

.badge.completed {
    background: #ddf4e8;
    color: #236147;
}

.badge.rejected,
.badge.cancelled {
    background: #f9dddd;
    color: #8a3333;
}

.badge.expired {
    background: #e7e2db;
    color: #4f4a43;
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 1.25rem;
}

.action-cell {
    display: grid;
    gap: 0.7rem;
    min-width: 260px;
}

.action-cell.compact {
    min-width: 220px;
}

.action-cell form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
}

.stack {
    display: grid;
    gap: 0.85rem;
}

.inline-editor,
.schedule-item,
.details div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

.inline-editor {
    display: grid;
    gap: 0.75rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.checkbox input {
    width: auto;
}

.dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
}

.schedule-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--ink);
}

.schedule-item strong,
.schedule-item small {
    display: block;
}

.narrow {
    width: min(760px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 1rem;
}

.back-link {
    font-weight: 750;
}

.summary-line {
    color: var(--ink);
    font-weight: 750;
    margin: 0.5rem 0 1rem;
}

.details {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0 0;
}

.details div {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
}

.details dt {
    color: var(--muted);
    font-weight: 800;
}

.details dd {
    margin: 0;
}

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

@media (max-width: 860px) {
    .hero,
    .auth-shell,
    .grid-two,
    .profile-shell,
    .dashboard-grid,
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
        padding-top: 2rem;
    }

    .hero-image {
        aspect-ratio: 4 / 3;
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .action-cell form {
        grid-template-columns: 1fr;
    }

    .calendar-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .calendar-grid {
        grid-template-columns: repeat(7, minmax(118px, 1fr));
    }
}

@media (max-width: 560px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav {
        width: 100%;
    }

    .button {
        width: 100%;
    }

    .actions {
        width: 100%;
    }

    .details div,
    .schedule-item {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}
