/* Base: design tokens, reset, shared interactive foundations, form control primitives. */

:root {
    color-scheme: light;
    --bg: #f4f1ea;
    --bg-alt: #e4ddd0;
    --text: #1f1d1a;
    --muted: #6b6358;
    --line: #c7bbac;
    --accent: #b14d29;
    --accent-dark: #89361c;
    --panel: #fffdf8;
    --shadow: 0 0 40px rgba(28, 24, 18, 0.08);
    --radius: 20px;
    --container: 1180px;
    --container-wide: 1380px;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --focus-ring: 0 0 0 3px rgba(177, 77, 41, 0.16), 0 0 0 1px rgba(177, 77, 41, 0.22);
    --surface-border-color: rgba(0, 0, 0, 0.06);
    --surface-border-soft-color: rgba(0, 0, 0, 0.08);
    --surface-radius-sm: 14px;
    --surface-radius-md: 20px;
    --surface-radius-lg: 24px;
    --surface-soft-bg: rgba(255, 255, 255, 0.78);
    --ui-control-bg: rgba(255, 255, 255, 0.9);
    --ui-control-bg-hover: rgba(255, 255, 255, 0.98);
    --ui-control-border: rgba(226, 200, 177, 0.95);
    --ui-control-border-strong: rgba(143, 100, 64, 0.42);
    --ui-control-text: var(--text);
    --ui-control-radius: 18px;
    --button-height: 46px;
    --button-icon-size: 42px;
    --control-height: 52px;
    --layout-gap-xs: 0.5rem;
    --layout-gap-sm: 0.75rem;
    --layout-gap-md: 1rem;
    --layout-gap-lg: 1.5rem;
    --layout-panel-padding: 1.4rem;
    --layout-sidebar-sm: 240px;
    --layout-sidebar-md: 280px;
    --layout-card-min: 16rem;
    --nav-overlay-max-height: 100dvh;
    --sticky-nav-offset: 4.75rem;
    --ui-control-shadow-hover: 0 14px 30px rgba(53, 33, 15, 0.08);
    --ui-control-shadow-focus: 0 0 0 4px rgba(143, 100, 64, 0.14);
    --ui-control-transition: all 360ms cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    overflow-x: clip;
    background: #f5efe4;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-sans);
    color: var(--text);
    background: radial-gradient(circle at top left, rgba(177, 77, 41, 0.15), transparent 32%),
    linear-gradient(180deg, #f5efe4 0%, var(--bg) 100%) #f5efe4;
    overflow-x: clip;
    caret-color: transparent;
}

.site-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 251, 244, 0.7);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 1100;
}

input,
textarea,
[contenteditable="true"] {
    caret-color: auto;
}

img {
    max-width: 100%;
    display: block;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button,
[role="button"] {
    color: inherit;
}

:where(.button, .button-icon, .button-ghost, .button-toggle, .nav__link, .nav__action, .admin-sidebar a, .place-breadcrumbs__link, .place-tag-link, .role-select__button, .policy-toggle, .place-action-icon, .media-tool-button, .media-preset, .media-card__delete-button, .media-tone-scope, .modal__close, .modal__nav, .nav-toggle, .leaflet-bar.map-controls a.map-controls__button, .media-card__back .js-open-media-editor) {
    transition: all 360ms cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

:where(.button, .button-icon, .button-ghost, .button-toggle, .nav__link, .nav__action, .admin-sidebar a, .place-breadcrumbs__link, .place-tag-link, .role-select__button, .policy-toggle, .place-action-icon, .media-tool-button, .media-preset, .media-card__delete-button, .media-tone-scope, .modal__close, .modal__nav, .nav-toggle, .leaflet-bar.map-controls a.map-controls__button, .media-card__back .js-open-media-editor):focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.l-stack {
    display: flex;
    flex-direction: column;
    gap: var(--layout-gap-md);
}

.l-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--layout-gap-sm);
    align-items: center;
}

