:root {
    --bg: #f3efe6;
    --bg-elevated: rgba(255, 250, 243, 0.86);
    --bg-strong: #fffaf3;
    --ink: #18231f;
    --muted: #52615a;
    --line: rgba(24, 35, 31, 0.12);
    --line-strong: rgba(24, 35, 31, 0.22);
    --accent: #0c8b6b;
    --accent-soft: rgba(12, 139, 107, 0.12);
    --accent-strong: #0a6a52;
    --danger: #ba4b3c;
    --warning: #b27013;
    --shadow: 0 20px 50px rgba(23, 34, 29, 0.14);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --sidebar-width: 196px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Public Sans", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(211, 147, 74, 0.24), transparent 35%),
        radial-gradient(circle at bottom right, rgba(12, 139, 107, 0.18), transparent 40%),
        linear-gradient(180deg, #f6f2e9 0%, #efe7da 100%);
}

body {
    min-height: 100vh;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.background-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(16px);
    opacity: 0.75;
    pointer-events: none;
    z-index: 0;
}

.orb-one {
    width: 360px;
    height: 360px;
    top: -120px;
    right: 8%;
    background: rgba(12, 139, 107, 0.17);
}

.orb-two {
    width: 300px;
    height: 300px;
    bottom: 4%;
    left: -80px;
    background: rgba(210, 125, 77, 0.18);
}

#app {
    position: relative;
    z-index: 1;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 14px;
    background: rgba(255, 249, 240, 0.72);
    border-right: 1px solid rgba(24, 35, 31, 0.08);
    backdrop-filter: blur(18px);
}

.sidebar-header {
    padding: 8px 10px;
    margin-bottom: 6px;
}

.user-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    font-weight: 600;
    font-size: 1rem;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 140ms ease;
}

.link-button:hover {
    background: rgba(12, 139, 107, 0.08);
}

.user-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.74);
    transition: background-color 120ms ease;
}

.user-row:hover {
    background: rgba(12, 139, 107, 0.05);
}

