/* ==========================================================================
   App Platform — control panel design system
   Plain CSS, no build step. Loaded by resources/views/control/layouts/app.blade.php
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */
:root {
    --bg: #080d19;
    --surface: #0e1626;
    --surface-2: #141f36;
    --surface-3: #1b2744;
    --border: #1e2a45;
    --border-strong: #2b3a5e;

    --text: #e8edf7;
    --text-dim: #a6b2cc;
    --muted: #7b8aa8;

    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-soft: rgba(99, 102, 241, 0.14);
    --accent-text: #c7cbff;

    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.14);
    --success-text: #86efac;

    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.14);
    --warning-text: #fcd34d;

    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.14);
    --danger-text: #fca5a5;

    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, 0.14);
    --info-text: #7dd3fc;

    --radius-sm: 7px;
    --radius: 11px;
    --radius-lg: 16px;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --sidebar-w: 258px;

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

    color-scheme: dark;
}

/* --- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); font-size: .85em; }
code {
    background: var(--surface-3);
    padding: .12em .42em;
    border-radius: 5px;
    color: var(--text-dim);
}

hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- App shell ---------------------------------------------------------- */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.nav-toggle { display: none; }

/* --- Sidebar ------------------------------------------------------------ */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 40;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.05rem 1.15rem;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.sidebar__mark {
    width: 30px; height: 30px;
    flex: 0 0 auto;
    display: grid; place-items: center;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: #fff;
    font-weight: 700;
    font-size: .82rem;
    letter-spacing: -.02em;
}

.sidebar__name { font-size: .86rem; font-weight: 650; letter-spacing: .01em; }
.sidebar__env {
    font-size: .68rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .1em;
}

.sidebar__nav { padding: .85rem .7rem 1rem; flex: 1 1 auto; }

.nav-group + .nav-group { margin-top: 1.15rem; }

.nav-group__label {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .13em;
    color: var(--muted);
    padding: 0 .55rem;
    margin-bottom: .4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .55rem;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: .885rem;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    transition: background .12s ease, color .12s ease;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .85; }

.nav-item.is-active {
    background: var(--accent-soft);
    color: #fff;
}

.nav-item.is-active svg { opacity: 1; color: var(--accent-text); }

.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: -0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.nav-item__count {
    margin-left: auto;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    background: var(--surface-3);
    color: var(--text-dim);
    padding: .05rem .4rem;
    border-radius: 99px;
}

.sidebar__footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--border);
    padding: .8rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem .5rem;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.user-chip__avatar {
    width: 28px; height: 28px;
    flex: 0 0 auto;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface-3);
    color: var(--accent-text);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.user-chip__meta { min-width: 0; }
.user-chip__email {
    font-size: .78rem;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__signout {
    margin-top: .5rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}
.sidebar__signout svg { width: 15px; height: 15px; }

/* --- Main / topbar ------------------------------------------------------ */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem 1.5rem;
    background: rgba(8, 13, 25, .85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    min-height: 56px;
}

.topbar__burger {
    display: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: .3rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.topbar__burger svg { width: 18px; height: 18px; display: block; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    color: var(--muted);
    min-width: 0;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb__sep { opacity: .45; }
.breadcrumb__current { color: var(--text); font-weight: 550; }

.topbar__spacer { margin-left: auto; }

.content {
    padding: 1.6rem 1.5rem 4rem;
    max-width: 1180px;
    width: 100%;
}

/* --- Page header -------------------------------------------------------- */
.page-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.35rem;
}
.page-header__text { min-width: 0; }
.page-header__subtitle { color: var(--muted); font-size: .875rem; margin-top: .2rem; }
.page-header__actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* --- Cards -------------------------------------------------------------- */
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card__header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--border);
}
.card__title { font-size: .92rem; font-weight: 600; }
.card__header > svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--accent-text); }
.card__actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.card__body { padding: 1.1rem; flex: 1 1 auto; }
.card__body--flush { padding: 0; }
/* A form wrapping a card body + footer has to stretch too, otherwise the
   footer inside it can never reach the bottom of the card. */
