/* ==========================================================================
   XO TOURS  -  admin panel
   Builds on style.css: same tokens, type, gold, tiles and springs. Only
   what the admin adds lives here: the shell, tables, pills, the agenda,
   settings forms and the sign-in card.
   ========================================================================== */

body.admin { background: var(--c-bg-2); }
.admin-main { padding: calc(var(--header-h) + clamp(1.5rem, 3vw, 2.5rem)) 0 clamp(3rem, 6vw, 5rem); min-height: 100vh; }

/* --- Shell ---------------------------------------------------------------- */
.admin-header .header-inner { gap: 1rem; }
.brand .admin-tag {
    margin-left: 0.6rem; padding: 0.22rem 0.55rem; border-radius: 999px;
    background: var(--gold-3); color: #5b4708;
    font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.admin-nav { display: flex; justify-content: center; gap: 0.25rem; }
.admin-link {
    display: inline-flex; align-items: center; gap: 0.4rem; height: 34px; padding: 0 0.85rem;
    border-radius: 999px; font-size: 0.8125rem; font-weight: 500; color: var(--c-ink-2);
    transition: background-color var(--t) ease, color var(--t) ease;
}
.admin-link:hover { background: rgba(0,0,0,0.05); color: var(--c-ink); }
.admin-link[aria-current="page"] { background: var(--c-ink); color: #fff; }
.admin-link svg { width: 15px; height: 15px; }
.count {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    display: inline-grid; place-items: center;
    background: var(--gold); color: #1d1d1f; font-size: 0.6875rem; font-weight: 700; line-height: 1;
}
.admin-link[aria-current="page"] .count { background: var(--gold-2); }
.nav-actions form { margin: 0; }
.hbtn {
    display: inline-flex; align-items: center; gap: 0.35rem; height: 34px; padding: 0 0.85rem;
    border: 0; border-radius: 999px; background: transparent;
    box-shadow: 0 0 0 1px var(--c-line-2) inset;
    font-size: 0.8125rem; font-weight: 500; color: var(--c-ink); cursor: pointer;
    transition: background-color var(--t) ease;
}
.hbtn:hover { background: rgba(0,0,0,0.04); }
.hbtn svg { width: 14px; height: 14px; }

/* Mobile tab bar, iOS style */
.admin-tabs {
    position: fixed; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; z-index: 90;
    display: none; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 0.4rem;
    border-radius: 22px; background: rgba(255,255,255,0.84);
    -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
    box-shadow: var(--shadow-md);
}
.admin-tabs a {
    position: relative; display: grid; justify-items: center; gap: 0.2rem; padding: 0.45rem 0.25rem;
    border-radius: 16px; font-size: 0.625rem; font-weight: 600; letter-spacing: 0.02em; color: var(--c-ink-3);
}
.admin-tabs a[aria-current="page"] { color: var(--c-ink); background: var(--c-bg-2); }
.admin-tabs svg { width: 20px; height: 20px; }
.admin-tabs .count { position: absolute; top: 3px; right: calc(50% - 22px); }

/* --- Page head ------------------------------------------------------------ */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem;
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}
.page-head .display { margin-top: 0.5rem; font-size: var(--fs-h2); }
.page-head .lead { margin-top: 0.5rem; font-size: 1.0625rem; max-width: 60ch; }
.page-head .lead a { color: var(--gold-ink); }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; flex-shrink: 0; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.8rem; }
.foot-notes { margin-top: 1.5rem; display: grid; gap: 0.3rem; }
.foot-notes a { color: var(--gold-ink); }