.login-card h1,
.page-title h2,
.section-title,
.hero-title {
    font-family: "Fraunces", serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.page-title p,
.eyebrow,
.helper-text,
.muted {
    color: var(--muted);
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link,
.logout-button {
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    padding: 10px 12px;
    border-radius: 16px;
    transition: background-color 140ms ease, transform 140ms ease;
}

.nav-link:hover,
.logout-button:hover,
.nav-link.is-active {
    background: rgba(24, 35, 31, 0.06);
    transform: translateX(2px);
}

.logout-button {
    margin-top: auto;
    color: var(--danger);
}

.page-frame {
    padding: 18px;
}

.page-card,
.panel,
.hero-card,
.login-card,
.report-card {
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.page-card {
    min-height: calc(100vh - 56px);
    padding: 22px;
    animation: fade-up 220ms ease;
}

.page-header,
.section-header,
.occasion-footer,
.split-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-header {
    margin-bottom: 18px;
}

.page-title h2,
.section-title,
.hero-title {
    margin: 0;
}

.page-title p,
.section-header p {
    margin: 8px 0 0;
}

.button-row,
.inline-form,
.form-grid,
.stack,
.login-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-card {
    width: min(560px, 100%);
    padding: 30px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
    font-weight: 700;
}

.hero-copy {
    margin-bottom: 16px;
}

.hero-copy p,
.login-form p {
    line-height: 1.6;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
    flex: 1 1 180px;
}

.field label,
.table th,
.save-pill {
    font-size: 0.85rem;
    font-weight: 700;
}

.field input,
.field select,
.field textarea,
.inline-edit,
.entry-checkbox {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-sm);
}

.field input,
.field select,
.field textarea,
.inline-edit {
    padding: 8px 10px;
    color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-edit:focus {
    outline: 0;
    border-color: rgba(12, 139, 107, 0.55);
    box-shadow: 0 0 0 4px rgba(12, 139, 107, 0.12);
}

.field textarea,
.inline-edit.comment-input {
    min-height: 38px;
    max-height: 38px;
    resize: none;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button,
.pill-button {
    border: 0;
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 700;
    transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.toggle-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
}

.toggle-chip input {
    margin: 0;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.icon-button:hover,
.pill-button:hover {
    transform: translateY(-1px);
}

.primary-button {
    background: linear-gradient(135deg, #0c8b6b, #0d6f58);
    color: white;
    box-shadow: 0 14px 28px rgba(12, 139, 107, 0.22);
}

.secondary-button {
    background: rgba(12, 139, 107, 0.12);
    color: var(--accent-strong);
}

.ghost-button {
    background: rgba(24, 35, 31, 0.06);
    color: var(--ink);
}

.danger-button,
.icon-button.is-danger {
    background: rgba(186, 75, 60, 0.12);
    color: var(--danger);
}

.icon-button {
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    background: rgba(24, 35, 31, 0.06);
    color: var(--ink);
}

.pill-button {
    background: rgba(214, 143, 71, 0.14);
    color: #8f4f11;
}

.panel {
    padding: 22px;
}

.panel + .panel {
    margin-top: 18px;
}

.table-wrap {
    overflow: visible;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.74);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.table th,
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table th {
    position: relative;
    background: rgba(243, 239, 230, 0.9);
    color: var(--muted);
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 120ms ease;
}

.table tbody tr:hover {
    background: rgba(12, 139, 107, 0.05);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr.is-openable {
    cursor: pointer;
}

.inline-edit {
    width: 100%;
    min-width: 0;
}

.checkbox-cell {
    text-align: center;
}

.entry-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.save-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(24, 35, 31, 0.06);
    color: var(--muted);
}

.save-pill.is-saving {
    background: rgba(178, 112, 19, 0.14);
    color: var(--warning);
}

.save-pill.is-saved {
    background: rgba(12, 139, 107, 0.14);
    color: var(--accent-strong);
}

.save-pill.is-error {
    background: rgba(186, 75, 60, 0.14);
    color: var(--danger);
}

.autocomplete {
    position: relative;
}

.autocomplete-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: rgba(255, 250, 243, 0.98);
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    box-shadow: 0 18px 30px rgba(24, 35, 31, 0.14);
    padding: 8px;
    display: none;
    z-index: 99999;
    max-height: 300px;
    overflow-y: auto;
    min-width: 300px;
}

.autocomplete-menu.is-open {
    display: block;
}

.actions-cell {
    padding: 4px 8px;
}

.actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.actions-row .icon-button {
    margin: 0;
}

.actions-row .save-pill {
    margin: 0;
}

.autocomplete-option {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 10px 12px;
    text-align: left;
    border-radius: 12px;
}

.autocomplete-option:hover,
.autocomplete-option.is-active {
    background: rgba(12, 139, 107, 0.08);
}

.status-row,
.empty-state {
    padding: 26px;
    border-radius: 18px;
    border: 1px dashed var(--line-strong);
    background: rgba(255, 255, 255, 0.56);
    text-align: center;
    color: var(--muted);
}

.report-grid,
.metrics {
    display: grid;
    gap: 18px;
}

.report-grid {
    grid-template-columns: minmax(0, 1fr);
}

.metrics {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-card {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.metric-label {
    font-size: 0.82rem;
    color: var(--muted);
}

.metric-value {
    margin-top: 6px;
    font-size: 1.55rem;
    font-weight: 700;
}

.occasion-toolbar,
.occasion-footer {
    margin-top: 18px;
}

.column-resizer {
    position: absolute;
    top: 0;
    right: -7px;
    width: 14px;
    height: 100%;
    cursor: col-resize;
}

.toast-root {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 90;
}

.toast {
    min-width: 220px;
    max-width: 320px;
    padding: 14px 16px;
    border-radius: 18px;
    color: white;
    box-shadow: 0 18px 28px rgba(24, 35, 31, 0.18);
    animation: fade-up 180ms ease;
}

.toast.is-success {
    background: linear-gradient(135deg, #0c8b6b, #0a6a52);
}

.toast.is-error {
    background: linear-gradient(135deg, #c55b4b, #a33829);
}

.toast.is-info {
    background: linear-gradient(135deg, #465e88, #304764);
}

.login-card.shake {
    animation: shake 280ms ease;
}

.report-card {
    padding: 28px;
}

.report-actions {
    margin-top: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(12, 139, 107, 0.1);
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 700;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(24, 35, 31, 0.08);
    }

    .page-frame {
        padding: 18px;
    }

    .page-card {
        min-height: auto;
        padding: 22px;
    }
}

@media (max-width: 720px) {
    .page-header,
    .section-header,
    .occasion-footer,
    .split-header {
        flex-direction: column;
        align-items: stretch;
    }

    .button-row,
    .inline-form,
    .form-grid,
    .stack,
    .login-form {
        flex-direction: column;
    }

    .table {
        min-width: 960px;
    }
}

@media print {
    body {
        background: white;
    }

    .background-orb,
    .sidebar,
    .page-header .button-row,
    .occasion-footer,
    .report-actions,
    .toast-root {
        display: none !important;
    }

    .app-shell,
    .page-frame,
    .page-card,
    .report-card,
    .panel,
    .table-wrap {
        display: block;
        padding: 0;
        margin: 0;
        box-shadow: none;
        background: white;
        border: 0;
    }

    .table th,
    .table td {
        border-color: rgba(0, 0, 0, 0.18);
    }
}