:root {
    --clr-bg: #fdf6ec;
    --clr-surface: #fffbf5;
    --clr-surface-alt: #fff5e8;
    --clr-border: #e3cdb0;
    --clr-border-focus: #c97b4b;

    --clr-text: #2d1c0d;
    --clr-text-soft: #6b4c30;
    --clr-text-muted: #a8836a;

    --clr-primary: #c97b4b;
    --clr-primary-dark: #a85e32;
    --clr-primary-bg: #f5e0ce;

    --clr-success: #4e8b55;
    --clr-success-bg: #d6edd9;

    --clr-warn: #b87428;
    --clr-warn-bg: #fce6c0;

    --clr-danger: #b03e33;
    --clr-danger-bg: #f7dbd8;

    --font: 'DynaPuff', system-ui, sans-serif;

    --text-xs: clamp(0.68rem, 0.64rem + 0.18vw, 0.75rem);
    --text-sm: clamp(0.8rem, 0.76rem + 0.2vw, 0.875rem);
    --text-base: clamp(0.875rem, 0.82rem + 0.28vw, 1rem);
    --text-md: clamp(1rem, 0.94rem + 0.3vw, 1.125rem);
    --text-lg: clamp(1.15rem, 1.05rem + 0.48vw, 1.375rem);
    --text-xl: clamp(1.375rem, 1.2rem + 0.82vw, 1.75rem);
    --text-2xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);

    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;

    --r-sm: 6px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(45, 28, 13, 0.07), 0 1px 2px rgba(45, 28, 13, 0.05);
    --shadow-md: 0 4px 12px rgba(45, 28, 13, 0.09), 0 2px 4px rgba(45, 28, 13, 0.05);
    --shadow-lg: 0 8px 24px rgba(45, 28, 13, 0.10), 0 4px 8px rgba(45, 28, 13, 0.06);

    --nav-h-mobile: 64px;
    --nav-h-desktop: 60px;
    --page-max: 680px;
    --page-pad: clamp(1rem, 4vw, 1.5rem);
}

[hidden] {
    display: none !important;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: var(--text-base);
    color: var(--clr-text);
    background: var(--clr-bg);
    line-height: 1.6;
    min-height: 100dvh;
    padding-bottom: var(--nav-h-mobile);
}

body.no-nav {
    padding-bottom: 0;
}

@media (min-width: 640px) {
    body {
        padding-bottom: 0;
        padding-top: var(--nav-h-desktop);
    }

    body.no-nav {
        padding-top: 0;
    }
}

img,
svg {
    display: block;
    max-width: 100%;
}

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

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
h4 {
    line-height: 1.25;
    font-weight: 700;
}

.page {
    max-width: var(--page-max);
    margin-inline: auto;
    padding: var(--sp-8) var(--page-pad);
}

.field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.field label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--clr-text-soft);
    letter-spacing: 0.02em;
}

.field-hint {
    font-size: var(--text-xs);
    color: var(--clr-text-muted);
}

.field-error {
    font-size: var(--text-xs);
    color: var(--clr-danger);
}

.input {
    font-family: var(--font);
    font-size: var(--text-base);
    color: var(--clr-text);
    background: var(--clr-surface);
    border: 1.5px solid var(--clr-border);
    border-radius: var(--r-md);
    padding: 0.6em 0.85em;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.input::placeholder {
    color: var(--clr-text-muted);
    font-weight: 400;
}

.input:focus-visible {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px var(--clr-primary-bg);
}

.input:user-invalid {
    border-color: var(--clr-danger);
    box-shadow: 0 0 0 3px var(--clr-danger-bg);
}

textarea.input {
    resize: vertical;
    min-height: 6em;
    line-height: 1.5;
}

select.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 10'%3E%3Cpath d='M1 1l7 7 7-7' stroke='%236b4c30' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8em center;
    background-size: 0.75em;
    padding-right: 2.5em;
    cursor: pointer;
}

input[type="number"].input {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"].input::-webkit-outer-spin-button,
input[type="number"].input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--clr-primary);
    width: 1.15em;
    height: 1.15em;
    cursor: pointer;
    flex-shrink: 0;
}

input[type="range"].input {
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    cursor: pointer;
    height: auto;
}

input[type="range"].input::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: var(--r-full);
    background: var(--clr-border);
}

input[type="range"].input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--clr-primary);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
    margin-top: -7.5px;
}

input[type="range"].input:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px var(--clr-primary-bg);
}

input[type="range"].input::-moz-range-track {
    height: 5px;
    border-radius: var(--r-full);
    background: var(--clr-border);
}

input[type="range"].input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--clr-primary);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: 600;
    padding: 0.65em 1.3em;
    border-radius: var(--r-md);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--clr-primary-bg);
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

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

.btn-primary {
    background: var(--clr-primary);
    color: white;
    border-color: var(--clr-primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--clr-primary-dark);
    border-color: var(--clr-primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--clr-primary);
    border-color: var(--clr-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--clr-primary-bg);
}

