/*
 * Admin: liquid glass (visionOS / iOS 26), always dark.
 * Spec: docs/superpowers/specs/2026-10-28-admin-liquid-glass-design.md
 * Component vocabulary for page work: .taste-skill/glass/components.md
 *
 * This file is the foundation: fonts, tokens, the photo backdrop, the shell (top bar, icon rail,
 * phone tab bar and "Více" sheet), motion and every generic component. Page-specific rules live in
 * the area files (admin-dashboard.css, admin-calendar.css, admin-events.css, admin-photos.css,
 * admin-pages.css), which the layout links after this file on every admin page.
 *
 * Glass and backdrop roots: backdrop-filter only sees what lies behind the nearest "backdrop root"
 * (an ancestor with filter, opacity < 1, mask, backdrop-filter or a view-transition-name). So glass is
 * never nested inside glass with blur, containers of glass never get those properties, and the page
 * content is named for view transitions only while a transition runs (admin-glass.js adds html.vt).
 *
 * Breakpoints: phone < 768px, tablet 768–1023px, desktop >= 1024px (wide >= 1280px).
 */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/inter-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/inter-latin-ext-400.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/inter-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/inter-latin-ext-700.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
    color-scheme: dark;

    /* Type */
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --fs-large: 34px;   /* page title */
    --fs-title2: 22px;
    --fs-title3: 20px;
    --fs-headline: 17px; /* section title */
    --fs-body: 15px;
    --fs-sub: 13px;     /* secondary */
    --fs-caption: 12px;
    --fs-caption2: 11px;

    /* Text */
    --text: #fff;
    --text-2: rgba(255, 255, 255, 0.7);
    --text-3: rgba(255, 255, 255, 0.48);
    --separator: rgba(255, 255, 255, 0.10);
    --link: #4da3ff;

    /* Apple system colours (dark variants) */
    --blue: #0a84ff;
    --blue-hover: #409cff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --red-text: #ff6961;
    --yellow: #ffd60a;
    --purple: #bf5af2;
    --teal: #64d2ff;
    --pink: #ff375f;
    --indigo: #5e5ce6;
    --indigo-text: #a5a3ff;
    --brown: #ac8e68;
    --gray: #8e8e93;
    --brand: #e6007e; /* only the "rec" dot of the brand mark */
    --accent: var(--blue);

    /* Material: top-level glass (panels, widgets, shell). Swapped for a solid fill when transparency is off. */
    --glass-fill: rgba(255, 255, 255, 0.12);
    --glass-fill-strong: rgba(255, 255, 255, 0.16);
    --glass-fill-hover: rgba(255, 255, 255, 0.16);
    --glass-stroke: rgba(255, 255, 255, 0.16);
    --glass-rim: inset 0 1px 0 rgba(255, 255, 255, 0.32);
    --glass-glow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 0 28px rgba(255, 255, 255, 0.035);
    --glass-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.45);
    --glass-shadow-sm: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --glass-depth: var(--glass-rim), var(--glass-glow), var(--glass-shadow);
    --glass-blur: blur(40px) saturate(150%) brightness(0.62);
    --glass-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.025) 38%, rgba(255, 255, 255, 0) 70%);
    --glass-solid: rgba(28, 28, 32, 0.94);
    --glass-flat: rgba(58, 58, 68, 0.72); /* stand-in for blurred glass inside a view-transition snapshot */

    /* Selection pills (also drawn by the view-transition group while they morph) */
    --pill-nav: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.15));
    --pill-nav-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.10), 0 4px 14px -4px rgba(0, 0, 0, 0.45);
    --pill-rail: linear-gradient(180deg, #fff, #e9e9ee);
    --pill-rail-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.08);
    --pill-tab: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.10));
    --pill-tab-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.07);

    /* Fills inside glass (never blurred, unaffected by the reduced-transparency swap) */
    --fill-1: rgba(255, 255, 255, 0.04);
    --fill-2: rgba(255, 255, 255, 0.07);
    --fill-3: rgba(255, 255, 255, 0.10);
    --fill-4: rgba(255, 255, 255, 0.16);
    --fill-dim: rgba(0, 0, 0, 0.22);

    /* Status tints (capsules, notices) */
    --tint-blue: rgba(10, 132, 255, 0.18);
    --tint-green: rgba(48, 209, 88, 0.16);
    --tint-orange: rgba(255, 159, 10, 0.16);
    --tint-red: rgba(255, 69, 58, 0.16);
    --tint-indigo: rgba(94, 92, 230, 0.24);
    --tint-purple: rgba(191, 90, 242, 0.18);
    --tint-teal: rgba(100, 210, 255, 0.16);

    /* Fields */
    --field-fill: rgba(0, 0, 0, 0.22);
    --field-stroke: rgba(255, 255, 255, 0.10);
    --focus-ring: 0 0 0 3px rgba(10, 132, 255, 0.45);

    /* Radii */
    --r-panel: 28px;   /* window panels */
    --r-card: 22px;    /* cards, widgets */
    --r-row: 14px;     /* inner rows, thumbnails */
    --r-field: 12px;
    --r-control: 999px; /* buttons, capsules, switches, segmented */

    /* Layout */
    --edge: 16px;      /* distance of the floating shell from the viewport edge */
    --topbar-h: 52px;
    --rail-w: 60px;
    --tabbar-h: 64px;
    --pad: 32px;
    --gap: 16px;
    --card-pad: 22px;
    --control-h: 40px;
    --field-h: 44px;
    --content-max: 1360px;

    /* Motion */
    --spring: cubic-bezier(0.2, 0.9, 0.25, 1);
    --spring-bounce: cubic-bezier(0.3, 1.3, 0.5, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --t-press: 120ms;
    --t-hover: 180ms;
    --t-move: 420ms;
}

/* No backdrop-filter, or the viewer asked for less transparency: solid dark material. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root { --glass-fill: var(--glass-solid); --glass-fill-strong: rgba(44, 44, 50, 0.97); --glass-fill-hover: rgba(52, 52, 58, 0.97); --glass-blur: none; }
}
@media (prefers-reduced-transparency: reduce) {
    :root { --glass-fill: var(--glass-solid); --glass-fill-strong: rgba(44, 44, 50, 0.97); --glass-fill-hover: rgba(52, 52, 58, 0.97); --glass-blur: none; --glass-sheen: none; }
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
    min-height: 100%;
    background: #0a0a0f;
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

body {
    min-height: 100vh;
    margin: 0;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: var(--fs-body);
    line-height: 1.4;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); text-wrap: balance; }
h1 { font-size: var(--fs-large); line-height: 1.18; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-headline); line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-body); line-height: 1.35; font-weight: 600; }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }

a { color: var(--link); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 50%, transparent); }

:focus-visible { outline: 2px solid var(--blue-hover); outline-offset: 2px; }
::selection { background: rgba(10, 132, 255, 0.55); color: #fff; }

[hidden] { display: none !important; }

.icon { flex: none; width: 1.25em; height: 1.25em; }

.num, .tabular { font-variant-numeric: tabular-nums; }
.num { text-align: right; }
.hint, .muted { color: var(--text-2); font-size: var(--fs-sub); line-height: 1.45; }
.hint + .hint { margin-top: 4px; }
.secondary { color: var(--text-2); }
.tertiary { color: var(--text-3); }

/* Type scale utilities */
.title-large { font-family: var(--font-display); font-size: var(--fs-large); line-height: 1.18; font-weight: 700; letter-spacing: -0.02em; }
.title-2 { font-family: var(--font-display); font-size: var(--fs-title2); line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; }
.title-3 { font-family: var(--font-display); font-size: var(--fs-title3); line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.headline { font-size: var(--fs-headline); line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.subhead { font-size: var(--fs-body); }
.footnote { font-size: var(--fs-sub); line-height: 1.4; }
.caption { font-size: var(--fs-caption); line-height: 1.35; color: var(--text-2); }
.overline { font-size: var(--fs-caption); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip-link {
    position: fixed;
    left: 16px;
    top: -80px;
    z-index: 100;
    padding: 10px 18px;
    border-radius: var(--r-control);
    background: var(--blue);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* Status dots */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.dot-ok { background: var(--green); }
.dot-warn { background: var(--orange); }
.dot-error { background: var(--red); }
.dot-accent, .dot-unread { background: var(--blue); }

/* ==========================================================================
   Glass material
   ========================================================================== */

.glass,
.panel,
.widget,
.topnav,
.topbar__brand,
.icon-btn,
.account__button,
.rail,
.tabbar,
.banner,
.popover,
.sheet,
.toast,
.login-box {
    background: var(--glass-sheen), var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    box-shadow: var(--glass-depth);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}
.glass-strong,
.popover,
.sheet,
.toast,
.tabbar {
    background: var(--glass-sheen), var(--glass-fill-strong);
}

/* ==========================================================================
   Backdrop: the home-page slideshow, blurred and darkened, behind everything
   ========================================================================== */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(70% 60% at 18% 12%, rgba(64, 86, 140, 0.55), transparent 70%),
        radial-gradient(60% 55% at 85% 88%, rgba(120, 62, 140, 0.45), transparent 70%),
        radial-gradient(50% 50% at 70% 20%, rgba(30, 110, 130, 0.30), transparent 70%),
        #0b0c12;
}
.backdrop__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    opacity: 0;
    filter: blur(22px) saturate(1.15) brightness(0.82);
    transform: scale(1.08);
    transition: opacity 1.6s ease;
}
.backdrop__img.is-current { opacity: 1; }
/* Tint and vignette: keeps white text on the glass above 4.5:1 whatever the photo. */
.backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(4, 4, 8, 0.34), rgba(4, 4, 8, 0) 26%),
        radial-gradient(120% 95% at 50% 40%, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.36) 100%),
        rgba(8, 8, 14, 0.14);
}