.l-split {
    display: flex;
    flex-wrap: wrap;
    gap: var(--layout-gap-md);
    align-items: center;
    justify-content: space-between;
}

.l-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--layout-gap-lg);
}

.l-grid-flex {
    display: flex;
    flex-wrap: wrap;
    gap: var(--layout-gap-md);
    align-items: stretch;
}

.l-grid-flex > * {
    flex: 1 1 var(--layout-card-min);
    min-width: min(100%, var(--layout-card-min));
}

.l-fill {
    flex: 1 1 0;
    min-width: 0;
}

.l-span-full {
    flex-basis: 100%;
    width: 100%;
    max-width: none;
}

.button {
    --button-bg: transparent;
    --button-border: transparent;
    --button-color: inherit;
    --button-hover-bg: var(--button-bg);
    --button-hover-border: var(--button-border);
    --button-hover-color: var(--button-color);
    --button-shadow: 0 0 22px rgba(28, 24, 18, 0.08);
    --button-hover-shadow: 0 0 36px rgba(28, 24, 18, 0.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    align-self: start;
    min-height: var(--button-height);
    height: var(--button-height);
    max-width: 100%;
    padding: 0 1.05rem;
    border-radius: 999px;
    border: 1px solid var(--button-border);
    cursor: pointer;
    color: var(--button-color);
    background: var(--button-bg);
    box-shadow: var(--button-shadow);
    line-height: 1;
    white-space: nowrap;
}

.button:hover {
    color: var(--button-hover-color);
    border-color: var(--button-hover-border);
    background: var(--button-hover-bg);
    box-shadow: var(--button-hover-shadow);
}

.button-primary {
    --button-bg: var(--accent);
    --button-border: var(--accent);
    --button-color: #fff;
    --button-hover-bg: var(--accent-dark);
    --button-hover-border: var(--accent-dark);
    --button-hover-color: #fff;
    --button-hover-shadow: 0 0 36px rgba(28, 24, 18, 0.18);
}

:is(.button-secondary, .button-ghost, .button-toggle) {
    --button-bg: transparent;
    --button-border: var(--line);
    --button-hover-bg: rgba(177, 77, 41, 0.05);
    --button-hover-border: var(--accent);
    --button-hover-color: var(--accent-dark);
    --button-hover-shadow: 0 0 30px rgba(177, 77, 41, 0.14);
}

.button-icon {
    min-width: var(--button-icon-size);
    width: var(--button-icon-size);
    min-height: var(--button-icon-size);
    height: var(--button-icon-size);
    padding: 0;
    border-radius: 14px;
}

:is(.button, .button-icon, .button-ghost, .button-toggle):disabled {
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: none;
}

:is(.button, .button-icon, .button-ghost, .button-toggle).is-loading {
    position: relative;
}

:where(.place-form, .auth-form, .search-form, .search-bar-form, .admin-search-form, .admin-setting-form, .js-policy-setting-form, .installer-form, .wellness-form, .category-picker-modal__editor) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select:not(.role-select__native), .field-static) {
    width: 100%;
    min-height: var(--control-height);
    padding: 0.95rem 1rem;
    border-radius: var(--ui-control-radius);
    border: 1px solid var(--ui-control-border);
    background: var(--ui-control-bg);
    color: var(--ui-control-text);
    box-shadow: none;
    transition: var(--ui-control-transition);
}

:where(.place-form, .auth-form, .search-form, .search-bar-form, .admin-search-form, .admin-setting-form, .js-policy-setting-form, .installer-form, .wellness-form, .category-picker-modal__editor) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select:not(.role-select__native), .field-static) {
    align-self: start;
    min-height: var(--control-height);
    height: var(--control-height);
    padding-top: 0;
    padding-bottom: 0;
}