.btn-ghost {
    background: transparent;
    color: var(--clr-text-soft);
    border-color: var(--clr-border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--clr-surface-alt);
    color: var(--clr-text);
}

.btn-danger {
    background: var(--clr-danger);
    color: white;
    border-color: var(--clr-danger);
}

.btn-danger:hover:not(:disabled) {
    filter: brightness(0.9);
}

.btn-sm {
    font-size: var(--text-sm);
    padding: 0.45em 0.9em;
    border-radius: var(--r-sm);
}

.btn-lg {
    font-size: var(--text-md);
    padding: 0.75em 1.6em;
    border-radius: var(--r-lg);
}

.btn-full {
    width: 100%;
}

.card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
    box-shadow: var(--shadow-sm);
}

.card-sm {
    padding: var(--sp-4);
    border-radius: var(--r-md);
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--r-md);
    font-size: var(--text-sm);
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert:empty {
    display: none;
}

.alert-error {
    background: var(--clr-danger-bg);
    color: var(--clr-danger);
    border-color: #ddb0aa;
}

.alert-success {
    background: var(--clr-success-bg);
    color: var(--clr-success);
    border-color: #a8ccac;
}

.alert-warn {
    background: var(--clr-warn-bg);
    color: var(--clr-warn);
    border-color: #d9bA88;
}

.badge {
    display: inline-flex;
    align-items: center;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 0.2em 0.65em;
    border-radius: var(--r-full);
}

.badge-success {
    background: var(--clr-success-bg);
    color: var(--clr-success);
}

.badge-warn {
    background: var(--clr-warn-bg);
    color: var(--clr-warn);
}

.badge-danger {
    background: var(--clr-danger-bg);
    color: var(--clr-danger);
}

.badge-neutral {
    background: var(--clr-surface-alt);
    color: var(--clr-text-soft);
}

.site-nav {
    position: fixed;
    z-index: 100;
    background: var(--clr-surface);
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-h-mobile);
    border-top: 1px solid var(--clr-border);
    box-shadow: 0 -2px 12px rgba(45, 28, 13, 0.06);
}

.site-nav__inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-inline: var(--page-pad);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.site-nav__brand {
    display: none;
}

.site-nav__links {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--clr-text-muted);
    text-decoration: none;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-md);
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.nav-link svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.nav-link:hover {
    color: var(--clr-primary);
    text-decoration: none;
}

.nav-link.active {
    color: var(--clr-primary);
}

.nav-link.active svg {
    transform: scale(1.1);
}

@media (min-width: 640px) {
    .site-nav {
        top: 0;
        bottom: auto;
        height: var(--nav-h-desktop);
        border-top: none;
        border-bottom: 1px solid var(--clr-border);
        box-shadow: var(--shadow-sm);
    }

    .site-nav__inner {
        max-width: calc(var(--page-max) + (var(--page-pad) * 2));
        margin-inline: auto;
        justify-content: space-between;
        padding-bottom: 0;
    }

    .site-nav__brand {
        display: flex;
        align-items: center;
        gap: var(--sp-2);
        font-size: var(--text-md);
        font-weight: 700;
        color: var(--clr-text);
        text-decoration: none;
    }

    .site-nav__brand:hover {
        text-decoration: none;
        color: var(--clr-primary);
    }

    .site-nav__links {
        width: auto;
        gap: var(--sp-1);
    }

    .nav-link {
        flex-direction: row;
        gap: var(--sp-2);
        font-size: var(--text-sm);
        padding: 0.45em 0.85em;
    }

    .nav-link svg {
        width: 17px;
        height: 17px;
    }
}

.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--clr-text-muted);
}

.text-soft {
    color: var(--clr-text-soft);
}

.text-sm {
    font-size: var(--text-sm);
}

.stack>*+* {
    margin-top: var(--sp-4);
}

.stack-sm>*+* {
    margin-top: var(--sp-2);
}

.stack-lg>*+* {
    margin-top: var(--sp-6);
}

.page-header {
    margin-bottom: var(--sp-6);
}

.page-header h1 {
    font-size: var(--text-xl);
}

.page-header p {
    margin-top: var(--sp-2);
}

.field-row {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-end;
    flex-wrap: wrap;
}

.field-row .field {
    flex: 1;
    min-width: 0;
}

.divider {
    border: none;
    border-top: 1px solid var(--clr-border);
    margin: 0;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    padding: var(--sp-10) var(--sp-4);
    color: var(--clr-text-muted);
}

.empty-state {
    text-align: center;
    padding: var(--sp-10) var(--sp-4);
    color: var(--clr-text-muted);
}

.empty-state p+p {
    margin-top: var(--sp-2);
    font-size: var(--text-sm);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(45, 28, 13, 0.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--page-pad);
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.15s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal__title {
    font-size: var(--text-md);
    font-weight: 700;
    margin-bottom: var(--sp-4);
}

.modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.modal__footer {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-5);
    flex-wrap: wrap;
}