/* ==========================================================================
   Shell
   ========================================================================== */

/* --- Brand mark (also used by the login card and the install wizard) --- */
.mark { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none; }
.mark:hover { text-decoration: none; }
.mark__rec { position: relative; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(230, 0, 126, 0.22), 0 0 12px rgba(230, 0, 126, 0.6); }
.mark__text { display: flex; flex-direction: column; min-width: 0; }
.mark__name { overflow: hidden; font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; letter-spacing: -0.01em; }
.mark__scope { color: var(--text-2); font-size: var(--fs-caption2); line-height: 1.25; }

/* --- Top bar --- */
.topbar {
    position: fixed;
    top: var(--edge);
    left: var(--edge);
    right: var(--edge);
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    pointer-events: none;
}
.topbar > * { pointer-events: auto; }
/* Scroll edge: content passing under the bar softens into a dark blur instead of colliding with it. */
.topbar::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    z-index: -1;
    height: calc(var(--edge) + var(--topbar-h) + 28px);
    background: linear-gradient(180deg, rgba(6, 6, 10, 0.55), rgba(6, 6, 10, 0));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    -webkit-mask-image: linear-gradient(180deg, #000 35%, transparent);
    mask-image: linear-gradient(180deg, #000 35%, transparent);
    pointer-events: none;
}
.topbar__brand { justify-self: start; height: 44px; padding: 0 16px 0 15px; border-radius: var(--r-control); }
.topbar__actions { display: flex; align-items: center; justify-self: end; gap: 8px; }

/* --- Centred pill navigation --- */
.topnav { justify-self: center; max-width: 100%; padding: 3px; border-radius: var(--r-control); } /* 3 + 36 + 3 + 2px border = 44px, like the brand and the icon buttons */
.topnav__list { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; }
.topnav__link {
    position: relative;
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 16px 0 14px;
    border-radius: var(--r-control);
    color: rgba(255, 255, 255, 0.84);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
    text-decoration: none;
    transition: color var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out);
}
.topnav__content { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; }
.topnav__link .icon { width: 18px; height: 18px; }
.topnav__link:hover { color: #fff; background: var(--fill-2); text-decoration: none; }
.topnav__link:active { transform: scale(0.97); }
.topnav__link[aria-current="page"] { color: #fff; font-weight: 600; background: none; }

/* The "liquid" pill under the active item. Moving to another section of the same bar morphs it from
   the old item to the new one (cross-document view transition, see Motion). Paint order
   matters for that: the links are not stacking contexts, the pills sit at z-index 0 and every item's
   content (.topnav__content, .rail__content, .tabbar__content) at z-index 1 of the bar's stacking
   context, so all pills paint before all labels and the morphing pill slides under the labels. */
.nav-pill, .rail-pill, .tab-pill {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    pointer-events: none;
}
.nav-pill { background: var(--pill-nav); box-shadow: var(--pill-nav-shadow); }

/* --- Round glass icon buttons (top bar) --- */
.icon-btn {
    position: relative;
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.86);
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--glass-sheen), var(--glass-fill-hover); color: #fff; text-decoration: none; }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.is-current { background: var(--glass-sheen), var(--glass-fill-strong); color: #fff; }
.icon-btn-sm { width: 32px; height: 32px; }
.icon-btn-sm .icon { width: 16px; height: 16px; }

/* Status dot on an icon (Drive) and the count badge (unread inquiries) */
.status-dot {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 2px rgba(20, 20, 26, 0.9);
}
.status-dot--warn { background: var(--orange); }
.status-dot--error { background: var(--red); }
.count-badge {
    position: absolute;
    top: 2px;
    right: 0;
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--r-control);
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px rgba(20, 20, 26, 0.9);
}

/* --- Avatar menu (works without JS: <details>) --- */
.account { position: relative; }
.account > summary { list-style: none; }
.account > summary::-webkit-details-marker { display: none; }
.account__button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 3px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--t-press) var(--ease-out);
}
.account__button:active { transform: scale(0.94); }
.account__button .avatar { width: 36px; height: 36px; font-size: 13px; }
.account[open] > .account__button { box-shadow: var(--glass-depth), 0 0 0 3px rgba(255, 255, 255, 0.18); }
.account__menu { position: absolute; top: calc(100% + 10px); right: 0; width: 260px; transform-origin: top right; animation: glass-pop 220ms var(--spring) both; }
.account__head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.account__head .avatar { width: 40px; height: 40px; font-size: 14px; }
.account__name { font-size: var(--fs-body); font-weight: 600; line-height: 1.25; }
.account__role { color: var(--text-2); font-size: var(--fs-caption); }
.account__menu .menu__rail { display: none; }

/* --- Popovers and menus --- */
.popover { z-index: 60; min-width: 220px; padding: 6px; border-radius: 20px; color: var(--text); }
.popover[popover] { position: fixed; inset: auto; margin: 0; left: var(--pop-x, 50%); top: var(--pop-y, 50%); max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow: auto; }
.popover[popover]:popover-open { animation: glass-pop 220ms var(--spring) both; }
.popover[popover]::backdrop { background: transparent; }
.popover__title { padding: 8px 10px 4px; font-size: var(--fs-headline); font-weight: 600; }
.popover__body { padding: 4px 10px 10px; color: var(--text-2); font-size: var(--fs-sub); }
.popover__actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 6px 4px; }
.menu { margin: 0; padding: 0; list-style: none; }
.menu form { margin: 0; }
.menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--text);
    font-size: var(--fs-body);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--t-hover) var(--ease-out);
}
.menu__item .icon { width: 19px; height: 19px; color: var(--text-2); }
.menu__item:hover, .menu__item:focus-visible { background: var(--fill-3); text-decoration: none; }
.menu__item[aria-current="page"] { background: var(--fill-2); font-weight: 600; }
.menu__item[aria-current="page"] .icon { color: var(--blue-hover); }
.menu__item--danger, .menu__item--danger .icon { color: var(--red-text); }
.menu__trail { margin-left: auto; color: var(--text-3); font-size: var(--fs-sub); }
.menu__sep { height: 1px; margin: 6px 10px; background: var(--separator); }

/* --- Left icon rail (desktop) --- */
.rail {
    position: fixed;
    top: 50%;
    left: var(--edge);
    z-index: 35;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: var(--rail-w);
    padding: 7px;
    border-radius: var(--r-control);
    transform: translateY(-50%);
}
.rail__link {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    transition: color var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.rail__content { position: relative; z-index: 1; display: grid; place-items: center; }
.rail__link .icon { width: 21px; height: 21px; }
.rail__link:hover { background: var(--fill-3); color: #fff; text-decoration: none; }
.rail__link:active { transform: scale(0.94); }
.rail__link[aria-current="page"] { color: #111216; }
.rail-pill { background: var(--pill-rail); box-shadow: var(--pill-rail-shadow); }
.rail__link .status-dot { top: -3px; right: -4px; }
/* Tooltip: the link's accessible name, shown beside the rail on hover and keyboard focus. */
.rail__tip {
    position: absolute;
    top: 50%;
    left: calc(100% + 14px);
    z-index: 2;
    padding: 6px 11px;
    border-radius: 10px;
    background: rgba(36, 36, 42, 0.94);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10), 0 8px 24px -6px rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: var(--fs-sub);
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-6px, -50%);
    transition: opacity 140ms var(--ease-out), transform 200ms var(--spring);
    pointer-events: none;
}
.rail__link:hover .rail__tip, .rail__link:focus-visible .rail__tip { opacity: 1; transform: translate(0, -50%); }
/* Generic tooltip in content: <x class="has-tip" aria-label="…">…<span class="tip" aria-hidden="true">…</span></x>.
   Centred above the trigger; display:none while hidden so it never widens the page. */
.has-tip { position: relative; }
.tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 20;
    display: none;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(36, 36, 42, 0.96);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10), 0 8px 24px -6px rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: var(--fs-caption);
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    transform: translateX(-50%);
    pointer-events: none;
}
@keyframes tip-in { from { opacity: 0; translate: 0 4px; } to { opacity: 1; translate: none; } }
.has-tip:hover > .tip, .has-tip:focus-visible > .tip { display: block; animation: tip-in 160ms var(--ease-out) both; }
@media (hover: none) { .has-tip:hover > .tip { display: none; } }