.card__form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.card__footer {
    margin-top: auto;
    padding: .75rem 1.1rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* --- Grids -------------------------------------------------------------- */
.grid { display: grid; gap: 1rem; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid--halves { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--thirds { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--two > .card:only-child { grid-column: 1 / -1; }

.stack > * + * { margin-top: 1.25rem; }

/* Module card description: three lines maximum, always the same height, so
   the Migrations/Seeders rows start at the same y in every card. */
.module-desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .855rem;
    margin: 0 0 .9rem;
    min-height: 4.05rem;
}

/* --- Stat --------------------------------------------------------------- */
.stat { display: flex; flex-direction: row; gap: .9rem; align-items: flex-start; padding: 1.05rem 1.1rem; }

.stat__icon {
    width: 38px; height: 38px;
    flex: 0 0 auto;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-dim);
}
.stat__icon svg { width: 18px; height: 18px; }
.stat__icon--accent { background: var(--accent-soft); color: var(--accent-text); }
.stat__icon--success { background: var(--success-soft); color: var(--success-text); }
.stat__icon--danger { background: var(--danger-soft); color: var(--danger-text); }
.stat__icon--warning { background: var(--warning-soft); color: var(--warning-text); }
.stat__icon--info { background: var(--info-soft); color: var(--info-text); }

.stat__label {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
}
.stat__value {
    font-size: 1.7rem;
    font-weight: 650;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}
.stat__hint { font-size: .78rem; color: var(--muted); }

/* --- Buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .5rem .85rem;
    font: inherit;
    font-size: .855rem;
    font-weight: 560;
    line-height: 1.2;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }

.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(.92); }

.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text-dim); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn--sm { padding: .34rem .6rem; font-size: .8rem; }

.btn--link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent-text);
    font-size: .85rem;
}
.btn--link:hover { background: none; text-decoration: underline; }
.btn--link.is-danger { color: var(--danger-text); }

.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* --- Badges ------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    padding: .12rem .5rem;
    border-radius: 99px;
    font-size: .735rem;
    font-weight: 560;
    background: var(--surface-3);
    color: var(--text-dim);
    white-space: nowrap;
    text-decoration: none;
}
.badge:hover { text-decoration: none; }
.badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .8;
}
.badge--plain::before { display: none; }
.badge--success { background: var(--success-soft); color: var(--success-text); }
.badge--warning { background: var(--warning-soft); color: var(--warning-text); }
.badge--danger { background: var(--danger-soft); color: var(--danger-text); }
.badge--info { background: var(--info-soft); color: var(--info-text); }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); }

/* --- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: .875rem; }

.table th {
    text-align: left;
    font-size: .71rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    padding: .6rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .017); }
.table td.is-tight { width: 1%; white-space: nowrap; text-align: right; }
.table .row-title { font-weight: 550; color: var(--text); }
.table .row-sub { font-size: .78rem; color: var(--muted); }

/* Column helpers: keep names readable and stop long values eating the row. */
.table .col-name { min-width: 11rem; }
.table .col-host { white-space: nowrap; }
.table .col-db { max-width: 13rem; }
.table .col-db code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Definition list ---------------------------------------------------- */
.dl { display: grid; grid-template-columns: minmax(9rem, auto) 1fr; gap: .55rem 1.25rem; margin: 0; font-size: .875rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* Booking detail: room to breathe, payment not crushed into one dd. */
.booking-detail {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.booking-detail__block {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.booking-detail__label {
    margin: 0;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

.booking-detail .dl {
    gap: .9rem 1.5rem;
    font-size: .875rem;
}

.booking-detail .dl dd {
    line-height: 1.45;
}

.booking-pay {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
}

.booking-pay__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .75rem;
}

.booking-pay__method {
    font-size: .875rem;
    color: var(--text-dim);
}

.booking-pay__amounts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: .85rem 1.25rem;
}

.booking-pay__stat {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    min-width: 0;
}

.booking-pay__stat-label {
    font-size: .72rem;
    color: var(--muted);
}

.booking-pay__stat-value {
    font-size: 1.05rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}

.booking-pay__stat-value--muted {
    font-weight: 550;
    color: var(--text-dim);
}

.booking-pay__meta {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding-top: .15rem;
    border-top: 1px solid var(--border);
    font-size: .78rem;
    color: var(--muted);
}

.booking-pay__meta .mono {
    word-break: break-all;
}

/* --- Forms -------------------------------------------------------------- */
/* Same vertical rhythm whichever form pieces follow each other: a field, a
   row of fields (.form-grid), a checkbox or a fieldset. */
:is(.field, .form-grid, fieldset) + :is(.field, .form-grid, fieldset) { margin-top: .95rem; }

.label {
    display: block;
    font-size: .78rem;
    font-weight: 550;
    color: var(--text-dim);
    margin-bottom: .3rem;
}

.hint { font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.error-text { font-size: .78rem; color: var(--danger-text); margin-top: .3rem; }

.input, .select, .textarea {
    width: 100%;
    padding: .55rem .7rem;
    font: inherit;
    font-size: .875rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { resize: vertical; min-height: 5.5rem; }
.select { appearance: none; background-image: none; }

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group__suffix {
    display: flex;
    align-items: center;
    padding: 0 .7rem;
    font-size: .82rem;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-left: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    white-space: nowrap;
}

.check { display: flex; align-items: center; gap: .5rem; font-size: .86rem; color: var(--text-dim); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.check-grid { display: flex; flex-wrap: wrap; gap: .6rem 1.15rem; }

/* --- Toolbar ------------------------------------------------------------ */
.toolbar {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--border);
}
.toolbar__search { flex: 1 1 14rem; max-width: 22rem; }
.toolbar__spacer { margin-left: auto; }

/* --- Alerts ------------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    font-size: .865rem;
    border: 1px solid;
    margin-bottom: 1.1rem;
}
.alert svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: .12rem; }
.alert--success { background: var(--success-soft); border-color: rgba(34,197,94,.3); color: var(--success-text); }
.alert--danger { background: var(--danger-soft); border-color: rgba(239,68,68,.3); color: var(--danger-text); }
.alert--warning { background: var(--warning-soft); border-color: rgba(245,158,11,.3); color: var(--warning-text); }
.alert--info { background: var(--info-soft); border-color: rgba(56,189,248,.3); color: var(--info-text); }

/* --- Empty state -------------------------------------------------------- */
.empty { padding: 2.4rem 1.25rem; text-align: center; }
.empty__icon {
    width: 42px; height: 42px;
    margin: 0 auto .8rem;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--muted);
}
.empty__icon svg { width: 20px; height: 20px; }
.empty__title { font-weight: 580; margin-bottom: .2rem; }
.empty__text { color: var(--muted); font-size: .865rem; }
.empty__actions { margin-top: .95rem; display: flex; gap: .5rem; justify-content: center; }

/* --- Misc --------------------------------------------------------------- */
.muted { color: var(--muted); }
.dim { color: var(--text-dim); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.inline { display: inline-flex; align-items: center; gap: .4rem; }
.inline svg { width: 13px; height: 13px; opacity: .6; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 1.25rem; }
.mb-2 { margin-bottom: 1.25rem; }
.text-right { text-align: right; }

.pill-list { display: flex; flex-wrap: wrap; gap: .35rem; }

.split { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* --- Pagination --------------------------------------------------------- */
.pagination-wrap { padding: .85rem 1.1rem; border-top: 1px solid var(--border); }
.pagination-wrap nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.pagination-wrap a, .pagination-wrap span[aria-current] span, .pagination-wrap span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 .5rem;
    font-size: .8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text-dim);
    background: var(--surface-2);
}
.pagination-wrap a:hover { background: var(--surface-3); text-decoration: none; }
.pagination-wrap span[aria-current] span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination-wrap svg { width: 14px; height: 14px; }

/* --- Login screen ------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(60rem 30rem at 50% -12%, rgba(99, 102, 241, .16), transparent 70%),
        var(--bg);
}
.auth__card {
    width: 100%;
    max-width: 24rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.85rem 1.75rem;
}
.auth__brand { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.35rem; }
.auth__title { font-size: 1.15rem; margin-bottom: .15rem; }
.auth__subtitle { color: var(--muted); font-size: .85rem; margin-bottom: 1.35rem; }
.auth__submit { width: 100%; margin-top: 1.35rem; padding: .62rem; }
.auth__row { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; font-size: .82rem; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 960px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow);
    }

    .nav-toggle:checked ~ .app-shell .sidebar { transform: translateX(0); }

    .nav-toggle:checked ~ .scrim { opacity: 1; pointer-events: auto; }

    .scrim {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .55);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 35;
        cursor: pointer;
    }

    .grid--two { grid-template-columns: minmax(0, 1fr); }
    .topbar__burger { display: block; }
    .content { padding: 1.25rem 1rem 3rem; }
    .dl { grid-template-columns: 1fr; gap: .15rem 0; }
    .dl dd { margin-bottom: .6rem; }
}

@media (min-width: 961px) {
    .scrim { display: none; }
}

/* --- Tabs --------------------------------------------------------------- */
.tabs {
    display: flex;
    gap: .15rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.35rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    appearance: none;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: .58rem .85rem;
    font: inherit;
    font-size: .875rem;
    font-weight: 550;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    transition: color .12s ease, border-color .12s ease;
}
.tab:hover { color: var(--text); }
.tab svg { width: 16px; height: 16px; }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab.is-active svg { color: var(--accent-text); }

.tab__badge {
    font-size: .68rem;
    font-weight: 600;
    padding: .05rem .38rem;
    border-radius: 99px;
    background: var(--danger-soft);
    color: var(--danger-text);
}

/* Sub-heading used to group cards inside a tab. */
.section + .section { margin-top: 1.6rem; }
.section__title {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .11em;
    color: var(--muted);
    margin-bottom: .6rem;
}

/* --- Settings form ------------------------------------------------------- */
.form-grid {
    display: grid;
    gap: 1rem 1.25rem;
    /* 18rem keeps a select's option text readable; a narrow card falls back
       to one column instead of truncating. */
    grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
}
.form-grid > .field { margin-top: 0; }
.form-grid > .field--wide { grid-column: 1 / -1; }

/* ---------------------------------------------------------------------------
   Settings rows
   A label and its help text sit in a fixed left column with the control
   beside them. A multi-column form grid cannot promise that: one long help
   text or one long option label drags its whole column out of shape.
--------------------------------------------------------------------------- */

.settings-intro {
    margin: 0 0 .35rem;
    color: var(--text-dim);
}

.settings-section {
    margin: 1.4rem 0 .2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: .7rem;
    font-weight: 650;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.settings-section:first-of-type {
    margin-top: .5rem;
    padding-top: 0;
    border-top: 0;
}

.settings-row {
    display: grid;
    grid-template-columns: minmax(0, 19rem) minmax(0, 1fr);
    gap: .4rem 2rem;
    align-items: start;
    padding: .9rem 0;
}

.settings-row + .settings-row {
    border-top: 1px solid var(--border);
}

.settings-row__text {
    min-width: 0;
}

.settings-row__label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
}

.settings-row__help {
    margin-top: .25rem;
    font-size: .78rem;
    line-height: 1.5;
    color: var(--muted);
}

.settings-row__control {
    min-width: 0;
}

.settings-row__control .input,
.settings-row__control .select,
.settings-row__control .textarea {
    width: 100%;
}

@media (max-width: 820px) {
    .settings-row {
        grid-template-columns: minmax(0, 1fr);
        gap: .5rem;
    }
}
/* ---------------------------------------------------------------------------
   Zone map editor
   `position: relative; z-index: 0` gives Leaflet its own stacking context, so
   its panes and controls cannot float above the sidebar or the topbar.
--------------------------------------------------------------------------- */

.zone-map__canvas {
    position: relative;
    z-index: 0;
    height: 380px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.zone-map__actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .6rem;
}

.leaflet-container {
    background: var(--surface);
    font-family: var(--font);
}

/* ---------------------------------------------------------------------------
   Alpine
   Without this, anything hidden with x-show is visible for the moment between
   the markup arriving and Alpine initialising.
--------------------------------------------------------------------------- */

[x-cloak] {
    display: none !important;
}
/* Keep domain actions together; the existing table wrapper owns overflow. */
.domain-actions-cell{width:1%;white-space:nowrap}.domain-actions{display:flex;align-items:center;gap:.4rem;flex-wrap:nowrap;width:max-content}.domain-actions>.btn{flex:0 0 auto;white-space:nowrap}.domain-table th,.domain-table td{padding-left:.75rem;padding-right:.75rem}.domain-table .row-title{white-space:nowrap}

/* --- Short links ------------------------------------------------------- */
.sl-period { max-width: 100%; overflow-x: auto; scrollbar-width: none; display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sl-period button { appearance: none; border: 0; background: none; color: var(--text-dim); font: inherit; font-size: .8rem; font-weight: 560; padding: .38rem .62rem; border-radius: 5px; cursor: pointer; white-space: nowrap; }
.sl-period button:hover { color: var(--text); }
.sl-period button.is-active { background: var(--accent); color: #fff; }

.sl-kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.sl-kpi { padding: 1rem 1.1rem; }
.sl-kpi__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.sl-kpi__label svg { width: 14px; height: 14px; }
.sl-kpi__value { font-size: 1.85rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; margin-top: .3rem; font-variant-numeric: tabular-nums; }
.sl-kpi__foot { margin-top: .35rem; font-size: .78rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.sl-delta { font-weight: 600; font-variant-numeric: tabular-nums; padding: .05rem .4rem; border-radius: 99px; font-size: .74rem; }
.sl-delta--up { color: var(--success-text); background: var(--success-soft); }
.sl-delta--down { color: var(--danger-text); background: var(--danger-soft); }
.sl-delta--flat { color: var(--text-dim); background: var(--surface-3); }

.sl-chart { position: relative; padding: 1rem 1.1rem .6rem; }
.sl-chart__plot { position: relative; height: 210px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--border-strong); }
.sl-chart__plot.is-dense { gap: 1px; }
.sl-chart__plot.is-packed { gap: 0; }
.sl-chart__line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); pointer-events: none; }
.sl-chart__line span { position: absolute; right: 0; top: -1.1rem; font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sl-bar { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.sl-bar__total { width: 100%; background: color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 3px 3px 0 0; display: flex; align-items: flex-end; min-height: 0; transition: background .15s; }
.sl-bar__new { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; }
.is-packed .sl-bar__total, .is-packed .sl-bar__new { border-radius: 0; }
.sl-bar:hover .sl-bar__total { background: color-mix(in srgb, var(--accent-text) 55%, transparent); }
.sl-bar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); font-size: .74rem; padding: .35rem .55rem; border-radius: 6px; white-space: pre; z-index: 5; pointer-events: none; box-shadow: var(--shadow); }
.sl-bar:first-child:hover::after, .sl-bar:nth-child(2):hover::after { left: 0; transform: none; }
.sl-bar:last-child:hover::after, .sl-bar:nth-last-child(2):hover::after { left: auto; right: 0; transform: none; }
.sl-chart__axis { display: grid; margin-top: .45rem; font-size: .7rem; color: var(--muted); white-space: nowrap; }
.sl-chart__axis span { overflow: hidden; text-overflow: clip; }
.sl-legend { display: flex; gap: 1rem; font-size: .76rem; color: var(--text-dim); align-items: center; margin-left: auto; flex-wrap: wrap; }
.sl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

.sl-heat { display: grid; grid-template-columns: 2.4rem repeat(24, minmax(0, 1fr)); gap: 3px; padding: 1rem 1.1rem; font-size: .68rem; color: var(--muted); }
.sl-heat__cell { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); min-width: 0; }
.sl-heat__day { align-self: center; }
.sl-heat__hour { text-align: center; }

.sl-rows { list-style: none; margin: 0; padding: .45rem .55rem .7rem; }
.sl-row { position: relative; display: flex; align-items: center; gap: .6rem; padding: .42rem .55rem; border-radius: 6px; font-size: .84rem; isolation: isolate; width: 100%; background: none; border: 0; color: inherit; font-family: inherit; text-align: left; }
button.sl-row { cursor: pointer; }
button.sl-row:hover { background: var(--surface-2); }
.sl-row__bar { position: absolute; inset: 2px auto 2px 0; background: var(--accent-soft); border-radius: 5px; z-index: -1; }
.sl-row__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-row__num { font-variant-numeric: tabular-nums; font-weight: 600; }
.sl-row__share { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .76rem; width: 3.2rem; text-align: right; }
.sl-empty-mini { padding: 1.4rem 1.1rem; color: var(--muted); font-size: .84rem; text-align: center; }

.sl-short { font-family: var(--mono); font-size: .84rem; color: var(--accent-text); text-decoration: none; }
.sl-short:hover { text-decoration: underline; }
.sl-dest { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--muted); font-size: .78rem; }
.sl-copy { appearance: none; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-dim); border-radius: 6px; padding: .2rem .45rem; font: inherit; font-size: .72rem; display: inline-flex; gap: .3rem; align-items: center; cursor: pointer; vertical-align: middle; }
.sl-copy svg { width: 13px; height: 13px; }
.sl-copy:hover { color: var(--text); border-color: var(--accent); }
.sl-copy.is-done { color: var(--success-text); border-color: var(--success); }
.sl-spark { width: 90px; height: 26px; display: block; }
.sl-spark polyline { fill: none; stroke: var(--accent-text); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.sl-spark polygon { fill: var(--accent-soft); stroke: none; }

.sl-hero { display: grid; gap: 1rem; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.sl-qr { display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 1.1rem; }
.sl-qr__img { background: #fff; border-radius: 12px; padding: 10px; width: 100%; max-width: 220px; aspect-ratio: 1; }
.sl-qr__img svg { width: 100%; height: 100%; display: block; }
.sl-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem 1.2rem; padding: 1.1rem; font-size: .84rem; }
.sl-facts dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .15rem; }
.sl-facts dd { margin: 0; overflow-wrap: anywhere; }
.sl-chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--accent-soft); color: var(--accent-text); padding: .25rem .4rem .25rem .7rem; border-radius: 99px; font-size: .8rem; }
.sl-chip button { appearance: none; border: 0; background: none; color: inherit; cursor: pointer; padding: 0 .2rem; font-size: 1rem; line-height: 1; }
.sl-visitor { font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.sl-top-title { display: block; max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-split { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 600px), 1fr)); }
.sl-table th, .sl-table td { padding-left: .7rem; padding-right: .7rem; }
.sl-actions .btn { padding: .38rem .5rem; }
.sl-created { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.sl-created .sl-short { font-size: 1.05rem; }

@media (max-width: 820px) {
    .sl-hero { grid-template-columns: 1fr; }
    .sl-chart__plot { height: 160px; }
    .sl-heat { gap: 2px; padding: .8rem; }
    .sl-dest { max-width: 12rem; }
}
.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; }