:where(.place-form, .auth-form, .search-form, .search-bar-form, .admin-search-form, .admin-setting-form, .js-policy-setting-form, .installer-form, .wellness-form, .category-picker-modal__editor) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select:not(.role-select__native), .field-static):hover {
    border-color: var(--ui-control-border-strong);
    background: var(--ui-control-bg-hover);
    box-shadow: var(--ui-control-shadow-hover);
}

:where(.place-form, .auth-form, .search-form, .search-bar-form, .admin-search-form, .admin-setting-form, .js-policy-setting-form, .installer-form, .wellness-form, .category-picker-modal__editor) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select:not(.role-select__native)):focus {
    outline: 0;
    border-color: rgba(143, 100, 64, 0.58);
    background: var(--ui-control-bg-hover);
    box-shadow: var(--ui-control-shadow-focus), var(--ui-control-shadow-hover);
}

:where(.place-form, .auth-form, .search-form, .search-bar-form, .js-policy-setting-form, .installer-form) textarea {
    resize: vertical;
    min-height: 120px;
}

.field-static {
    display: flex;
    align-items: center;
    font-weight: 400;
    word-break: break-all;
}

.role-select__native {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.role-select {
    position: relative;
}

.role-select--locked {
    opacity: 0.8;
}

.role-select__button {
    width: 100%;
    align-self: start;
    min-height: var(--control-height);
    height: var(--control-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0 1rem;
    border: 1px solid var(--ui-control-border);
    border-radius: var(--ui-control-radius);
    background: var(--ui-control-bg);
    color: var(--ui-control-text);
    box-shadow: none;
    cursor: pointer;
    transition: var(--ui-control-transition);
}

.role-select:hover .role-select__button,
.role-select.is-open .role-select__button {
    border-color: var(--ui-control-border-strong);
    background: var(--ui-control-bg-hover);
    box-shadow: var(--ui-control-shadow-hover);
}

.role-select__button:focus-visible {
    outline: none;
    border-color: rgba(143, 100, 64, 0.58);
    background: var(--ui-control-bg-hover);
    box-shadow: var(--ui-control-shadow-focus), var(--ui-control-shadow-hover);
}

.role-select__button:disabled {
    cursor: default;
    color: rgba(31, 23, 18, 0.55);
}

.role-select__chevron {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: var(--ui-control-transition);
}

.role-select.is-open .role-select__chevron {
    transform: rotate(-135deg);
}

.role-select__menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2400;
    display: none;
    padding: 0.45rem;
    border-radius: var(--ui-control-radius);
    background: rgba(255, 253, 248, 0.98);
    border: 1px solid rgba(177, 77, 41, 0.16);
    box-shadow: 0 0 36px rgba(16, 14, 12, 0.14);
    backdrop-filter: blur(10px);
}

.role-select.is-open .role-select__menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.role-select__option {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #241912;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: var(--ui-control-transition);
}

.role-select__option:hover {
    background: rgba(177, 77, 41, 0.08);
    box-shadow: 0 0 20px rgba(177, 77, 41, 0.06);
}

.role-select__option.is-active {
    background: rgba(177, 77, 41, 0.12);
    color: var(--accent-dark);
}

.role-select__check {
    color: var(--accent);
    font-weight: 800;
    font-size: 1rem;
    line-height: 1;
}

:where(.checkbox, .checkbox-inline) {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--ui-control-border);
    border-radius: var(--ui-control-radius);
    background: var(--ui-control-bg);
    box-shadow: none;
    transition: all 360ms cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

:where(.checkbox, .checkbox-inline):hover {
    box-shadow: var(--ui-control-shadow-hover);
}

.checkbox {
    align-items: flex-start;
    margin-bottom: 14px;
}

:where(.checkbox, .checkbox-inline) input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--accent);
    transform: scale(1.08);
}

.checkbox-inline {
    display: flex !important;
}

:is(.checkbox-inline span, .checkbox strong) {
    color: var(--text);
    font-weight: 700;
}