/* --- Slim status banner (Drive needs reconnecting) --- */
.banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 20px;
    padding: 8px 8px 8px 16px;
    border-radius: 24px;
    font-size: var(--fs-sub);
}
.banner .icon { width: 18px; height: 18px; }
.banner-warning .icon { color: var(--orange); }
.banner-error .icon { color: var(--red); }
.banner .btn { margin-left: 4px; }

/* --- Phone tab bar and the "Více" sheet --- */
.tabbar, .sheet-toggle, .sheet-scrim, .more-sheet { display: none; }

/* --- Content area --- */
.admin-main {
    width: 100%;
    max-width: calc(var(--content-max) + var(--edge) + var(--rail-w) + 28px + var(--pad));
    margin: 0 auto;
    padding: calc(var(--edge) + var(--topbar-h) + 30px) var(--pad) 72px calc(var(--edge) + var(--rail-w) + 28px);
}
.admin-main:focus { outline: none; }

/* --- Toasts (session flashes). Without JS they sit in the page flow; with JS they float and dismiss. --- */
.toasts { display: grid; gap: 8px; margin: 0 0 20px; }
.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 14px 13px 15px;
    border-radius: 20px;
    font-size: var(--fs-body);
    line-height: 1.4;
}
.toast > .icon { width: 22px; height: 22px; margin-top: -1px; }
.toast-success > .icon { color: var(--green); }
.toast-warning > .icon { color: var(--orange); }
.toast-error > .icon { color: var(--red); }
.toast__text { flex: 1; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.toast__text a { color: inherit; font-weight: 600; text-decoration: underline; }
.toast__close {
    display: grid;
    flex: none;
    place-items: center;
    width: 26px;
    height: 26px;
    margin: -2px -2px -2px 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--fill-2);
    color: var(--text-2);
    cursor: pointer;
}
.toast__close:hover { background: var(--fill-4); color: #fff; }
.toast__close .icon { width: 14px; height: 14px; }
html.js .toasts {
    position: fixed;
    top: calc(var(--edge) + var(--topbar-h) + 12px);
    right: var(--edge);
    z-index: 80;
    width: min(380px, calc(100vw - 2 * var(--edge)));
    margin: 0;
    gap: 10px;
    pointer-events: none;
}
html.js .toast { pointer-events: auto; animation: toast-in 520ms var(--spring) both; }
html.js .toast:nth-child(2) { animation-delay: 80ms; }
html.js .toast:nth-child(3) { animation-delay: 160ms; }
html.js .toast.is-leaving { animation: toast-out 320ms var(--ease-in) both; }

/* --- Tablet: the rail's items move into the avatar menu; the pill nav scrolls if it must. --- */
@media (max-width: 1279.98px) {
    .topbar__brand .mark__scope { display: none; }
}
@media (max-width: 1023.98px) {
    :root { --pad: 24px; }
    .rail { display: none; }
    .account__menu .menu__rail { display: block; }
    .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
    .topbar__brand { padding: 0 14px 0 15px; }
    .topbar__brand .mark__text { display: none; }
    .topbar__brand { width: 44px; padding: 0; justify-content: center; }
    .topnav { overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
    .topnav::-webkit-scrollbar { display: none; }
    .topnav__link { padding: 0 14px 0 12px; }
    .topbar__actions [data-shell="site"] { display: none; }
    .admin-main { padding: calc(var(--edge) + var(--topbar-h) + 28px) var(--pad) 64px; }
}

/* --- Phone: compact top bar, floating tab bar, "Více" sheet --- */
@media (max-width: 767.98px) {
    :root { --edge: 12px; --pad: 16px; --card-pad: 18px; --r-panel: 24px; --fs-large: 30px; }
    .topbar { top: calc(env(safe-area-inset-top) + 8px); grid-template-columns: minmax(0, 1fr) auto; height: 48px; }
    .topbar::before { height: calc(env(safe-area-inset-top) + 72px); }
    .topnav, .topbar__actions > .icon-btn { display: none; }
    .topbar__brand { width: auto; height: 42px; padding: 0 14px 0 13px; }
    .topbar__brand .mark__text { display: flex; }
    .account__button { width: 42px; height: 42px; }
    .account__button .avatar { width: 34px; height: 34px; }
    .account__menu { width: min(280px, calc(100vw - 24px)); }
    .account__menu .menu__rail { display: none; }
    .admin-main { padding: calc(env(safe-area-inset-top) + 8px + 48px + 22px) var(--pad) calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }

    .tabbar {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 2px;
        height: var(--tabbar-h);
        padding: 6px;
        border-radius: 32px;
    }
    .tabbar__item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-width: 0;
        border-radius: 26px;
        color: rgba(255, 255, 255, 0.78);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0;
        text-decoration: none;
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
        transition: color var(--t-hover) var(--ease-out), transform var(--t-press) var(--ease-out);
    }
    .tabbar__content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 100%; min-width: 0; }
    .tabbar__item .icon { width: 24px; height: 24px; }
    .tabbar__item:active { transform: scale(0.94); }
    label.tabbar__item { margin: 0; font-size: 10px; } /* "Více" is a <label>: drop the form-label rhythm */
    .tabbar__item:hover { text-decoration: none; }
    .tabbar__label { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .tabbar__item[aria-current="page"], .tabbar__item.is-current { color: var(--blue-hover); }
    .tab-pill { background: var(--pill-tab); box-shadow: var(--pill-tab-shadow); }
    .tabbar .count-badge { top: -4px; right: auto; left: calc(50% + 5px); }

    /* The toggle is a real checkbox (keyboard: Space), visually hidden; the "Více" tab is its label. */
    .sheet-toggle { display: block; position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
    .sheet-toggle:focus-visible + .tabbar__more { outline: 2px solid var(--blue-hover); outline-offset: -2px; }
    .sheet-toggle:checked + .tabbar__more { color: #fff; }
    .sheet-scrim {
        position: fixed;
        inset: 0;
        z-index: 65;
        display: block;
        background: rgba(0, 0, 0, 0.45);
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 280ms var(--ease-out), visibility 0s linear 280ms;
        cursor: pointer;
    }
    .more-sheet {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        z-index: 70;
        display: block;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 8px 12px 14px;
        border-radius: 32px;
        visibility: hidden;
        transform: translateY(calc(100% + 32px));
        transition: transform 460ms var(--spring), visibility 0s linear 460ms;
    }
    body:has(.sheet-toggle:checked) .sheet-scrim { opacity: 1; visibility: visible; transition: opacity 280ms var(--ease-out); }
    body:has(.sheet-toggle:checked) .more-sheet { visibility: visible; transform: none; transition: transform 460ms var(--spring); }
    html:has(.sheet-toggle:checked) { overflow: hidden; }

    html.js .toasts { top: calc(env(safe-area-inset-top) + 64px); right: 12px; left: 12px; width: auto; }
}

/* ==========================================================================
   Sheets (phone "Více" sheet, generic bottom sheets)
   ========================================================================== */

.sheet { border-radius: 32px; color: var(--text); }
.sheet__grabber { width: 36px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
.sheet__title { padding: 2px 8px 10px; font-size: var(--fs-headline); font-weight: 600; text-align: center; }
.sheet__group { margin: 0 0 10px; padding: 4px; border-radius: 20px; background: var(--fill-2); list-style: none; }
.sheet__group:last-child { margin-bottom: 0; }
.sheet__row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 50px;
    padding: 8px 10px;
    border: 0;
    border-radius: 16px;
    background: none;
    color: var(--text);
    font-size: 16px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.sheet__row:hover, .sheet__row:active { background: var(--fill-2); text-decoration: none; }
.sheet__row[aria-current="page"] { background: var(--fill-3); font-weight: 600; }
.sheet__row > .icon:last-child { width: 16px; height: 16px; margin-left: auto; color: var(--text-3); }
.sheet__row--danger { color: var(--red-text); }
.sheet__group form { margin: 0; }
.sheet__meta { margin-left: auto; color: var(--text-3); font-size: var(--fs-sub); }
.sheet__meta + .icon { margin-left: 0 !important; }

/* iOS-settings icon tile */
.tile-icon {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--tile, var(--blue));
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.tile-icon .icon { width: 18px; height: 18px; }
.tile-icon-lg { width: 44px; height: 44px; border-radius: 12px; }
.tile-icon-lg .icon { width: 24px; height: 24px; }
.tile-blue { --tile: var(--blue); }
.tile-green { --tile: var(--green); }
.tile-orange { --tile: var(--orange); }
.tile-red { --tile: var(--red); }
.tile-yellow { --tile: #d6a800; }
.tile-purple { --tile: var(--purple); }
.tile-teal { --tile: #2aa9d6; }
.tile-pink { --tile: var(--pink); }
.tile-indigo { --tile: var(--indigo); }
.tile-gray { --tile: #636366; }
.tile-glass { --tile: var(--fill-3); }

/* ==========================================================================
   Page header
   ========================================================================== */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin: 0 0 26px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { overflow-wrap: anywhere; }
.page-sub { margin-top: 4px; color: var(--text-2); font-size: var(--fs-body); line-height: 1.4; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-main > h1 { margin-bottom: 24px; }
.section-title { margin: 28px 4px 10px; color: var(--text-2); font-size: var(--fs-sub); font-weight: 600; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    --btn-h: var(--control-h);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--btn-h);
    padding: 0 18px;
    border: 0;
    border-radius: var(--r-control);
    background: var(--blue);
    color: #fff;
    font-size: var(--fs-body);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 20px -8px rgba(10, 132, 255, 0.7);
    transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out);
}
.btn .icon { width: 18px; height: 18px; margin-left: -3px; }
.btn:hover { background: var(--blue-hover); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--fill-2); color: var(--text-3); box-shadow: none; cursor: not-allowed; transform: none; }
.btn-primary { /* alias of .btn kept for older markup */ }
.btn-secondary {
    background: var(--fill-3);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}
.btn-secondary:hover { background: var(--fill-4); }
.btn-danger {
    background: var(--tint-red);
    color: var(--red-text);
    box-shadow: inset 0 0 0 1px rgba(255, 69, 58, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn-danger:hover { background: rgba(255, 69, 58, 0.26); }
.btn-danger-filled, .confirm-dialog .btn-danger { background: var(--red); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 20px -8px rgba(255, 69, 58, 0.7); }
.btn-danger-filled:hover, .confirm-dialog .btn-danger:hover { background: #ff5e55; }
.btn-ghost { background: transparent; color: var(--link); box-shadow: none; }
.btn-ghost:hover { background: var(--fill-2); }
.btn-small { --btn-h: 32px; gap: 6px; padding: 0 14px; font-size: var(--fs-sub); }
.btn-small .icon { width: 16px; height: 16px; }
.btn-large { --btn-h: 50px; padding: 0 26px; font-size: 17px; }
.btn-block { width: 100%; }
.btn-link { min-height: 0; padding: 0; background: none; color: var(--link); font-weight: 500; box-shadow: none; }
.btn-link:hover { background: none; text-decoration: underline; }
/* Small round icon button inside content (reorder arrows, row actions) */
.btn-icon {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--fill-3);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: background-color var(--t-hover) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.btn-icon .icon { width: 16px; height: 16px; }
.btn-icon:hover { background: var(--fill-4); }
.btn-icon:active { transform: scale(0.92); }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon--danger { background: var(--tint-red); color: var(--red-text); box-shadow: inset 0 0 0 1px rgba(255, 69, 58, 0.28); }
.btn-icon--danger:hover { background: rgba(255, 69, 58, 0.26); }
.btn-icon--plain { background: none; box-shadow: none; color: var(--text-2); }
.btn-icon--plain:hover { background: var(--fill-3); color: #fff; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
form.inline { display: inline; }

@media (max-width: 767.98px) {
    :root { --control-h: 44px; }
    .btn-small { --btn-h: 38px; padding: 0 15px; font-size: 14px; }
    .btn-icon { width: 40px; height: 40px; }
}

/* ==========================================================================
   Panels, cards, widgets
   ========================================================================== */

.panel { position: relative; min-width: 0; margin: 0; padding: var(--card-pad); border-radius: var(--r-panel); }
.panel + .panel { margin-top: var(--gap); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; margin-bottom: 14px; }
.panel-head h2 { min-width: 0; }
.panel-head > a, .panel-head .panel-link { flex: none; color: var(--link); font-size: var(--fs-sub); font-weight: 500; white-space: nowrap; }
.panel-head .hint { margin-top: 2px; }
.panel-foot { margin-top: 14px; }
.panel-flush { padding: 8px; }

/* Card: an inner surface on glass (no blur of its own) */
.card { position: relative; min-width: 0; padding: 16px; border-radius: var(--r-card); background: var(--fill-2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.card-inset { border-radius: var(--r-row); background: var(--fill-dim); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }

/* Widget: an iOS home-screen style glass tile */
.widget { position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 18px; border-radius: var(--r-card); color: var(--text); }
.widget__head { display: flex; align-items: center; gap: 8px; min-height: 24px; color: var(--text-2); font-size: var(--fs-sub); font-weight: 600; }
.widget__head .icon { width: 17px; height: 17px; }
.widget__head .tile-icon { width: 24px; height: 24px; border-radius: 7px; }
.widget__head .tile-icon .icon { width: 15px; height: 15px; }
.widget__head > a, .widget__link { margin-left: auto; color: var(--link); font-weight: 500; }
.widget__value { font-family: var(--font-display); font-size: var(--fs-large); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.widget__label { color: var(--text-2); font-size: var(--fs-sub); }
.widget__foot { margin-top: auto; }

/* Hover lift for anything clickable that looks like a surface */
a.widget, a.card, .lift { transition: transform 260ms var(--spring), box-shadow 260ms var(--ease-out), background-color var(--t-hover) var(--ease-out); }
a.widget:hover, a.card:hover, .lift:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.10), 0 30px 60px -14px rgba(0, 0, 0, 0.55);
    text-decoration: none;
}
a.widget:active, a.card:active, .press:active { transform: scale(0.98); }

/* ==========================================================================
   Notices, banners, capsules, badges
   ========================================================================== */

.notice, .alert {
    display: block;
    margin: 0 0 16px;
    padding: 13px 16px;
    border-radius: 16px;
    background: var(--fill-2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
    color: var(--text);
    line-height: 1.45;
}
.notice-success { background: rgba(48, 209, 88, 0.12); box-shadow: inset 0 0 0 1px rgba(48, 209, 88, 0.28); }
.notice-warning { background: rgba(255, 159, 10, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 159, 10, 0.30); color: #ffe2b8; }
.notice-error, .alert-error { background: rgba(255, 69, 58, 0.13); box-shadow: inset 0 0 0 1px rgba(255, 69, 58, 0.32); color: #ffc9c4; }
.notice a, .alert a { color: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }

/* Status capsules: .capsule (new) and .badge (older markup) share one look. */
.badge, .capsule {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: var(--r-control);
    background: var(--fill-3);
    color: rgba(255, 255, 255, 0.86);
    font-size: var(--fs-caption);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}
.capsule::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.capsule-plain::before { display: none; }
.badge-ok, .capsule-published, .capsule-green { background: var(--tint-green); color: var(--green); }
.badge-warn, .capsule-draft, .capsule-orange { background: var(--tint-orange); color: var(--orange); }
.badge-error, .capsule-failed, .capsule-cancelled, .capsule-red { background: var(--tint-red); color: var(--red-text); }
.capsule-planned, .capsule-indigo { background: var(--tint-indigo); color: var(--indigo-text); }
.capsule-info, .capsule-blue, .capsule-processing { background: var(--tint-blue); color: var(--blue-hover); }
.capsule-hidden, .capsule-gray, .capsule-queued { background: var(--fill-3); color: var(--text-2); }
.capsule-purple { background: var(--tint-purple); color: var(--purple); }
.capsule-teal { background: var(--tint-teal); color: var(--teal); }
.capsule-cancelled { text-decoration: line-through; }
.unread-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 8px rgba(10, 132, 255, 0.6); }

/* Category colours (Apple palette): category_color($id) gives cat-1 … cat-8, which sets --cat (the
   colour) and --cat-text (a lighter tone readable as text on glass). */
.cat-1 { --cat: var(--blue); --cat-text: #69b4ff; }
.cat-2 { --cat: var(--green); --cat-text: #5fe07f; }
.cat-3 { --cat: var(--orange); --cat-text: #ffb340; }
.cat-4 { --cat: var(--purple); --cat-text: #d48cf7; }
.cat-5 { --cat: var(--pink); --cat-text: #ff6b88; }
.cat-6 { --cat: var(--teal); --cat-text: #8adfff; }
.cat-7 { --cat: var(--indigo); --cat-text: var(--indigo-text); }
.cat-8 { --cat: var(--yellow); --cat-text: #ffe14d; }
.cat-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cat, var(--gray)); }
.cat-bar { display: block; flex: none; width: 4px; align-self: stretch; border-radius: 2px; background: var(--cat, var(--gray)); }
.cat-tint { background: color-mix(in srgb, var(--cat, var(--gray)) 24%, transparent); color: var(--cat-text, #fff); }

/* "Nová akce" / "Nová kategorie" in the page head: a labelled pill, a round + button on phone (iOS). The link
   carries aria-label; the visible label is aria-hidden. */
.btn-new { flex: none; }
@media (max-width: 767.98px) {
    .page-head:has(.btn-new) { flex-wrap: nowrap; align-items: center; }
    .btn-new { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
    .btn-new .icon { width: 22px; height: 22px; margin: 0; }
    .btn-new__label { display: none; }
}

/* Back link above a page title (iOS navigation bar style): <a class="back-link" href="…">icon('chevron-left') Akce</a>.
   One pattern for every drill-down page (event, category, confirm, photos, calendar settings). */
.back-link { display: inline-flex; align-items: center; gap: 1px; margin: 0 0 6px -8px; padding: 4px 10px 4px 2px; border-radius: var(--r-control); color: var(--link); font-size: var(--fs-body); font-weight: 500; text-decoration: none; transition: background var(--t-hover) var(--ease-out); }
.back-link .icon { width: 20px; height: 20px; }
.back-link:hover { background: var(--fill-2); text-decoration: none; }
.back-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Date tile (generic, adopted from the events area): date_tile($date, category_color($id), ['planned'|'sm'|'lg']).
   Month over day in the category colour; planned = hatched (tentative, like Apple Calendar). One tile on every
   screen (Akce, Potvrdit, Přehled waiting list, Kalendář sidebar); only the dashboard hero keeps its own big white one. */
.date-tile {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 13px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--cat, var(--gray)) 34%, rgba(255, 255, 255, 0.08)), color-mix(in srgb, var(--cat, var(--gray)) 16%, rgba(255, 255, 255, 0.04)));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px color-mix(in srgb, var(--cat, var(--gray)) 40%, transparent);
    color: #fff;
}
.date-tile__mon { color: var(--cat-text, var(--text-2)); font-size: 10.5px; font-weight: 700; line-height: 1.1; letter-spacing: 0.06em; text-transform: uppercase; }
.date-tile__day { margin-top: 1px; font-family: var(--font-display); font-size: 21px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.date-tile--empty { color: var(--cat-text, var(--text-2)); }
.date-tile--empty .icon { width: 22px; height: 22px; }
.date-tile--planned { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0 3px, transparent 3px 7px), linear-gradient(180deg, color-mix(in srgb, var(--cat, var(--gray)) 30%, rgba(255, 255, 255, 0.06)), color-mix(in srgb, var(--cat, var(--gray)) 12%, rgba(255, 255, 255, 0.03))); }
.date-tile--sm { width: 44px; height: 44px; border-radius: 12px; }
.date-tile--sm .date-tile__mon { font-size: 9.5px; }
.date-tile--sm .date-tile__day { font-size: 18px; }
.date-tile--lg { width: 76px; height: 82px; border-radius: 20px; }
.date-tile--lg .date-tile__mon { font-size: 13px; }
.date-tile--lg .date-tile__day { margin-top: 3px; font-size: 36px; }
.date-tile--lg.date-tile--empty .icon { width: 30px; height: 30px; }
@media (max-width: 767.98px) {
    .date-tile--lg { width: 64px; height: 70px; border-radius: 17px; }
    .date-tile--lg .date-tile__day { font-size: 30px; }
}

/* Status line ("● Google Drive je propojený.") */
.status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 16px; }

/* ==========================================================================
   Avatars
   ========================================================================== */

.avatar {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    --av-a: #8e8e93;
    --av-b: #48484a;
    background: linear-gradient(145deg, var(--av-a), var(--av-b));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.10);
    user-select: none;
}
.avatar-1 { --av-a: #6ab0ff; --av-b: #2f6bd8; }
.avatar-2 { --av-a: #6fe0d2; --av-b: #1f9b8f; }
.avatar-3 { --av-a: #c39bff; --av-b: #7b4fd6; }
.avatar-4 { --av-a: #ff8fb0; --av-b: #d63b6b; }
.avatar-5 { --av-a: #ffc46b; --av-b: #e0812a; }
.avatar-6 { --av-a: #8fe08a; --av-b: #3b9e46; }
.avatar-7 { --av-a: #ff9a7a; --av-b: #d6532f; }
.avatar-8 { --av-a: #9aa8ff; --av-b: #5560d6; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 88px; height: 88px; font-size: 30px; }

/* ==========================================================================
   Lists (glass list rows)
   ========================================================================== */

.list { margin: 0; padding: 0; list-style: none; }
.list-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 10px 12px;
    border-radius: var(--r-row);
    color: var(--text);
    text-decoration: none;
    transition: background-color var(--t-hover) var(--ease-out);
}
a.list-row:hover, button.list-row:hover, .list-row.is-link:hover { background: var(--fill-2); text-decoration: none; }
a.list-row:active, button.list-row:active { background: var(--fill-3); }
.list-row.is-selected, .list-row[aria-current="page"] { background: var(--fill-4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10); }
button.list-row { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.list-separated > li + li > .list-row::before, .list-separated > .list-row + .list-row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 12px;
    right: 12px;
    height: 1px;
    background: var(--separator);
}
.list-row__lead { flex: none; }
.list-row__lead img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--fill-2); }
.list-row__body { flex: 1; min-width: 0; }
.list-row__title { display: block; overflow: hidden; font-size: var(--fs-body); font-weight: 600; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.list-row__sub { display: block; overflow: hidden; margin-top: 2px; color: var(--text-2); font-size: var(--fs-sub); line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; }
.list-row__trail { display: flex; flex: none; align-items: center; gap: 8px; color: var(--text-3); font-size: var(--fs-sub); font-variant-numeric: tabular-nums; }
.list-row__trail > .icon { width: 16px; height: 16px; }
.list-row__lead .unread-dot { margin: 0 -2px 0 0; }

/* Key/value rows (definition lists) */
.detail { margin: 0; }
.detail > div { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 12px; padding: 11px 0; border-top: 1px solid var(--separator); }
.detail > div:first-child { border-top: 0; padding-top: 0; }
.detail dt { color: var(--text-2); }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.message { max-width: 68ch; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }

/* KPI tiles */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.stats > div { min-width: 0; padding: 14px 16px; border-radius: 18px; background: var(--fill-2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.stats dt { color: var(--text-2); font-size: var(--fs-sub); line-height: 1.3; }
.stats dd { margin: 6px 0 0; font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats dd small { color: var(--text-2); font-size: 14px; font-weight: 500; }
.stats .is-bad dd { color: var(--red-text); }
@media (max-width: 767.98px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   Empty states
   ========================================================================== */

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; color: var(--text-2); text-align: center; }
.empty-state__icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 6px; border-radius: 20px; background: var(--fill-2); color: rgba(255, 255, 255, 0.72); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.empty-state__icon .icon { width: 28px; height: 28px; }
.empty-state__title { color: var(--text); font-size: var(--fs-headline); font-weight: 600; }
.empty-state__text { max-width: 36ch; font-size: var(--fs-sub); }
.empty-state .btn { margin-top: 8px; }
.empty-line { padding: 14px 16px; border: 1px dashed rgba(255, 255, 255, 0.16); border-radius: var(--r-row); background: var(--fill-1); color: var(--text-2); }

/* ==========================================================================
   Tables, restyled as glass lists
   ========================================================================== */

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.table th { padding: 0 12px 10px; color: var(--text-3); font-size: var(--fs-caption); font-weight: 500; text-align: left; white-space: nowrap; }
.table td { padding: 11px 12px; border-top: 1px solid var(--separator); vertical-align: middle; transition: background-color var(--t-hover) var(--ease-out); }
.table tbody tr:first-child td { border-top-color: transparent; }
.table tbody tr:hover td { background: var(--fill-1); }
.table tbody tr:hover td:first-child { border-radius: 12px 0 0 12px; }
.table tbody tr:hover td:last-child { border-radius: 0 12px 12px 0; }
.table tbody tr { height: 60px; }
.table th.num, .table td.num { text-align: right; }
.table .cell-main a { color: var(--text); font-weight: 600; text-decoration: none; }
.table .cell-main a:hover { text-decoration: underline; }
.table .cell-sub { display: block; margin-top: 1px; color: var(--text-2); font-size: var(--fs-sub); line-height: 1.35; }
.table .muted-cell { color: var(--text-2); }
.table td a { color: var(--text); }
.table tr.draggable { cursor: grab; }
.table tr.dragging { opacity: 0.4; }
.table tr.unread .cell-main a { font-weight: 700; }
.table tr:not(.unread) .cell-main a { font-weight: 500; }
.table.events-table tr .cell-main a, .table.categories-table tr .cell-main a { font-weight: 600; }
.media-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.media-cell img, .media-cell .media-empty { flex: none; width: 56px; height: 42px; border-radius: 10px; object-fit: cover; background: var(--fill-2); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { vertical-align: middle; }
.row-actions a:not(.btn) { display: inline-block; margin-left: 8px; padding: 6px 4px; color: var(--link); }
.row-actions .btn-icon { margin-left: 6px; }
.row-actions .btn { margin-right: 4px; }
.list-total { color: var(--text-2); }

/* Phone: table rows become two-line items; the header goes to screen readers only. */
@media (max-width: 767.98px) {
    .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .table, .table tbody { display: block; }
    .table tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; height: auto; padding: 12px 0; border-top: 1px solid var(--separator); }
    .table tbody tr:first-child { border-top: 0; padding-top: 2px; }
    .table td { display: block; padding: 0 !important; border: 0; background: none !important; color: var(--text-2); font-size: var(--fs-sub); }
    .table td.cell-main { flex: 1 0 100%; color: var(--text); font-size: var(--fs-body); }
    .table td.num { text-align: left; }
    .table td.row-actions { display: flex; flex: 1 0 100%; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; text-align: left; }
    .row-actions a:not(.btn) { margin: 0; padding: 10px 8px; }
    .row-actions .btn-icon, .row-actions .btn { margin: 0; }
    .table td:empty { display: none; }
    .table td[data-label]::before { content: attr(data-label) ": "; }
}

/* ==========================================================================
   Toolbars, segmented controls, chips, search
   ========================================================================== */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar__spacer { flex: 1; }
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter label { margin: 0; color: var(--text-2); font-weight: 500; }
.filter select { width: auto; min-width: 200px; min-height: var(--control-h); }

/* Segmented control: radios (<label><input type="radio"><span>…</span></label>) or links ([aria-current]). */
.segmented {
    position: relative;
    isolation: isolate;
    display: inline-grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    align-items: stretch;
    min-height: 36px;
    padding: 3px;
    border-radius: var(--r-control);
    background: var(--fill-dim);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    --seg-count: 2;
    --seg-index: 0;
}
.segmented > * { position: relative; display: flex; min-width: 0; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented span, .segmented > a, .segmented > button {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    padding: 0 14px;
    border: 0;
    border-radius: var(--r-control);
    background: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--fs-sub);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: color 220ms var(--ease-out);
}
.segmented > a:hover, .segmented > button:hover, .segmented label:hover span { color: #fff; text-decoration: none; }
/* Thumb */
.segmented::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    z-index: -1;
    width: calc((100% - 6px) / var(--seg-count));
    border-radius: var(--r-control);
    background: linear-gradient(180deg, #fff, #ececf1);
    box-shadow: 0 3px 10px -2px rgba(0, 0, 0, 0.45);
    transform: translateX(calc(100% * var(--seg-index)));
    transition: transform 380ms var(--spring-bounce);
}
.segmented:not(:has(:checked, [aria-current], [aria-pressed="true"], .is-active))::before { opacity: 0; }
.segmented :checked + span, .segmented > [aria-current], .segmented > [aria-pressed="true"], .segmented > .is-active { color: #111216; }
.segmented :focus-visible + span { outline: 2px solid var(--blue-hover); outline-offset: 1px; }
.segmented:has(> :nth-child(3)) { --seg-count: 3; }
.segmented:has(> :nth-child(4)) { --seg-count: 4; }
.segmented:has(> :nth-child(5)) { --seg-count: 5; }
.segmented:has(> :nth-child(2) :checked, > :nth-child(2)[aria-current], > :nth-child(2)[aria-pressed="true"], > :nth-child(2).is-active) { --seg-index: 1; }
.segmented:has(> :nth-child(3) :checked, > :nth-child(3)[aria-current], > :nth-child(3)[aria-pressed="true"], > :nth-child(3).is-active) { --seg-index: 2; }
.segmented:has(> :nth-child(4) :checked, > :nth-child(4)[aria-current], > :nth-child(4)[aria-pressed="true"], > :nth-child(4).is-active) { --seg-index: 3; }
.segmented:has(> :nth-child(5) :checked, > :nth-child(5)[aria-current], > :nth-child(5)[aria-pressed="true"], > :nth-child(5).is-active) { --seg-index: 4; }
.segmented-block { display: grid; width: 100%; }
.segmented-glass { background: var(--glass-sheen), var(--glass-fill); box-shadow: var(--glass-depth); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }

/* Chips: small toggles and filters */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 13px;
    border: 0;
    border-radius: var(--r-control);
    background: var(--fill-2);
    color: rgba(255, 255, 255, 0.82);
    font-size: var(--fs-sub);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: background-color var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out);
}
.chip .icon { width: 15px; height: 15px; }
.chip:hover { background: var(--fill-3); color: #fff; text-decoration: none; }
.chip[aria-pressed="true"], .chip.is-active, label.chip:has(input:checked) { background: #fff; color: #111216; box-shadow: none; }
label.chip input { position: absolute; opacity: 0; pointer-events: none; }
label.chip { position: relative; }
label.chip:has(input:focus-visible) { outline: 2px solid var(--blue-hover); outline-offset: 2px; }

/* Search field: <label class="search-field">icon <input type="search"></label> */
.search-field { position: relative; display: flex; align-items: center; margin: 0; }
.search-field > .icon { position: absolute; left: 12px; width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.search-field input { padding-left: 38px; border-radius: var(--r-control); }

/* ==========================================================================
   Forms
   ========================================================================== */

label { display: block; margin: 0 0 7px; color: rgba(255, 255, 255, 0.86); font-size: var(--fs-sub); font-weight: 600; }
.field { min-width: 0; margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
input[type="email"], input[type="password"], input[type="text"], input[type="date"], input[type="datetime-local"], input[type="time"],
input[type="number"], input[type="url"], input[type="search"], input[type="tel"], select, textarea {
    width: 100%;
    min-height: var(--field-h);
    padding: 10px 14px;
    border: 1px solid var(--field-stroke);
    border-radius: var(--r-field);
    background: var(--field-fill);
    color: var(--text);
    font-size: var(--fs-body);
    line-height: 1.35;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
    transition: border-color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out);
}
input:hover:not(:disabled):not([readonly]), select:hover:not(:disabled), textarea:hover:not(:disabled):not([readonly]) { border-color: rgba(255, 255, 255, 0.18); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--blue); box-shadow: var(--focus-ring); background-color: rgba(0, 0, 0, 0.3); }
input[readonly] { color: var(--text-2); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }
select {
    padding-right: 40px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='.6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 9.5 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 16px 16px;
    cursor: pointer;
}
select option, select optgroup { background: #1f1f25; color: #fff; }
textarea { min-height: 120px; line-height: 1.5; resize: vertical; }
::placeholder { color: var(--text-3); opacity: 1; }
::-webkit-calendar-picker-indicator { opacity: 0.6; cursor: pointer; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
.field .hint, .field-error { margin-top: 6px; }
.field-invalid input, .field-invalid select, .field-invalid textarea { border-color: rgba(255, 69, 58, 0.7); }
.field-error { color: var(--red-text); font-size: var(--fs-sub); line-height: 1.4; }
.req { color: var(--text-3); }

/* Checkboxes and radios (Apple-style). On/off settings use .switch instead. */
.checkbox, .radio, .inherit-toggle, label.inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    margin: 0;
    color: var(--text);
    font-size: var(--fs-body);
    font-weight: 400;
    cursor: pointer;
}
input[type="checkbox"], input[type="radio"] {
    flex: none;
    width: 22px;
    height: 22px;
    margin: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.36);
    border-radius: 7px;
    background: var(--fill-dim);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked {
    border-color: var(--blue);
    background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 16px no-repeat;
}
input[type="radio"]:checked { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 5px var(--blue), inset 0 0 0 11px #fff; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; box-shadow: var(--focus-ring); }
input[type="radio"]:checked:focus-visible { box-shadow: inset 0 0 0 5px var(--blue), inset 0 0 0 11px #fff, var(--focus-ring); }
input[type="range"] { accent-color: var(--blue); }
input[type="color"] { cursor: pointer; }
label.inline input[type="number"] { width: 5.5rem; }

/* iOS switch: <input type="checkbox" class="switch"> or any checkbox inside .switch-row */
.switch, .switch-row > input[type="checkbox"] {
    position: relative;
    flex: none;
    width: 51px;
    height: 31px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--r-control);
    background: rgba(120, 120, 128, 0.36);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background-color 250ms var(--ease-out);
}
.switch::before, .switch-row > input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(0, 0, 0, 0.16);
    transition: transform 320ms var(--spring-bounce);
}
.switch:checked, .switch-row > input[type="checkbox"]:checked { border: 0; background: var(--green); box-shadow: none; }
.switch:checked::before, .switch-row > input[type="checkbox"]:checked::before { transform: translateX(20px); }
.switch:active::before, .switch-row > input[type="checkbox"]:active::before { width: 31px; }
.switch:checked:active::before, .switch-row > input[type="checkbox"]:checked:active::before { transform: translateX(16px); }
.switch:focus-visible, .switch-row > input[type="checkbox"]:focus-visible { outline: 2px solid var(--blue-hover); outline-offset: 2px; box-shadow: none; }
/* Row: label text left, switch right (the input may come first in the markup). */
.switch-row {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    margin: 0;
    color: var(--text);
    font-size: var(--fs-body);
    font-weight: 400;
    cursor: pointer;
}
.switch-row--start { flex-direction: row; justify-content: flex-start; }

.grid-2, .grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--gap); }
.grid-2 > .field, .grid-3 > .field { margin-bottom: 18px; }
@media (min-width: 768px) {
    .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

@media (max-width: 767.98px) {
    input[type="email"], input[type="password"], input[type="text"], input[type="date"], input[type="datetime-local"], input[type="time"],
    input[type="number"], input[type="url"], input[type="search"], input[type="tel"], select, textarea { font-size: 16px; }
    .checkbox, .radio, .inherit-toggle, label.inline { min-height: 44px; }
    .toolbar, .filter { width: 100%; }
    .filter label { flex-basis: 100%; }
    .filter select { flex: 1; min-width: 0; }
}

/* The form's one Save stays in reach: a floating glass capsule at the bottom of the viewport. */
.form-actions {
    position: sticky;
    bottom: 16px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: var(--gap);
    padding: 10px;
    border: 1px solid var(--glass-stroke);
    border-radius: 26px;
    background: var(--glass-sheen), var(--glass-fill-strong);
    box-shadow: var(--glass-depth);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}
.form-actions .btn-danger { margin-left: auto; }
/* Hint or secondary text on the left of the bar, primary on the right. */
.form-actions__hint { flex: 1 1 12rem; min-width: 0; padding-left: 10px; color: var(--text-2); font-size: var(--fs-sub); line-height: 1.35; }
.form-actions__hint + .btn { flex: none; }
@media (max-width: 767.98px) {
    .form-actions { bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom)); }
    .form-actions:has(> .form-actions__hint) { flex-wrap: nowrap; gap: 8px; padding: 6px 6px 6px 8px; border-radius: 28px; }
    .form-actions__hint { flex: 1 1 auto; padding-left: 6px; font-size: var(--fs-caption); line-height: 1.3; }
    .form-actions__hint + .btn { --btn-h: 42px; padding: 0 22px; }
}

/* ==========================================================================
   Progress: bar and ring
   ========================================================================== */

progress, .progress {
    display: block;
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: var(--r-control);
    background: var(--fill-3);
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
}
progress::-webkit-progress-bar { background: var(--fill-3); border-radius: var(--r-control); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: var(--r-control); transition: width 300ms var(--ease-out); }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: var(--r-control); }
.progress-green::-webkit-progress-value { background: var(--green); }
.progress-green::-moz-progress-bar { background: var(--green); }

.ring { width: 56px; height: 56px; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 4.5; }
.ring__track { stroke: var(--fill-3); }
.ring__value { stroke: var(--blue); stroke-linecap: round; transition: stroke-dashoffset 700ms var(--spring); }
.ring-green .ring__value { stroke: var(--green); }
.ring-orange .ring__value { stroke: var(--orange); }
.ring-red .ring__value { stroke: var(--red); }
.ring-lg { width: 96px; height: 96px; }
.ring-lg circle { stroke-width: 4; }
.ring-wrap { position: relative; display: inline-grid; place-items: center; }
.ring-wrap > .ring { grid-area: 1 / 1; }
.ring-wrap__label { grid-area: 1 / 1; font-size: var(--fs-sub); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Dialogs
   ========================================================================== */

dialog { color: var(--text); }
.confirm-dialog, .glass-dialog {
    width: min(340px, calc(100vw - 32px));
    max-width: none;
    padding: 22px 20px 18px;
    border: 1px solid var(--glass-stroke);
    border-radius: 28px;
    background: var(--glass-sheen), rgba(44, 44, 50, 0.72);
    box-shadow: var(--glass-rim), var(--glass-glow), 0 40px 90px -20px rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    backdrop-filter: blur(40px) saturate(180%);
    text-align: center;
}
.glass-dialog { width: min(480px, calc(100vw - 32px)); text-align: left; }
.confirm-dialog[open], .glass-dialog[open] { animation: glass-pop 260ms var(--spring) both; }
.confirm-dialog::backdrop, .glass-dialog::backdrop {
    background: rgba(0, 0, 0, 0.38);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: fade-in 220ms var(--ease-out) both;
}
.confirm-dialog form { margin: 0; }
.confirm-dialog__icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%; background: var(--tint-red); color: var(--red-text); }
.confirm-dialog__icon .icon { width: 26px; height: 26px; }
.confirm-dialog p { margin: 0 0 20px; font-size: var(--fs-body); font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.confirm-dialog .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-dialog .actions .btn { width: 100%; }
.dialog__title { margin-bottom: 8px; font-size: var(--fs-headline); font-weight: 600; }
.dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ==========================================================================
   Login card (also the install wizard, which only links this file)
   ========================================================================== */

.login-page { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 32px 16px calc(32px + env(safe-area-inset-bottom)); }
.login-box { position: relative; width: 100%; max-width: 400px; padding: 30px 28px 28px; border-radius: 32px; animation: glass-rise 620ms var(--spring) both; }
.login-box > .mark { margin-bottom: 24px; }
.login-box h1 { margin-bottom: 6px; font-size: 26px; letter-spacing: -0.02em; }
.login-box h1 + form, .login-box h1 + .alert { margin-top: 18px; }
.login-box h2 { margin: 20px 0 14px; }
.login-box form label:not(.switch-row):not(.checkbox) { margin-top: 16px; }
.login-box__fields > label:first-of-type,
.login-box form > label:first-of-type:not(.switch-row),
.login-box fieldset > label:first-of-type { margin-top: 0; }
.login-box > .muted { margin: -4px 0 12px; }
.login-box form .muted { margin-top: 8px; }
.login-box .btn { width: 100%; margin-top: 22px; }
.login-box fieldset { margin: 0 0 16px; padding: 16px; border: 0; border-radius: 18px; background: var(--fill-2); }
.login-box legend { float: left; width: 100%; margin-bottom: 6px; padding: 0; font-weight: 600; }
.login-box legend + * { clear: both; }
.login-box .alert { margin: 0 0 18px; }
.login-box__sub { margin-bottom: 22px; color: var(--text-2); font-size: var(--fs-body); }
.login-box .switch-row { margin-top: 16px; }
.install-page .login-box { max-width: 520px; }
.install-checks { margin: 0 0 16px; padding: 0; list-style: none; }
.install-checks li { padding: 10px 0; border-top: 1px solid var(--separator); }
.install-checks li:first-child { border-top: 0; }
.install-checks small { display: block; margin-top: 2px; }

/* ==========================================================================
   Motion
   ========================================================================== */

@keyframes glass-rise { from { opacity: 0; transform: translateY(14px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes glass-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translate(14px, -10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(28px) scale(0.96); } }
@keyframes vt-leave { to { opacity: 0; transform: scale(0.985); filter: blur(6px); } }

/* Utilities */
.rise { animation: glass-rise 520ms var(--spring) both; }
.stagger > * { animation: glass-rise 520ms var(--spring) both; }
.stagger > :nth-child(2) { animation-delay: 40ms; }
.stagger > :nth-child(3) { animation-delay: 80ms; }
.stagger > :nth-child(4) { animation-delay: 120ms; }
.stagger > :nth-child(5) { animation-delay: 160ms; }
.stagger > :nth-child(6) { animation-delay: 200ms; }
.stagger > :nth-child(7) { animation-delay: 240ms; }
.stagger > :nth-child(n + 8) { animation-delay: 280ms; }

/* Cross-document view transitions between admin pages (Chrome, Safari 18.2+). How it is put together:
 *
 * - The shell (backdrop, top bar, rail, tab bar) stays in the root snapshot. It is identical on both
 *   pages, so the root swaps instantly and nothing in it moves. It must not be named: a named element is
 *   a backdrop root, so its glass would lose the blur of the photo while the transition runs.
 * - Old page (pageswap, html.vt-out): the content is named "main" and leaves with a quick fade, scale and
 *   blur. Its panels are flattened to a tinted fill first (the blur is gone inside a named snapshot).
 * - New page (pagereveal, html.vt-in): the content is NOT named. It is part of the live root, so its glass
 *   keeps the real blur from the first frame to the last; html.vt-enter plays the entrance on the live
 *   DOM: every top-level block rises (translate only) and every glass-free subtree fades in. Opacity is
 *   never put on an element that contains glass, because opacity < 1 makes it a backdrop root.
 * - The labels of every bar are always named (view-transition-class: shell-label), so they paint above
 *   the pills and only crossfade their colour in place.
 * - The selection pills: the old page names its pills (they leave, still under the labels). The new page
 *   names a pill only when the same bar had one on the old page: admin-glass.js then adds
 *   html.vt-morph-{nav|rail|tab} and the group pseudo itself draws the capsule while it moves and
 *   resizes (no stretched bitmap). A pill new to its bar stays unnamed, in the live root under the
 *   labels, and grows in there. (A name that only exists on the new page would be painted above
 *   every label, hiding the icon under the white rail pill.)
 */
@view-transition { navigation: auto; }

html.vt-out .admin-main { view-transition-name: main; }
html.vt-out .nav-pill, html.vt-morph-nav .nav-pill { view-transition-name: nav-pill; }
html.vt-out .rail-pill, html.vt-morph-rail .rail-pill { view-transition-name: rail-pill; }
html.vt-out .tab-pill, html.vt-morph-tab .tab-pill { view-transition-name: tab-pill; }
@keyframes pill-in { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
html.vt-in:not(.vt-morph-nav) .nav-pill, html.vt-in:not(.vt-morph-rail) .rail-pill, html.vt-in:not(.vt-morph-tab) .tab-pill {
    animation: pill-in 420ms var(--spring-bounce) both;
}
html.vt-out .admin-main :is(.panel, .widget, .glass, .glass-strong, .form-actions, .banner, .toast, .segmented-glass) {
    background: var(--glass-sheen), var(--glass-flat);
}

.topnav__content, .tabbar__content { view-transition-class: shell-label; }
.rail__content { view-transition-class: shell-label rail-label; }
.nav-c-dashboard { view-transition-name: nav-c-dashboard; }
.nav-c-events { view-transition-name: nav-c-events; }
.nav-c-calendar { view-transition-name: nav-c-calendar; }
.nav-c-categories { view-transition-name: nav-c-categories; }
.nav-c-inquiries { view-transition-name: nav-c-inquiries; }
.rail-c-design { view-transition-name: rail-c-design; }
.rail-c-settings { view-transition-name: rail-c-settings; }
.rail-c-drive { view-transition-name: rail-c-drive; }
.rail-c-errors { view-transition-name: rail-c-errors; }
.tab-c-dashboard { view-transition-name: tab-c-dashboard; }
.tab-c-events { view-transition-name: tab-c-events; }
.tab-c-calendar { view-transition-name: tab-c-calendar; }
.tab-c-inquiries { view-transition-name: tab-c-inquiries; }
.tab-c-more { view-transition-name: tab-c-more; }

::view-transition-group(root) { animation-duration: 320ms; }
html.vt-in::view-transition-old(root) { animation: none; opacity: 0; }
html.vt-in::view-transition-new(root) { animation: none; }

::view-transition-group(main) { animation: none; }
::view-transition-old(main) {
    transform-origin: 50% var(--vt-oy, 0);
    -webkit-mask-image: linear-gradient(180deg, transparent calc(var(--vt-ct, -100px) - 8px), #000 calc(var(--vt-ct, -100px) + 22px), #000 calc(var(--vt-cb, 99999px) - 22px), transparent calc(var(--vt-cb, 99999px) + 8px));
    mask-image: linear-gradient(180deg, transparent calc(var(--vt-ct, -100px) - 8px), #000 calc(var(--vt-ct, -100px) + 22px), #000 calc(var(--vt-cb, 99999px) - 22px), transparent calc(var(--vt-cb, 99999px) + 8px));
    animation: vt-leave 220ms var(--ease-in) both;
}

::view-transition-group(*.shell-label) { animation-duration: 300ms; animation-timing-function: var(--ease-out); }
::view-transition-old(*.shell-label), ::view-transition-new(*.shell-label) { animation-duration: 300ms; }
/* The rail pill is opaque white and the idle rail icons are white: while the pill slides past an icon,
   a hairline dark outline keeps it visible (invisible over the dark rail). */
::view-transition-image-pair(*.rail-label) { filter: drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.85)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3)); }

::view-transition-group(nav-pill), ::view-transition-group(rail-pill), ::view-transition-group(tab-pill) {
    animation-duration: 520ms;
    animation-timing-function: cubic-bezier(0.3, 1.16, 0.42, 1);
}
::view-transition-old(nav-pill), ::view-transition-new(nav-pill),
::view-transition-old(rail-pill), ::view-transition-new(rail-pill),
::view-transition-old(tab-pill), ::view-transition-new(tab-pill) { height: 100%; animation-duration: 260ms; }
/* Same bar on both pages: the group pseudo draws the capsule while it moves and resizes. */
html.vt-morph-nav::view-transition-group(nav-pill) { border-radius: var(--r-control); background: var(--pill-nav); box-shadow: var(--pill-nav-shadow); }
html.vt-morph-rail::view-transition-group(rail-pill) { border-radius: var(--r-control); background: var(--pill-rail); box-shadow: var(--pill-rail-shadow); }
html.vt-morph-tab::view-transition-group(tab-pill) { border-radius: 26px; background: var(--pill-tab); box-shadow: var(--pill-tab-shadow); }
html.vt-morph-nav::view-transition-image-pair(nav-pill),
html.vt-morph-rail::view-transition-image-pair(rail-pill),
html.vt-morph-tab::view-transition-image-pair(tab-pill) { display: none; }

/* Entrance of the new page's content (also on first load in browsers without cross-document view
   transitions). --vt-delay staggers the top-level blocks and is inherited by everything inside them. */
@keyframes vt-rise { from { translate: 0 16px; } to { translate: none; } }
@keyframes vt-fade { from { opacity: 0; } to { opacity: 1; } }
html.vt-enter .admin-main > * { --vt-delay: 60ms; }
html.vt-enter .admin-main > :nth-child(2) { --vt-delay: 95ms; }
html.vt-enter .admin-main > :nth-child(3) { --vt-delay: 130ms; }
html.vt-enter .admin-main > :nth-child(4) { --vt-delay: 165ms; }
html.vt-enter .admin-main > :nth-child(5) { --vt-delay: 200ms; }
html.vt-enter .admin-main > :nth-child(n + 6) { --vt-delay: 235ms; }
html.vt-enter .admin-main > :not(.toasts) { animation: vt-rise 560ms var(--spring) var(--vt-delay) both; }
html.vt-enter .admin-main > :not(.toasts):not(:has(.panel, .widget, .glass, .glass-strong, .form-actions, .banner, .toast, .segmented-glass)) {
    animation: vt-rise 560ms var(--spring) var(--vt-delay) both, vt-fade 360ms var(--ease-out) var(--vt-delay) both;
}
html.vt-enter .admin-main :has(.panel, .widget, .glass, .glass-strong, .form-actions, .banner, .toast, .segmented-glass) > :not(.toasts):not(:has(.panel, .widget, .glass, .glass-strong, .form-actions, .banner, .toast, .segmented-glass)) {
    animation: vt-fade 360ms var(--ease-out) var(--vt-delay) both;
}

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-delay: 0s !important; scroll-behavior: auto !important; }
}