/* Analytics ------------------------------------------------------------ */
.an-plot .an-bar { display: flex; align-items: flex-end; gap: 1px; }
.an-plot .an-bar .sl-bar__total { flex: 2 1 0; }
.an-bar__app { flex: 1 1 0; min-height: 0; border-radius: 3px 3px 0 0; background: var(--success); opacity: .85; }
.an-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.an-score { display: inline-grid; place-items: center; min-width: 2.2rem; height: 2.2rem; padding: 0 .4rem; border-radius: 999px; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.an-score--lg { min-width: 4.4rem; height: 4.4rem; font-size: 1.5rem; }
.an-score--good { background: var(--success-soft); color: var(--success-text); }
.an-score--ok { background: var(--warning-soft); color: var(--warning-text); }
.an-score--bad { background: var(--danger-soft); color: var(--danger-text); }
.an-score--flat { background: var(--surface-3); color: var(--text-dim); }
.an-seo { display: grid; gap: 1.1rem; }
.an-seo__score { display: flex; gap: 1rem; align-items: center; }
.an-seo__verdict { font-weight: 700; font-size: 1.05rem; }
.an-history { display: flex; align-items: flex-end; gap: 3px; height: 26px; margin-top: .45rem; }
.an-history span { width: 7px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 60%, transparent); }
.an-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.an-check { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.an-check__icon { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 999px; flex: none; }
.an-check__icon svg { width: 14px; height: 14px; }
.an-check--pass .an-check__icon { background: var(--success-soft); color: var(--success-text); }
.an-check--warn .an-check__icon { background: var(--warning-soft); color: var(--warning-text); }
.an-check--fail .an-check__icon { background: var(--danger-soft); color: var(--danger-text); }
.an-check__label { font-weight: 600; font-size: .88rem; }
.an-check__detail { color: var(--text-dim); font-size: .8rem; line-height: 1.45; margin-top: .15rem; }
.an-passed summary { cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--text-dim); padding: .2rem 0 .6rem; }