/* --- Panels --------------------------------------------------------------- */
.panel { padding: 1.35rem 1.4rem 1.5rem; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head .h3 { font-size: 1.0625rem; }
.panel-head form { margin: 0; flex-shrink: 0; }
.panel-head .link { font-size: var(--fs-sm); }
.help { margin-top: 0.25rem; font-size: var(--fs-xs); color: var(--c-ink-3); max-width: 60ch; }
.stack { display: grid; gap: 1.1rem; min-width: 0; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-top: 1.1rem; }
button.link { border: 0; background: transparent; padding: 0; cursor: pointer; }

/* --- Stat tiles ----------------------------------------------------------- */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
.stat-tile { display: grid; gap: 0.35rem; align-content: start; padding: 1.3rem 1.4rem 1.35rem; }
.stat-k { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-ink-3); }
.stat-v {
    font-size: clamp(1.9rem, 3vw, 2.5rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1;
    color: var(--c-ink); font-variant-numeric: tabular-nums;
}
.stat-v small { font-size: 0.45em; font-weight: 500; color: var(--c-ink-2); letter-spacing: -0.01em; margin-left: 0.25em; }
.stat-n { font-size: var(--fs-xs); color: var(--c-ink-3); }
.stat-tile.is-hot .stat-v { color: var(--gold-ink); }

/* --- Rows (compact lists in panels) --------------------------------------- */
.rows { display: grid; }
.row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem;
    padding: 0.75rem 0; border-top: 1px solid var(--c-line);
}
.row.row-2 { grid-template-columns: minmax(0, 1fr) auto; }
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row-main { display: grid; gap: 0.15rem; min-width: 0; }
.row-main strong { font-weight: 600; font-size: var(--fs-sm); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--t) ease; }
.row-main span { font-size: var(--fs-xs); color: var(--c-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main:hover strong { color: var(--gold-ink); }
.row-side { display: grid; justify-items: end; gap: 0.15rem; font-size: var(--fs-sm); }
.row form { margin: 0; }

/* --- Status pills and dots ------------------------------------------------ */
.pill {
    display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.28rem 0.65rem; border-radius: 999px;
    font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-new { background: var(--gold-3); color: #5b4708; }
.pill-confirmed, .pill-replied { background: rgba(31,138,91,0.12); color: #14663f; }
.pill-deposit { background: rgba(126,197,224,0.3); color: #1f5a70; }
.pill-completed, .pill-archived { background: rgba(0,0,0,0.06); color: var(--c-ink-2); }
.pill-cancelled { background: rgba(208,52,44,0.1); color: #a3231c; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-new { background: var(--gold); }
.dot-confirmed, .dot-replied { background: var(--green); }
.dot-deposit { background: var(--sky); }
.dot-completed, .dot-archived { background: var(--c-ink-3); }
.dot-cancelled { background: var(--red); }

/* --- Agenda --------------------------------------------------------------- */
.agenda { display: grid; }
.agenda-day { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0.9rem; padding: 0.55rem 0; border-top: 1px solid var(--c-line); }
.agenda-day:first-child { border-top: 0; padding-top: 0; }
.agenda-day:last-child { padding-bottom: 0; }
.agenda-date { display: grid; justify-items: center; align-content: start; padding: 0.35rem 0; border-radius: 12px; background: var(--c-bg-2); }
.agenda-date b { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.agenda-date span { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-ink-3); }
.agenda-day.is-today .agenda-date { background: var(--c-ink); color: #fff; }
.agenda-day.is-today .agenda-date span { color: rgba(255,255,255,0.7); }
.agenda-items { display: grid; gap: 0.3rem; align-content: center; min-width: 0; }
.agenda-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.55rem; font-size: var(--fs-sm); }
.agenda-what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--t) ease; }
.agenda-what strong { font-weight: 600; }
.agenda-item:hover .agenda-what { color: var(--gold-ink); }
.agenda-none { font-size: var(--fs-xs); color: var(--c-ink-3); }
.agenda-day.is-empty { padding: 0.35rem 0; }
.agenda-day.is-empty .agenda-date { opacity: 0.55; }

/* --- Bars ----------------------------------------------------------------- */
.bars { display: grid; gap: 0.75rem; }
.bars li { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; font-size: var(--fs-sm); }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 10px; border-radius: 999px; background: var(--c-bg-2); overflow: hidden; }
/* The fill spans the track and is revealed through a rounded clip, so
   growing in never touches layout (same trick as the site's segmented control). */
.bar i {
    display: block; height: 100%; width: 100%; border-radius: inherit;
    background: linear-gradient(90deg, var(--gold-2), var(--gold));
    clip-path: inset(0 calc(100% - var(--w)) 0 0 round 999px);
    transition: clip-path 900ms var(--ease-out);
}
html.js .bar i:not(.is-in) { clip-path: inset(0 100% 0 0 round 999px); }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bar-val small { font-weight: 400; color: var(--c-ink-3); margin-left: 0.35rem; }

/* --- Filters -------------------------------------------------------------- */
.filters { display: grid; gap: 0.9rem; padding: 0.9rem 1rem; margin-bottom: 1.1rem; }
.seg-links { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,0.05); overflow-x: auto; scrollbar-width: none; max-width: 100%; justify-self: start; }
.seg-links::-webkit-scrollbar { display: none; }
.seg-link {
    display: inline-flex; align-items: center; padding: 0.42rem 0.9rem; border-radius: 999px;
    font-size: var(--fs-sm); font-weight: 500; color: var(--c-ink-2); white-space: nowrap;
    transition: color var(--t) ease, background-color var(--t) ease;
}
.seg-link[aria-current] { background: #fff; color: var(--c-ink); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.06); }
.seg-link .count { margin-left: 0.4rem; }
.filter-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }
.filter-fields input, .filter-fields select {
    min-height: 38px; padding: 0 0.8rem; border: 1px solid var(--c-line-2); border-radius: 10px;
    background: var(--c-surface); font: inherit; font-size: var(--fs-sm); color: var(--c-ink); letter-spacing: inherit;
    transition: border-color var(--t) ease, box-shadow var(--t) ease;
}
.filter-fields input:focus, .filter-fields select:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,162,39,0.18); }
.search { position: relative; flex: 1 1 240px; }
.search svg { position: absolute; left: 0.7rem; top: 50%; translate: 0 -50%; width: 15px; height: 15px; color: var(--c-ink-3); pointer-events: none; }
.search input { width: 100%; padding-left: 2.1rem; }

/* --- Table ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
    text-align: left; padding: 0.9rem 1rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--c-ink-3); border-bottom: 1px solid var(--c-line); white-space: nowrap;
}
.table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--c-line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .sub { display: block; font-size: var(--fs-xs); color: var(--c-ink-3); margin-top: 0.1rem; }
.table td[data-label="Tour date"], .table td[data-label="Received"], .table td[data-label="Tour"] .sub { white-space: nowrap; }
.table strong { font-weight: 600; }
.table tr.clickable { cursor: pointer; transition: background-color var(--t) ease; }
.table tr.clickable:hover { background: rgba(0,0,0,0.025); }
.table tr.is-unread .ref { font-weight: 700; }
.ref { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--c-ink); transition: color var(--t) ease; }
.ref:hover { color: var(--gold-ink); }
.tag-demo { margin-left: 0.4rem; padding: 0.2rem 0.45rem; background: var(--c-bg-2); color: var(--c-ink-3); font-size: 0.625rem; -webkit-backdrop-filter: none; backdrop-filter: none; }
.empty-cell { text-align: center; padding: 3rem 1rem !important; color: var(--c-ink-3); }
.empty-cell .link { margin-left: 0.4rem; }

/* --- Pager ---------------------------------------------------------------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 0.4rem; margin-top: 1.25rem; font-size: var(--fs-sm); }
.pager a, .pager span { min-width: 36px; height: 36px; padding: 0 0.7rem; display: inline-grid; place-items: center; border-radius: 999px; }
.pager a { background: var(--c-surface); box-shadow: var(--shadow-sm); transition: background-color var(--t) ease, color var(--t) ease; }
.pager a:hover { background: var(--c-ink); color: #fff; }
.pager .is-current { background: var(--c-ink); color: #fff; }

/* --- Detail: key and value ------------------------------------------------ */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0.95rem 1.5rem; margin: 0; }
.kv > div { display: grid; gap: 0.15rem; min-width: 0; }
.kv .span { grid-column: 1 / -1; }
.kv dt { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--c-ink-3); }
.kv dd { margin: 0; font-size: var(--fs-sm); color: var(--c-ink); overflow-wrap: anywhere; }
.kv dd .sub { display: block; font-size: var(--fs-xs); color: var(--c-ink-3); }
.kv dd a { color: var(--gold-ink); }
.quote { padding: 0.9rem 1rem; border-radius: 12px; background: var(--c-bg-2); white-space: pre-line; line-height: 1.5; }
.message-body { font-size: var(--fs-body); color: var(--c-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips .chip { font-size: var(--fs-xs); padding: 0.3rem 0.7rem; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; margin-top: 1.25rem; }

/* --- Detail: aside -------------------------------------------------------- */
.admin-aside { display: grid; gap: 1.6rem; }
.admin-aside .h3 { font-size: 0.9375rem; margin-bottom: 0.6rem; }
.admin-aside form { margin: 0; }
.status-list { display: grid; gap: 0.35rem; }
.status-btn {
    display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 42px; padding: 0 0.9rem;
    border: 0; border-radius: 12px; background: var(--c-bg-2); font-size: var(--fs-sm); font-weight: 500;
    color: var(--c-ink); cursor: pointer; text-align: left;
    transition: background-color var(--t) ease, translate 200ms var(--ease-out);
}
.status-btn:hover:not(:disabled) { background: rgba(0,0,0,0.08); translate: 2px 0; }
.status-btn.is-current { background: var(--c-ink); color: #fff; cursor: default; }
.status-btn .xs { margin-left: auto; opacity: 0.7; font-weight: 400; }
.timeline { display: grid; gap: 0.6rem; margin-left: 0.3rem; padding-left: 1rem; border-left: 2px solid var(--c-line); }
.timeline li { position: relative; display: grid; gap: 0.1rem; font-size: var(--fs-xs); }
.timeline li::before { content: ""; position: absolute; left: calc(-1rem - 5px); top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px #fff; }
.timeline b { font-weight: 600; color: var(--c-ink); font-size: var(--fs-sm); }
.timeline span { color: var(--c-ink-3); }
.btn-danger { color: #a3231c; background: transparent; box-shadow: 0 0 0 1px rgba(208,52,44,0.35) inset; }
@media (hover: hover) and (pointer: fine) { .btn-danger:hover { background: rgba(208,52,44,0.06); } }

/* --- Toasts --------------------------------------------------------------- */
.toast-stack { position: fixed; left: 50%; bottom: 1.25rem; translate: -50% 0; z-index: 120; display: grid; gap: 0.5rem; width: min(92vw, 460px); pointer-events: none; }
.toast {
    padding: 0.85rem 1.1rem; border-radius: 14px; background: rgba(28,28,30,0.92); color: #f5f5f7;
    font-size: var(--fs-sm); box-shadow: var(--shadow-lg); cursor: pointer; pointer-events: auto;
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    animation: toast-in 420ms var(--ease-out);
}
.toast.err { background: rgba(163,35,28,0.94); }
.toast.is-leaving { opacity: 0; translate: 0 8px; transition: opacity 240ms ease, translate 240ms ease; }
@keyframes toast-in { from { opacity: 0; translate: 0 12px; } }

/* --- Notices and empty state ---------------------------------------------- */
.notice-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; margin-bottom: 1.25rem; background: linear-gradient(160deg, #fbf3d6, #f6e7b4); color: #5b4708; }
.notice-warn strong, .notice-warn a { color: #3f3105; }
.empty { display: grid; justify-items: center; gap: 0.8rem; padding: clamp(2rem, 6vw, 4rem) 1.5rem; text-align: center; }
.empty p { max-width: 52ch; color: var(--c-ink-2); font-size: var(--fs-sm); }
.empty form { margin-top: 0.4rem; }

/* --- Switch --------------------------------------------------------------- */
.switch { position: relative; display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: rgba(0,0,0,0.16); flex-shrink: 0; transition: background-color var(--t) ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: translate 220ms var(--ease-out); }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { translate: 18px 0; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* --- Settings ------------------------------------------------------------- */
.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 2rem; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--header-h) + 1.25rem); display: grid; gap: 0.15rem; }
.settings-nav a { padding: 0.5rem 0.8rem; border-radius: 10px; font-size: var(--fs-sm); color: var(--c-ink-2); transition: background-color var(--t) ease, color var(--t) ease; }
.settings-nav a:hover { background: rgba(0,0,0,0.05); color: var(--c-ink); }
.settings-nav a.is-active { background: var(--c-surface); color: var(--c-ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.settings-sections { display: grid; gap: 1.25rem; min-width: 0; }
.settings-sections section { scroll-margin-top: calc(var(--header-h) + 1rem); }
.tour-row { padding: 1.1rem 1.15rem; border-radius: var(--r); background: var(--c-bg-2); }
.tour-row + .tour-row { margin-top: 0.8rem; }
.tour-row-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.tour-row-head strong { font-size: 1rem; font-weight: 600; letter-spacing: -0.014em; }
.tour-row-head .xs { display: block; color: var(--c-ink-3); }
.tour-fields { display: grid; grid-template-columns: 0.9fr 1.2fr 1.7fr 0.8fr 1fr; gap: 0.8rem; }
.tour-fields .field label, .tour-row .field label { font-size: var(--fs-xs); color: var(--c-ink-2); }
.tour-row .field input { min-height: 40px; background: #fff; }
.prefix { position: relative; display: block; }
.prefix input { padding-right: 3.4rem; }
.prefix::after { content: attr(data-unit); position: absolute; right: 0.8rem; top: 50%; translate: 0 -50%; font-size: var(--fs-xs); color: var(--c-ink-3); pointer-events: none; }
.prefix[data-unit="VND per USD"] input { padding-right: 6.4rem; }
.field textarea { font-size: var(--fs-sm); line-height: 1.6; }

/* --- Sign in -------------------------------------------------------------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem var(--gutter); background: var(--c-bg-2); }
.login-card { width: min(100%, 400px); padding: 2.25rem 2rem 2rem; text-align: center; }
.login-card .xo-mark { height: 56px; width: auto; margin: 0 auto 1.25rem; }
.login-card .lead { font-size: var(--fs-sm); margin-top: 0.4rem; }
.login-card form { text-align: left; margin-top: 1.5rem; display: grid; gap: 1rem; }
.remember { display: flex; align-items: center; gap: 0.5rem; font-size: var(--fs-sm); color: var(--c-ink-2); cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: var(--gold-ink); }
.login-error { padding: 0.75rem 0.9rem; border-radius: 10px; background: rgba(208,52,44,0.08); color: #a3231c; font-size: var(--fs-sm); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1100px) {
    .stat-tiles { grid-template-columns: repeat(2, 1fr); }
    .tour-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
    .admin-nav, .hbtn-label { display: none; }
    .hbtn { padding: 0 0.6rem; }
    .admin-tabs { display: grid; }
    .admin-main { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
    .toast-stack { bottom: calc(5.25rem + env(safe-area-inset-bottom)); }
    .dash-grid, .settings-layout { grid-template-columns: 1fr; }
    .settings-nav { position: static; display: flex; gap: 0.3rem; overflow-x: auto; padding-bottom: 0.25rem; scrollbar-width: none; }
    .settings-nav::-webkit-scrollbar { display: none; }
    .settings-nav a { white-space: nowrap; }
    .page-head { flex-direction: column; align-items: flex-start; gap: 0.9rem; }
    .bars li { grid-template-columns: 120px minmax(0, 1fr) auto; }
    .kv { grid-template-columns: 1fr; }
    .tour-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .stat-tiles { gap: 0.7rem; }
    .stat-tile { padding: 1rem 1.05rem 1.1rem; }
    .row { grid-template-columns: minmax(0, 1fr) auto; }
    .row form { grid-column: 1 / -1; }
    .row form .btn { width: 100%; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1 1 auto; }
    .filter-fields select, .filter-fields input[type="date"] { flex: 1 1 45%; }
    .filter-fields .btn { flex: 1 1 100%; }
    .bars li { grid-template-columns: 1fr; gap: 0.3rem; }
    /* The table becomes a stack of cards */
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; }
    .table tr { padding: 0.85rem 1rem; border-bottom: 1px solid var(--c-line); }
    .table tr:last-child { border-bottom: 0; }
    .table td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.18rem 0; border: 0; text-align: right; }
    .table td::before { content: attr(data-label); flex-shrink: 0; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--c-ink-3); text-align: left; }
    .table td .sub { display: inline; margin-left: 0.3rem; }
    .empty-cell::before { display: none; }
    .empty-cell { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .toast { animation: none; }
    .bar i { transition: none; clip-path: inset(0 calc(100% - var(--w)) 0 0 round 999px); }
}

/* Paired fields keep their labels level whatever the input heights. */
.admin .field { align-content: start; }
