:root {
    color-scheme: dark;
    --bg: #0d1117;
    --surface: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --link: #58a6ff;
    --btn-bg: #21262d;
    --btn-border: #30363d;
    --focus: #1f6feb;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
}

[x-cloak] {
    display: none !important;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--link);
}

a:hover {
    text-decoration: underline;
}

main {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.site-header__inner {
    position: relative;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-brand {
    color: var(--text);
    font-weight: 650;
    letter-spacing: 0.01em;
    text-decoration: none;
}

.site-brand:hover {
    text-decoration: none;
    color: var(--link);
}

.site-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.4;
    border-radius: 4px;
}

.site-nav a:hover {
    color: var(--text);
    text-decoration: underline;
}

.site-nav .services-switcher-toggle {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

.site-nav .services-switcher-toggle:hover {
    color: var(--text);
}

.site-nav-toggle {
    display: none;
}

@media (max-width: 719px) {
    .site-nav-toggle {
        display: inline-flex;
    }

    .site-nav {
        display: none;
        position: absolute;
        right: 1rem;
        top: calc(100% + 0.35rem);
        z-index: 80;
        flex-direction: column;
        align-items: stretch;
        min-width: 12rem;
        padding: 0.75rem 1rem;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--surface);
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    }

    .site-nav.site-nav--open {
        display: flex;
    }

    .site-nav a {
        padding: 0.35rem 0;
    }
}

@media (min-width: 720px) {
    .site-nav-toggle {
        display: none !important;
    }

    .site-nav {
        display: flex !important;
        position: static !important;
        border: 0;
        box-shadow: none;
        padding: 0;
        min-width: 0;
    }
}

.hero {
    padding: 1rem 0 2rem;
}

.home-hero {
    padding: 1rem 0 1.75rem;
}

.home-hero__title {
    margin: 0 0 0.75rem;
    font-size: clamp(1.75rem, 3vw, 2.4rem);
}

.home-hero__lead {
    margin: 0;
    max-width: 62ch;
    line-height: 1.55;
}

.home-plans {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .home-plans {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .home-plans {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.home-plan-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 14px;
    padding: 1.1rem 1.15rem 1.15rem;
    min-width: 0;
}

.home-plan-card__title {
    margin: 0;
    font-size: 1.2rem;
    flex: 1;
    min-width: 0;
}

.home-plan-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.home-plan-card__toggle {
    flex-shrink: 0;
}

.home-plan-card__title a {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.home-plan-card__title a:hover {
    color: var(--link);
    text-decoration: underline;
}

.home-plan-card__empty {
    margin: 0;
    font-size: 0.95rem;
}

.home-plan-card__places {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.home-plan-card__places li {
    margin: 0;
    padding: 0;
    color: var(--muted);
    line-height: 1.35;
    font-size: 0.98rem;
}

.home-plan-card__places li::before {
    content: "·";
    margin-right: 0.4rem;
    color: var(--border);
    font-weight: 700;
}

.hero__title {
    margin: 0 0 0.75rem;
    font-size: clamp(1.75rem, 3vw, 2.4rem);
}

.hero__lead {
    margin: 0 0 1.25rem;
    color: var(--muted);
    max-width: 62ch;
    line-height: 1.55;
}

.hero__cta {
    margin: 0 0 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 0.95rem;
    border-radius: 10px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.btn:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.btn--primary {
    border-color: rgba(88, 166, 255, 0.35);
    background: rgba(31, 111, 235, 0.18);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95em;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.9rem;
}

.plan-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Give the plan grid a little more room than the shared 1320px — two full-width
   Yr widgets (each needs ≥ 40rem of table) fit side by side from ~1420px up. */
main:has(.plan-page) {
    max-width: 1420px;
}

/* Row-major order: item 1,2,… left-to-right, then next row — matches foreach order.
   The Yr table widget only shows all its columns at ≥ 40rem, so a column is only
   created when a card can hold the full-width widget (40rem table + card padding).
   auto-fill counts tracks by the minmax() max, so the widget cap (66.67rem) lives
   on .place-card instead of the track definition. */
.plan-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 42.5rem), 1fr));
}

.plan-header__title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.35rem, 2.4vw, 1.85rem);
}

.plan-header__meta {
    margin: 0;
    color: var(--muted);
}

.place-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 14px;
    padding: 1rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    /* Cap at the widget's max content width and centre within a wide track */
    width: 100%;
    max-width: 66.75rem;
    margin-inline: auto;
}

/* On containers narrower than the widget's full table (40rem) the card scrolls
   horizontally instead of letting the iframe silently crop the table columns. */
.place-card .yr-widget {
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    border-radius: 12px;
}

.place-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.place-card__title {
    margin: 0;
    font-size: 1.15rem;
    flex: 1;
    min-width: 0;
}

.place-card__toggle-widget {
    flex-shrink: 0;
}

/* min-width keeps the widget at its full table layout (40rem); the natural
   content height is ~31rem, background matches the widget's dark mode. */
.yr-widget__frame {
    border: 0;
    border-radius: 12px;
    background: #0a2343;
    display: block;
    width: 100%;
    min-width: 40rem;
    height: 35rem;
}

.attribution {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
    color: var(--muted);
    line-height: 1.55;
}

.error-title {
    margin-top: 0;
}

.error-dev h2 {
    font-size: 1rem;
    margin: 1.5rem 0 0.5rem;
}

.backoffice .muted {
    max-width: 80ch;
    line-height: 1.55;
}

/* Backoffice -------------------------------------------------------------- */

.backoffice-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.backoffice-nav {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.55rem 0.75rem;
}