/* Earnings ------------------------------------------------------------- */
.ea-bar { flex: 1 1 0; min-height: 0; border-radius: 3px 3px 0 0; background: var(--success); }
.ea-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .45rem; line-height: 1.5; }
.ea-steps a { text-decoration: underline; }
.ea-connection { display: flex; align-items: center; gap: .9rem; padding: .9rem 1.1rem; flex-wrap: wrap; }
.ea-connection > svg { width: 22px; height: 22px; color: var(--success); flex: none; }
.ea-connection__actions { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.ea-warn { display: block; color: var(--danger-text); margin-top: .2rem; }

/* Dashboard performance ------------------------------------------------ */
.db-section-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-top: .4rem; }
.db-section-head h2 { margin: 0; font-size: 1.05rem; }
.db-section-links { display: flex; gap: .9rem; margin-left: auto; font-size: .82rem; }
.db-section-links a { color: var(--text-muted, inherit); text-decoration: none; }
.db-section-links a:hover { text-decoration: underline; }
.db-rank { display: flex; align-items: center; gap: .7rem; }
.db-rank__n { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); flex: none; }
.db-rank__n.is-top { background: var(--accent); color: #fff; }
.db-link-row { text-decoration: none; color: inherit; }
.db-seo { list-style: none; margin: 0; padding: .4rem .6rem .7rem; display: grid; gap: .2rem; }
.db-seo a { display: grid; grid-template-columns: auto minmax(0, 1fr) 30%; align-items: center; gap: .8rem; padding: .45rem .5rem; border-radius: 10px; color: inherit; text-decoration: none; }
.db-seo a:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.db-seo .row-sub { display: block; }
.db-seo__bar { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--text, #888) 12%, transparent); overflow: hidden; }
.db-seo__bar i { display: block; height: 100%; border-radius: 99px; }
.db-seo__bar i.is-good { background: var(--success); }
.db-seo__bar i.is-ok { background: var(--warning, #e3a008); }
.db-seo__bar i.is-bad { background: var(--danger, #e5484d); }
@media (max-width: 720px) { .db-seo a { grid-template-columns: auto minmax(0, 1fr); } .db-seo__bar { display: none; } }

/* --- Recipe module: recipe editor -------------------------------------- */
.recipe-numbers { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
.recipe-flags { display: grid; gap: .55rem; border: 0; padding: 0; margin: 0; }
.recipe-photo__row { display: flex; gap: 1rem; align-items: flex-start; }
.recipe-photo__preview {
    width: 132px; height: 96px; flex: none; overflow: hidden; display: grid; place-items: center;
    border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted);
}
.recipe-photo__preview img { width: 100%; height: 100%; object-fit: cover; }
.recipe-rows { display: grid; gap: .45rem; margin: .6rem 0; }
.recipe-rows__head, .recipe-rows__row {
    display: grid;
    grid-template-columns: 5rem 5rem minmax(0, 1.6fr) minmax(0, 1.2fr) minmax(0, 1.3fr) auto;
    gap: .45rem;
    align-items: center;
}
.recipe-rows__head { font-size: .74rem; font-weight: 550; color: var(--muted); }
.recipe-rows__tools { display: flex; gap: .25rem; }
.recipe-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.recipe-search { max-width: 16rem; margin-left: auto; }
.recipe-thumb { display: block; width: 52px; height: 40px; overflow: hidden; border-radius: 8px; background: var(--surface-2); }
.recipe-thumb img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) {
    .recipe-rows__head { display: none; }
    .recipe-rows__row { grid-template-columns: 1fr 1fr; }
    .recipe-rows__row > :nth-child(3), .recipe-rows__row > :nth-child(5) { grid-column: span 2; }
}
.recipe-photo__preview--icon, .recipe-thumb--icon { background: #fff; }
.recipe-photo__preview--icon img, .recipe-thumb--icon img { object-fit: contain; padding: 6px; }
.recipe-rows__en { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: .45rem; align-items: center; }
.recipe-rows__sq { font-size: .84rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .recipe-rows__en { grid-template-columns: 1fr; } }