.backoffice-nav__toggle {
    display: none;
    width: 100%;
    justify-content: center;
    margin: 0;
}

.backoffice-nav__panel {
    display: block;
}

.backoffice-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
    align-items: center;
}

.backoffice-nav__link {
    color: var(--muted);
    text-decoration: none;
    font-weight: 650;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
}

.backoffice-nav__link:hover {
    color: var(--text);
    text-decoration: none;
}

.backoffice-nav__link.is-active {
    color: var(--text);
    background: rgba(88, 166, 255, 0.12);
    outline: 1px solid rgba(88, 166, 255, 0.25);
}

@media (max-width: 640px) {
    .backoffice-nav__toggle {
        display: inline-flex;
        width: auto;
    }

    .backoffice-nav__panel {
        display: none;
        margin-top: 0.45rem;
        padding-top: 0.6rem;
        border-top: 1px solid var(--border);
    }

    .backoffice-nav__panel--open {
        display: block;
    }

    .backoffice-nav__list {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (min-width: 641px) {
    .backoffice-nav__toggle {
        display: none !important;
    }

    .backoffice-nav__panel {
        display: block !important;
    }
}

.backoffice-flash {
    margin: 0;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(88, 166, 255, 0.25);
    background: rgba(31, 111, 235, 0.12);
    border-radius: 14px;
    color: var(--text);
}

.alpine-flash {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.alpine-flash__text {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding-top: 0.25rem;
    line-height: 1.45;
}

.alpine-flash__close {
    flex-shrink: 0;
}

.backoffice-heading__title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.35rem, 2.6vw, 1.95rem);
}

.backoffice-heading__lead,
.backoffice-heading__meta {
    margin: 0;
    line-height: 1.55;
}

.backoffice-breadcrumbs {
    margin: 0;
}

.backoffice-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 14px;
    padding: 1.1rem 1.1rem 1.15rem;
}

.backoffice-card--danger {
    border-color: rgba(248, 81, 73, 0.45);
}

.backoffice-card__title {
    margin: 0 0 0.85rem;
    font-size: 1.1rem;
}

.backoffice-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.backoffice-section-title {
    margin: 0;
    font-size: 1.1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.form-field label {
    font-weight: 650;
    font-size: 0.92rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
}

.form-control:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.field-hint {
    margin: 0;
}

.field-error {
    color: #ff7b72;
    font-size: 0.92rem;
}

.yr-search {
    position: relative;
    width: 100%;
}

.yr-search__anchor {
    position: relative;
    width: 100%;
}

.yr-search__dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 30;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    max-height: 20rem;
    overflow-y: auto;
}

.yr-search__status {
    margin: 0;
    padding: 0.65rem 0.85rem;
}

.yr-search__list {
    list-style: none;
    margin: 0;
    padding: 0.25rem;
}

.yr-search__option {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 0.95rem;
    cursor: pointer;
}

.yr-search__option--active,
.yr-search__option:hover {
    background: rgba(31, 111, 235, 0.18);
}

.yr-search__option-name {
    font-weight: 650;
}

.backoffice-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.table-wrap {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: auto;
    background: var(--surface);
}

.backoffice-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.backoffice-table th,
.backoffice-table td {
    text-align: left;
    padding: 0.75rem 0.95rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.backoffice-table thead th {
    font-size: 0.92rem;
    color: var(--muted);
}

.backoffice-table tbody tr:last-child td {
    border-bottom: none;
}

.backoffice-table .num {
    text-align: right;
    white-space: nowrap;
}

.actions {
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.btn--small {
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 650;
}

.btn--ghost {
    background: transparent;
}

.btn--danger {
    border-color: rgba(248, 81, 73, 0.45);
    background: rgba(248, 81, 73, 0.12);
}

.btn--danger:hover {
    border-color: rgba(248, 81, 73, 0.75);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(88, 166, 255, 0.25);
    background: rgba(88, 166, 255, 0.1);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge--muted {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.pager__links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nowrap {
    white-space: nowrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.validation-summary {
    color: #ff7b72;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.validation-summary ul {
    margin: 0.25rem 0 0 1.25rem;
    padding: 0;
}

/* Auth login (minimal / dnt-ish) ----------------------------------------- */

.auth-body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at 30% -10%, rgba(88, 166, 255, 0.12), transparent 45%), var(--bg);
    color: var(--text);
}

.auth-main {
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 3rem;
}

.auth-shell {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-header {
    text-align: center;
}

.auth-brand-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 750;
}

.auth-sub {
    margin: 0;
    font-weight: 600;
}

.auth-card {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(6px);
    border-radius: 16px;
    padding: 1.35rem 1.35rem 1.25rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    margin-top: 0.25rem;
}

.auth-footer {
    margin: 1.15rem 0 0;
    text-align: center;
}

.backoffice-nav__user {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.55rem;
}

.backoffice-nav__logout-form {
    margin: 0;
}

.backoffice-nav__logout {
    border: none;
    background: transparent;
    color: var(--link);
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    text-decoration: underline;
}

.backoffice-nav__logout:hover {
    color: var(--text);
}

.backoffice-nav__logout:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* Alpine interactions ----------------------------------------------------- */

.alpine-inline-confirm {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.alpine-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.alpine-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 4, 9, 0.72);
    backdrop-filter: blur(2px);
}

.alpine-modal__panel {
    position: relative;
    z-index: 1;
    max-width: 28rem;
    width: 100%;
    padding: 1.25rem 1.35rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.alpine-modal__text {
    margin: 0 0 1rem;
    line-height: 1.45;
}

.alpine-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.alpine-slug-preview {
    margin-top: 0.35rem !important;
}
