/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size: 15px; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
input[type="checkbox"], input[type="radio"] { appearance: auto; -webkit-appearance: auto; accent-color: var(--accent); width: 1rem; height: 1rem; cursor: pointer; }

/* ========== CSS VARIABLES (LIGHT / DARK) ========== */
:root {
    --bg: #f0f2f5;
    --bg-card: #fff;
    --bg-card-hover: #f8fafc;
    --bg-input: #fff;
    --text: #1a1a2e;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --accent-text: #c7d2fe;
    --header-bg: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    --header-text: #fff;
    --badge-absent-bg: #fef2f2;
    --badge-absent-text: #ef4444;
    --badge-taken-bg: #ecfdf5;
    --badge-taken-text: #059669;
    --free-spot-bg: #f0fdf4;
    --free-spot-border: #86efac;
    --free-spot-hover-bg: #dcfce7;
    --free-spot-hover-border: #22c55e;
    --free-spot-text: #16a34a;
    --horse-bg: #f1f5f9;
    --modal-backdrop: rgba(0,0,0,.4);
    --shadow-card: 0 4px 16px rgba(0,0,0,.06);
    --shadow-modal: 0 20px 60px rgba(0,0,0,.15);
    --toast-bg: #1e293b;
    --stat-value: #4f46e5;
    --danger: #ef4444;
    --danger-hover-bg: color-mix(in srgb, var(--danger) 12%, transparent);
    --success: #10b981;
    --success-bg: color-mix(in srgb, var(--success) 14%, var(--bg-card));
    --warning: #f59e0b;
    --warning-bg: color-mix(in srgb, var(--warning) 14%, var(--bg-card));
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #1e293b;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-light: rgba(129,140,248,.15);
    --accent-text: #c7d2fe;
    --header-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --header-text: #e2e8f0;
    --badge-absent-bg: rgba(239,68,68,.15);
    --badge-absent-text: #f87171;
    --badge-taken-bg: rgba(5,150,105,.15);
    --badge-taken-text: #34d399;
    --free-spot-bg: rgba(34,197,94,.08);
    --free-spot-border: #166534;
    --free-spot-hover-bg: rgba(34,197,94,.15);
    --free-spot-hover-border: #22c55e;
    --free-spot-text: #4ade80;
    --horse-bg: #334155;
    --modal-backdrop: rgba(0,0,0,.6);
    --shadow-card: 0 4px 16px rgba(0,0,0,.2);
    --shadow-modal: 0 20px 60px rgba(0,0,0,.4);
    --toast-bg: #334155;
    --stat-value: #818cf8;
    --danger: #f87171;
    --danger-hover-bg: color-mix(in srgb, var(--danger) 14%, transparent);
    --success: #34d399;
    --success-bg: color-mix(in srgb, var(--success) 14%, var(--bg-card));
    --warning: #fbbf24;
    --warning-bg: color-mix(in srgb, var(--warning) 16%, var(--bg-card));
}

[data-theme="horse"] {
    --bg: #f5efe6;
    --bg-card: #fff8f0;
    --bg-card-hover: #fdf3e7;
    --bg-input: #fff8f0;
    --text: #2a1a0e;
    --text-secondary: #5c4230;
    --text-muted: #7a5c3e;
    --border: #d4b896;
    --border-light: #e8d8c4;
    --accent: #6b4c2a;
    --accent-hover: #5a3d20;
    --accent-light: #f0e0c8;
    --accent-text: #d4a96a;
    --header-bg: linear-gradient(135deg, #3d2b1a 0%, #6b4c2a 100%);
    --header-text: #fff8f0;
    --badge-absent-bg: #fef2f2;
    --badge-absent-text: #dc2626;
    --badge-taken-bg: #ecfdf5;
    --badge-taken-text: #059669;
    --free-spot-bg: #f0fdf4;
    --free-spot-border: #86efac;
    --free-spot-hover-bg: #dcfce7;
    --free-spot-hover-border: #22c55e;
    --free-spot-text: #16a34a;
    --horse-bg: #e8d8c4;
    --modal-backdrop: rgba(0,0,0,.4);
    --shadow-card: 0 4px 16px rgba(107,76,42,.1);
    --shadow-modal: 0 20px 60px rgba(0,0,0,.15);
    --toast-bg: #3d2b1a;
    --stat-value: #6b4c2a;
    --danger: #ef4444;
    --danger-hover-bg: color-mix(in srgb, var(--danger) 12%, transparent);
    --success: #10b981;
    --success-bg: color-mix(in srgb, var(--success) 14%, var(--bg-card));
    --warning: #f59e0b;
    --warning-bg: color-mix(in srgb, var(--warning) 14%, var(--bg-card));
}

[data-theme="lavender"] {
    --bg: #fdf2fb;
    --bg-card: #fef7fe;
    --bg-card-hover: #fdf0fc;
    --bg-input: #fef7fe;
    --text: #1a0a1e;
    --text-secondary: #52395a;
    --text-muted: #6b4c72;
    --border: #d8b4e2;
    --border-light: #ecd8f0;
    --accent: #9c27b0;
    --accent-hover: #7b1fa2;
    --accent-light: #f3e5f5;
    --accent-text: #ce93d8;
    --header-bg: linear-gradient(135deg, #4a148c 0%, #9c27b0 100%);
    --header-text: #fdf2fb;
    --badge-absent-bg: #fef2f2;
    --badge-absent-text: #dc2626;
    --badge-taken-bg: #ecfdf5;
    --badge-taken-text: #059669;
    --free-spot-bg: #f0fdf4;
    --free-spot-border: #86efac;
    --free-spot-hover-bg: #dcfce7;
    --free-spot-hover-border: #22c55e;
    --free-spot-text: #16a34a;
    --horse-bg: #ead8f0;
    --modal-backdrop: rgba(0,0,0,.4);
    --shadow-card: 0 4px 16px rgba(156,39,176,.08);
    --shadow-modal: 0 20px 60px rgba(0,0,0,.15);
    --toast-bg: #4a148c;
    --stat-value: #9c27b0;
    --danger: #ef4444;
    --danger-hover-bg: color-mix(in srgb, var(--danger) 12%, transparent);
    --success: #10b981;
    --success-bg: color-mix(in srgb, var(--success) 14%, var(--bg-card));
    --warning: #f59e0b;
    --warning-bg: color-mix(in srgb, var(--warning) 14%, var(--bg-card));
}

body { background: var(--bg); color: var(--text); min-height: 100vh; transition: background .2s, color .2s; }

/* ========== HEADER ========== */
.header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.header__inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 4rem;
}
.header__brand {
    display: flex; align-items: center; gap: .75rem;
    transition: opacity .15s;
}
.header__brand:hover { opacity: .85; }
.header__brand h1 {
    font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em;
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
[data-theme="dark"] .header__brand h1 {
    background: linear-gradient(135deg, #e2e8f0 0%, #818cf8 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
[data-theme="horse"] .header__brand h1 {
    background: linear-gradient(135deg, #fff8f0 0%, #d4a96a 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
[data-theme="lavender"] .header__brand h1 {
    background: linear-gradient(135deg, #fdf2fb 0%, #ce93d8 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header__logo {
    height: 2.6rem; width: auto;
    filter: brightness(0) invert(1);
    transition: transform .2s;
}
.header__brand:hover .header__logo { transform: scale(1.05); }
.header__nav { display: flex; gap: .25rem; align-items: center; }
.nav-link {
    padding: .4rem .8rem; border-radius: .5rem; font-size: .85rem; font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.1); }
.nav-link.active { background: rgba(255,255,255,.15); color: var(--accent-text); }
.nav-link--admin { color: #fbbf24; }
.nav-link--login { color: #94a3b8; }

/* Theme picker dots */
.theme-dots {
    display: flex; align-items: center; gap: .25rem;
    background: rgba(255,255,255,.1); border-radius: 999px;
    padding: .2rem .4rem; margin-left: .25rem;
}
.theme-dot {
    width: .75rem; height: .75rem; border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.3);
    cursor: pointer; transition: box-shadow .15s, border-color .15s;
    flex-shrink: 0; padding: 0; display: block;
    -webkit-appearance: none; appearance: none; min-width: 0; min-height: 0;
}
.theme-dot:hover { border-color: rgba(255,255,255,.7); }
.theme-dot--active { box-shadow: 0 0 0 2px #fff; border-color: transparent; }
.theme-dot[data-theme-target="light"] { background: #e2e8f0; }
.theme-dot[data-theme-target="dark"] { background: #0f172a; }
.theme-dot[data-theme-target="horse"] { background: #6b4c2a; }
.theme-dot[data-theme-target="lavender"] { background: #9c27b0; }

/* ========== LAYOUT ========== */
.main { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }

/* ========== WEEK NAV ========== */
.week-nav {
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}
/* Groups the prev-week/label/next-week trio so they can be kept on one row
   together on mobile (see "MOBILE MAIN LAYOUT" below); on desktop/tablet this
   is a no-op — display:contents makes the wrapper invisible to layout, so
   its children behave exactly as if they were direct .week-nav children. */
.week-nav__row { display: contents; }
.week-nav__label { font-size: 1.1rem; font-weight: 600; min-width: 14rem; text-align: center; }

.week-nav__label-wrap {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}
button.week-nav__label--picker {
    font: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 14rem;
    text-align: center;
    margin: 0;
    padding: 0.15rem 0.35rem;
    border: none;
    border-radius: 0.35rem;
    background: transparent;
    color: inherit;
    cursor: pointer;
    line-height: 1.3;
}
button.week-nav__label--picker:hover {
    background: rgba(148, 163, 184, 0.15);
}
button.week-nav__label--picker:focus:not(:focus-visible) {
    outline: none;
}
button.week-nav__label--picker:focus-visible {
    outline: 2px solid var(--accent, #3b82f6);
    outline-offset: 2px;
}

.week-date-popover {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    width: min(18.5rem, calc(100vw - 2rem));
    padding: 0.65rem 0.75rem 0.75rem;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid #94a3b8;
    border-radius: 0.5rem;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.85),
        0 8px 28px rgba(15, 23, 42, 0.12);
}
.week-date-popover__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}
.week-date-popover__title {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.week-date-popover__dows {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.15rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    text-align: center;
}
.week-date-popover__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.2rem;
    padding: 0.4rem;
    margin-top: 0.15rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
}
.week-date-popover__cell {
    aspect-ratio: 1;
    min-height: 2rem;
    max-height: 2.35rem;
    border: 1px solid transparent;
    border-radius: 0.3rem;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
}
.week-date-popover__cell:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border);
}
.week-date-popover__cell:focus {
    outline: none;
}
.week-date-popover__cell:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.week-date-popover__cell--muted {
    visibility: hidden;
    pointer-events: none;
    background: transparent;
    border-color: transparent;
}
.week-date-popover__cell--today {
    box-shadow: inset 0 0 0 2px var(--accent);
}
.week-date-popover__cell--picked {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent-hover, var(--accent));
}
.week-date-popover__cell--picked:hover:not(:disabled) {
    background: var(--accent-hover);
    color: #fff;
    border-color: var(--accent-hover);
}

[data-theme="dark"] .week-date-popover {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid #64748b;
    box-shadow:
        0 0 0 1px rgba(148, 163, 184, 0.2),
        0 14px 44px rgba(0, 0, 0, 0.65);
}
[data-theme="dark"] .week-date-popover__title {
    color: #f8fafc;
}
[data-theme="dark"] .week-date-popover__dows {
    color: #cbd5e1;
    border-bottom-color: #475569;
}
[data-theme="dark"] .week-date-popover__grid {
    background: #0f172a;
    border-color: #475569;
}
[data-theme="dark"] .week-date-popover__cell {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
}
[data-theme="dark"] .week-date-popover__cell:hover:not(:disabled) {
    background: #334155;
    border-color: #64748b;
    color: #fff;
}
[data-theme="dark"] .week-date-popover__cell--picked {
    color: #fff;
    border-color: transparent;
}
[data-theme="dark"] .week-date-popover__cell--today:not(.week-date-popover__cell--picked) {
    box-shadow: inset 0 0 0 2px #a5b4fc;
}

/* ========== ANNOUNCEMENTS (Option A: icon + label) ========== */
.announcements-wrap {
    margin-bottom: 1rem;
    display: none;
}
.announcement {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-left: 4px solid #d97706;
    border-radius: .5rem;
    padding: .85rem 1.1rem;
    margin-bottom: .6rem;
    font-size: 1rem;
    line-height: 1.45;
    color: #92400e;
    box-shadow: 0 2px 6px rgba(245, 158, 11, .25);
}
.announcement:last-child { margin-bottom: 0; }
.announcement__icon-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .35rem;
    background: rgba(217, 119, 6, .2);
    color: #b45309;
}
.announcement__icon { width: 1.25rem; height: 1.25rem; }
.announcement__content { flex: 1; min-width: 0; }
.announcement__label {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #b45309;
    margin-bottom: .25rem;
}
.announcement__body {
    color: #92400e;
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}
.announcement__body a { color: #b45309; font-weight: 600; text-decoration: underline; word-break: break-all; overflow-wrap: anywhere; }
.announcement__body a:hover { color: #92400e; }
.announcement__meta {
    margin-top: .5rem;
    font-size: .8rem;
    color: #b45309;
    opacity: .9;
}
[data-theme="dark"] .announcement {
    background: linear-gradient(135deg, rgba(245, 158, 11, .28) 0%, rgba(245, 158, 11, .16) 100%);
    border-color: #f59e0b;
    border-left-color: #fbbf24;
    color: #fcd34d;
    box-shadow: 0 2px 8px rgba(245, 158, 11, .2);
}
[data-theme="dark"] .announcement__icon-wrap { background: rgba(251, 191, 36, .25); color: #fcd34d; }
[data-theme="dark"] .announcement__label { color: #fde68a; }
[data-theme="dark"] .announcement__body { color: #fcd34d; }
[data-theme="dark"] .announcement__body a { color: #fde68a; }
[data-theme="dark"] .announcement__body a:hover { color: #fff; }
[data-theme="dark"] .announcement__meta { color: #fde68a; opacity: .85; }
@media (max-width: 400px) {
    .announcement { padding: .6rem .75rem; gap: .5rem; }
    .announcement__icon-wrap { width: 1.75rem; height: 1.75rem; }
    .announcement__icon { width: 1rem; height: 1rem; }
}

/* ========== BIRTHDAY REMINDER (pink, distinct from announcements) ========== */
.birthday-reminder-wrap {
    margin-bottom: 1rem;
    display: none;
}
.birthday-reminder-wrap:not([hidden]) { display: block; }
.birthday-reminder {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    border: 1px solid #ec4899;
    border-left: 4px solid #db2777;
    border-radius: .5rem;
    padding: .85rem 1.1rem;
    font-size: 1rem;
    line-height: 1.45;
    color: #831843;
    box-shadow: 0 2px 6px rgba(236, 72, 153, .25);
}
.birthday-reminder__icon-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .35rem;
    background: rgba(219, 39, 119, .2);
    color: #be185d;
}
.birthday-reminder__icon { width: 1.25rem; height: 1.25rem; }
.birthday-reminder__content { flex: 1; min-width: 0; }
.birthday-reminder__label {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #be185d;
    margin-bottom: .25rem;
}
.birthday-reminder__body { color: #831843; word-break: break-word; }
[data-theme="dark"] .birthday-reminder {
    background: linear-gradient(135deg, rgba(236, 72, 153, .28) 0%, rgba(219, 39, 119, .2) 100%);
    border-color: #ec4899;
    border-left-color: #f472b6;
    color: #fbcfe8;
    box-shadow: 0 2px 8px rgba(236, 72, 153, .25);
}
[data-theme="dark"] .birthday-reminder__icon-wrap { background: rgba(219, 39, 119, .35); color: #f9a8d4; }
[data-theme="dark"] .birthday-reminder__label { color: #f9a8d4; }
[data-theme="dark"] .birthday-reminder__body { color: #fbcfe8; }

/* ========== PUBLIC HOLIDAY (Estonian riigipühad, slate/blue — distinct from birthday) ========== */
.public-holiday-banner-wrap {
    margin-bottom: 1rem;
    display: none;
}
.public-holiday-banner-wrap:not([hidden]) { display: block; }
.public-holiday-banner {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%);
    border: 1px solid #6366f1;
    border-left: 4px solid #4338ca;
    border-radius: .5rem;
    padding: .85rem 1.1rem;
    font-size: 1rem;
    line-height: 1.45;
    color: #1e1b4b;
    box-shadow: 0 2px 6px rgba(67, 56, 202, .2);
}
.public-holiday-banner__icon-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .35rem;
    background: rgba(67, 56, 202, .15);
    color: #4338ca;
}
.public-holiday-banner__icon { width: 1.25rem; height: 1.25rem; }
.public-holiday-banner__content { flex: 1; min-width: 0; }
.public-holiday-banner__label {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #4338ca;
    margin-bottom: .25rem;
}
.public-holiday-banner__body { color: #1e1b4b; word-break: break-word; font-weight: 600; }
[data-theme="dark"] .public-holiday-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, .22) 0%, rgba(67, 56, 202, .18) 100%);
    border-color: #818cf8;
    border-left-color: #a5b4fc;
    color: #e0e7ff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .2);
}
[data-theme="dark"] .public-holiday-banner__icon-wrap { background: rgba(129, 140, 248, .25); color: #c7d2fe; }
[data-theme="dark"] .public-holiday-banner__label { color: #c7d2fe; }
[data-theme="dark"] .public-holiday-banner__body { color: #e0e7ff; }

.day-tab--holiday:not(.active) {
    border-color: #6366f1;
    border-left-width: 3px;
}
.day-tab-holiday-badge {
    display: inline-block;
    margin-left: .35rem;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
    padding: .12rem .32rem;
    border-radius: .25rem;
    background: #4338ca;
    color: #fff;
    vertical-align: middle;
    line-height: 1.2;
    cursor: help;
}
.day-tab.active .day-tab-holiday-badge {
    background: rgba(255, 255, 255, .28);
    color: #fff;
}

/* ========== DAY TABS ========== */
.day-tabs {
    display: flex; gap: .35rem; margin-bottom: 1.25rem;
    overflow-x: auto; padding-bottom: .25rem;
}
.day-tab {
    padding: .45rem 1rem; border-radius: .5rem;
    font-size: .85rem; font-weight: 500; white-space: nowrap;
    background: var(--bg-card); border: 1.5px solid var(--border);
    color: var(--text); transition: all .15s; cursor: pointer;
}
.day-tab:hover { border-color: var(--accent); color: var(--accent); }
.day-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.day-tab.today { border-color: #f59e0b; }
.day-tab .tab-count {
    display: inline-block; margin-left: .3rem;
    background: rgba(0,0,0,.08); border-radius: 1rem;
    padding: 0 .4rem; font-size: .75rem;
}
.day-tab.active .tab-count { background: rgba(255,255,255,.25); }

/* ========== DESIGN DEMO SWITCHER ========== */
.design-demo {
    display: flex; align-items: center; gap: .75rem;
    margin-bottom: 1rem; padding: .6rem .85rem;
    background: var(--bg-card); border: 1px dashed var(--border);
    border-radius: .5rem; flex-wrap: wrap;
}
.design-demo__label {
    font-size: .8rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em;
}
.design-demo__buttons { display: flex; gap: .35rem; flex-wrap: wrap; max-width: 100%; }
.design-demo__btn {
    padding: .35rem .7rem; border-radius: .4rem; font-size: .8rem; font-weight: 500;
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    cursor: pointer; transition: all .15s;
}
.design-demo__btn:hover { border-color: var(--accent); color: var(--accent); }
.design-demo__btn.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ========== VIEW TOGGLE (Päev / Nädal) ========== */
.view-toggle {
    display: flex; margin-left: .5rem; flex-shrink: 0;
    width: 6.5rem; /* fixed width so both buttons always visible on mobile */
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: .4rem; position: relative; z-index: 1;
    /* no overflow:hidden – was clipping the second button when flex gave toggle too little space */
}
.view-toggle__btn {
    flex: 1; min-width: 0; /* equal width, allow shrink only if needed */
    padding: .35rem .5rem; font-size: .8rem; font-weight: 500;
    background: transparent; border: none; color: var(--text-secondary);
    cursor: pointer; transition: background .15s, color .15s;
    white-space: nowrap;
}
.view-toggle__btn:hover { color: var(--text); background: var(--bg-card-hover); }
.view-toggle__btn.active {
    background: var(--accent); color: #fff;
}

/* ========== WEEK VIEW (nädalavaade) ========== */
.week-view {
    display: grid; grid-template-columns: repeat(7, minmax(8.5rem, 1fr));
    gap: .5rem; width: 100%; overflow-x: auto;
    padding-bottom: .5rem; min-width: 100%; contain: layout;
}
@media (max-width: 1400px) {
    .week-view { grid-template-columns: repeat(5, minmax(8.5rem, 1fr)); }
}
@media (max-width: 1100px) {
    .week-view { grid-template-columns: repeat(4, minmax(8rem, 1fr)); gap: .4rem; }
}
@media (max-width: 800px) {
    .week-view { grid-template-columns: repeat(3, minmax(7.5rem, 1fr)); gap: .35rem; }
}
@media (max-width: 600px) {
    .week-view { grid-template-columns: repeat(2, minmax(7rem, 1fr)); gap: .3rem; }
}
@media (max-width: 420px) {
    .week-view { grid-template-columns: 1fr; }
    .week-view-slot {
        padding: .35rem .45rem;
    }
    .week-view-day__content {
        padding: .4rem .5rem;
        gap: .35rem;
    }
}
.week-view-day {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: .4rem; overflow: hidden;
    min-height: 5.5rem; min-width: 0;
}
.week-view-day--today {
    border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light);
}
.week-view-day--holiday:not(.week-view-day--today) {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, .35);
}
.week-view-day--holiday.week-view-day--today {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light), inset 0 3px 0 0 #6366f1;
}
.week-view-day__header {
    padding: .45rem .55rem; background: var(--bg-card-hover);
    border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background .15s;
}
.week-view-day__header:hover { background: var(--accent-light); }
.week-view-day__name {
    display: block; font-size: .75rem; font-weight: 700;
    color: var(--text); text-transform: uppercase; letter-spacing: .02em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.week-view-day__date {
    display: block; font-size: .7rem; color: var(--text-muted); margin-top: .05rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.week-view-day__holiday {
    display: block;
    margin-top: .4rem;
    padding-top: .35rem;
    border-top: 1px dashed rgba(99, 102, 241, .45);
    font-size: .72rem;
    font-weight: 700;
    color: #3730a3;
    line-height: 1.35;
}
[data-theme="dark"] .week-view-day__holiday {
    color: #a5b4fc;
    border-top-color: rgba(165, 180, 252, .4);
}
.week-view-day__content {
    padding: .4rem .45rem; display: flex; flex-direction: column; gap: .3rem;
    overflow-y: auto; overflow-x: hidden; min-height: 3.5rem;
    min-width: 0;
}
.week-view-slot {
    font-size: .7rem; padding: .3rem .35rem;
    background: var(--bg-card-hover); border-radius: .35rem;
    border-left: 3px solid var(--accent);
    display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: .12rem;
    min-width: 0;
}
.week-view-slot__status {
    display: flex; flex-direction: column; gap: .1rem; margin-bottom: .15rem;
}
.week-view-slot__status .slot-badge {
    font-size: .6rem;
    padding: .15rem .3rem;
    line-height: 1.2;
    text-align: center;
}
.week-view-slot__header {
    display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 0;
    font-weight: 600; color: var(--text); line-height: 1.2;
    min-width: 0;
    width: 100% !important;
}
.week-view-slot__time {
    display: block;
    width: 100%;
    padding: .1rem .2rem;
    margin: 0 -0.35rem 0.08rem -0.35rem;
    font-size: .65rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    border: 1px solid var(--border);
    border-radius: .25rem;
    background: var(--bg-card);
    order: 0;
}
.week-view-slot.week-view-slot--rescheduled .week-view-slot__time {
    font-size: .6rem;
    padding: .08rem .15rem;
}
.week-view-slot__level {
    display: block;
    width: 100%;
    padding: .25rem .35rem;
    margin: -0.3rem -0.35rem 0.15rem -0.35rem;
    font-size: .65rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    border-radius: .3rem .3rem 0 0;
    letter-spacing: 0.02em;
    white-space: nowrap;
    text-transform: uppercase;
    order: -1;
    border: none;
    box-sizing: border-box;
}
button.week-view-slot__level {
    width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
}
.week-view-slot__spots-available {
    display: inline-block;
    font-size: .62rem; font-weight: 700;
    color: #15803d;
    background: #dcfce7;
    padding: .1rem .3rem;
    border-radius: .25rem;
    white-space: nowrap;
    flex: 0 1 auto;
}
[data-theme="dark"] .week-view-slot__spots-available {
    color: #86efac;
    background: rgba(34, 197, 94, .25);
}
.week-view-slot__trainer {
    font-size: .68rem; color: var(--text); font-weight: 650;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0; line-height: 1.3; padding: .05rem 0;
}
.week-view-slot__relocate-hint {
    font-size: .65rem; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0; flex: 0 1 auto;
}
.week-view-slot__riders {
    display: flex; flex-direction: column; gap: .1rem;
    margin-top: .1rem; padding-top: .15rem;
    border-top: 1px solid var(--border);
    min-width: 0;
}
.week-view-slot__riders-label {
    font-size: .6rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .02em; margin-bottom: .05rem;
}
.week-view-slot__masked-roster {
    font-size: .65rem; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block; min-width: 0;
}
.week-view-slot__rider-name {
    display: block; font-size: .65rem; color: var(--text);
    line-height: 1.3; padding-left: .2rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}
.week-view-slot__riders-chips {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin-top: 2px;
}
.week-view-slot__free-spots-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .35rem;
    margin-top: 2px;
    min-width: 0;
}
.week-view-slot__free-spots-row .week-view-slot__riders-chips {
    margin-top: 0;
    flex: 1 1 auto;
    min-width: 0;
}
.week-view-slot__free-spots-row .free-spot--compact {
    margin-top: 0;
    flex: 1 1 10rem;
    min-width: 0;
}
.week-view-slot__rider-chip {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px;
    max-width: 100%;
    padding: 1px 6px; border-radius: 20px;
    font-size: .68rem; line-height: 1.3;
    background: var(--bg-card-hover);
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.week-view-slot__rider-chip .badge-absent,
.week-view-slot__rider-chip .badge-taken {
    font-size: .58rem;
    padding: .05rem .28rem;
}
.week-view-slot__rider-chip--absent {
    opacity: .72;
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, var(--text-muted) 55%, transparent);
}
.week-view-slot__rider-chip--signup {
    background: color-mix(in srgb, var(--color-success, #16a34a) 10%, transparent);
    color: var(--color-success, #16a34a);
    text-decoration: none;
    opacity: 1;
}
.week-view-slot__rider-chip--free {
    background: color-mix(in srgb, var(--color-success, #16a34a) 15%, transparent);
    color: var(--color-success, #16a34a);
    cursor: pointer;
    text-decoration: none;
    opacity: 1;
}
.week-view-slot__rider-chip--free:hover { filter: brightness(1.08); }
.week-view-slot__rider-chip--staff-only {
    cursor: default;
    opacity: .85;
    font-size: .62rem;
    font-style: italic;
}
[data-theme="dark"] .week-view-slot__rider-chip {
    color: var(--text);
}
[data-theme="dark"] .week-view-slot__rider-chip--absent {
    color: var(--text-secondary);
    opacity: 0.88;
}
[data-theme="dark"] .week-view-slot__rider-chip--free,
[data-theme="dark"] .week-view-slot__rider-chip--signup {
    color: var(--free-spot-text);
}
[data-theme="dark"] .week-view-slot__rider-chip {
    background: color-mix(in srgb, var(--bg-card) 85%, var(--accent) 15%);
}
[data-theme="dark"] .week-view-slot__rider-chip--absent {
    background: color-mix(in srgb, var(--bg-card) 90%, var(--text-muted) 10%);
}
.week-view-event {
    font-size: .75rem; padding: .35rem .45rem;
    background: rgba(239,68,68,.08); border-radius: .4rem;
    border-left: 3px solid #ef4444;
}
.week-view-event__time { font-weight: 600; margin-right: .35rem; }
.week-view-event__name { color: var(--text); }

/* Perioodi sündmused (tunniplaan) */
.schedule-period-strip {
    padding: .35rem .55rem 0;
    display: flex;
    flex-direction: column;
    gap: .28rem;
}
.schedule-period-strip__item {
    border-radius: .35rem;
    border-left: 3px solid var(--period-border, var(--accent));
    padding: .22rem .4rem .24rem;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}
.schedule-period-strip__text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.schedule-period-pills {
    display: flex;
    flex-direction: column;
    gap: .28rem;
    margin: 0 0 .85rem;
}
.schedule-period-pill {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .45rem .75rem .48rem;
    border-radius: 0;
    border-top: 3px solid var(--period-border, var(--accent));
    font-size: 1.08rem;
    line-height: 1.3;
}
.schedule-period-pill__name {
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}
.schedule-period-pill__range {
    font-size: 1.02rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: auto;
    flex-shrink: 0;
}
.schedule-period-pill__no-signup {
    font-size: .65rem;
    color: var(--text-muted);
    font-style: italic;
}
.schedule-period-strip__no-signup {
    font-size: .65rem;
    color: var(--text-muted);
    font-style: italic;
}

.week-view-empty {
    font-size: .8rem; color: var(--text-muted); text-align: center;
    padding: .75rem;
}

/* ========== SCHEDULE DAY HEADING ========== */
.schedule-day-heading {
    font-size: 1.35rem; font-weight: 700; color: var(--text);
    margin-bottom: 1rem; padding-bottom: .5rem;
    border-bottom: 2px solid var(--border);
}

/* ========== ERITI KOMPAKTNE (compact day table) ========== */
.compact-view-heading { margin-bottom: .75rem; }
.compact-day-table-wrap {
    overflow-x: auto;
    border-radius: .75rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
}
.compact-day-table {
    width: 100%; border-collapse: collapse;
    font-size: .88rem;
}
.compact-day-table th {
    text-align: left;
    padding: .5rem .75rem;
    background: var(--bg-card-hover);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.compact-day-table td {
    padding: .4rem .75rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
}
.compact-day-table tbody tr:last-child td { border-bottom: none; }
.compact-day-table tbody tr:hover td { background: var(--bg-card-hover); }
.compact-day-table { table-layout: fixed; width: 100%; }
.compact-day-time { white-space: nowrap; font-weight: 600; width: 7%; }
.compact-day-time--wrap {
    white-space: normal;
    vertical-align: top;
}
.compact-day-time--rescheduled {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
    max-width: 100%;
    font-weight: 600;
    line-height: 1.25;
}
.compact-day-time__old {
    font-size: .72rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, var(--text-secondary) 55%, transparent);
}
.compact-day-time__arrow {
    font-size: .65rem;
    color: var(--text-muted);
    line-height: 1;
}
.compact-day-time__new {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text);
}
.compact-day-level { white-space: nowrap; width: 8%; }
.compact-day-trainer { white-space: nowrap; color: var(--text-secondary); width: 13%; max-width: 13%; overflow: hidden; text-overflow: ellipsis; }
.compact-day-riders {
    width: 46%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.compact-day-horse { white-space: nowrap; width: 26%; color: var(--text-secondary); }
.compact-day-vabad { white-space: nowrap; text-align: right; font-weight: 500; width: 15%; }
.compact-day-vabad--stack {
    white-space: normal;
    line-height: 1.35;
}
.compact-day-vabad--stack .slot-badge--rescheduled,
.compact-day-vabad--stack .slot-badge--cancelled { display: inline-flex; }
.compact-day-level-pill {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: .35rem;
    font-size: .78rem;
    font-weight: 600;
}
.compact-day-row--cancelled {
    background: color-mix(in srgb, var(--bg-card) 88%, #57534e 12%);
    box-shadow: inset 3px 0 0 #292524;
}
.compact-day-row--cancelled .compact-day-time,
.compact-day-row--cancelled .compact-day-level-pill,
.compact-day-row--cancelled .compact-day-trainer,
.compact-day-row--cancelled .compact-day-riders { text-decoration: line-through; color: var(--text-secondary); }
.compact-day-row--class-rider td.compact-day-riders,
.compact-day-row--class-rider td.compact-day-horse { border-top-color: transparent; }
.compact-day-events-section {
    margin-top: .75rem;
    padding: .5rem .75rem;
    background: var(--bg-card);
    border-radius: .5rem;
    border: 1px solid var(--border);
}
.compact-day-events-heading {
    font-size: .8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
    margin: 0 0 .35rem 0;
}
.compact-day-events-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.compact-day-event-item { font-size: .9em; }
.compact-day-event-time { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.compact-day-event-name { font-weight: 500; }
.compact-day-event-desc { color: var(--text-secondary); }

/* ========== SCHEDULE CARDS ========== */
.schedule-container { display: flex; flex-direction: column; gap: 1rem; }
.no-classes {
    text-align: center; padding: 3rem 1rem; color: var(--text-muted);
    font-size: 1rem; background: var(--bg-card); border-radius: .75rem;
}
.class-card {
    background: var(--bg-card); border-radius: .75rem;
    border: 2px solid var(--border);
    overflow: hidden; transition: box-shadow .15s;
}
.class-card:hover { box-shadow: var(--shadow-card); }
.class-card__header {
    padding: 0;
    background: var(--bg-card-hover);
    border-bottom: 2px solid var(--border);
}
.class-card__header-top {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .5rem 1.1rem;
    min-height: 3.5rem;
    justify-content: flex-start; align-items: center;
}
.class-card__times {
    display: flex; flex-direction: column; justify-content: center; line-height: 1.1;
    min-width: 3.5rem;
}
/* Header fonts: rem fallbacks so text is always visible */
.class-card__time-tall {
    font-size: 1.35rem; font-weight: 800; color: var(--text);
    letter-spacing: .02em; line-height: 1;
}
.class-card__time-plats {
    font-size: .9rem; font-weight: 600; color: var(--text-secondary);
    margin-top: .1rem;
}
.class-card__times--rescheduled {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .35rem;
    min-width: auto; line-height: 1.25;
}
.class-card__times--rescheduled .class-card__time-arrow {
    font-size: .85rem; color: var(--text-muted); font-weight: 700;
}
.class-card__times--rescheduled .class-card__time-new {
    font-size: 1rem; font-weight: 800; color: var(--accent);
}
.class-card__level {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 3.5rem; padding: .5rem .85rem;
    border-radius: .5rem; font-size: 1.05rem; font-weight: 800;
    color: #fff; letter-spacing: .03em;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.class-card__trainer {
    display: flex; align-items: center; gap: .5rem;
    font-size: 1.05rem; font-weight: 700; color: var(--accent);
    background: var(--accent-light); padding: .5rem .9rem;
    border-radius: .5rem;
}
.class-card__trainer svg { width: 1.35rem; height: 1.35rem; flex-shrink: 0; }
.class-card__trainer--missing {
    color: #ef4444; background: var(--badge-absent-bg);
}
.class-card__spots-available {
    display: inline-flex; align-items: center;
    font-size: .75rem; font-weight: 700;
    color: #15803d;
    background: #dcfce7;
    padding: .25rem .5rem;
    border-radius: .35rem;
    white-space: nowrap;
}
[data-theme="dark"] .class-card__spots-available {
    color: #86efac;
    background: rgba(34, 197, 94, .25);
}
.class-card__spots-available--overcap {
    color: #b45309;
    background: #fffbeb;
}
[data-theme="dark"] .class-card__spots-available--overcap {
    color: #fbbf24;
    background: rgba(180, 83, 9, .28);
}
.class-card__riders { padding: .5rem .75rem .75rem; }
.rider-row--header {
    cursor: default; padding: .25rem .5rem .15rem;
    border-bottom: 1px solid var(--border-light); margin-bottom: .15rem;
}
.rider-row--header:hover { background: transparent; }
.rider-row--header .rider-row__name,
.rider-row--header .rider-row__horse {
    font-size: .72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted);
}
.rider-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .4rem .5rem; border-radius: .4rem;
    transition: background .1s; cursor: pointer;
}
.rider-row:hover { background: var(--bg-card-hover); }
.rider-row__name { font-size: .88rem; font-weight: 500; flex: 1; }
.rider-row__horse {
    font-size: .78rem; color: var(--text-secondary); background: var(--horse-bg);
    padding: .15rem .5rem; border-radius: .3rem;
    min-width: 5.5rem; text-align: center; flex-shrink: 0;
}
.rider-row__horse:empty { background: none; min-width: 5.5rem; }
.rider-row__horse--assigned { color: #16a34a; background: #f0fdf4; }
[data-theme="dark"] .rider-row__horse--assigned { color: #4ade80; background: rgba(34,197,94,.1); }
.rider-row__horse--pending { color: #b45309; background: #fefce8; font-style: italic; font-size: .72rem; }
[data-theme="dark"] .rider-row__horse--pending { color: #fbbf24; background: rgba(251,191,36,.1); }
.rider-row--absent .rider-row__name {
    color: var(--text-muted);
}
.rider-row--absent .rider-row__horse { opacity: .4; }
.slot-badge { display: inline-flex; align-items: center; font-size: .65rem; font-weight: 700; padding: .2rem .45rem; border-radius: .25rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
/* TIME CHANGED — amber / yellow (high contrast dark text) */
.slot-badge--rescheduled {
    background: linear-gradient(135deg, #fde047 0%, #eab308 50%, #ca8a04 100%);
    color: #422006;
    font-size: .7rem;
    font-weight: 800;
    padding: .3rem .55rem;
    border-radius: .35rem;
    box-shadow: 0 2px 8px rgba(202, 138, 4, .45);
    border: 1px solid rgba(66, 32, 6, .28);
    letter-spacing: .04em;
    animation: slot-badge-pulse-rescheduled 2s ease-in-out infinite;
}
@keyframes slot-badge-pulse-rescheduled {
    0%, 100% { box-shadow: 0 2px 8px rgba(202, 138, 4, .45); transform: scale(1); }
    50% {
        box-shadow: 0 2px 14px rgba(202, 138, 4, .72), 0 0 18px rgba(250, 204, 21, .4);
        transform: scale(1.02);
    }
}
[data-theme="dark"] .slot-badge--rescheduled {
    background: linear-gradient(135deg, #fef08a 0%, #facc15 45%, #eab308 100%);
    color: #451a03;
    border: 1px solid rgba(234, 179, 8, .55);
    animation: slot-badge-pulse-rescheduled-dark 2s ease-in-out infinite;
}
@keyframes slot-badge-pulse-rescheduled-dark {
    0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, .35); transform: scale(1); }
    50% {
        box-shadow: 0 2px 16px rgba(234, 179, 8, .55), 0 0 22px rgba(250, 204, 21, .25);
        transform: scale(1.02);
    }
}
/* CANCELLED — red */
.slot-badge--cancelled {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 45%, #b91c1c 100%);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    padding: .3rem .55rem;
    border-radius: .35rem;
    box-shadow: 0 2px 10px rgba(185, 28, 28, .55);
    border: 1px solid rgba(255, 255, 255, .42);
    letter-spacing: .04em;
    animation: slot-badge-pulse-cancelled 2s ease-in-out infinite;
}
@keyframes slot-badge-pulse-cancelled {
    0%, 100% { box-shadow: 0 2px 10px rgba(185, 28, 28, .55); transform: scale(1); }
    50% {
        box-shadow: 0 2px 16px rgba(185, 28, 28, .82), 0 0 22px rgba(248, 113, 113, .42);
        transform: scale(1.02);
    }
}
[data-theme="dark"] .slot-badge--cancelled {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 40%, #dc2626 100%);
    color: #fff;
    border: 1px solid rgba(254, 202, 202, .4);
    animation: slot-badge-pulse-cancelled-dark 2s ease-in-out infinite;
}
@keyframes slot-badge-pulse-cancelled-dark {
    0%, 100% { box-shadow: 0 2px 10px rgba(127, 29, 29, .55); transform: scale(1); }
    50% {
        box-shadow: 0 2px 18px rgba(239, 68, 68, .65), 0 0 26px rgba(248, 113, 113, .35);
        transform: scale(1.02);
    }
}
.class-card--cancelled .class-card__header-top .class-card__level,
.class-card--cancelled .class-card__times,
.class-card--cancelled .class-card__trainer,
.class-card--cancelled .class-card__riders .rider-row__name,
.class-card--cancelled .class-card__riders .rider-row__horse {
    text-decoration: line-through;
}
.class-card--cancelled .class-card__riders .rider-row {
    opacity: .85;
}
.class-card--cancelled {
    background: color-mix(in srgb, var(--bg-card) 90%, #78716c 10%);
    border-left: 4px solid #44403c !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 70%, #57534e 30%);
}
.week-view-slot--cancelled .week-view-slot__time,
.week-view-slot--cancelled .week-view-slot__level,
.week-view-slot--cancelled .week-view-slot__trainer,
.week-view-slot--cancelled .week-view-slot__rider-name {
    text-decoration: line-through;
    color: var(--text-secondary);
}
.week-view-slot--cancelled {
    opacity: 1;
    background: color-mix(in srgb, var(--bg-card-hover) 82%, #57534e 18%);
    border-left-color: #44403c !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 65%, #78716c 35%);
}

/* Read-only stub: class moved to another weekday (full card + riders only on new day) */
.class-card--reschedule-notice {
    background: color-mix(in srgb, var(--bg-card) 88%, var(--accent) 12%);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 80%, var(--accent) 20%);
}
.class-card--reschedule-notice .class-card__header-top {
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}
/* Same horizontal inset as .class-card__header-top (1.1rem) so „Tund toimub nüüd“ lines up with times / tase / treener */
.class-card__reschedule-notice-body {
    padding: .5rem 1.1rem .65rem;
    border-top: 1px solid var(--border-light);
}
.class-card--reschedule-notice .reschedule-notice__text {
    margin: 0;
    font-size: .9rem;
    line-height: 1.35;
    color: var(--text);
}
.class-card--reschedule-notice .reschedule-notice__goto {
    margin-top: .5rem;
}
.week-view-slot--reschedule-notice {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    align-items: flex-start;
    padding: .35rem .4rem;
    background: color-mix(in srgb, var(--bg-card-hover) 90%, var(--accent) 10%);
    border-radius: .35rem;
}
.week-view-slot--reschedule-notice .week-view-reschedule-goto {
    font-size: .65rem;
    padding: .15rem .35rem;
}
.week-view-slot__relocate-hint {
    display: block;
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: .2rem;
    line-height: 1.25;
}
.sched-card__relocate-note {
    font-size: .78rem;
    color: var(--text-muted);
    margin: .35rem 0 .25rem;
    line-height: 1.3;
}
.sched-cl__sub--relocate {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .15rem;
}
.class-card--reschedule-notice .class-card__header-top .class-card__times {
    flex-shrink: 0;
}
.compact-day-row--reschedule-notice .compact-day-reschedule-summary {
    display: inline-block;
    margin-right: .35rem;
    font-size: .82rem;
    vertical-align: middle;
}
.sched-card--reschedule-notice {
    opacity: 0.95;
    border: 1px dashed color-mix(in srgb, var(--border) 70%, var(--accent) 30%);
}
.sched-card--reschedule-notice .sched-card__goto {
    margin-top: .35rem;
}
.sched-cl__row--reschedule-notice .sched-cl__goto {
    font-size: .7rem;
    padding: .2rem .4rem;
}

/* Rescheduled badge: allow wrap in tight views (Ajakava, Nädal) */
body[data-schedule-theme="timeline"] .class-card__header-top .slot-badge--rescheduled {
    white-space: normal;
    line-height: 1.2;
    text-align: center;
    font-size: .6rem;
    padding: .25rem .4rem;
    max-width: 5.5rem;
}
body[data-schedule-theme="timeline"] .class-card__header-top .slot-badge--cancelled {
    white-space: normal;
    line-height: 1.2;
    text-align: center;
    font-size: .6rem;
    padding: .25rem .4rem;
    max-width: 5.5rem;
}
.week-view-slot__top .slot-badge--rescheduled {
    white-space: normal;
    line-height: 1.2;
    text-align: center;
    font-size: .6rem;
    padding: .2rem .35rem;
    max-width: 5rem;
}
.week-view-slot__top .slot-badge--cancelled {
    white-space: normal;
    line-height: 1.2;
    text-align: center;
    font-size: .6rem;
    padding: .2rem .35rem;
    max-width: 5rem;
}

.badge-absent {
    font-size: .7rem; font-weight: 600; color: var(--badge-absent-text);
    background: var(--badge-absent-bg); padding: .1rem .4rem; border-radius: .25rem;
}
.badge-taken {
    font-size: .7rem; font-weight: 600; color: var(--badge-taken-text);
    background: var(--badge-taken-bg); padding: .1rem .4rem; border-radius: .25rem;
}
.badge-notice {
    font-size: .65rem; font-weight: 600; padding: .1rem .35rem; border-radius: .25rem;
    margin-left: .25rem;
}
.badge-notice--late {
    color: #b91c1c; background: #fef2f2;
}
.badge-notice--ontime {
    color: #166534; background: #dcfce7;
}
/* Open class slots: reuse .free-spot (same look as „Vaba koht — Registreeru!“) */
.class-card__open-signup-wrap {
    padding: 0 .75rem .65rem;
}
.class-card__open-signup-wrap .free-spot {
    margin-top: .15rem;
}
.class-card__free-spots-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: .5rem;
    padding: 0 .75rem .65rem;
}
.class-card__free-spots-row .free-spot {
    flex: 1 1 12rem;
    min-width: 0;
    margin-top: 0;
}
.sched-card__open-signup {
    padding: 0 .5rem .5rem;
}
.sched-card__open-signup .free-spot {
    margin-top: 0;
}
/* Nädal / kompaktvaade / tabel: kitsam sama stiil */
.free-spot--compact {
    padding: .35rem .5rem;
    margin-top: .35rem;
    gap: .4rem;
}
.free-spot--compact .free-spot__icon {
    width: 1.05rem;
    height: 1.05rem;
}
.free-spot--compact .free-spot__label {
    font-size: .78rem;
    line-height: 1.25;
}
.compact-day-vabad .free-spot--compact {
    margin-top: .25rem;
}
body[data-schedule-theme="timeline"] .class-card__open-signup-wrap .free-spot,
body[data-schedule-theme="timeline"] .class-card__free-spots-row .free-spot {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.free-spot {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem; margin-top: .25rem;
    border: 2px dashed var(--free-spot-border); border-radius: .5rem;
    background: var(--free-spot-bg); cursor: pointer;
    transition: all .15s;
}
button.free-spot {
    font: inherit;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    color: inherit;
}
button.free-spot.free-spot--staff-only { cursor: default; }
.free-spot:hover { border-color: var(--free-spot-hover-border); background: var(--free-spot-hover-bg); }
.free-spot__label { font-size: .82rem; font-weight: 600; color: var(--free-spot-text); }
.free-spot__icon { width: 1.25rem; height: 1.25rem; color: #22c55e; }
.rider-row--signedup { background: var(--badge-taken-bg); border-radius: .4rem; }
.rider-row--signedup .rider-row__name { color: var(--badge-taken-text); }

.replacement-group {
    position: relative;
    border-left: 2px solid var(--badge-taken-text);
    margin-left: .5rem; padding-left: .5rem;
    border-radius: 0 0 0 .4rem;
}
.replacement-arrow {
    display: flex; align-items: center; gap: .3rem;
    padding: 0 .25rem; color: var(--badge-taken-text);
}
.replacement-arrow svg { width: .85rem; height: .85rem; }

/* Skill-level badge colors (used in schedule, week view, admin) */
.level-0    { background: #a78bfa; }
.level-poni { background: #f472b6; }
.level-1a   { background: #38bdf8; }
.level-1a-plus { background: #0ea5e9; }
.level-1b   { background: #34d399; }
.level-1b-plus { background: #10b981; }
.level-2a   { background: #fb923c; }
.level-2b   { background: #f97316; }
.level-hup  { background: #ef4444; }
.level-event {
    background: #ef4444; white-space: normal; word-break: break-word;
    overflow-wrap: break-word; text-align: center; line-height: 1.25;
}
.event-card .level-event { background: var(--event-badge-color); }

/* Level-colored left border on class cards (main + admin) */
/* Level colors are applied inline from API (skill_levels.color) */
.class-card.level-event,
.admin-slot-card.level-event { border-left: 4px solid #ef4444; }

/* ========== EVENT CARDS ========== */
.event-card {
    --event-badge-color: #ef4444;
    background: var(--bg-card); border-radius: .75rem;
    border: 2px solid var(--event-badge-color);
    overflow: hidden; transition: box-shadow .15s;
}
.event-card:hover { box-shadow: 0 4px 16px rgba(239,68,68,.15); }
.event-card[style*="--event-badge-color"]:hover {
    box-shadow: 0 4px 16px color-mix(in srgb, var(--event-badge-color) 15%, transparent);
}
.event-card__header {
    display: flex; flex-direction: column; gap: .5rem;
    padding: .85rem 1rem;
    background: color-mix(in srgb, var(--event-badge-color) 6%, transparent);
    border-bottom: 2px solid color-mix(in srgb, var(--event-badge-color) 20%, transparent);
}
[data-theme="dark"] .event-card__header {
    background: color-mix(in srgb, var(--event-badge-color) 10%, transparent);
}
.event-card__header-top {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.event-category-label {
    display: inline-block; font-size: .7rem; font-weight: 600; text-transform: uppercase;
    color: var(--event-category-color, var(--event-badge-color)); letter-spacing: .03em;
    margin-right: .25rem;
}
.event-card--inactive {
    opacity: .65; filter: saturate(0.7);
}
.event-card__time {
    font-size: .9rem; font-weight: 700; color: var(--text);
}
.event-card__time--allday {
    font-size: .85rem; font-weight: 600; color: var(--text-secondary); font-style: italic;
}
.event-card__desc {
    font-size: .82rem; color: var(--text-secondary); line-height: 1.4;
    padding: 0 1rem .5rem;
}
.event-card__signups,
.event-card__waitlist { padding: .35rem .75rem 0; }
.event-card__waitlist { padding-top: .25rem; }
.event-signup-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .35rem .5rem; border-radius: .4rem; font-size: .88rem;
}
.event-waitlist-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .3rem .5rem; border-radius: .4rem; font-size: .82rem;
    background: var(--bg-card-hover); font-style: italic; color: var(--text-secondary);
}
.event-waitlist-row__name { flex: 1; }
.event-waitlist-row__badge {
    font-size: .7rem; font-style: normal; color: var(--text-muted);
}
.event-signup-row__name { font-weight: 500; flex: 1; }
.event-signup-row__cancel {
    font-size: .75rem; color: var(--badge-absent-text); cursor: pointer;
    background: var(--badge-absent-bg); border: none; padding: .15rem .5rem;
    border-radius: .25rem; font-weight: 600;
}
.event-signup-row__cancel:hover { background: var(--event-badge-color); color: #fff; }
.event-card__spots {
    padding: .35rem 1rem; font-size: .8rem; font-weight: 600;
    color: var(--text-secondary);
}
.event-card__spots--full { color: var(--event-badge-color); }
.event-card__register {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem; margin: .25rem .75rem .75rem;
    border: 2px dashed color-mix(in srgb, var(--event-badge-color) 35%, transparent);
    border-radius: .5rem;
    background: color-mix(in srgb, var(--event-badge-color) 4%, transparent);
    cursor: pointer; transition: all .15s;
}
.event-card__register:hover {
    border-color: var(--event-badge-color);
    background: color-mix(in srgb, var(--event-badge-color) 10%, transparent);
}
.event-card__register--disabled {
    opacity: .5; cursor: not-allowed; pointer-events: none;
}
.event-card__register-label {
    font-size: .82rem; font-weight: 600; color: var(--event-badge-color);
}
.event-card__register-icon { width: 1.25rem; height: 1.25rem; color: var(--event-badge-color); }

/* ========== SHARE LINK ========== */
.share-link-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: .2rem;
    border-radius: .3rem; display: inline-flex; align-items: center; justify-content: center;
    transition: color .15s, background .15s;
    margin-left: auto; flex-shrink: 0;
}
.share-link-btn:hover { color: var(--accent); background: var(--accent-light); }
.share-link-btn svg { width: 1rem; height: 1rem; }
.share-link-btn--admin {
    color: var(--text-muted); padding: .15rem .4rem;
    font-size: .75rem; border-radius: .25rem;
    display: inline-flex; align-items: center; gap: .25rem;
}
.share-link-btn--admin:hover { color: var(--accent); background: var(--accent-light); }

@keyframes cardHighlight {
    0% { box-shadow: 0 0 0 3px var(--accent); }
    70% { box-shadow: 0 0 0 3px var(--accent); }
    100% { box-shadow: none; }
}
.card--highlighted {
    animation: cardHighlight 2s ease-out;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    padding: .5rem 1rem; border-radius: .5rem; font-size: .85rem; font-weight: 500;
    border: none; transition: all .15s;
}
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-icon {
    padding: .4rem; background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: .4rem; color: var(--text);
}
.btn-icon svg { width: 1.2rem; height: 1.2rem; }
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

.week-date-popover .btn.btn-icon.week-date-popover__nav-btn {
    flex-shrink: 0;
    padding: 0.4rem;
    border-radius: 0.35rem;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    color: var(--text);
}
.week-date-popover .btn.btn-icon.week-date-popover__nav-btn:hover {
    background: var(--bg);
    border-color: var(--text-muted);
    color: var(--text);
}
[data-theme="dark"] .week-date-popover .btn.btn-icon.week-date-popover__nav-btn {
    background: #0f172a;
    border-color: #64748b;
    color: #f1f5f9;
}
[data-theme="dark"] .week-date-popover .btn.btn-icon.week-date-popover__nav-btn:hover {
    background: #334155;
    border-color: #94a3b8;
    color: #fff;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #eab308; color: #1c1917; border: 1px solid #ca8a04; }
.btn-warning:hover { background: #ca8a04; color: #1c1917; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--text-muted); }
.stats-preset-btn--active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }
.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-print { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-print:hover { border-color: var(--accent); color: var(--accent); }
.btn-print svg { width: 1rem; height: 1rem; }

/* ========== MODALS ========== */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
}
.modal[hidden] { display: none; }
.modal__backdrop {
    position: absolute; inset: 0; background: var(--modal-backdrop);
    backdrop-filter: blur(4px);
}
.modal__content {
    position: relative; background: var(--bg-card); border-radius: .75rem;
    padding: 1.5rem; max-width: 28rem; width: 90%;
    box-shadow: var(--shadow-modal); color: var(--text);
    animation: modalIn .2s ease-out;
}
.modal__content--wide { max-width: 36rem; }

/* Tase → tulevased tunnid (modal) */
#level-future-modal.modal {
    padding: max(0.5rem, env(safe-area-inset-top, 0px))
        max(0.5rem, env(safe-area-inset-right, 0px))
        max(0.5rem, env(safe-area-inset-bottom, 0px))
        max(0.5rem, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    align-items: flex-end;
}
@media (min-width: 640px) {
    #level-future-modal.modal { align-items: center; }
}
.level-future-modal__content {
    width: 100%;
    max-width: 26rem;
    max-height: min(85dvh, 32rem);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: .85rem .85rem 0 0;
}
@media (min-width: 640px) {
    .level-future-modal__content {
        max-width: 32rem;
        max-height: min(80vh, 28rem);
        border-radius: .75rem;
    }
}
.level-future-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0 1rem 1rem;
    font-size: .9rem;
}
#level-future-modal .modal__title {
    flex-shrink: 0;
    margin: 0;
    padding: 1rem 1rem .65rem;
    font-size: 1.05rem;
}
#level-future-modal .modal__actions {
    flex-shrink: 0;
    padding: .75rem 1rem 1rem;
    margin: 0;
    border-top: 1px solid var(--border);
    background: var(--bg-card-hover);
}
.level-future-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.level-future-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    width: 100%;
    text-align: left;
    padding: .55rem .65rem;
    border: 1px solid var(--border);
    border-radius: .5rem;
    background: var(--bg-card);
    color: var(--text);
    font: inherit;
    font-size: .85rem;
    line-height: 1.35;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.level-future-row:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}
.level-future-row:disabled,
.level-future-row--muted {
    opacity: .65;
    cursor: not-allowed;
}
.level-future-row__meta {
    font-size: .78rem;
    color: var(--text-secondary);
}
.level-future-row__badges {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .15rem;
}
button.level-future-badge {
    font: inherit;
    font-size: inherit;
    font-weight: 600;
    border: none;
    padding: 0 .45rem;
    border-radius: .35rem;
    cursor: pointer;
    line-height: 1.35;
    vertical-align: baseline;
}
button.level-future-badge:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.compact-day-level button.level-future-badge {
    padding: .12rem .4rem;
    border-radius: .35rem;
}
.level-future-badge--sched-cl {
    font-size: .78rem;
    padding: .08rem .32rem;
    border-radius: .3rem;
    line-height: 1.25;
}
.week-view-slot__top .level-future-badge {
    flex-shrink: 0;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Competition detail modal – enhanced look; body scrolls when content is tall */
#competition-detail-modal.modal {
    padding: max(0.75rem, env(safe-area-inset-top, 0px))
        max(0.75rem, env(safe-area-inset-right, 0px))
        max(0.75rem, env(safe-area-inset-bottom, 0px))
        max(0.75rem, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
}
#competition-detail-modal .modal__content {
    max-width: 42rem;
    width: min(42rem, 100%);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: min(90vh, calc(100dvh - 1.5rem));
}
#competition-detail-modal .modal__title {
    flex-shrink: 0;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #0c4a6e 0%, #0e7490 100%);
    color: #fff;
    border-bottom: 3px solid #06b6d4;
}
#competition-detail-modal .modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    padding: 1.5rem;
    margin-bottom: 0;
    background: var(--bg-card);
    color: var(--text);
}
#competition-detail-modal .modal__actions {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    background: var(--bg-card-hover);
    border-top: 1px solid var(--border);
}

.competition-detail-dl {
    margin: 0;
    font-size: .95rem;
    background: var(--bg-card-hover);
    border-radius: .75rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
}
.competition-detail-dl dt {
    font-weight: 600;
    color: var(--text-muted);
    margin-top: .85rem;
    margin-bottom: .25rem;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.competition-detail-dl dt:first-child { margin-top: 0; }
.competition-detail-dl dd {
    margin: 0;
    color: var(--text);
    font-weight: 500;
}
.competition-detail-dl dd + dt { margin-top: .75rem; }
.competition-detail-dl a {
    color: var(--accent);
    text-decoration: none;
}
.competition-detail-dl a:hover { text-decoration: underline; }

.competition-detail-signups,
.competition-detail-helpers {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: var(--bg-card-hover);
    border-radius: .75rem;
    border: 1px solid var(--border);
}
.competition-detail-signups > strong,
.competition-detail-helpers > strong {
    display: block;
    font-size: .9rem;
    color: var(--text);
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}
.competition-detail-signups .event-card__signups,
.competition-detail-signups ul,
.competition-detail-helpers .event-card__signups,
.competition-detail-helpers ul {
    margin: 0 0 .75rem 0;
    padding-left: 1.25rem;
    font-size: .9rem;
    color: var(--text-secondary);
}
.competition-detail-signups li,
.competition-detail-helpers li {
    margin-bottom: .35rem;
    padding: .25rem 0;
}
.competition-detail-signups .competition-detail-waitlist-note {
    font-size: .85rem;
    margin: .5rem 0 .75rem 0;
    padding: .5rem .75rem;
    background: rgba(0,0,0,.04);
    border-radius: .5rem;
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
}
[data-theme="dark"] .competition-detail-signups .competition-detail-waitlist-note {
    background: rgba(255,255,255,.06);
}
.competition-detail-signups .event-card__register--disabled,
.competition-detail-helpers .event-card__register--disabled {
    margin-top: .75rem;
    padding: .75rem;
    border-radius: .5rem;
    background: var(--bg);
    color: var(--text-muted);
    font-size: .9rem;
}
.competition-detail-signups .btn-sm,
.competition-detail-helpers .btn-sm {
    margin-top: .5rem;
}
.competition-my-status {
    margin-top: 1rem;
    padding: .875rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface-raised, var(--bg-card-hover));
    border-radius: 0 0 .5rem .5rem;
}
.competition-my-status__label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: .55rem;
}
.competition-my-status__entry {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .35rem;
}
.competition-my-status__badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .2rem .65rem;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.competition-my-status__badge--competitor {
    background: #dcfce7;
    color: #15803d;
}
[data-theme="dark"] .competition-my-status__badge--competitor {
    background: rgba(21,128,61,.2);
    color: #4ade80;
}
.competition-my-status__badge--waitlist {
    background: #fef9c3;
    color: #854d0e;
}
[data-theme="dark"] .competition-my-status__badge--waitlist {
    background: rgba(133,77,14,.2);
    color: #fde047;
}
.competition-my-status__badge--helper {
    background: #ede9fe;
    color: #6d28d9;
}
[data-theme="dark"] .competition-my-status__badge--helper {
    background: rgba(109,40,217,.2);
    color: #a78bfa;
}
.competition-my-status__details {
    font-size: .83rem;
    color: var(--text-secondary);
}
.competition-my-status__none {
    font-size: .88rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
}
.competition-my-status__divider {
    margin: .75rem 0 .6rem;
    border-top: 1px solid var(--border-light, var(--border));
}
.competition-inline-signup-form,
.competition-inline-helper-form {
    margin-top: .65rem;
}
.competition-inline-form-inner {
    padding: .75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: .45rem;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal__title { font-size: 1.05rem; font-weight: 700; margin-bottom: .75rem; }
.modal__body { font-size: .9rem; color: var(--text-secondary); margin-bottom: 1.25rem; line-height: 1.5; }
.modal__notice--warning {
    margin-top: .85rem;
    padding: .6rem .65rem;
    border-radius: .45rem;
    font-size: .85rem;
    line-height: 1.45;
    color: var(--text);
    background: color-mix(in srgb, #f59e0b 14%, var(--bg-card-hover));
    border: 1px solid color-mix(in srgb, #f59e0b 42%, var(--border));
}
.modal__notice--warning--absence-late {
    margin-top: .9rem;
    padding: .85rem 1rem;
    border-radius: .5rem;
    font-size: .93rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--text);
    background: color-mix(in srgb, #fb923c 22%, var(--bg-card));
    border: 1px solid color-mix(in srgb, #ea580c 38%, var(--border));
    border-left: 4px solid #ea580c;
    box-shadow: 0 2px 12px rgba(234, 88, 12, .12);
}
.modal__notice--warning__text {
    margin: 0;
}
.modal__notice--warning__text strong {
    color: #9a3412;
    font-weight: 700;
}
[data-theme="dark"] .modal__notice--warning {
    background: color-mix(in srgb, #f59e0b 18%, var(--bg-card));
    border-color: color-mix(in srgb, #f59e0b 35%, var(--border));
}
[data-theme="dark"] .modal__notice--warning--absence-late {
    background: color-mix(in srgb, #ea580c 22%, var(--bg-card));
    border-color: color-mix(in srgb, #fb923c 45%, var(--border));
    box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .modal__notice--warning__text strong {
    color: #fdba74;
}
.modal__notice--warning--urgent {
    box-shadow: 0 2px 16px rgba(234, 88, 12, .22);
    border-color: color-mix(in srgb, #ea580c 55%, var(--border));
}
[data-theme="dark"] .modal__notice--warning--urgent {
    box-shadow: 0 2px 18px rgba(251, 146, 60, .25);
}
.modal__actions { display: flex; gap: .5rem; justify-content: flex-end; }

/* ========== FORMS ========== */
.form-label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; color: var(--text); }
.form-input, .form-select {
    width: 100%; padding: .5rem .75rem; border: 1.5px solid var(--border);
    border-radius: .5rem; font-size: .88rem; background: var(--bg-input); color: var(--text);
    transition: border-color .15s;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(129,140,248,.15); }
.form-group { margin-bottom: .75rem; }
.signup-toggle-link {
    display: inline-block; margin-top: .5rem; font-size: .82rem;
    color: var(--accent); background: none; border: none; cursor: pointer;
    text-decoration: underline; padding: 0;
}
.signup-toggle-link:hover { color: var(--accent-hover); }
.form-row { display: flex; gap: .75rem; }
.form-row > * { flex: 1; }

/* ========== STATS PAGE ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--bg-card); border-radius: .75rem; padding: 1.25rem;
    border: 1px solid var(--border); text-align: center;
}
.stat-card__value { font-size: 2rem; font-weight: 700; color: var(--stat-value); }
.stat-card__label { font-size: .82rem; color: var(--text-secondary); margin-top: .25rem; }
.stats-table {
    width: 100%; border-collapse: collapse; background: var(--bg-card);
    border-radius: .75rem; overflow: hidden; border: 1px solid var(--border);
}
.stats-table th {
    background: var(--bg-card-hover); text-align: left; padding: .65rem 1rem;
    font-size: .8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em;
}
.stats-table td { padding: .65rem 1rem; font-size: .88rem; border-top: 1px solid var(--border-light); color: var(--text); }
.stats-table tr:hover td { background: var(--bg-card-hover); }
.stats-section { margin-bottom: 2rem; }
.stats-section__title { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; }
.stats-section__subtitle { font-size: .92rem; font-weight: 600; margin: 1.25rem 0 .5rem; color: var(--text-secondary); }

/* Horse usage in overview: all horses, group count per horse */
.horse-usage-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .75rem;
}
.horse-usage-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: .6rem;
    padding: .75rem 1rem;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.horse-usage-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.horse-usage-card--zero {
    background: var(--bg);
    border-color: var(--border-light);
}
.horse-usage-card--zero .horse-usage-card__count { color: var(--text-muted); }
.horse-usage-card__name {
    display: block; font-size: .9rem; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.horse-usage-card__count {
    font-size: .85rem; font-weight: 600; color: var(--accent);
    margin-top: .2rem;
}
.horse-usage-card__bar {
    position: absolute; left: 0; bottom: 0; height: 3px;
    background: var(--accent); border-radius: 0 0 0 .6rem;
    max-width: 100%;
}

/* ---------- Õpilased: extra views (Cards, Comparison, Rankings) ---------- */
.lapsed-view-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.lapsed-cards-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem;
}
.lapsed-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: .75rem;
    padding: 1rem; transition: box-shadow .15s;
}
.lapsed-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.lapsed-card__name { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; color: var(--text); }
.lapsed-card__stats {
    display: flex; flex-wrap: wrap; gap: .5rem .75rem; margin-bottom: .5rem;
    font-size: .85rem; color: var(--text-secondary);
}
.lapsed-card__stat { white-space: nowrap; }
.lapsed-card__meta { font-size: .8rem; color: var(--text-muted); line-height: 1.4; }
.lapsed-card__meta-label { font-weight: 600; color: var(--text-secondary); }
.lapsed-card__timing { font-size: .78rem; margin-top: .35rem; }
.lapsed-cards-more { font-size: .85rem; color: var(--text-muted); margin-top: 1rem; }

.lapsed-comparison { margin-bottom: .5rem; }
.lapsed-bars { display: flex; flex-direction: column; gap: .4rem; }
.lapsed-bar-row {
    display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(6rem, 2fr) 2.5rem;
    align-items: center; gap: .5rem;
}
.lapsed-bar__label {
    font-size: .88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lapsed-bar__track {
    height: .6rem; background: var(--bg); border-radius: .3rem; overflow: hidden;
}
.lapsed-bar__track--absent { background: rgba(185,28,28,.1); }
.lapsed-bar__track--absent .lapsed-bar__fill { background: #b91c1c; }
.lapsed-bar__fill { height: 100%; background: var(--accent); border-radius: .3rem; transition: width .25s; }
.lapsed-bar__value { font-size: .85rem; font-weight: 600; text-align: right; color: var(--text); }

.lapsed-rankings { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.5rem; }
.lapsed-ranking-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: .75rem; padding: 1rem; }
.lapsed-ranking-list { list-style: none; margin: 0; padding: 0; }
.lapsed-ranking-list li {
    display: flex; align-items: center; gap: .5rem; padding: .35rem 0;
    font-size: .88rem; border-bottom: 1px solid var(--border-light);
}
.lapsed-ranking-list li:last-child { border-bottom: none; }
.lapsed-ranking__rank {
    flex-shrink: 0; width: 1.5rem; height: 1.5rem; display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-card-hover); border-radius: .35rem; font-size: .75rem; font-weight: 700; color: var(--text-secondary);
}
.lapsed-ranking__value { margin-left: auto; font-weight: 600; color: var(--accent); }
.lapsed-ranking-list--absent .lapsed-ranking__value { color: #b91c1c; }

/* ========== COACH CARDS ========== */
.coach-cards { display: flex; flex-direction: column; gap: .75rem; }
.coach-card {
    background: var(--bg-card); border-radius: .75rem; border: 1px solid var(--border);
    overflow: hidden; transition: box-shadow .15s;
}
.coach-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.coach-card__header {
    display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem;
    cursor: pointer; user-select: none; background: var(--bg-card);
}
.coach-card__header:hover { background: var(--bg-card-hover); }
.coach-card__header-left { flex: 1; min-width: 0; }
.coach-card__name { font-size: .95rem; font-weight: 700; color: var(--text); }
.coach-card__toggle { font-size: .7rem; color: var(--text-muted); transition: transform .15s; }
.coach-card__body { padding: 0 1rem 1rem; }
.coach-card__section { margin-top: .75rem; }
.coach-card__section-title {
    display: block; font-size: .75rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem;
}
.coach-stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .25rem;
}
@media (max-width: 600px) { .coach-stats-grid { grid-template-columns: repeat(2, 1fr); } }
.coach-stat {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    background: var(--bg); border-radius: .5rem; padding: .5rem .35rem;
}
.coach-stat__value { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.coach-stat__label { font-size: .7rem; color: var(--text-muted); margin-top: .1rem; }
.coach-levels { display: flex; flex-wrap: wrap; gap: .3rem; }
.coach-level-badge {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .75rem; font-weight: 600; padding: .2rem .5rem; border-radius: .35rem;
}
.coach-level-badge small { font-weight: 400; opacity: .85; }
.coach-weekdays { display: flex; gap: .25rem; }
.coach-weekday {
    display: flex; flex-direction: column; align-items: center; width: 2.2rem;
    padding: .25rem 0; border-radius: .35rem; background: var(--bg); border: 1px solid var(--border-light);
}
.coach-weekday--active { background: var(--accent-light, rgba(99,102,241,.1)); border-color: var(--accent); }
.coach-weekday__label { font-size: .65rem; font-weight: 700; color: var(--text-muted); }
.coach-weekday--active .coach-weekday__label { color: var(--accent); }
.coach-weekday__cnt { font-size: .8rem; font-weight: 600; color: var(--text); }
.coach-weekday--active .coach-weekday__cnt { color: var(--accent); }
.coach-top5 { margin: 0; padding-left: 1.2rem; font-size: .85rem; color: var(--text); }
.coach-top5 li { padding: .1rem 0; }
.coach-top5__cnt { font-size: .75rem; color: var(--text-muted); }

/* Coach print table — hidden on screen */
.coach-print-table { display: none; }
.coach-print-header { text-align: center; margin-bottom: .75rem; font-size: 1rem; }
.coach-print-tbl {
    width: 100%; border-collapse: collapse; font-size: .78rem;
}
.coach-print-tbl th, .coach-print-tbl td {
    border: 1px solid #000; padding: .3rem .4rem; text-align: left; vertical-align: top;
}
.coach-print-tbl th {
    background: #e5e5e5; font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em;
}
.coach-print-tbl tr:nth-child(even) td { background: #f5f5f5; }

/* ========== ADMIN PAGE ========== */
.admin-grid { display: grid; grid-template-columns: 250px 1fr; gap: 1.5rem; min-height: 70vh; }
/* Mobile-only button that reveals .admin-sidebar; hidden outside the phone
   breakpoint where the sidebar collapses (see "MOBILE ADMIN" block below). */
.admin-sidebar-toggle { display: none; }
.admin-sidebar {
    background: var(--bg-card); border-radius: .75rem; border: 1px solid var(--border);
    padding: .5rem; height: fit-content; position: sticky; top: 5rem;
}
.admin-sidebar .nav-link {
    display: flex; align-items: center; justify-content: flex-start; gap: .5rem;
    padding: .6rem .75rem; border-radius: .4rem;
    font-size: .88rem; font-weight: 500; color: var(--text-secondary);
}
.admin-sidebar .nav-link:hover { background: var(--bg-card-hover); }
.admin-sidebar .nav-link.active { background: var(--accent-light); color: var(--accent); }
.admin-sidebar .nav-link .nav-link-icon {
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--text-secondary);
}
.admin-sidebar .nav-link.active .nav-link-icon { color: var(--accent); }
.admin-sidebar__coach-note {
    font-size: .85rem;
    color: var(--text-muted);
    margin: .75rem 0 0;
    line-height: 1.45;
    padding: .65rem .5rem 0;
    border-top: 1px solid var(--border-light);
}
.admin-panel {
    background: var(--bg-card); border-radius: .75rem; border: 1px solid var(--border); padding: 1.25rem;
}
.admin-panel__title {
    display: flex; align-items: center; gap: .5rem;
    font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem;
}
.admin-panel__title-icon {
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    color: var(--accent);
}
.admin-panel__title:not(:has(.admin-panel__title-icon)) { display: block; }
/* Haldus → Logid: full grid borders */
.admin-logs__header {
    display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.admin-logs__title { margin: 0; }
.admin-logs__scroll {
    overflow-x: auto;
    margin-top: 0.75rem;
    border-radius: 0.4rem;
    background: var(--bg-card);
}
.admin-logs__table {
    width: 100%;
    min-width: 40rem;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-sizing: border-box;
}
.admin-logs__table th,
.admin-logs__table td {
    border: 1px solid var(--border-light);
    padding: 0.5rem 0.65rem;
    text-align: left;
    vertical-align: top;
    color: var(--text);
}
.admin-logs__table thead th {
    background: var(--bg-card);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
.admin-logs__table tbody tr:hover td { background: var(--bg-card-hover); }
.admin-logs__table .admin-logs__code {
    font-size: 0.8rem;
    color: var(--text);
}
.admin-logs__table .admin-logs__details { word-break: break-word; max-width: 30rem; }
.admin-logs__table .admin-logs__empty { padding: 1rem; text-align: center; color: var(--text-muted); }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    text-align: left; padding: .6rem .75rem; font-size: .8rem; font-weight: 600;
    color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 2px solid var(--border);
}
.admin-table td { padding: .55rem .75rem; font-size: .88rem; border-bottom: 1px solid var(--border-light); color: var(--text); }
.admin-table tr:hover td { background: var(--bg-card-hover); }
/* Võistluse laiendatud rida: fikseeri taust, et üldine tr:hover ei väreldaks osalejate alal */
.admin-table tr.voist-detail-row > td {
    background: var(--bg-card-hover);
}
.admin-table tr.voist-detail-row:hover > td {
    background: var(--bg-card-hover);
}
.admin-actions { display: flex; gap: .3rem; }
.riders-table__th-account { width: 1%; white-space: nowrap; min-width: 6.5rem; }
.riders-table__th-actions { width: 1%; min-width: 9.5rem; white-space: normal; }
.riders-table__parent-phone { display: block; margin-top: .2rem; font-size: .85rem; color: var(--text-muted); line-height: 1.3; }
.riders-account-cell { vertical-align: top; padding-top: 0.5rem; }
.riders-account-badge {
    display: inline-block; font-size: .72rem; font-weight: 600; padding: .2rem .5rem; border-radius: 9999px; line-height: 1.2;
}
.riders-account-badge--yes { background: rgba(34, 197, 94, 0.2); color: #166534; }
.riders-account-badge--no { background: rgba(148, 163, 184, 0.25); color: var(--text-muted); }
[data-theme="dark"] .riders-account-badge--yes { background: rgba(74, 222, 128, 0.18); color: #bbf7d0; }
[data-theme="dark"] .riders-account-badge--no { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.admin-day-tabs {
    display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem;
}
.admin-day-tab {
    padding: .4rem .85rem; border-radius: .5rem; font-size: .85rem; font-weight: 500;
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    cursor: pointer; white-space: nowrap;
}
.admin-day-tab:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.admin-day-tab.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.admin-save-status { margin-left: .75rem; font-size: .9rem; font-weight: 500; }
.admin-actions .btn { padding: .25rem .5rem; font-size: .78rem; }
.admin-time-label { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; font-weight: 600; }

/* Admin slot flags: "Aeg muutunud" / "Tund tühistatud" – chip-style toggles */
.admin-slot-flag {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .65rem;
    border-radius: .5rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}
.admin-slot-flag:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    color: var(--text);
}
.admin-slot-flag__input {
    appearance: none;
    -webkit-appearance: none;
    width: 1.05rem !important;
    height: 1.05rem !important;
    min-width: 1.05rem !important;
    min-height: 1.05rem !important;
    border-radius: .3rem;
    border: 2px solid var(--text-muted);
    background: var(--bg-card);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
    background-image: none;
    background-size: 70%;
    background-position: center;
    background-repeat: no-repeat;
}
.admin-slot-flag__input:checked {
    border-color: transparent;
    background-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
}
.admin-slot-flag__text { user-select: none; }
/* === Admin slot card redesigned layout === */
.admin-slot-card { margin-bottom: .75rem; overflow: visible; }
.admin-slot-card--dirty { outline: 2px solid var(--warning, #f59e0b); outline-offset: 1px; }
.admin-slot-card--dirty .admin-slot-dow { outline: 2px solid var(--warning, #f59e0b); }
.admin-slot-card__header {
    background: var(--bg-card-hover);
    border-bottom: 2px solid var(--border);
}
/* Row1: controls on left (wrappable), actions pinned right */
.admin-slot-card__row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .85rem;
}
.admin-slot-card__row1-controls {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.admin-slot-card__row1-actions { display: flex; gap: .3rem; align-items: center; flex-shrink: 0; }
/* Row2: flags on left, trainer+uuenda pinned right */
.admin-slot-card__row2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .4rem .85rem .5rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-light, rgba(0,0,0,.08));
}
[data-theme="dark"] .admin-slot-card__row2 { border-top-color: rgba(255,255,255,.07); }
.admin-slot-card__row2-right { display: flex; gap: .3rem; align-items: center; flex-shrink: 0; }
/* Override global .form-select { width: 100% } for all selects inside admin slot cards */
.admin-slot-card .form-select { width: auto; }
/* Override mobile-optimizations.css global rules (select min-height/padding, button min-height/padding).
   Those rules load after this file so !important is required to win at equal specificity. */
.admin-slot-card select {
    min-height: unset !important;
    font-size: .82rem !important;
}
.admin-slot-card__row1-actions .btn,
.admin-slot-card__row2-right .btn {
    min-height: unset !important;
    min-width: unset !important;
    padding: .25rem .55rem !important;
    font-size: .8rem !important;
}
.admin-slot-rider-remove {
    min-height: unset !important;
    min-width: unset !important;
    width: 1.6rem !important;
    height: 1.6rem !important;
    padding: 0 !important;
}
.admin-slot-add-rider__student,
.admin-slot-add-rider__horse,
.admin-slot-rider-horse {
    min-height: unset !important;
}
.admin-time-input {
    min-height: unset !important;
    font-size: .82rem !important;
}
.admin-slot-flag__input {
    min-width: 1.05rem !important;
    min-height: 1.05rem !important;
}
.admin-slot-card__level-sel {
    font-size: .82rem !important;
    padding: .2rem .4rem !important;
    min-width: 5rem;
    font-weight: 700;
}
.admin-slot-card__dow-sel {
    font-size: .8rem !important;
    padding: .2rem .35rem !important;
    min-width: 7rem;
}
.admin-slot-card__time-wrap {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .8rem;
    font-weight: 600;
}
.admin-slot-card__field-label { font-size: .8rem; font-weight: 600; }
.admin-slot-card__plats {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.admin-slot-card__orig-time {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.admin-slot-card__trainer-sel {
    font-size: .82rem !important;
    padding: .2rem .4rem !important;
    min-width: 9rem;
}
.admin-slot-card__delete-btn { color: var(--error, #ef4444); border-color: var(--error, #ef4444); }
.admin-slot-card__delete-btn:hover { background: var(--error, #ef4444); color: #fff; }
.admin-slot-level-unknown {
    background: rgba(234,179,8,.15) !important;
    border-color: #d97706 !important;
    color: #b45309 !important;
}
[data-theme="dark"] .admin-slot-level-unknown {
    background: rgba(234,179,8,.2) !important;
    border-color: #f59e0b !important;
    color: #fbbf24 !important;
}
/* Body */
.admin-slot-card__body { padding: .55rem .85rem .8rem; }
.admin-slot-card__cap-hint { margin: 0 0 .5rem; font-size: .78rem; color: var(--text-muted); }
.admin-slot-card__empty-riders { color: var(--text-muted); font-size: .85rem; margin: 0 0 .35rem; }
.admin-slot-card__full-hint {
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: .35rem;
    padding: .35rem .5rem;
    font-size: .82rem;
    margin: .3rem 0 .35rem;
}
[data-theme="dark"] .admin-slot-card__full-hint {
    background: rgba(234,179,8,.1);
    border-color: rgba(234,179,8,.3);
    color: #fbbf24;
}
/* Riders list */
.admin-slot-riders-list { margin-bottom: .4rem; }
.admin-slot-riders-header {
    display: grid;
    grid-template-columns: 1fr auto 2rem;
    gap: .35rem .5rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.admin-slot-rider-row {
    display: grid;
    grid-template-columns: 1fr auto 2rem;
    gap: .35rem .5rem;
    align-items: center;
    padding: .3rem 0;
    border-bottom: 1px solid rgba(0,0,0,.05);
}
[data-theme="dark"] .admin-slot-rider-row { border-bottom-color: rgba(255,255,255,.05); }
.admin-slot-rider-row:last-child { border-bottom: none; }
.admin-slot-rider-name { font-size: .875rem; font-weight: 500; }
.admin-slot-rider-horse { font-size: .8rem; padding: .2rem .35rem; min-width: 8rem; }
.admin-slot-rider-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    font-size: .9rem;
    line-height: 1;
    color: var(--error, #ef4444);
    background: transparent;
    border: 1px solid transparent;
    border-radius: .3rem;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.admin-slot-rider-remove:hover { background: rgba(239,68,68,.1); border-color: var(--error, #ef4444); }
/* Add rider row */
.admin-slot-add-rider {
    display: flex;
    gap: .35rem;
    align-items: center;
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px dashed var(--border);
}
.admin-slot-add-rider__student { font-size: .8rem; padding: .25rem .4rem; flex: 1; min-width: 0; width: auto; }
.admin-slot-add-rider__horse { font-size: .8rem; padding: .25rem .4rem; width: auto; min-width: 7rem; }

/* Time selection in schedule admin (24h dropdown) */
.admin-time-input {
    font-family: inherit;
    min-width: 5rem;
}
/* Rescheduled: when checked, amber/warning tint */
.admin-slot-flag--rescheduled .admin-slot-flag__input:checked {
    background-color: #d97706;
    border-color: transparent;
}
.admin-slot-flag--rescheduled:has(.admin-slot-flag__input:checked) {
    background: rgba(234, 179, 8, 0.15);
    border-color: #d97706;
    color: #b45309;
}
[data-theme="dark"] .admin-slot-flag--rescheduled:has(.admin-slot-flag__input:checked) {
    background: rgba(234, 179, 8, 0.2);
    border-color: #f59e0b;
    color: #fbbf24;
}
/* Cancelled: when checked, red tint */
.admin-slot-flag--cancelled .admin-slot-flag__input:checked {
    background-color: #dc2626;
    border-color: transparent;
}
.admin-slot-flag--cancelled:has(.admin-slot-flag__input:checked) {
    background: rgba(239, 68, 68, 0.12);
    border-color: #dc2626;
    color: #b91c1c;
}
[data-theme="dark"] .admin-slot-flag--cancelled:has(.admin-slot-flag__input:checked) {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #f87171;
}

/* Firefox < 121 :has() fallback — class toggled via JS */
.admin-slot-flag--rescheduled.admin-slot-flag--is-checked {
    background: rgba(234, 179, 8, 0.15);
    border-color: #d97706;
    color: #b45309;
}
[data-theme="dark"] .admin-slot-flag--rescheduled.admin-slot-flag--is-checked {
    background: rgba(234, 179, 8, 0.2);
    border-color: #f59e0b;
    color: #fbbf24;
}
.admin-slot-flag--cancelled.admin-slot-flag--is-checked {
    background: rgba(239, 68, 68, 0.12);
    border-color: #dc2626;
    color: #b91c1c;
}
[data-theme="dark"] .admin-slot-flag--cancelled.admin-slot-flag--is-checked {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #f87171;
}

/* Focus indicators for admin slot card interactive elements */
.admin-day-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.admin-slot-rider-remove:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--error, #ef4444);
}
.admin-slot-flag__input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.event-row--inactive td { opacity: .7; background: var(--bg-card-hover); }
.admin-event-active-toggle {
    padding: .2rem; font-size: .9rem; border: 1px solid var(--border);
    border-radius: .25rem; background: var(--bg-card); color: var(--text-secondary);
}
.admin-event-active-toggle[data-active="1"] { color: var(--badge-taken-text); border-color: var(--badge-taken-text); }
.admin-event-expand { padding: .2rem; font-size: .75rem; border: none; background: none; color: var(--text-muted); }
.event-detail-row td { padding: .75rem 1rem; background: var(--bg-card-hover); vertical-align: top; }
.event-detail-cell { border-bottom: 1px solid var(--border); }
.event-signups-panel { max-width: 32rem; }
.admin-signups-ul { list-style: none; padding: 0; margin: .35rem 0 .75rem; }
.admin-signups-ul li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; font-size: .88rem; }
.admin-signups-section { margin-bottom: .5rem; }
.admin-signups-section strong { font-size: .85rem; }

/* Admin: võistluse osalejad (struktureeritud) */
.voist-signups-panel { padding: .25rem 0 .5rem; }
.voist-admin-subsection {
    margin-bottom: 1.35rem;
    padding-bottom: 1.15rem;
    border-bottom: 1px solid var(--border);
}
.voist-admin-subsection:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.voist-admin-subsection__title {
    margin: 0 0 .75rem;
    font-size: .82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}
.voist-admin-subsection--add .voist-admin-subsection__title { margin-bottom: .65rem; }
.voist-signups-stack,
.voist-waitlist-stack,
.voist-helpers-stack { display: flex; flex-direction: column; gap: .35rem; }
.voist-list-empty {
    margin: .15rem 0;
    font-size: .88rem;
    color: var(--text-muted);
}
.voist-compact-thead {
    display: grid;
    grid-template-columns: 1.25rem 1fr 1fr;
    gap: .75rem;
    align-items: center;
    padding: .35rem .65rem .5rem;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    margin-bottom: .25rem;
}
.voist-compact-thead span:nth-child(1) { grid-column: 2; }
.voist-compact-thead span:nth-child(2) { grid-column: 3; }
.voist-compact-row {
    border: 1px solid var(--border);
    border-radius: .55rem;
    background: var(--bg-card-hover);
    overflow: hidden;
}
.voist-compact-row__summary {
    display: flex;
    align-items: stretch;
    gap: .4rem;
    padding: .15rem .35rem .15rem .15rem;
}
.voist-compact-row__summary > .btn { align-self: center; flex-shrink: 0; }
.voist-compact-row__toggle {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: 1.25rem 1fr 1fr;
    gap: .65rem .75rem;
    align-items: center;
    padding: .5rem .5rem .5rem .35rem;
    margin: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: .4rem;
}
.voist-compact-row__toggle:hover { background: rgba(99, 102, 241, .08); }
[data-theme="dark"] .voist-compact-row__toggle:hover { background: rgba(255, 255, 255, .05); }
/* Admin: osalejate loendis ära korda „rea hover“ efekti klõpsitaval real */
.voist-signups-panel .voist-compact-row__toggle:hover,
[data-theme="dark"] .voist-signups-panel .voist-compact-row__toggle:hover {
    background: transparent;
}
.voist-compact-row__chev {
    display: inline-block;
    font-size: .55rem;
    opacity: .65;
    transition: transform .15s ease;
    line-height: 1;
}
.voist-compact-row--open .voist-compact-row__chev { transform: rotate(90deg); }
.voist-compact-row__cell--rider {
    font-weight: 600;
    font-size: .9rem;
    line-height: 1.35;
    min-width: 0;
    word-break: break-word;
}
.voist-compact-row__cell--horse {
    font-size: .88rem;
    color: var(--text-secondary);
    min-width: 0;
    word-break: break-word;
}
.voist-compact-row__class-mini {
    display: inline-block;
    margin-left: .35rem;
    padding: .08rem .35rem;
    font-size: .68rem;
    font-weight: 600;
    vertical-align: middle;
    border-radius: .25rem;
    background: var(--border);
    color: var(--text-secondary);
}
.voist-compact-row__result-dot {
    display: inline-block;
    margin-left: .35rem;
    font-size: .45rem;
    vertical-align: middle;
    color: #22c55e;
    line-height: 1;
}
[data-theme="dark"] .voist-compact-row__result-dot { color: #4ade80; }
.voist-compact-row__panel {
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.voist-compact-row__panel-inner { padding: .85rem 1rem 1rem; }
.voist-compact-row__panel-title {
    margin: 0 0 .55rem;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}
.voist-compact-row__panel-title--spaced { margin-top: 1rem; }
.voist-badge-waitlist {
    display: inline-block;
    margin-left: .35rem;
    padding: .12rem .4rem;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-radius: .25rem;
    background: var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}
.voist-participant-card__grid {
    display: grid;
    grid-template-columns: minmax(8rem, 1.1fr) minmax(6rem, 1fr) auto;
    gap: .65rem 1rem;
    align-items: end;
}
.voist-participant-card__grid--reg-two {
    grid-template-columns: 1fr 1fr;
}
.voist-participant-card__result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .55rem;
}
@media (min-width: 640px) {
    .voist-participant-card__result-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    .voist-participant-card__result-grid .voist-participant-field--btn {
        grid-column: 1 / -1;
    }
}
.voist-participant-field .form-label,
.voist-participant-card__result-grid .form-label { font-size: .78rem; margin-bottom: .25rem; }
.voist-participant-field--btn .form-label { visibility: hidden; }
.voist-participant-field--btn { min-width: 8.5rem; }
.voist-helper-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .5rem .65rem;
    border: 1px solid var(--border);
    border-radius: .5rem;
    background: var(--bg-card-hover);
    font-size: .9rem;
}
.voist-helper-row__name { font-weight: 500; min-width: 0; }
.voist-add-signup-row,
.voist-add-helper-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    align-items: flex-end;
}
.voist-add-signup-field { min-width: 10rem; flex: 1 1 8rem; }
.voist-add-signup-field--btn { flex: 0 0 auto; min-width: auto; }
.voist-add-helper-field--btn { flex: 0 0 auto; }
@media (max-width: 720px) {
    .voist-participant-card__grid {
        grid-template-columns: 1fr;
    }
    .voist-participant-field--btn { min-width: 0; width: 100%; }
    .voist-participant-field--btn .btn { width: 100%; }
}
.admin-add-signup-btn { margin-top: .5rem; }

/* Kasutajad (admin user list) */
.users-toolbar {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem;
}
.users-toolbar--actions {
    margin-bottom: .5rem;
}
.users-toolbar--filters {
    margin-bottom: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}
.users-toolbar__search { margin: 0; flex: 1 1 14rem; max-width: 22rem; min-width: 10rem; }
.users-toolbar__filter { margin: 0; flex: 0 1 12rem; min-width: 10rem; }
.users-admin-th-actions { width: 1%; white-space: nowrap; min-width: 9.5rem; }
.users-actions-cell { white-space: nowrap; vertical-align: middle; }
.users-actions-cell .btn { margin-right: .25rem; }
.users-actions-cell .btn:last-child { margin-right: 0; }
.users-role-legend {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; font-size: .8rem; color: var(--text-muted);
}
.user-role-badge {
    display: inline-block; font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 9999px;
    letter-spacing: .02em; line-height: 1.2;
}
.user-role-badge--admin {
    background: rgba(99, 102, 241, 0.22); color: #4338ca;
}
.user-role-badge--trainer {
    background: rgba(14, 165, 233, 0.2); color: #0369a1;
}
.user-role-badge--student {
    background: rgba(34, 197, 94, 0.2); color: #166534;
}
[data-theme="dark"] .user-role-badge--admin { background: rgba(129, 140, 248, 0.25); color: #c7d2fe; }
[data-theme="dark"] .user-role-badge--trainer { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
[data-theme="dark"] .user-role-badge--student { background: rgba(74, 222, 128, 0.18); color: #bbf7d0; }
.users-group-label-row td {
    padding: .5rem .75rem .35rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); border-bottom: none; background: var(--bg-card-hover);
}
.users-group-label { display: inline-block; }
.users-group-label--admin { color: #4f46e5; }
.users-group-label--trainer { color: #0284c7; }
.users-group-label--student { color: #15803d; }
[data-theme="dark"] .users-group-label--admin { color: #a5b4fc; }
[data-theme="dark"] .users-group-label--trainer { color: #38bdf8; }
[data-theme="dark"] .users-group-label--student { color: #86efac; }
.users-data-row--admin td:first-child { box-shadow: inset 3px 0 0 #6366f1; }
.users-data-row--trainer td:first-child { box-shadow: inset 3px 0 0 #0ea5e9; }
.users-data-row--student td:first-child { box-shadow: inset 3px 0 0 #22c55e; }
.users-filter-empty {
    font-size: .88rem; color: var(--text-muted); margin: 0 0 .75rem;
}
.users-entity-cell {
    font-size: 0.88rem;
    line-height: 1.35;
    min-width: 0;
    max-width: 14rem;
}
.users-entity-cell__name { min-width: 0; }
.users-entity-cell__id {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    word-break: break-all;
}
.users-entity-mute, .users-entity-cell--empty { color: var(--text-muted); }
.users-entity-unresolved { color: var(--text-secondary); font-size: 0.85rem; }
.users-entity-link { font-weight: 500; }
.users-invite-compact { font-size: 0.9rem; white-space: nowrap; }
.users-invite-compact--zero { color: var(--text-muted); }
.users-invite-compact__n { font-weight: 700; }

.admin-modal-overlay {
    position: fixed; inset: 0; background: var(--modal-backdrop); display: flex;
    align-items: center; justify-content: center; z-index: 1000;
}
.admin-modal {
    background: var(--bg-card); border-radius: .75rem; padding: 1.25rem;
    box-shadow: var(--shadow-modal); min-width: 18rem; max-width: 90vw;
}
.admin-modal h4 { margin-bottom: .5rem; font-size: 1rem; }
.admin-confirm-dialog { text-align: center; max-width: 22rem; padding: 1.75rem 1.5rem; }
.admin-confirm-dialog__msg { margin: 0 0 1.25rem; white-space: pre-line; line-height: 1.55; font-size: .95rem; }
.admin-confirm-dialog__btns { display: flex; gap: .75rem; justify-content: center; }
.admin-link { color: var(--accent); }
.admin-link:hover { text-decoration: underline; }

.admin-level-checkboxes {
    display: flex; flex-wrap: wrap; gap: .5rem .75rem;
}
.admin-level-cb {
    display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; font-size: .9rem; white-space: nowrap;
}

.riders-table tbody tr.riders-row-clickable { cursor: pointer; }
.riders-table tbody tr.riders-row-clickable:hover { background: var(--bg-hover, rgba(0,0,0,.04)); }
[data-theme="dark"] .riders-table tbody tr.riders-row-clickable:hover { background: rgba(255,255,255,.06); }

.horses-table tbody tr.horses-row-clickable { cursor: pointer; }
.horses-table tbody tr.horses-row-clickable:hover { background: var(--bg-hover, rgba(0,0,0,.04)); }
[data-theme="dark"] .horses-table tbody tr.horses-row-clickable:hover { background: rgba(255,255,255,.06); }

.horse-health-edit-list { list-style: none; margin: 0 0 1rem; padding: 0; font-size: .875rem; }
.horse-health-edit-item {
    display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem;
    padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.horse-health-edit-item:last-child { border-bottom: none; }
.horse-health-edit-item__main { flex: 1; min-width: 0; }
.horse-health-edit-meta { font-size: .78rem; color: var(--text-muted); display: block; margin-bottom: .25rem; }
.horse-health-edit-body { margin: 0; white-space: pre-wrap; word-break: break-word; }
.horse-detail-health-list li { margin-bottom: .65rem; }
.horse-detail-health-body { white-space: pre-wrap; word-break: break-word; }

/* Rider form + detail view: shared shell (scroll, header, cards, footer) */
.admin-modal--rider-form,
.admin-modal--rider-detail {
    max-width: 38rem;
    max-height: min(90vh, 44rem);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.admin-modal--rider-form .rider-form-modal__scroll,
.admin-modal--rider-detail .rider-form-modal__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem 1.25rem 1rem;
    -webkit-overflow-scrolling: touch;
}
.admin-modal--rider-form .rider-form-modal__header,
.admin-modal--rider-detail .rider-form-modal__header {
    margin: 0 0 1rem;
}
.admin-modal--rider-form .rider-form-modal__title,
.admin-modal--rider-detail .rider-form-modal__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
}
.admin-modal--rider-form .rider-form-modal__subtitle,
.admin-modal--rider-detail .rider-form-modal__subtitle {
    margin: .35rem 0 0;
    font-size: .8125rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.4;
}
.admin-modal--rider-form .rider-form-modal__contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
}
@media (min-width: 480px) {
    .admin-modal--rider-form .rider-form-modal__contact-grid {
        grid-template-columns: 1fr 1fr;
    }
    .admin-modal--rider-form .rider-form-modal__contact-grid > .form-group:first-child {
        grid-column: 1 / -1;
    }
}
.admin-modal--rider-form .rider-form-section--card,
.admin-modal--rider-detail .rider-form-section--card {
    margin-top: .875rem;
    padding: .875rem 1rem;
    border-radius: .5rem;
    background: var(--bg-card-hover, rgba(0, 0, 0, .03));
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent, #6366f1);
}
.admin-modal--rider-form .rider-form-modal__header + .rider-form-section--card,
.admin-modal--rider-detail .rider-form-modal__header + .rider-form-section--card {
    margin-top: 0;
}
[data-theme="dark"] .admin-modal--rider-form .rider-form-section--card,
[data-theme="dark"] .admin-modal--rider-detail .rider-form-section--card {
    background: rgba(255, 255, 255, .04);
}
.admin-modal--rider-form .rider-form-section--card .form-group:last-child {
    margin-bottom: 0;
}
.admin-modal--rider-form .rider-form-section-title,
.admin-modal--rider-detail .rider-form-section-title {
    margin: 0 0 .65rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-secondary, var(--text-muted));
    letter-spacing: 0.01em;
}
.admin-modal--rider-detail .rider-form-section--card .rider-detail-dl {
    margin: 0;
    font-size: .875rem;
    gap: .35rem .85rem;
}
.admin-modal--rider-detail .rider-form-section--card .rider-detail-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .875rem;
}
.admin-modal--rider-detail .rider-form-section--card .rider-detail-empty {
    margin: 0;
}
.admin-modal--rider-detail .rider-detail-list--competitions {
    padding-left: 0;
    list-style: none;
}
.admin-modal--rider-detail .rider-detail-competition-block {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.admin-modal--rider-detail .rider-detail-competition-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.admin-modal--rider-detail .rider-detail-competition-head {
    margin-bottom: .5rem;
    line-height: 1.35;
}
.admin-modal--rider-detail .rider-detail-dl--competition {
    margin: 0;
    font-size: .8125rem;
    gap: .2rem .65rem;
}
.admin-modal--rider-detail .rider-detail-dl--competition dt::after {
    content: ':';
}
.admin-modal--rider-form .rider-form-modal__contract-cb {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1.35;
}
.admin-modal--rider-form .rider-form-modal__contract-cb input {
    margin-top: .2rem;
    flex-shrink: 0;
}
.admin-modal--rider-form .admin-level-checkboxes {
    margin-top: 0;
}
.admin-modal--rider-form .rider-form-modal__footer,
.admin-modal--rider-detail .rider-form-modal__footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .75rem 1.25rem 1.15rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 -6px 16px rgba(0, 0, 0, .06);
}
[data-theme="dark"] .admin-modal--rider-form .rider-form-modal__footer,
[data-theme="dark"] .admin-modal--rider-detail .rider-form-modal__footer {
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
}

/* Legacy / non-modal rider sections (e.g. add-form) */
.rider-form-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.rider-form-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.add-form .form-group + .rider-form-section { margin-top: 0; padding-top: 0; border-top: none; }
.rider-form-section-title { margin: 0 0 .75rem; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.rider-detail-notes { margin: 0; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.rider-detail-info { margin-bottom: 1rem; }
.rider-detail-dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: 0; font-size: .9rem; }
.rider-detail-dl dt { color: var(--text-muted); font-weight: 500; }
.rider-detail-dl dd { margin: 0; }
.rider-detail-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.rider-detail-section-title { margin: 0 0 .5rem; font-size: .9rem; font-weight: 600; color: var(--text-muted); }
.rider-detail-list { margin: 0; padding-left: 1.25rem; font-size: .9rem; }
.rider-detail-list li { margin-bottom: .35rem; }
.rider-detail-meta { font-size: .85rem; color: var(--text-muted); }
.rider-detail-extra { font-size: .85rem; color: var(--text-muted); margin-left: .25rem; }
.rider-detail-empty { margin: 0; font-size: .9rem; color: var(--text-muted); }
.rider-detail-badge { font-size: .75rem; padding: .15rem .4rem; border-radius: .25rem; font-weight: 500; }

.riders-section-heading { margin: 1.25rem 0 .75rem; font-size: 1rem; font-weight: 600; }
.riders-section-heading:first-of-type { margin-top: 0; }
.riders-section-heading--ended { color: var(--text-muted); margin-top: 1.75rem; }
.riders-page-intro {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
    line-height: 1.5;
    max-width: 48rem;
}
.riders-page-filters { margin-bottom: 0.35rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.riders-list-panel {
    margin-top: 0.35rem;
    padding: 0.9rem 1rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-card);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.riders-list-panel--active { border-left: 3px solid var(--accent, #6366f1); }
.riders-list-panel .riders-section-heading {
    margin-top: 0;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: var(--text);
}
.riders-list-panel .riders-interaction-hint {
    margin: 0 0 0.7rem;
    padding: 0.45rem 0.6rem 0.5rem;
    border-radius: 0.35rem;
    background: color-mix(in srgb, var(--accent) 7%, var(--bg));
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    line-height: 1.4;
    font-size: 0.8rem;
    max-width: 100%;
}
[data-theme="dark"] .riders-list-panel .riders-interaction-hint {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
}
.riders-list-panel .riders-pager { margin-top: 0.15rem; }
.riders-list-panel .riders-dual__mobile { margin-top: 0.4rem; }
/* Tabel: raam, veeruseparaatorid, kerge zebra (ära sea overflow: hidden — rikuks sticky päise + scrolli) */
.riders-list-panel .admin-table-scroll--riders,
.riders-ended-block .admin-table-scroll--riders {
    margin: 0.2rem 0 0.35rem;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: var(--bg);
}
.riders-list-panel--active .riders-table--active th + th,
.riders-list-panel--active .riders-table--active td + td,
.riders-ended-block .riders-table--ended th + th,
.riders-ended-block .riders-table--ended td + td { border-left: 1px solid var(--border-light); }
.riders-list-panel--active .riders-table--active tbody tr:nth-child(even) > td,
.riders-ended-block .riders-table--ended tbody tr:nth-child(even) > td {
    background: color-mix(in srgb, var(--text) 2.5%, var(--bg-card) 97.5%);
}
[data-theme="dark"] .riders-list-panel--active .riders-table--active tbody tr:nth-child(even) > td,
[data-theme="dark"] .riders-ended-block .riders-table--ended tbody tr:nth-child(even) > td {
    background: color-mix(in srgb, #fff 3.5%, var(--bg-card) 96.5%);
}
/* Zebra + ühtlane hover: kõrgema spetsiifilisusega */
.riders-list-panel .riders-table tbody tr.riders-row-clickable:hover > td,
.riders-ended-block .riders-table tbody tr.riders-row-clickable:hover > td { background: var(--bg-card-hover) !important; }
[data-theme="dark"] .riders-list-panel .riders-table tbody tr.riders-row-clickable:hover > td,
[data-theme="dark"] .riders-ended-block .riders-table tbody tr.riders-row-clickable:hover > td { background: rgba(255, 255, 255, 0.06) !important; }
.riders-list-panel .admin-table-scroll--riders .admin-table thead th { background: var(--bg-card); }
.riders-ended-block .riders-section-heading--ended { margin-top: 0.15rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border-light); }
.riders-ended-block { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.riders-ended-block.riders-ended-block--muted {
    margin-top: 1.75rem;
    padding: 0.9rem 0.85rem 0.1rem;
    border-radius: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
}
.riders-ended-hint { font-size: .85rem; color: var(--text-muted); margin: 0 0 .75rem; max-width: 40rem; }
.admin-table.riders-table--ended tbody tr { opacity: 0.92; }
.riders-interaction-hint {
    font-size: .85rem; color: var(--text-secondary);
    margin: 0 0 .75rem;
    max-width: 44rem;
    line-height: 1.45;
}
.riders-filter-meta {
    font-size: .88rem;
    color: var(--text-muted);
    margin: 0 0 .5rem;
}
.riders-toolbar--filters { margin-top: 0; }
.riders-level-filter-group { flex: 0 0 100%; min-width: 0; }
.riders-compact-group { flex-shrink: 0; }
.riders-compact-btn {
    padding: .28rem .75rem; border-radius: 9999px; font-size: .82rem; font-weight: 500;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
    cursor: pointer; white-space: nowrap; line-height: 1.4;
    transition: background .12s, border-color .12s, color .12s;
}
.riders-compact-btn:hover { background: var(--bg-card-hover); border-color: var(--text-muted); color: var(--text); }
.riders-compact-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.riders-level-filter-pills {
    display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
    padding-top: .15rem;
}
.riders-level-pill-btn {
    padding: .28rem .75rem; border-radius: 9999px; font-size: .82rem; font-weight: 500;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
    cursor: pointer; white-space: nowrap; line-height: 1.4;
    transition: background .12s, border-color .12s, color .12s;
}
.riders-level-pill-btn:hover { background: var(--bg-card-hover); border-color: var(--text-muted); color: var(--text); }
.riders-level-pill-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.riders-level-pill-btn--all[aria-pressed="true"] { background: var(--bg-card-hover); border-color: var(--text-muted); color: var(--text); }
.admin-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin-bottom: 0.25rem;
    border-radius: 0.35rem;
}
.admin-table-scroll .admin-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-card);
    box-shadow: 0 1px 0 var(--border);
}
.riders-th-sort { vertical-align: middle; }
.riders-th-label { display: inline-flex; align-items: center; }
.riders-th-sort-btn {
    display: inline;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    text-align: left;
    text-decoration: underline dotted var(--text-muted);
    text-underline-offset: 0.2em;
}
.riders-th-sort-btn:hover { color: var(--accent); }
.riders-th-sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.riders-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    max-width: 100%;
}
.riders-name-cell-text { min-width: 0; }
.riders-name-cell-cue {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1;
    opacity: 0.8;
}
.riders-td-name .riders-name-cell-text { font-weight: 600; color: var(--text); }
.riders-td-contact {
    color: var(--text-secondary);
    font-size: 0.86rem;
    max-width: 15rem;
    vertical-align: top;
}
.riders-contact-phone {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.riders-email-crop {
    display: inline-block;
    max-width: 12.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.riders-table td[data-field="skill_levels"] {
    font-size: 0.8rem;
    line-height: 1.45;
    max-width: 20rem;
    vertical-align: top;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}
.rider-level-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.4rem;
    max-width: 20rem;
}
.rider-level-pill--hidden { display: none; }
.rider-level-pills[data-expanded="true"] .rider-level-pill--hidden { display: inline-flex; }
.rider-level-pills[data-expanded="true"] .rider-level-pill-more { display: none; }
.rider-level-pill-more {
    display: inline-flex; align-items: center; cursor: pointer;
    font-size: 0.72rem; font-weight: 700; line-height: 1.2;
    padding: 0.2rem 0.45rem; border-radius: 0.35rem;
    background: var(--bg-card-hover); border: 1px solid var(--border);
    color: var(--text-secondary); transition: background .12s, color .12s;
}
.rider-level-pill-more:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.rider-level-pill-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.riders-level-count-badge {
    display: none; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 600; padding: 0.2rem 0.55rem;
    border-radius: 0.35rem; background: var(--bg-card-hover);
    border: 1px solid var(--border); color: var(--text-secondary);
}
.riders-compact-mode .rider-level-pills { display: none; }
.riders-compact-mode .riders-level-count-badge { display: inline-flex; }
.rider-level-pill {
    --rlp: #64748b;
    display: inline-flex;
    align-items: center;
    margin: 0;
    max-width: 100%;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.2rem 0.45rem;
    border-radius: 0.35rem;
    border: 1px solid color-mix(in srgb, var(--rlp) 40%, var(--border));
    background: color-mix(in srgb, var(--rlp) 16%, var(--bg-card));
    color: var(--text);
    word-break: break-word;
    hyphens: auto;
}
/* Eeldus: <td> ei tohi olla .admin-actions — display:flex murrab tabeli laotuse ja
   tekitab viimases veerus tühja tumeda riba, kui tase-veerus on palju sisu. */
.riders-table td.riders-actions-td { display: table-cell; position: relative; vertical-align: top; padding-top: 0.5rem; }
.riders-actions { display: inline-flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 0.35rem; }
.riders-actions .btn { flex-shrink: 0; }
/* Õpilased, tegevused: nupud alati näha, vertikaalselt (Muuda → kasutaja → Kustuta) */
.riders-actions--stacked {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    align-self: flex-end;
    gap: 0.35rem;
    width: 100%;
    min-width: 8.75rem;
    max-width: 12.5rem;
}
.riders-actions--stacked .btn {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
}
.riders-actions--stacked .btn + .btn {
    margin-left: 0;
}
.riders-actions--stacked .riders-del-btn {
    color: #b91c1c;
    border-color: color-mix(in srgb, #dc2626 40%, var(--border));
    background: color-mix(in srgb, #ef4444 6%, var(--bg-card));
}
.riders-actions--stacked .riders-del-btn:hover {
    color: #991b1b;
    border-color: #dc2626;
    background: color-mix(in srgb, #ef4444 12%, var(--bg));
}
[data-theme="dark"] .riders-actions--stacked .riders-del-btn {
    color: #f87171;
    border-color: color-mix(in srgb, #f87171 45%, var(--border));
    background: color-mix(in srgb, #ef4444 12%, var(--bg-card));
}
/* Õpilased: desktop = tabel, <768px = kaardid.
   Samal <ul>-l on klassid riders-dual__mobile + riders-mobile-cards — ära määra
   .riders-mobile-cards { display: flex } eraldi, muidu kirjutab see üle display:none. */
.riders-dual__mobile {
    display: none;
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    flex-direction: column;
    gap: 0.75rem;
}
@media (max-width: 768px) {
    .riders-dual__desktop { display: none; }
    .riders-dual__mobile { display: flex; }
    .riders-pager { flex-wrap: wrap; }
}
.riders-card {
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-card);
    padding: 0.7rem 0.85rem 0.65rem;
    max-width: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.riders-list-panel .riders-card,
.riders-ended-block .riders-card { border-color: var(--border); }
.riders-card__levels .rider-level-pills { max-width: 100%; }
.riders-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.riders-card__name {
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 0;
    word-break: break-word;
    color: var(--text);
    line-height: 1.35;
}
.riders-card__actions { display: inline-flex; flex-shrink: 0; align-items: center; gap: 0.3rem; }
.riders-card__actions--stacked {
    flex-direction: column;
    align-items: stretch;
    align-self: flex-start;
    min-width: 7.5rem;
    max-width: 12rem;
    gap: 0.35rem;
}
.riders-card__actions--stacked .btn { width: 100%; justify-content: center; box-sizing: border-box; }
.riders-card__actions--stacked .riders-del-btn {
    color: #b91c1c;
    border-color: color-mix(in srgb, #dc2626 40%, var(--border));
    background: color-mix(in srgb, #ef4444 6%, var(--bg-card));
}
.riders-card__actions--stacked .riders-del-btn:hover {
    color: #991b1b;
    border-color: #dc2626;
    background: color-mix(in srgb, #ef4444 12%, var(--bg));
}
[data-theme="dark"] .riders-card__actions--stacked .riders-del-btn {
    color: #f87171;
    border-color: color-mix(in srgb, #f87171 45%, var(--border));
    background: color-mix(in srgb, #ef4444 12%, var(--bg-card));
}
.riders-card__meta { font-size: 0.82rem; color: var(--text-secondary); margin: 0 0 0.25rem; }
.riders-card__phone { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }
.riders-card__levels { margin: 0.4rem 0; line-height: 1.4; }
.riders-card__credits {
    margin: 0.35rem 0 0.45rem;
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    line-height: 1.4;
}
.riders-credits-label { color: var(--text-muted); font-size: 0.8rem; }
.riders-td-credits { white-space: nowrap; vertical-align: top; padding-top: 0.45rem; }
.riders-credits-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.5rem; padding: .15rem .45rem; border-radius: .35rem;
    font-weight: 700; font-size: .82rem; line-height: 1.3;
}
.riders-credits-badge--zero { background: rgba(148,163,184,.2); color: var(--text-muted); }
.riders-credits-badge--low { background: rgba(245,158,11,.18); color: #92400e; }
.riders-credits-badge--ok { background: rgba(34,197,94,.18); color: #166534; }
[data-theme="dark"] .riders-credits-badge--zero { background: rgba(148,163,184,.15); color: #94a3b8; }
[data-theme="dark"] .riders-credits-badge--low { background: rgba(245,158,11,.2); color: #fcd34d; }
[data-theme="dark"] .riders-credits-badge--ok { background: rgba(74,222,128,.18); color: #bbf7d0; }
.riders-card__account { margin: 0.2rem 0 0.45rem; }
.riders-card-open-btn { width: 100%; margin-top: 0.15rem; }
.riders-card--empty { font-style: italic; color: var(--text-muted); }
.riders-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem 0.65rem;
    margin: 0 0 0.4rem;
}
.riders-pager__text { font-size: 0.82rem; color: var(--text-secondary); margin-right: auto; }
.riders-table tbody tr.riders-row-keyboard:focus { outline: none; }
.riders-table tbody tr.riders-row-keyboard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.riders-table tbody tr.riders-row-keyboard { scroll-margin: 0.5rem; }
.admin-date-field {
    display: flex; align-items: stretch; gap: .35rem; width: 100%;
}
.admin-date-field__input {
    flex: 1 1 auto; min-width: 0; cursor: text;
}
.admin-date-picker-btn {
    flex-shrink: 0; padding: .4rem .55rem; display: inline-flex;
    align-items: center; justify-content: center; align-self: stretch;
}
.admin-date-picker-btn__icon {
    width: 1.15rem; height: 1.15rem; display: block;
}

.admin-calendar-overlay {
    align-items: flex-start; padding-top: 2rem;
    background: rgba(0, 0, 0, 0.75);
}
.admin-calendar {
    background: #ffffff;
    border-radius: .75rem; padding: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    border: 2px solid #333;
    min-width: 16rem;
    color: #111;
}
[data-theme="dark"] .admin-calendar-overlay { background: rgba(0, 0, 0, 0.85); }
[data-theme="dark"] .admin-calendar {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}
.admin-calendar__header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: .75rem; gap: .5rem; flex-wrap: wrap;
}
.admin-calendar__selects {
    display: flex; align-items: center; gap: .4rem; flex: 1 1 auto;
    justify-content: center; min-width: 0;
}
.admin-calendar__selects .form-select {
    font-size: .85rem; padding: .35rem .5rem; min-width: 0;
    flex: 1 1 auto; max-width: 9.5rem;
}
.admin-calendar__selects .admin-calendar__year-select { max-width: 5.5rem; }
.admin-calendar .form-select {
    background: #f8fafc; color: #111; border-color: #334155;
}
[data-theme="dark"] .admin-calendar .form-select {
    background: #334155; color: #e2e8f0; border-color: #64748b;
}
.admin-calendar__title { font-weight: 700; font-size: 1rem; color: inherit; }
.admin-calendar__nav {
    padding: .4rem .65rem; border: 1px solid #333; border-radius: .35rem;
    background: #f1f5f9; color: #111; cursor: pointer; font-size: 1.15rem; line-height: 1;
}
.admin-calendar__nav:hover { background: #e2e8f0; }
[data-theme="dark"] .admin-calendar__nav {
    background: #334155; border-color: #64748b; color: #e2e8f0;
}
[data-theme="dark"] .admin-calendar__nav:hover { background: #475569; }
.admin-calendar__table {
    border-collapse: collapse; font-size: .9rem; width: 100%;
}
.admin-calendar__table th {
    padding: .45rem .3rem; font-weight: 700; color: inherit;
    border-bottom: 2px solid #333; background: #f1f5f9;
}
[data-theme="dark"] .admin-calendar__table th {
    border-color: #475569; background: #334155;
}
.admin-calendar__table td { padding: 4px; text-align: center; }
.admin-calendar__day {
    width: 2.35rem; height: 2.35rem; padding: 0; border: none; border-radius: .35rem;
    background: transparent; color: inherit; cursor: pointer; font-size: inherit;
}
.admin-calendar__day:hover { background: #4f46e5; color: #fff; }
.admin-calendar__day--today { background: #4f46e5; color: #fff; font-weight: 700; }
.admin-calendar__day--today:hover { background: #4338ca; color: #fff; }
.add-form { display: flex; gap: .5rem; align-items: flex-end; margin-bottom: 1rem; flex-wrap: wrap; }
.add-form .form-group { margin-bottom: 0; }

/* Add-slot card (Lisa uus tund) */
.add-slot-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: .75rem;
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.add-slot-card__summary {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .8rem 1rem;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    list-style: none;
    color: var(--accent);
    user-select: none;
    transition: background .15s;
}
.add-slot-card__summary::-webkit-details-marker { display: none; }
.add-slot-card__summary:hover { background: var(--bg-card-hover); }
.add-slot-card__icon { width: 1rem; height: 1rem; flex-shrink: 0; }
.add-slot-card__chevron { width: 1rem; height: 1rem; margin-left: auto; transition: transform .2s; flex-shrink: 0; }
.add-slot-card[open] .add-slot-card__chevron { transform: rotate(180deg); }
.add-slot-card__body {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
}
.add-slot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .65rem 1rem;
    margin-bottom: .85rem;
}
.add-slot-grid .form-group { margin-bottom: 0; }
.add-slot-date-wrap { display: flex; align-items: center; gap: .5rem; flex-wrap: nowrap; }
.add-slot-date-input { flex: 1; min-width: 0; }
.add-slot-day-badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: .35rem;
    font-size: .78rem;
    font-weight: 600;
    background: var(--accent-light, rgba(99,102,241,.12));
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}
.add-slot-recurring-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .85rem;
}
.add-slot-recurring-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
    font-weight: 500;
    font-size: .9rem;
}
.add-slot-recurring-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    min-width: 1.1rem;
    margin: 0;
    cursor: pointer;
    border: 2px solid var(--accent);
    border-radius: 3px;
    background: transparent;
    position: relative;
    flex-shrink: 0;
    transition: background .15s;
}
.add-slot-recurring-label input[type="checkbox"]:checked {
    background: var(--accent);
}
.add-slot-recurring-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 45%;
    width: 6px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: translate(-50%, -50%) rotate(45deg);
}
.add-slot-weeks-wrap { display: flex; align-items: center; gap: .4rem; }
.add-slot-weeks-input { width: 4.5rem !important; }
.add-slot-hint { font-size: .8rem; color: var(--text-muted); font-weight: 400; }
.add-slot-preview {
    font-size: .85rem;
    color: var(--accent);
    background: var(--accent-light, rgba(99,102,241,.1));
    border-radius: .4rem;
    padding: .4rem .75rem;
    margin: 0 0 .9rem;
    font-weight: 500;
    min-height: 1.75rem;
}
.admin-schedule-save-row { margin: .6rem 0 .5rem; display: flex; align-items: center; gap: .75rem; }
@media (max-width: 600px) {
    .add-slot-grid { grid-template-columns: 1fr; }
    .add-slot-date-wrap { flex-wrap: wrap; }
}
[data-theme="dark"] .admin-date-picker-btn {
    border-color: color-mix(in srgb, var(--border) 40%, var(--text-secondary) 60%);
    color: var(--text);
    background: color-mix(in srgb, var(--bg-card-hover) 85%, var(--text) 15%);
}
[data-theme="dark"] .admin-date-picker-btn:hover {
    border-color: var(--accent);
    color: var(--accent-text, #c7d2fe);
    background: var(--accent-light);
}
[data-theme="dark"] .admin-date-picker-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.add-form__recurring-label {
    display: inline-flex !important;
    align-items: center;
    gap: .45rem;
    cursor: pointer;
    font-weight: 500;
    margin: 0 !important;
    white-space: nowrap;
}
.add-form__recurring-label input { width: auto; margin: 0; cursor: pointer; }
#new-recurring-weeks-count { max-width: 5.5rem; }
.add-form--announcements { flex-direction: column; align-items: stretch; max-width: 42rem; }
.add-form--announcements .form-group { margin-bottom: .75rem; }
.admin-announcement-textarea {
    min-height: 8rem; resize: vertical; padding: .65rem .85rem;
    font-size: .95rem; line-height: 1.45;
}
.admin-announcement-card {
    border: 1px solid var(--border); border-radius: .5rem;
    padding: .75rem 1rem; margin-bottom: .75rem;
    background: var(--bg-card);
}
.admin-announcement-body { margin-bottom: .35rem; }
.admin-announcement-meta { font-size: .8rem; color: var(--text-muted); }
.admin-announcement-card .admin-actions { margin-top: .5rem; }
.admin-announcements-section-title { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; color: var(--accent); }
.admin-announcements-section-hint { margin-bottom: .5rem; font-size: .85rem; }
.admin-list-empty { color: var(--text-muted); font-size: .9rem; margin: 0 0 .5rem 0; }
.admin-announcement-edit .form-label { display: block; margin-bottom: .25rem; }
.admin-announcement-edit .admin-announcement-textarea { margin-bottom: 0; }

/* Login card */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.login-card {
    background: var(--bg-card); border-radius: .75rem; padding: 2rem;
    box-shadow: 0 4px 24px rgba(0,0,0,.08); max-width: 22rem; width: 90%;
}
.login-card h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; text-align: center; }
.login-card .error-message { color: #ef4444; font-size: .85rem; margin-top: .5rem; text-align: center; }

/* ========== LOADING ========== */
.loading { text-align: center; padding: 3rem; color: var(--text-muted); font-size: .95rem; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .header__inner { height: auto; flex-wrap: wrap; padding: .6rem 0; gap: .5rem; }
    .header__brand h1 { font-size: 1.05rem; }
    .header__logo { height: 2rem; }
    .admin-grid { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; display: flex; flex-wrap: wrap; gap: .25rem; }
    .form-row { flex-direction: column; }
    .week-nav__label,
    button.week-nav__label--picker { min-width: auto; font-size: .95rem; }

    /*
     * Date picker is wider than the week label; left:50% on the label wrap
     * centers on the wrap and clips past the viewport. Use fixed + viewport
     * centering so it stays fully on screen (safe areas included in width).
     */
    .week-date-popover {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        top: max(6.5rem, calc(env(safe-area-inset-top, 0px) + 5rem));
        width: min(18.5rem, calc(100vw - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
        max-width: none;
        z-index: 200;
        max-height: min(28rem, calc(100dvh - 7rem - env(safe-area-inset-top, 0px)));
        overflow-y: auto;
    }
}

/* ========== TOAST ========== */
.toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1100;
    background: var(--toast-bg); color: #fff; padding: .7rem 1.2rem;
    border-radius: .5rem; font-size: .85rem; font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    animation: toastIn .3s ease-out;
}
.toast--error { background: #ef4444; }
.toast--success { background: #16a34a; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== SCHEDULE DESIGN VARIANTS (demo) ========== */
/* Default: no body[data-schedule-theme] or data-schedule-theme="default" – uses base styles */

/* --- MINIMAL: lots of whitespace, soft borders, calm typography --- */
body[data-schedule-theme="minimal"] .week-nav__label { font-weight: 500; letter-spacing: .02em; }
body[data-schedule-theme="minimal"] .day-tabs { gap: .5rem; margin-bottom: 1.5rem; }
body[data-schedule-theme="minimal"] .day-tab {
    padding: .55rem 1.1rem; border-radius: .6rem;
    border: 1px solid var(--border); font-weight: 500;
}
body[data-schedule-theme="minimal"] .day-tab.active { box-shadow: 0 2px 8px rgba(79,70,229,.2); }
body[data-schedule-theme="minimal"] .schedule-container { gap: 1.5rem; }
body[data-schedule-theme="minimal"] .class-card {
    border-radius: 1rem; border: 1px solid var(--border);
    box-shadow: none; background: var(--bg-card);
}
body[data-schedule-theme="minimal"] .class-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.06); }
body[data-schedule-theme="minimal"] .class-card__header {
    padding: 1.1rem 1.25rem; background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}
body[data-schedule-theme="minimal"] .class-card__level {
    padding: .4rem .75rem; border-radius: .6rem; font-weight: 700;
    font-size: .8rem; letter-spacing: .02em;
}
body[data-schedule-theme="minimal"] .class-card__time-tall { font-size: .9rem; font-weight: 600; }
body[data-schedule-theme="minimal"] .class-card__trainer {
    font-size: .85rem; font-weight: 600; padding: .35rem .65rem;
    background: var(--bg-card-hover); color: var(--text-secondary);
    border-radius: .5rem;
}
body[data-schedule-theme="minimal"] .class-card__trainer--missing { color: var(--text-muted); }
body[data-schedule-theme="minimal"] .class-card__riders { padding: .75rem 1.25rem 1rem; }
body[data-schedule-theme="minimal"] .class-card__free-spots-row { padding: 0 1.25rem 1rem; }
body[data-schedule-theme="minimal"] .rider-row {
    padding: .5rem .6rem; border-radius: .5rem;
}
body[data-schedule-theme="minimal"] .rider-row--header { padding: .4rem .6rem .3rem; }
body[data-schedule-theme="minimal"] .free-spot { padding: .65rem; border-radius: .6rem; }
body[data-schedule-theme="minimal"] .event-card {
    border-radius: 1rem; border: 1px solid var(--border);
}
body[data-schedule-theme="minimal"] .event-card__header {
    padding: 1.1rem 1.25rem; background: var(--bg-card-hover);
    border-bottom: 1px solid var(--border-light);
}

/* --- COMPACT: denser layout, more on screen, clear hierarchy --- */
body[data-schedule-theme="compact"] .week-nav { margin-bottom: .75rem; }
body[data-schedule-theme="compact"] .week-nav__label { font-size: 1rem; }
body[data-schedule-theme="compact"] .day-tabs { margin-bottom: .85rem; gap: .25rem; }
body[data-schedule-theme="compact"] .day-tab {
    padding: .3rem .7rem; font-size: .8rem; border-radius: .35rem;
}
body[data-schedule-theme="compact"] .schedule-container { gap: .6rem; }
body[data-schedule-theme="compact"] .class-card {
    border-radius: .5rem; border: 1px solid var(--border);
}
body[data-schedule-theme="compact"] .class-card__header-top {
    padding: .5rem .75rem; gap: .4rem; flex-wrap: wrap;
    min-height: 0;
}
body[data-schedule-theme="compact"] .class-card__header { border-bottom: 1px solid var(--border); }
body[data-schedule-theme="compact"] .class-card__level {
    min-width: auto; padding: .25rem .45rem; font-size: .75rem;
}
body[data-schedule-theme="compact"] .class-card__times {
    flex-direction: row; gap: .5rem; min-width: 0;
}
body[data-schedule-theme="compact"] .class-card__time-tall { font-size: .85rem; }
body[data-schedule-theme="compact"] .class-card__time-plats { font-size: .75rem; margin-top: 0; }
body[data-schedule-theme="compact"] .class-card__trainer {
    font-size: .78rem; padding: .25rem .5rem;
}
body[data-schedule-theme="compact"] .class-card__riders { padding: .4rem .75rem .5rem; }
body[data-schedule-theme="compact"] .class-card__free-spots-row { padding: 0 .75rem .5rem; }
body[data-schedule-theme="compact"] .rider-row--header { padding: .15rem .4rem; margin-bottom: .1rem; }
body[data-schedule-theme="compact"] .rider-row--header .rider-row__name,
body[data-schedule-theme="compact"] .rider-row--header .rider-row__horse { font-size: .65rem; }
body[data-schedule-theme="compact"] .rider-row {
    padding: .28rem .4rem; font-size: .82rem;
}
body[data-schedule-theme="compact"] .rider-row__name { font-size: .82rem; }
body[data-schedule-theme="compact"] .rider-row__horse { font-size: .72rem; min-width: 4.5rem; padding: .1rem .35rem; }
body[data-schedule-theme="compact"] .free-spot { padding: .35rem .5rem; }
body[data-schedule-theme="compact"] .free-spot__label { font-size: .78rem; }
body[data-schedule-theme="compact"] .event-card { border-radius: .5rem; border-width: 1px; }
body[data-schedule-theme="compact"] .event-card__header { padding: .5rem .75rem; }

/* --- WARM: rounded, soft accent, friendly feel --- */
body[data-schedule-theme="warm"] .week-nav__label { color: var(--text); }
body[data-schedule-theme="warm"] .day-tab {
    border-radius: 1rem; padding: .5rem 1rem;
    border: 1.5px solid var(--border);
}
body[data-schedule-theme="warm"] .day-tab.active {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border-color: #b45309; color: #fff;
}
body[data-schedule-theme="warm"] .day-tab.today { border-color: #d97706; }
body[data-schedule-theme="warm"] .schedule-container { gap: 1.1rem; }
body[data-schedule-theme="warm"] .class-card {
    border-radius: 1.25rem; border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
body[data-schedule-theme="warm"] .class-card:hover {
    box-shadow: 0 8px 28px rgba(217,119,6,.12);
}
body[data-schedule-theme="warm"] .class-card__header {
    padding: .9rem 1.1rem; border-bottom: none;
    background: linear-gradient(180deg, rgba(254,243,199,.4) 0%, var(--bg-card) 100%);
    border-radius: 1.25rem 1.25rem 0 0;
}
body[data-schedule-theme="warm"] .class-card__level {
    border-radius: .75rem; font-weight: 800;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
body[data-schedule-theme="warm"] .class-card__trainer {
    background: rgba(254,243,199,.6); color: #92400e;
    border-radius: .75rem; padding: .4rem .7rem;
}
[data-theme="dark"] body[data-schedule-theme="warm"] .class-card__trainer {
    background: rgba(251,191,36,.15); color: #fbbf24;
}
body[data-schedule-theme="warm"] .class-card__trainer--missing {
    background: rgba(254,226,226,.5); color: #b91c1c;
}
body[data-schedule-theme="warm"] .class-card__riders { padding: .6rem 1rem .85rem; }
body[data-schedule-theme="warm"] .class-card__free-spots-row { padding: 0 1rem .85rem; }
body[data-schedule-theme="warm"] .rider-row {
    border-radius: .6rem; padding: .45rem .55rem;
}
body[data-schedule-theme="warm"] .rider-row:hover { background: rgba(254,243,199,.25); }
body[data-schedule-theme="warm"] .free-spot {
    border-radius: .75rem; border-style: solid;
    border-color: #fcd34d; background: rgba(254,243,199,.35);
}
body[data-schedule-theme="warm"] .free-spot:hover {
    border-color: #d97706; background: rgba(254,243,199,.6);
}
body[data-schedule-theme="warm"] .event-card {
    border-radius: 1.25rem; border: 2px solid #ea580c;
    box-shadow: 0 2px 12px rgba(234,88,12,.08);
}
body[data-schedule-theme="warm"] .event-card[style*="--event-badge-color"] {
    border-color: var(--event-badge-color);
    box-shadow: 0 2px 12px color-mix(in srgb, var(--event-badge-color) 8%, transparent);
}
body[data-schedule-theme="warm"] .event-card__header {
    background: linear-gradient(180deg, rgba(254,243,199,.3) 0%, var(--bg-card) 100%);
    border-radius: 1.25rem 1.25rem 0 0; border-bottom: 1px solid rgba(234,88,12,.2);
}

/* --- BOLD: strong borders, high contrast, confident --- */
body[data-schedule-theme="bold"] .day-tab {
    border-width: 2px; font-weight: 600;
}
body[data-schedule-theme="bold"] .day-tab.active {
    background: var(--text); border-color: var(--text); color: var(--bg-card);
}
body[data-schedule-theme="bold"] .schedule-container { gap: 1.25rem; }
body[data-schedule-theme="bold"] .class-card {
    border: 2px solid var(--text);
    border-radius: .5rem; box-shadow: 0 4px 0 var(--text);
}
body[data-schedule-theme="bold"] .class-card__header {
    border-bottom: 2px solid var(--text);
    background: var(--text); color: var(--bg-card);
}
body[data-schedule-theme="bold"] .class-card__level {
    background: var(--bg-card); color: var(--text);
    border: 2px solid var(--bg-card);
}
body[data-schedule-theme="bold"] .class-card__time-tall,
body[data-schedule-theme="bold"] .class-card__time-plats { color: var(--bg-card); }
body[data-schedule-theme="bold"] .class-card__time-plats { opacity: .9; }
body[data-schedule-theme="bold"] .class-card__trainer {
    background: var(--bg-card); color: var(--text);
    border: 2px solid var(--text);
}
body[data-schedule-theme="bold"] .class-card__trainer--missing {
    background: var(--badge-absent-bg); border-color: var(--badge-absent-text);
    color: var(--badge-absent-text);
}
body[data-schedule-theme="bold"] .share-link-btn { color: var(--bg-card); }
body[data-schedule-theme="bold"] .share-link-btn:hover { background: var(--bg-card); color: var(--text); }
body[data-schedule-theme="bold"] .rider-row--header {
    border-bottom: 2px solid var(--border);
    font-weight: 700;
}
body[data-schedule-theme="bold"] .event-card[style*="--event-badge-color"] {
    border-color: var(--event-badge-color);
}
body[data-schedule-theme="bold"] .event-card {
    border: 2px solid var(--text);
    box-shadow: 0 4px 0 var(--text);
}
body[data-schedule-theme="bold"] .event-card__header {
    background: var(--text); color: var(--bg-card);
    border-bottom: 2px solid var(--text);
}
body[data-schedule-theme="bold"] .event-card__header-top .class-card__level { background: var(--bg-card); color: var(--text); }
body[data-schedule-theme="bold"] .event-card__time { color: var(--bg-card); }

/* --- TIMELINE: time on left, list flow --- */
body[data-schedule-theme="timeline"] .schedule-container { gap: 0; }
body[data-schedule-theme="timeline"] .class-card {
    display: grid; grid-template-columns: 9.5rem minmax(0, 1fr);
    border-radius: 0; border: none;
    border-bottom: 1px solid var(--border);
    box-shadow: none; background: var(--bg-card);
}
body[data-schedule-theme="timeline"] .class-card:hover { box-shadow: none; background: var(--bg-card-hover); }
body[data-schedule-theme="timeline"] .class-card__header {
    /* Span all grid rows (use span, not -1: with several column-2 siblings / implicit rows,
       1 / -1 can leave the sidebar short; span clamps to actual row count). */
    grid-column: 1;
    grid-row: 1 / span 999;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-bottom: none; border-right: 2px solid var(--border);
    padding: .6rem .5rem; text-align: center;
    background: var(--bg-card-hover); min-width: 0; max-width: 9.5rem;
    overflow-wrap: break-word; word-break: break-word;
}
body[data-schedule-theme="timeline"] .class-card__header-top {
    flex-direction: column; gap: .25rem;
}
body[data-schedule-theme="timeline"] .class-card__level {
    order: -1;
}
body[data-schedule-theme="timeline"] .class-card__times {
    flex-direction: column; align-items: center; font-size: .85rem;
}
body[data-schedule-theme="timeline"] .class-card__time-tall {
    font-weight: 800; font-size: .95rem;
}
body[data-schedule-theme="timeline"] .class-card__level {
    font-size: .75rem; padding: .25rem .4rem;
}
body[data-schedule-theme="timeline"] .class-card__trainer {
    font-size: .75rem; font-weight: 700; line-height: 1.3; padding: .25rem .35rem;
    word-break: break-word; overflow-wrap: break-word;
    max-width: 100%; margin-top: .2rem;
    display: block; text-align: center;
    color: var(--accent); background: var(--accent-light);
}
body[data-schedule-theme="timeline"] .class-card__trainer strong {
    font-weight: 700;
}
body[data-schedule-theme="timeline"] .class-card__trainer--missing {
    color: #ef4444; background: var(--badge-absent-bg);
}
body[data-schedule-theme="timeline"] .class-card__trainer svg {
    width: .8rem; height: .8rem;
}
body[data-schedule-theme="timeline"] .class-card__header .share-link-btn { display: none; }
/* Free-spot summary in narrow column: must wrap, not spill into rider column */
body[data-schedule-theme="timeline"] .class-card__spots-available {
    align-self: stretch;
    min-width: 0;
    white-space: normal;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
    overflow-wrap: break-word;
    word-break: break-word;
}
body[data-schedule-theme="timeline"] .class-card__open-signup-wrap,
body[data-schedule-theme="timeline"] .class-card__free-spots-row {
    grid-column: 2;
    min-width: 0;
    box-sizing: border-box;
}
body[data-schedule-theme="timeline"] .class-card__free-spots-row {
    padding-left: 1rem;
    padding-right: 1rem;
}
body[data-schedule-theme="timeline"] .class-card__notes {
    grid-column: 2;
    min-width: 0;
    box-sizing: border-box;
}
body[data-schedule-theme="timeline"] .class-card__riders {
    grid-column: 2; padding: .6rem 1rem;
    border-left: none;
    min-width: 0; /* allow grid cell to shrink; keeps column alignment */
    overflow-x: clip; /* keep content (e.g. Vaba koht) inside the info area */
    box-sizing: border-box;
}
body[data-schedule-theme="timeline"] .class-card__riders .share-link-btn { margin-left: auto; }
/* Align all info-area content: rider rows, free-spot, replacement-group */
body[data-schedule-theme="timeline"] .class-card__riders .rider-row,
body[data-schedule-theme="timeline"] .class-card__riders .replacement-group {
    min-width: 0; max-width: 100%;
    box-sizing: border-box;
}
body[data-schedule-theme="timeline"] .class-card__free-spots-row .free-spot {
    margin-left: 0; margin-right: 0;
}
/* Dark mode: row dividers use --border (#334155), too close to card bg — clearer separator */
[data-theme="dark"] body[data-schedule-theme="timeline"] .class-card,
[data-theme="dark"] body[data-schedule-theme="timeline"] .event-card {
    border-bottom: 1px solid rgba(148, 163, 184, 0.45);
}
@media (max-width: 480px) {
    body[data-schedule-theme="timeline"] .class-card__spots-available {
        font-size: .68rem;
        padding: .2rem .38rem;
    }
}
body[data-schedule-theme="timeline"] .event-card {
    display: grid; grid-template-columns: 9.5rem minmax(0, 1fr);
    border-radius: 0; border: none; border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
body[data-schedule-theme="timeline"] .event-card:hover { background: var(--bg-card-hover); }
body[data-schedule-theme="timeline"] .event-card__header {
    grid-column: 1;
    grid-row: 1 / span 999;
    align-self: stretch;
    border-right: 2px solid var(--event-badge-color); border-bottom: none;
    flex-direction: column; justify-content: flex-start; text-align: center;
    padding: .6rem .4rem; background: var(--bg-card-hover); min-width: 0;
}
body[data-schedule-theme="timeline"] .event-card__header-top {
    flex-direction: column; gap: .25rem; align-items: center;
}
body[data-schedule-theme="timeline"] .event-card__header-top .class-card__level {
    font-size: .7rem; padding: .2rem .35rem; white-space: normal;
    word-break: break-word; overflow-wrap: break-word; line-height: 1.25;
    max-width: 100%;
}
body[data-schedule-theme="timeline"] .event-card__header-top .share-link-btn { display: none; }
body[data-schedule-theme="timeline"] .event-card__time,
body[data-schedule-theme="timeline"] .event-card__time--allday { font-size: .85rem; }
body[data-schedule-theme="timeline"] .event-card__desc,
body[data-schedule-theme="timeline"] .event-card__spots,
body[data-schedule-theme="timeline"] .event-card__signups,
body[data-schedule-theme="timeline"] .event-card__waitlist,
body[data-schedule-theme="timeline"] .event-card__register { grid-column: 2; }

/* --- PASTEL: soft pastel tints, gentle --- */
body[data-schedule-theme="pastel"] .day-tab {
    background: rgba(255,255,255,.7); border: 1px solid var(--border);
}
body[data-schedule-theme="pastel"] .day-tab.active {
    background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 100%);
    border-color: #a78bfa; color: #fff;
}
body[data-schedule-theme="pastel"] .schedule-container { gap: 1.2rem; }
body[data-schedule-theme="pastel"] .class-card {
    border: none; border-radius: 1rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
body[data-schedule-theme="pastel"] .class-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.06);
}
body[data-schedule-theme="pastel"] .class-card__header {
    border-bottom: none; border-radius: 1rem 1rem 0 0;
    padding: 1rem 1.2rem;
}
body[data-schedule-theme="pastel"] .class-card__level {
    box-shadow: none; opacity: .95;
}
body[data-schedule-theme="pastel"] .level-0    { background: #e9d5ff; color: #6b21a8; }
body[data-schedule-theme="pastel"] .level-poni { background: #fbcfe8; color: #9d174d; }
body[data-schedule-theme="pastel"] .level-1a   { background: #bae6fd; color: #0369a1; }
body[data-schedule-theme="pastel"] .level-1a-plus { background: #7dd3fc; color: #0c4a6e; }
body[data-schedule-theme="pastel"] .level-1b   { background: #a7f3d0; color: #065f46; }
body[data-schedule-theme="pastel"] .level-1b-plus { background: #6ee7b7; color: #047857; }
body[data-schedule-theme="pastel"] .level-2a   { background: #fed7aa; color: #9a3412; }
body[data-schedule-theme="pastel"] .level-2b   { background: #fdba74; color: #c2410c; }
body[data-schedule-theme="pastel"] .level-hup  { background: #fecaca; color: #b91c1c; }
body[data-schedule-theme="pastel"] .class-card__trainer {
    background: rgba(196,181,253,.25); color: #5b21b6;
}
[data-theme="dark"] body[data-schedule-theme="pastel"] .class-card__trainer {
    background: rgba(139,92,246,.2); color: #c4b5fd;
}
body[data-schedule-theme="pastel"] .rider-row:hover { background: rgba(196,181,253,.08); }
body[data-schedule-theme="pastel"] .free-spot {
    background: rgba(167,243,208,.35); border-color: #6ee7b7;
}
body[data-schedule-theme="pastel"] .event-card {
    border: none; box-shadow: 0 2px 12px rgba(239,68,68,.08);
}
body[data-schedule-theme="pastel"] .event-card[style*="--event-badge-color"] {
    box-shadow: 0 2px 12px color-mix(in srgb, var(--event-badge-color) 8%, transparent);
}
body[data-schedule-theme="pastel"] .event-card__header {
    background: rgba(254,202,202,.3); border-bottom: none;
}

/* --- PAPER: neutral, document-like --- */
body[data-schedule-theme="paper"] .main { --bg: #f5f5f0; }
body[data-schedule-theme="paper"] .week-nav__label { color: #444; font-weight: 600; }
body[data-schedule-theme="paper"] .day-tab {
    background: #fff; border: 1px solid #d4d4d4;
    color: #333; border-radius: .25rem;
}
body[data-schedule-theme="paper"] .day-tab.active {
    background: #333; color: #fff; border-color: #333;
}
body[data-schedule-theme="paper"] .schedule-container { gap: 1rem; }
body[data-schedule-theme="paper"] .class-card {
    background: #fff; border: 1px solid #d4d4d4;
    border-radius: .2rem; box-shadow: none;
}
body[data-schedule-theme="paper"] .class-card:hover {
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
body[data-schedule-theme="paper"] .class-card__header {
    background: #fafaf9; border-bottom: 1px solid #e5e5e0;
    padding: .75rem 1rem;
}
body[data-schedule-theme="paper"] .class-card__level {
    background: #525252; color: #fff;
    border-radius: .2rem; font-weight: 700;
}
body[data-schedule-theme="paper"] .class-card__time-tall { color: #262626; }
body[data-schedule-theme="paper"] .class-card__time-plats { color: #737373; }
body[data-schedule-theme="paper"] .class-card__trainer {
    background: #f5f5f0; color: #525252;
    border-radius: .2rem; font-weight: 600;
}
body[data-schedule-theme="paper"] .class-card__trainer--missing { color: #737373; }
body[data-schedule-theme="paper"] .class-card__riders { padding: .6rem 1rem; }
body[data-schedule-theme="paper"] .rider-row--header {
    border-bottom: 1px solid #e5e5e0;
    color: #737373; font-size: .7rem;
}
body[data-schedule-theme="paper"] .rider-row { border-radius: 0; }
body[data-schedule-theme="paper"] .free-spot {
    border: 1px dashed #a3a3a3;
    background: #fafaf9; border-radius: .2rem;
}
body[data-schedule-theme="paper"] .event-card {
    background: #fff; border: 1px solid #d4d4d4;
    border-radius: .2rem;
}
body[data-schedule-theme="paper"] .event-card[style*="--event-badge-color"] {
    border-color: var(--event-badge-color);
}
body[data-schedule-theme="paper"] .event-card__header {
    background: #fef2f2; border-bottom: 1px solid #fecaca;
}

/* --- Dark mode overrides for design themes --- */
[data-theme="dark"] body[data-schedule-theme="pastel"] .day-tab {
    background: rgba(30,41,59,.8); border-color: var(--border);
}
[data-theme="dark"] body[data-schedule-theme="pastel"] .day-tab.active {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border-color: #6d28d9;
}
[data-theme="dark"] body[data-schedule-theme="bold"] .class-card__header {
    background: var(--text); color: var(--bg-card);
}
[data-theme="dark"] body[data-schedule-theme="bold"] .share-link-btn:hover {
    background: var(--bg-card); color: var(--text);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .main { --bg: #1e293b; }
[data-theme="dark"] body[data-schedule-theme="paper"] .week-nav__label { color: var(--text); }
[data-theme="dark"] body[data-schedule-theme="paper"] .day-tab {
    background: var(--bg-card); border-color: var(--border); color: var(--text);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .day-tab.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .class-card {
    background: var(--bg-card); border-color: var(--border);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .class-card__header {
    background: var(--bg-card-hover); border-color: var(--border);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .class-card__level {
    background: var(--text-secondary); color: var(--bg-card);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .class-card__time-tall,
[data-theme="dark"] body[data-schedule-theme="paper"] .class-card__time-plats { color: var(--text); }
[data-theme="dark"] body[data-schedule-theme="paper"] .class-card__trainer {
    background: var(--bg-card-hover); color: var(--text-secondary);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .class-card__trainer--missing { color: var(--text-muted); }
[data-theme="dark"] body[data-schedule-theme="paper"] .rider-row--header { color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] body[data-schedule-theme="paper"] .free-spot {
    border-color: var(--border); background: var(--bg-card-hover);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .event-card {
    background: var(--bg-card); border-color: var(--border);
}
[data-theme="dark"] body[data-schedule-theme="paper"] .event-card__header {
    background: rgba(239,68,68,.15); border-color: var(--border);
}

/* ========== PRINT STYLES (A4 day view) ========== */
/*
  Portrait vs Landscape for day schedule:
  - Portrait A4: 210mm wide × 297mm tall. One column of cards; rider tables (Name | Horse)
    fit the width, but with many classes we run out of height and must shrink fonts.
  - Landscape A4: 297mm wide × 210mm tall. We use two columns of cards (grid), so each
    column has ~140mm width (enough for name + horse) and we use the width instead of
    stacking everything vertically. Result: more content fits at a larger font size,
    less shrinking, better readability. So day view print uses LANDSCAPE + two columns.
*/
@media print {
    /* Default portrait for other pages; day view overrides via injected style */
    @page { size: A4 portrait; margin: 5mm; }

    /* Day view: fill entire page, minimal whitespace */
    html.print-day-view {
        height: 100% !important; width: 100% !important;
    }
    html.print-day-view body {
        height: 100% !important; min-height: 100vh !important;
        width: 100% !important; margin: 0 !important; padding: 0 !important;
    }
    html.print-day-view .main {
        min-height: 100vh !important; height: auto !important;
        width: 100% !important; max-width: none !important;
        margin: 0 !important; padding: 0 !important;
        justify-content: flex-start !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;
    }

    /* Override ALL CSS variables to pure B&W at the source */
    :root, [data-theme="dark"] {
        --bg: #fff !important;
        --bg-card: #fff !important;
        --bg-card-hover: #fff !important;
        --bg-input: #fff !important;
        --text: #000 !important;
        --text-secondary: #000 !important;
        --text-muted: #000 !important;
        --border: #000 !important;
        --border-light: #000 !important;
        --accent: #000 !important;
        --accent-hover: #000 !important;
        --accent-light: transparent !important;
        --accent-text: #000 !important;
        --header-bg: #fff !important;
        --header-text: #000 !important;
        --badge-absent-bg: transparent !important;
        --badge-absent-text: #000 !important;
        --badge-taken-bg: transparent !important;
        --badge-taken-text: #000 !important;
        --free-spot-bg: transparent !important;
        --free-spot-border: #000 !important;
        --free-spot-hover-bg: transparent !important;
        --free-spot-hover-border: #000 !important;
        --free-spot-text: #000 !important;
        --horse-bg: transparent !important;
        --modal-backdrop: transparent !important;
        --shadow-card: none !important;
        --shadow-modal: none !important;
        --toast-bg: #000 !important;
        --stat-value: #000 !important;
    }

    html { height: 100%; }
    * { color: #000 !important; }
    body {
        background: #fff !important; color: #000 !important;
        line-height: 1.2; margin: 0; padding: 0;
        height: 100%; overflow: hidden;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .header, .week-nav, .day-tabs, .modal, .toast, .btn-print,
    .free-spot, .no-print, .share-link-btn,
    .reschedule-notice__goto, .week-view-reschedule-goto,
    .sched-card__goto, .sched-cl__goto,
    .compact-day-row--reschedule-notice button,
    .site-footer { display: none !important; }
    /* Reset sticky so the header can't bleed onto page 2 */
    .header { position: static !important; }

    /* Week print: omit move-stub (new day still shows full class) */
    html.print-week-view .week-view-slot--reschedule-notice { display: none !important; }

    .main {
        padding: 0; margin: 0;
        max-width: none !important; width: 100% !important;
        height: 100%; overflow: hidden;
        display: flex; flex-direction: column;
    }

    /* Nädal view: fill one A4 landscape, B&W, maximize readability */
    html.print-week-view { height: 100% !important; }
    html.print-week-view body { height: 100% !important; min-height: 100vh !important; }
    html.print-week-view .main {
        height: 100% !important; min-height: 0 !important; padding: 0 3mm !important;
        display: flex !important; flex-direction: column !important;
    }
    html.print-week-view .print-header {
        display: flex !important; flex-direction: row !important; align-items: center !important;
        gap: .6rem !important;
        flex-shrink: 0 !important; padding: 1.5mm 0 2mm !important; margin-bottom: 2mm !important;
        border-bottom: 2px solid #000 !important;
    }
    html.print-week-view .print-header img { height: 2.6rem !important; filter: grayscale(1) contrast(1.2) !important; }
    html.print-week-view .print-header__school { font-size: .8rem !important; font-weight: 800 !important; }
    html.print-week-view .print-header__title { font-size: .95rem !important; font-weight: 800 !important; }
    html.print-week-view .print-header .print-date { font-size: .9rem !important; font-weight: 700 !important; }

    html.print-week-view .schedule-container {
        flex: 1 !important; min-height: 0 !important; overflow: hidden !important;
        display: block !important; padding: 0 !important;
    }
    html.print-week-view .week-view {
        display: grid !important;
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
        gap: 1.5mm !important; width: 100% !important; height: 100% !important; min-height: 0 !important;
        overflow: hidden !important; padding: 0 !important;
    }

    /* Day column */
    html.print-week-view .week-view-day {
        min-width: 0 !important; min-height: 0 !important; overflow: hidden !important;
        border-radius: 0 !important; border: 1px solid #000 !important;
        display: flex !important; flex-direction: column !important;
        background: #fff !important;
    }
    html.print-week-view .week-view-day__header {
        padding: .28rem .38rem !important; flex-shrink: 0 !important;
        border-bottom: 2px solid #000 !important;
        background: #d8d8d8 !important;
    }
    html.print-week-view .week-view-day__name {
        font-size: .75rem !important; line-height: 1.2 !important; font-weight: 900 !important;
        text-transform: uppercase !important; letter-spacing: .02em !important;
    }
    html.print-week-view .week-view-day__date {
        font-size: .65rem !important; margin-top: .05rem !important; font-weight: 600 !important;
    }
    html.print-week-view .week-view-day__content {
        padding: .22rem .28rem !important; gap: .22rem !important;
        flex: 1 !important; min-height: 0 !important;
        overflow: hidden !important; display: flex !important; flex-direction: column !important;
    }

    /* Class slot — clean B&W card, left border marks the slot boundary */
    html.print-week-view .week-view-slot {
        padding: .2rem .26rem !important; flex-shrink: 0 !important;
        border-radius: 0 !important;
        border-left: 3px solid #000 !important;
        border-top: 1px solid #ddd !important;
        border-right: none !important; border-bottom: none !important;
        line-height: 1.3 !important;
        background: #fff !important;
    }
    /* Level label: readable grey header strip */
    html.print-week-view .week-view-slot__level {
        display: block !important; width: 100% !important;
        margin: -0.2rem -0.26rem 0.12rem -0.26rem !important;
        padding: 2px .28rem !important;
        font-size: .6rem !important; font-weight: 800 !important; line-height: 1.25 !important;
        text-align: left !important;
        background: #e2e2e2 !important; color: #000 !important;
        border-bottom: 1px solid #bbb !important;
        border-radius: 0 !important;
        text-transform: uppercase !important; letter-spacing: .04em !important;
    }
    /* Header wraps level (order:-1) + time — reset layout to plain column */
    html.print-week-view .week-view-slot__header {
        display: flex !important; flex-direction: column !important; gap: 0 !important;
        width: 100% !important;
    }
    /* Time: plain bold text, no border/box from screen CSS */
    html.print-week-view .week-view-slot__time {
        display: block !important;
        font-size: .72rem !important; font-weight: 900 !important; line-height: 1.2 !important;
        border: none !important; background: transparent !important;
        margin: 0 0 .08rem !important; padding: 0 !important;
        width: auto !important; text-align: left !important; border-radius: 0 !important;
    }
    /* Trainer line */
    html.print-week-view .week-view-slot__trainer {
        font-size: .6rem !important; font-weight: 600 !important; display: block !important;
        margin-bottom: .05rem !important; color: #333 !important;
    }
    /* Free spots: B&W outline pill instead of green badge */
    html.print-week-view .week-view-slot__spots-available {
        display: inline-block !important;
        background: transparent !important; color: #000 !important;
        border: 1px solid #555 !important; border-radius: 2px !important;
        font-size: .56rem !important; font-weight: 700 !important;
        padding: 1px 4px !important; margin-bottom: .05rem !important;
    }
    /* Riders section */
    html.print-week-view .week-view-slot__riders-label {
        font-size: .56rem !important; font-weight: 800 !important;
        text-transform: uppercase !important; letter-spacing: .02em !important;
        color: #555 !important;
    }
    html.print-week-view .week-view-slot__rider-name {
        font-size: .62rem !important; padding-left: .16rem !important; line-height: 1.3 !important;
    }
    html.print-week-view .week-view-slot__riders-chips {
        gap: 2px !important; margin-top: 2px !important; flex-wrap: wrap !important;
    }
    html.print-week-view .week-view-slot__rider-chip {
        font-size: .58rem !important; padding: 0 3px !important;
        background: transparent !important;
        border: 1px solid #aaa !important; border-radius: 2px !important;
    }
    html.print-week-view .week-view-slot__rider-chip .badge-absent,
    html.print-week-view .week-view-slot__rider-chip .badge-taken {
        font-size: .48rem !important; font-weight: 700 !important;
    }
    /* Status badges (TÜHISTATUD / Aeg muutunud) — solid B&W, no animation */
    html.print-week-view .week-view-slot__status {
        margin-bottom: .06rem !important;
    }
    html.print-week-view .slot-badge--cancelled {
        background: #222 !important; color: #fff !important;
        border: none !important; box-shadow: none !important; animation: none !important;
        font-size: .52rem !important; padding: 1px .25rem !important; border-radius: 2px !important;
    }
    html.print-week-view .slot-badge--rescheduled {
        background: transparent !important; color: #000 !important;
        border: 1px solid #555 !important; box-shadow: none !important; animation: none !important;
        font-size: .52rem !important; padding: 1px .22rem !important; border-radius: 2px !important;
    }
    /* Cancelled slot: subtle shading to distinguish from active */
    html.print-week-view .week-view-slot--cancelled {
        background: #f5f5f5 !important;
    }
    /* Hide period notices in week print — reschedule info visible on new date */
    html.print-week-view .week-view-slot--reschedule-notice {
        display: none !important;
    }

    /* Events and empty state */
    html.print-week-view .week-view-event {
        padding: .2rem .26rem !important;
        border-left: 3px solid #000 !important; border-top: 1px solid #ddd !important;
        border-right: none !important; border-bottom: none !important;
        background: #f8f8f8 !important; border-radius: 0 !important;
    }
    html.print-week-view .week-view-event__time {
        font-size: .6rem !important; font-weight: 800 !important; display: block !important;
    }
    html.print-week-view .week-view-event__name { font-size: .62rem !important; }
    html.print-week-view .week-view-empty {
        font-size: .58rem !important; padding: .3rem !important; color: #999 !important;
        font-style: italic !important;
    }

    /* ========== DAY VIEW PRINT: B&W, one A4 portrait, readable ========== */
    /* Header: horizontal row matching week view — compact, left-aligned */
    html.print-day-view .print-header {
        display: flex !important; flex-direction: row !important; align-items: center !important;
        gap: .6rem !important;
        padding: 1.5mm 0 2mm !important; margin-bottom: 2mm !important;
        border-bottom: 2px solid #000 !important;
        flex-shrink: 0 !important; text-align: left !important;
        width: 100% !important;
    }
    html.print-day-view .print-header img {
        height: 2.6rem !important; filter: grayscale(1) contrast(1.2) !important; margin-bottom: 0 !important;
    }
    html.print-day-view .print-header__school {
        font-size: .85rem !important; font-weight: 800 !important; color: #000 !important; margin-bottom: 0 !important;
    }
    html.print-day-view .print-header__title {
        font-size: .95rem !important; font-weight: 900 !important; color: #000 !important; letter-spacing: .02em !important;
    }
    html.print-day-view .print-header .print-date {
        display: none !important;
    }

    /* Single column portrait: compact spacing between cards */
    html.print-day-view .schedule-container {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: .45rem 0 !important;
        flex: 1 1 auto !important; min-height: 0 !important;
        overflow: hidden !important; width: 100% !important;
        align-content: start !important;
        page-break-inside: avoid !important;
    }
    html.print-day-view .schedule-day-heading {
        grid-column: 1 / -1 !important;
        font-size: 1.1rem !important; font-weight: 900 !important; margin-bottom: .05rem !important;
        color: #000 !important; border-bottom: 1px solid #000 !important; padding-bottom: .08rem !important;
    }

    /* Single layout: reset any theme-specific grid/flex so we control everything */
    html.print-day-view .class-card,
    html.print-day-view .event-card {
        display: flex !important; flex-direction: column !important;
        grid-column: unset !important; grid-template-columns: unset !important;
    }
    html.print-day-view .class-card__header,
    html.print-day-view .class-card__riders,
    html.print-day-view .class-card__notes,
    html.print-day-view .class-card__open-signup-wrap,
    html.print-day-view .class-card__free-spots-row,
    html.print-day-view .event-card__header,
    html.print-day-view .event-card__time,
    html.print-day-view .event-card__desc,
    html.print-day-view .event-card__signups,
    html.print-day-view .event-card__spots,
    html.print-day-view .event-card__waitlist,
    html.print-day-view .event-card__register { grid-column: unset !important; }

    /* Class card: strong left border for visual hierarchy, clean B&W */
    html.print-day-view .class-card {
        border: 1px solid #ccc !important; border-left: 4px solid #000 !important;
        border-radius: 0 !important; box-shadow: none !important; background: #fff !important;
        flex: 0 0 auto !important; overflow: visible !important;
        margin-bottom: 0 !important; width: 100% !important; min-width: 0 !important;
    }
    html.print-day-view .class-card__header {
        padding: .18rem .35rem !important; border-bottom: 1px solid #ccc !important;
        background: #ececec !important; gap: .3rem !important;
        flex-shrink: 0 !important;
        max-width: none !important;
        width: 100% !important;
        border-right: none !important;
        grid-row: unset !important;
    }
    html.print-day-view .class-card__header-top {
        gap: .45rem !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
        align-items: center !important;
    }
    /* Reschedule stub: drop extra horizontal padding so „Tund toimub nüüd“ lines up (header already has .3rem) */
    html.print-day-view .class-card--reschedule-notice .class-card__header-top {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: .25rem !important;
        padding-bottom: .25rem !important;
    }
    html.print-day-view .class-card__reschedule-notice-body {
        padding: .35rem 0 .4rem !important;
        border-top: 1px solid #000 !important;
    }
    html.print-day-view .class-card__level,
    html.print-day-view .class-card .class-card__level {
        font-size: .88rem !important; font-weight: 900 !important; padding: .12rem .5rem !important;
        box-shadow: none !important; min-width: auto !important;
        border: 1px solid #000 !important; color: #000 !important;
        background: #fff !important; letter-spacing: .03em !important;
        border-radius: .2rem !important;
        order: 0 !important;
    }
    html.print-day-view [class*="level-"] { background: #fff !important; color: #000 !important; }
    html.print-day-view .class-card__times {
        line-height: 1.25 !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: baseline !important;
        gap: .25rem .5rem !important;
    }
    html.print-day-view .class-card__spots-available {
        white-space: normal !important; max-width: 100% !important;
        align-self: center !important; width: auto !important;
        background: transparent !important; color: #000 !important;
        border: 1px solid #666 !important; border-radius: 2px !important;
        padding: 1px 6px !important; font-size: .75rem !important;
    }
    html.print-day-view .class-card__open-signup-wrap,
    html.print-day-view .class-card__free-spots-row {
        display: none !important;
    }
    html.print-day-view .class-card__time-tall { font-size: 1rem !important; font-weight: 900 !important; color: #000 !important; }
    html.print-day-view .class-card__time-plats { font-size: .8rem !important; font-weight: 600 !important; color: #000 !important; }
    html.print-day-view .class-card__trainer {
        display: inline-flex !important; align-items: center !important; gap: .2rem !important;
        font-size: .78rem !important; font-weight: 600 !important; padding: 0 !important;
        background: transparent !important; color: #000 !important;
        border: none !important; border-radius: 0 !important;
    }
    html.print-day-view .class-card__trainer svg { width: .7rem !important; height: .7rem !important; stroke: #555 !important; flex-shrink: 0 !important; }
    html.print-day-view .class-card__trainer--missing {
        color: #555 !important;
    }
    /* Rider table: collapse borders so lines meet full height; stretch to 100% width */
    html.print-day-view .class-card__riders {
        padding: 0 !important; margin: 0 !important; overflow: visible !important; min-height: 0 !important;
        display: table !important; width: 100% !important; table-layout: fixed !important;
        border-collapse: collapse !important; border-spacing: 0 !important;
    }
    html.print-day-view .replacement-group { display: contents !important; }
    html.print-day-view .replacement-arrow { display: none !important; }

    html.print-day-view .rider-row {
        display: table-row !important; background: #fff !important;
        border: none !important; border-radius: 0 !important;
        padding: 0 !important; margin: 0 !important;
    }
    html.print-day-view .rider-row:hover { background: #fff !important; }
    html.print-day-view .rider-row--header {
        background: #e8e8e8 !important; border: none !important;
    }
    html.print-day-view .rider-row--header .rider-row__name,
    html.print-day-view .rider-row--header .rider-row__horse {
        font-size: .65rem !important; font-weight: 800 !important;
        text-transform: uppercase !important; letter-spacing: .04em !important;
        border: 1px solid #000 !important;
        border-left: none !important;
        border-top: none !important;
    }
    html.print-day-view .rider-row--header .rider-row__horse { border-right: none !important; }
    /* Single 1px lines: only inner borders; outer frame comes from .class-card */
    html.print-day-view .rider-row__name {
        display: table-cell !important;
        border: 1px solid #000 !important;
        border-left: none !important;
        padding: .2rem .45rem !important; vertical-align: middle !important;
        font-weight: 500 !important; font-size: inherit !important;
        background: transparent !important; border-radius: 0 !important; box-shadow: none !important;
        width: 55% !important;
    }
    html.print-day-view .rider-row__horse,
    html.print-day-view .rider-row__horse--assigned,
    html.print-day-view .rider-row__horse--pending {
        display: table-cell !important;
        border: 1px solid #000 !important;
        border-right: none !important;
        padding: .2rem .45rem !important; vertical-align: middle !important;
        font-size: inherit !important; font-weight: 400 !important; font-style: normal !important;
        background: transparent !important; border-radius: 0 !important; box-shadow: none !important;
        color: #000 !important; opacity: 1 !important;
        width: 45% !important; text-align: left !important;
    }
    html.print-day-view .class-card__riders .rider-row:first-child .rider-row__name,
    html.print-day-view .class-card__riders .rider-row:first-child .rider-row__horse {
        border-top: none !important;
    }
    html.print-day-view .class-card__riders .rider-row:last-child .rider-row__name,
    html.print-day-view .class-card__riders .rider-row:last-child .rider-row__horse {
        border-bottom: none !important;
    }
    html.print-day-view .horse-pending-text { display: none !important; }
    html.print-day-view .rider-row--absent { background: #fff !important; }
    html.print-day-view .rider-row--absent .rider-row__name,
    html.print-day-view .rider-row--absent .rider-row__horse { color: #555 !important; opacity: 1 !important; }
    html.print-day-view .rider-row--signedup { background: #fff !important; }

    html.print-day-view .badge-absent,
    html.print-day-view .badge-taken,
    html.print-day-view .badge-notice,
    html.print-day-view .badge-notice--late,
    html.print-day-view .badge-notice--ontime {
        background: #fff !important; border: none !important; border-radius: 0 !important;
        outline: none !important; font-size: .6rem !important; font-weight: 800 !important;
        padding: 0 .15rem !important; box-shadow: none !important; color: #000 !important;
    }

    /* Event card: 1px borders only */
    html.print-day-view .event-card {
        border: 1px solid #000 !important; border-radius: 0 !important;
        box-shadow: none !important; background: #fff !important;
        flex: 0 0 auto !important; overflow: visible !important; min-height: 0 !important;
        margin-bottom: 0 !important; width: 100% !important; min-width: 0 !important;
    }
    html.print-day-view .event-card__header {
        padding: .1rem .3rem !important; border-bottom: 1px solid #000 !important;
        background: #e8e8e8 !important; flex-shrink: 0 !important;
        max-width: none !important;
        width: 100% !important;
        border-right: none !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        grid-row: unset !important;
    }
    html.print-day-view .event-card__header-top {
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: wrap !important;
    }
    html.print-day-view .event-card__desc { font-size: .8rem !important; padding: .12rem .5rem .18rem !important; color: #000 !important; }
    html.print-day-view .event-card__spots { font-size: .8rem !important; font-weight: 700 !important; padding: .08rem .5rem !important; color: #000 !important; }
    html.print-day-view .event-card__spots--full { color: #000 !important; }
    html.print-day-view .event-card__signups { padding: .12rem .5rem .18rem !important; flex: 1 !important; overflow: hidden !important; min-height: 0 !important; }
    html.print-day-view .event-signup-row {
        padding: .15rem .3rem !important; border: none !important;
        border-bottom: 1px solid #000 !important; color: #000 !important;
        font-size: inherit !important;
    }
    html.print-day-view .event-signup-row:last-child { border-bottom: none !important; }
    html.print-day-view .event-card__register { display: none !important; }
    html.print-day-view .event-signup-row__cancel { display: none !important; }
    html.print-day-view .event-card__time,
    html.print-day-view .event-card__time--allday { color: #000 !important; font-size: .85rem !important; }

    html.print-day-view .class-card__notes,
    html.print-day-view .class-card > div[style*="padding"] { font-size: .75rem !important; color: #000 !important; padding: .12rem .5rem .18rem !important; }
    html.print-day-view .slot-badge--cancelled {
        font-size: .6rem !important; font-weight: 800 !important; padding: 1px .25rem !important;
        background: #222 !important; color: #fff !important;
        border: none !important; border-radius: 2px !important;
        box-shadow: none !important; animation: none !important;
    }
    html.print-day-view .slot-badge--rescheduled {
        font-size: .6rem !important; font-weight: 700 !important; padding: 1px .22rem !important;
        background: transparent !important; color: #000 !important;
        border: 1px solid #555 !important; border-radius: 2px !important;
        box-shadow: none !important; animation: none !important;
    }

    /* Eriti kompaktne: table prints like day view (same page setup) */
    html.print-day-view .schedule-period-pill {
        background: #fff !important; border-top-color: #000 !important;
    }
    html.print-day-view .schedule-period-pill__name,
    html.print-day-view .schedule-period-pill__range,
    html.print-day-view .schedule-period-pill__no-signup { color: #000 !important; }
    html.print-day-view .compact-day-table-wrap {
        border: 1px solid #000 !important; border-radius: 0 !important;
        background: #fff !important; overflow: visible !important;
    }
    html.print-day-view .compact-day-table th {
        background: #e8e8e8 !important; color: #000 !important;
        border: 1px solid #000 !important; font-size: inherit !important;
    }
    html.print-day-view .compact-day-table td {
        border: 1px solid #000 !important; color: #000 !important;
        vertical-align: middle !important;
    }
    html.print-day-view .compact-day-level-pill {
        background: #fff !important; color: #000 !important;
        border: 1px solid #000 !important;
        padding: 1px .3rem !important; font-size: .7rem !important;
    }
    html.print-day-view .compact-day-level { width: 7% !important; }
    html.print-day-view .compact-day-trainer { width: 11% !important; }
    html.print-day-view .compact-day-riders { width: 47% !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
    html.print-day-view .compact-day-horse { width: 28% !important; color: #000 !important; white-space: nowrap !important; }
    html.print-day-view .compact-day-row--class-rider td.compact-day-riders,
    html.print-day-view .compact-day-row--class-rider td.compact-day-horse {
        border-top-color: #ccc !important;
    }
    html.print-day-view .compact-day-row--cancelled .compact-day-time,
    html.print-day-view .compact-day-row--cancelled .compact-day-level-pill,
    html.print-day-view .compact-day-row--cancelled .compact-day-trainer,
    html.print-day-view .compact-day-row--cancelled .compact-day-riders { color: #555 !important; }
    html.print-day-view .compact-day-time__old {
        color: #555 !important;
        text-decoration: line-through !important;
    }
    html.print-day-view .compact-day-time__arrow { color: #000 !important; }
    html.print-day-view .compact-day-time__new { color: #000 !important; font-weight: 700 !important; }

    html.print-day-view .compact-day-events-section {
        border: 1px solid #000 !important; border-radius: 0 !important;
        background: #fff !important; margin-top: .4rem !important;
        padding: .3rem .5rem !important;
    }
    html.print-day-view .compact-day-events-heading {
        color: #000 !important; margin-bottom: .2rem !important;
    }
    html.print-day-view .compact-day-event-time,
    html.print-day-view .compact-day-event-name,
    html.print-day-view .compact-day-event-desc { color: #000 !important; }

    /* Kaardid / Nimekiri (päevavaade): tükelda lehel loetavalt, ära jäta kitsaks CSS Gridiks */
    html.print-day-view .sched-cards {
        display: block !important;
        width: 100% !important;
        gap: 0 !important;
    }
    html.print-day-view .sched-card {
        width: 100% !important;
        max-width: none !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        margin-bottom: .75rem !important;
        border: 1px solid #000 !important;
        border-radius: 0 !important;
        background: #fff !important;
        border-left-width: 1px !important;
    }
    html.print-day-view .sched-card__topbar { display: none !important; }
    html.print-day-view .sched-card__footer .free-spot,
    html.print-day-view .sched-card__free-spots-below .free-spot,
    html.print-day-view .sched-card__open-signup { display: none !important; }
    html.print-day-view .sched-cl { display: block !important; width: 100% !important; }
    html.print-day-view .sched-cl__row {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        margin-bottom: .35rem !important;
        border-color: #000 !important;
    }

    /* Ensure no overflow clips borders */
    html.print-day-view .class-card__riders,
    html.print-day-view .class-card,
    html.print-day-view .event-card { overflow: visible !important; }

    /* -- Coach stats print mode -- */
    .coach-print-mode .header,
    .coach-print-mode .stats-tabs,
    .coach-print-mode #stats-date-row,
    .coach-print-mode #stats-presets-row,
    .coach-print-mode .no-print,
    .coach-print-mode .coach-cards,
    .coach-print-mode .coach-card__toggle { display: none !important; }
    .coach-print-mode .coach-print-table { display: block !important; }
    .coach-print-mode .coach-print-header { font-size: 1.1rem; font-weight: 700; color: #000 !important; margin-bottom: .5rem; }
    .coach-print-mode .coach-print-tbl th { background: #ddd !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .coach-print-mode .coach-print-tbl tr:nth-child(even) td { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .coach-print-mode .coach-print-tbl th,
    .coach-print-mode .coach-print-tbl td { border-color: #000 !important; color: #000 !important; }
    .coach-print-mode .main { padding: 5mm; max-width: none !important; }
    .coach-print-mode .stats-section__title { display: none !important; }
    .coach-print-mode .stats-section > p { display: none !important; }
}
.print-header { display: none; }

/* ========== Turg (marketplace) ========== */
.main--turg { max-width: 72rem; margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.turg-layout {
    display: grid;
    grid-template-columns: minmax(12rem, 14.5rem) 1fr;
    gap: 1.25rem 1.75rem;
    align-items: start;
}
@media (max-width: 52rem) {
    .turg-layout {
        grid-template-columns: 1fr;
    }
    .turg-subcat-sidebar {
        position: sticky;
        top: .5rem;
        z-index: 2;
        max-height: min(40vh, 16rem);
        overflow-y: auto;
        padding-bottom: .5rem;
        border-bottom: 1px solid var(--border);
    }
}
.turg-layout__main { min-width: 0; }
.turg-subcat-nav {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding-top: .6rem;
    border-top: 1px solid var(--border);
}
.turg-subcat-nav__btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: .45rem .55rem;
    font-size: .875rem;
    line-height: 1.3;
    border: 1px solid transparent;
    border-radius: .4rem;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}
.turg-subcat-nav__btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
}
.turg-subcat-nav__btn.is-active {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}
[data-theme="dark"] .turg-subcat-nav__btn.is-active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}
.turg-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
    margin-bottom: 1rem;
}
.turg-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.turg-filters .turg-filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.turg-intro { font-size: .9rem; color: var(--text-muted); margin-bottom: 1.25rem; line-height: 1.45; }
/* Reused on detail hero when no image */
.turg-card__img-wrap--empty { display: flex; align-items: center; justify-content: center; font-size: .85rem; color: var(--text-muted); }
.turg-empty { text-align: center; color: var(--text-muted); padding: 2rem; }
.turg-detail__gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.turg-detail__gallery a { display: block; border-radius: .35rem; overflow: hidden; border: 1px solid var(--border); }
.turg-detail__gallery img { width: 100%; height: 6rem; object-fit: cover; display: block; }
.turg-detail__price { font-size: 1.35rem; font-weight: 700; margin: 0 0 .5rem; }
.turg-detail__drop { font-size: .9rem; color: #ea580c; font-weight: 600; margin: 0 0 .5rem; }
.turg-detail__desc { line-height: 1.5; margin-bottom: 1rem; }
.turg-detail__attrs { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: 0 0 1rem; font-size: .9rem; }
.turg-detail__attrs dt { color: var(--text-muted); font-weight: 500; }
.turg-detail__attrs dd { margin: 0; }
.turg-detail__contact { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: 0; font-size: .9rem; }
.turg-detail__contact dt { color: var(--text-muted); font-weight: 500; }
.turg-detail__contact dd { margin: 0; }
.main--turg-manage { max-width: 36rem; margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.turg-manage-thumbs { display: flex; flex-wrap: wrap; gap: .75rem; }
.turg-manage-thumb-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; font-size: .8rem; }
.turg-manage-thumb-wrap img { width: 5rem; height: 5rem; object-fit: cover; border-radius: .35rem; border: 1px solid var(--border); }
.marketplace-admin-actions { flex-wrap: wrap; gap: .25rem; }
.marketplace-admin-drop { color: #ea580c; font-weight: 700; }

.turg-toolbar__cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}
.turg-toolbar__cluster--filters {
    flex: 1;
    min-width: 0;
}
.turg-toolbar__cluster--end {
    align-items: center;
    margin-left: auto;
}
.turg-list {
    flex-direction: column;
    gap: .5rem;
}
.turg-list__row {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    text-align: left;
    padding: .65rem .85rem;
    border: 1px solid var(--border);
    border-radius: .5rem;
    background: var(--bg-card);
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.turg-list__row:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-modal);
}
.turg-list__thumb {
    flex: 0 0 3.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: .35rem;
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--border);
}
.turg-list__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.turg-list__thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    color: var(--text-muted);
}
.turg-list__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.turg-list__subject {
    font-weight: 600;
    font-size: .95rem;
    line-height: 1.25;
}
.turg-list__cat {
    font-size: .8rem;
    color: var(--text-muted);
}
.turg-list__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}
.turg-list__price {
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 1rem;
}
.turg-detail__catline {
    font-size: .9rem;
    color: var(--text-muted);
    margin: 0 0 .75rem;
}
.turg-detail__subheading {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
    margin: 0 0 .35rem;
}

/* Marketplace v2 (scoped to .turg-page) */
.turg-page {
    --turg-display: inherit;
    --turg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --turg-shadow-md: 0 8px 28px rgba(0, 0, 0, 0.08);
    --turg-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
[data-theme="dark"] .turg-page {
    --turg-shadow-md: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.turg-page .main--turg {
    max-width: 78rem;
    padding-bottom: 3rem;
}
.turg-page .turg-hero__title,
.turg-page .turg-ad__title {
    font-family: var(--turg-display);
}
.turg-page .turg-ad__title { font-weight: 700; letter-spacing: -0.02em; }

@keyframes turg-hero-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.turg-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.65rem 1rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background:
        radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
        linear-gradient(165deg, var(--bg-card), var(--bg-card-hover));
    box-shadow: var(--turg-shadow-sm);
    position: relative;
    overflow: hidden;
}
.turg-hero::after {
    content: "";
    position: absolute;
    left: 1.25rem;
    bottom: 0;
    width: 3.5rem;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent));
    opacity: .85;
}
@media (prefers-reduced-motion: no-preference) {
    .turg-hero { animation: turg-hero-in 0.55s var(--turg-ease) both; }
}
.turg-hero__title {
    margin: 0;
    font-size: clamp(1.55rem, 2.6vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.12;
}
.turg-hero__lead {
    margin: .45rem 0 0;
    max-width: 36rem;
    color: var(--text-muted);
    font-size: .95rem;
    line-height: 1.5;
}
.turg-page .turg-hero .btn-primary {
    flex-shrink: 0;
    box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 35%, transparent);
    transition: transform 0.2s var(--turg-ease), box-shadow 0.2s var(--turg-ease);
}
@media (prefers-reduced-motion: no-preference) {
    .turg-page .turg-hero .btn-primary:hover { transform: translateY(-1px); }
}

.turg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .65rem;
    margin-bottom: .65rem;
    padding: .55rem .6rem;
    border: 1px solid var(--border);
    border-radius: .85rem;
    background: var(--bg-card);
}
.turg-toolbar > #turg-search {
    flex: 1 1 14rem;
    min-width: 10rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.turg-toolbar > #turg-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}
.turg-toolbar > #turg-sort {
    flex: 0 1 13rem;
    min-width: 9rem;
}

.turg-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0 0 1rem;
    min-height: 1.25rem;
}
.turg-chip-btn,
.turg-chip {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 999px;
    font-size: .76rem;
    padding: .22rem .55rem;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s var(--turg-ease);
}
.turg-chip-btn {
    cursor: pointer;
}
.turg-chip-btn:hover,
.turg-chip-btn:focus-visible {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    outline: none;
}
@media (prefers-reduced-motion: no-preference) {
    .turg-chip-btn:active { transform: scale(0.97); }
}

.turg-layout { grid-template-columns: minmax(13.5rem, 15.5rem) 1fr; gap: 1.35rem 1.75rem; }
.turg-layout__main { padding-bottom: 0.5rem; }

.turg-subcat-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: .85rem .75rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text-muted) 35%, transparent) transparent;
    box-shadow: var(--turg-shadow-sm);
}
.turg-subcat-nav__btn {
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s var(--turg-ease);
}
@media (prefers-reduced-motion: no-preference) {
    .turg-subcat-nav__btn:active { transform: scale(0.98); }
}

/* ---- Sidebar type filter ---- */
.turg-type-filter {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.85rem;
}
.turg-type-filter .turg-filter {
    flex: 1;
    text-align: center;
    font-size: 0.78rem;
    padding: 0.28rem 0.4rem;
}
.turg-type-filter .turg-filter.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---- View toggle ---- */
.turg-view-toggle {
    display: flex;
    gap: .2rem;
    flex-shrink: 0;
}
.turg-view-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: .45rem;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: background .12s, border-color .12s, color .12s;
}
.turg-view-btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); color: var(--text); }
.turg-view-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.turg-view-btn svg { width: 1.35rem; height: 1.35rem; flex-shrink: 0; }

/* ---- Card grid ---- */
.turg-list--grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    align-items: start;
}
/* List view meta badges */
.turg-list__badge {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: .15rem .45rem;
    border-radius: 999px;
    line-height: 1.4;
}
.turg-list__badge--sale { background: var(--accent); color: #fff; }
.turg-list__badge--wanted { background: rgba(17,24,39,.72); color: #fff; }
[data-theme="light"] .turg-list__badge--wanted { background: rgba(0,0,0,.6); }
.turg-list__seller, .turg-list__age, .turg-list__cond { font-size: .8rem; color: var(--text-muted); }
.turg-list__seller::before, .turg-list__age::before, .turg-list__cond::before { content: '·'; margin-right: .25rem; color: var(--text-muted); }
.turg-list__status {
    font-size: .68rem;
    font-weight: 600;
    padding: .15rem .45rem;
    border-radius: 999px;
    line-height: 1.4;
}
/* List view owner action icon buttons */
.turg-list__actions {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: 0 .75rem 0 .5rem;
    flex-shrink: 0;
}
.turg-list__action-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: .4rem;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: .95rem;
    font-family: inherit;
    transition: background .12s, border-color .12s, color .12s;
}
.turg-list__action-btn svg { width: 1.35rem; height: 1.35rem; flex-shrink: 0; }
.turg-list__action-btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); color: var(--text); }
.turg-list__action-btn--danger { color: #ef4444; border-color: rgba(239,68,68,.5); }
.turg-list__action-btn--danger:hover { background: rgba(239,68,68,.08); border-color: #ef4444; }
.turg-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s var(--turg-ease);
}
@media (prefers-reduced-motion: no-preference) {
    .turg-card:hover {
        border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
        box-shadow: var(--turg-shadow-md);
    }
}
.turg-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}
.turg-card__link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.turg-card__img {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--bg);
    overflow: hidden;
    flex-shrink: 0;
}
.turg-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s var(--turg-ease);
}
@media (prefers-reduced-motion: no-preference) {
    .turg-card:hover .turg-card__img img { transform: scale(1.04); }
}
.turg-card__img--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.turg-card__badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.4;
}
.turg-card__badge--sale {
    background: var(--accent);
    color: #fff;
}
.turg-card__badge--wanted {
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
}
[data-theme="light"] .turg-card__badge--wanted {
    background: rgba(0, 0, 0, 0.6);
}
.turg-card__body {
    padding: 0.7rem 0.85rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}
.turg-card__title {
    margin: 0 0 0.35rem;
    font-size: 0.925rem;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.turg-card__price {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.turg-card__seller {
    margin: 0.3rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Owner card actions */
.turg-card--mine { outline: 1.5px solid var(--accent); outline-offset: -1px; }
.turg-card__actions {
    display: flex;
    gap: 0.35rem;
    padding: 0.55rem 0.85rem 0.65rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card-hover);
}
.turg-card__action-btn {
    flex: 1;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.turg-card__action-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.turg-card__action-btn--danger { color: #ef4444; border-color: transparent; }
.turg-card__action-btn--danger:hover { background: rgba(239,68,68,.08); border-color: #ef4444; }
.turg-card__status-tag {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(0,0,0,.55);
    color: #fff;
    backdrop-filter: blur(4px);
}
.turg-card__status-tag--sold { background: rgba(34,197,94,.8); }
.turg-card__status-tag--pending { background: rgba(234,179,8,.85); color: #000; }
.turg-card__status-tag--rejected { background: rgba(239,68,68,.8); }

.turg-fav-btn {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    color: #4b5563;
    border-radius: 999px;
    width: 2.15rem;
    height: 2.15rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    line-height: 1;
    transition: transform 0.15s var(--turg-ease), color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    z-index: 2;
}
[data-theme="dark"] .turg-fav-btn {
    background: rgba(17, 24, 39, 0.72);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.35);
}
.turg-fav-btn:hover,
.turg-fav-btn:focus-visible {
    outline: none;
    border-color: var(--accent);
}
.turg-fav-btn.is-fav {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}
[data-theme="dark"] .turg-fav-btn.is-fav {
    background: rgba(127, 29, 29, 0.45);
    color: #fecaca;
    border-color: #f87171;
}
.turg-list__mainlink {
    color: inherit;
    text-decoration: none;
    display: flex;
    width: 100%;
}

.turg-list__row {
    padding: .2rem;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: .85rem;
    background: var(--bg-card);
    margin-bottom: .5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s var(--turg-ease);
}
@media (prefers-reduced-motion: no-preference) {
    .turg-list__row:hover {
        border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
        box-shadow: var(--turg-shadow-sm);
    }
}
.turg-list__mainlink {
    align-items: center;
    gap: .75rem;
    padding: .55rem .65rem;
    border-radius: .65rem;
    transition: background 0.15s ease;
}
.turg-list__mainlink:hover { background: var(--bg-card-hover); }
.turg-list__mainlink:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.turg-list__row .turg-fav-btn {
    margin: auto .5rem auto 0;
    background: transparent;
}
[data-theme="dark"] .turg-list__row .turg-fav-btn { background: transparent; }

.turg-empty {
    padding: 3rem 1.5rem;
    border: 1px dashed var(--border);
    border-radius: 1rem;
    background: var(--bg-card);
    font-size: 0.95rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.turg-empty__art {
    width: min(180px, 60vw);
    height: auto;
    margin-bottom: 1.5rem;
    color: color-mix(in srgb, var(--accent) 45%, var(--text-muted));
    opacity: 0.7;
}

.turg-empty__art svg {
    width: 100%;
    height: auto;
    display: block;
}

.turg-empty__title {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.turg-empty__text {
    margin: 0 0 1.5rem;
    max-width: 24rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.turg-empty__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 0.7rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.turg-empty__cta:hover {
    background: color-mix(in srgb, var(--accent) 90%, #000);
    transform: translateY(-1px);
}

.turg-empty__cta:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.turg-empty__cta i {
    font-size: 1rem;
    flex-shrink: 0;
}

.turg-stepper {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-bottom: 1rem;
}
.turg-step {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 999px;
    padding: .4rem .75rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.turg-step:hover { color: var(--text); border-color: var(--accent); }
.turg-step.is-active {
    color: var(--text);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-card));
    font-weight: 600;
}
.turg-step-actions {
    display: flex;
    justify-content: space-between;
    margin-top: .5rem;
    gap: .5rem;
}

.turg-image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin: 0 0 1rem;
}
.turg-image-preview__item {
    border: 1px solid var(--border);
    border-radius: .5rem;
    padding: .4rem;
    background: var(--bg-card);
    transition: border-color 0.15s ease;
}
.turg-image-preview__item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.turg-image-preview__item img {
    width: 5.5rem;
    height: 4.25rem;
    object-fit: cover;
    border-radius: .35rem;
    display: block;
}
.turg-image-preview__actions {
    margin-top: .4rem;
    display: flex;
    gap: .3rem;
    justify-content: center;
}

/* Add-listing modal (marketplace only id) */
#turg-add-modal .modal__content--wide { max-width: 32rem; border-radius: 1rem; }
#turg-add-modal .modal__title { font-family: var(--turg-display); font-size: 1.35rem; }
#turg-add-modal .modal__body { color: var(--text); }

.main--turg-ad {
    max-width: 78rem;
    margin: 0 auto;
    padding: 1rem 1.25rem 3rem;
}
.turg-ad__back { margin: 0 0 1rem; }
.turg-ad__back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s var(--turg-ease);
}
.turg-ad__back-link:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.turg-ad__back-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: no-preference) {
    .turg-ad__back-link:hover { transform: translateX(-2px); }
}

.turg-ad {
    display: grid;
    grid-template-columns: 1fr minmax(17rem, 22rem);
    gap: 1.35rem 2rem;
    align-items: start;
}
.turg-ad__hero {
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--turg-shadow-sm);
}
.turg-ad__hero img {
    width: 100%;
    height: min(56vh, 34rem);
    object-fit: cover;
    display: block;
}
.turg-ad__gallery {
    margin-top: .65rem;
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding: .2rem .1rem .45rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.turg-ad__gallery::-webkit-scrollbar { height: 6px; }
.turg-ad__gallery::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted) 40%, transparent);
    border-radius: 99px;
}
.turg-ad__thumb {
    flex: 0 0 auto;
    scroll-snap-align: start;
    border: 2px solid transparent;
    padding: 0;
    border-radius: .45rem;
    overflow: hidden;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s var(--turg-ease);
}
.turg-ad__thumb img {
    width: 4.85rem;
    height: 4.1rem;
    object-fit: cover;
    display: block;
}
.turg-ad__thumb:hover { border-color: var(--border); }
.turg-ad__thumb.is-active {
    border-color: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
    .turg-ad__thumb:active { transform: scale(0.97); }
}

.turg-ad__title {
    margin: .85rem 0 .25rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.15;
}
.turg-ad__cat {
    margin: 0 0 .75rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}
.turg-ad__desc {
    line-height: 1.62;
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
}

.turg-ad__right {
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--bg-card);
    padding: 1rem 1rem 1.1rem;
    height: fit-content;
    position: sticky;
    top: 1rem;
    box-shadow: var(--turg-shadow-sm);
}
.turg-ad__price {
    margin: 0 0 .65rem;
    font-size: clamp(1.45rem, 2.5vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.turg-ad__tags {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .85rem;
}
.turg-ad__seller h3 {
    margin: .85rem 0 .45rem;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}
.turg-ad__seller p { margin: 0 0 .4rem; word-break: break-word; }
.turg-ad__seller a { color: var(--accent); text-underline-offset: 2px; }
.turg-ad__trust {
    margin: 1rem 0 0;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

/* Owner action bar on turg-ad.php */
.turg-ad__owner-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--accent);
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.turg-ad__owner-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    margin-right: auto;
}
.turg-ad__owner-bar-danger { color: #ef4444 !important; border-color: transparent !important; }
.turg-ad__owner-bar-danger:hover { border-color: #ef4444 !important; background: rgba(239,68,68,.08) !important; }
.turg-chip--sold {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(34,197,94,.15);
    color: #22c55e;
}

@media (max-width: 52rem) {
    .turg-toolbar {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    .turg-toolbar > #turg-search { flex: 1 1 0; min-width: 0; }
    .turg-toolbar > #turg-sort { flex: 0 1 9rem; min-width: 7rem; }
    .turg-layout { grid-template-columns: 1fr; }
    .turg-list--grid { grid-template-columns: repeat(2, 1fr); }
    .turg-subcat-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
        padding: 0.6rem 0.75rem;
    }
    .turg-type-filter { justify-content: flex-start; }
    .turg-ad { grid-template-columns: 1fr; }
    .turg-ad__right { position: static; }
    .turg-ad__hero img { height: min(42vh, 22rem); }
}
@media (max-width: 30rem) {
    .turg-list--grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .turg-hero,
    .turg-page .turg-hero .btn-primary,
    .turg-ad__back-link,
    .turg-ad__thumb {
        animation: none !important;
        transition: none !important;
    }
    .slot-badge--cancelled,
    .slot-badge--rescheduled {
        animation: none !important;
    }
}

/* ============================================================
   NEW DEMO THEMES: card-grid | compact-list
   Added 2026 — these styles are purely additive
   ============================================================ */

.sched-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.sched-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    border-left: 3px solid var(--tc, var(--accent));
    display: flex;
    flex-direction: column;
    gap: 0;
}
.sched-card--cancelled {
    opacity: 1;
    background: color-mix(in srgb, var(--bg-card) 90%, #78716c 10%);
    border-left-color: #44403c !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 70%, #57534e 30%);
}
.sched-card__topbar {
    display: flex;
    justify-content: flex-end;
    margin: -4px -4px 4px 0;
}
.sched-card__share {
    padding: 0.2rem;
    opacity: 0.75;
}
.sched-card__share:hover { opacity: 1; }
.sched-card__time {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
}
.sched-card__level {
    margin-bottom: 6px;
    display: block;
}
.sched-card--cancelled .sched-card__level .class-card__level {
    text-decoration: line-through;
}
/* Level pill: same visual scale as .sched-card__time (default .class-card__level is larger) */
.sched-card__level .class-card__level {
    font-size: .9rem;
    font-weight: 700;
    min-width: 0;
    padding: .32rem .65rem;
    border-radius: .4rem;
    letter-spacing: .02em;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.sched-card__trainer {
    display: flex; align-items: center; gap: 6px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.3;
}
.sched-card__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--tc, var(--accent)); flex-shrink: 0;
}
.sched-card__riders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.sched-card__rider {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .75rem; padding: 3px 6px; border-radius: 6px;
    background: var(--bg-card-hover);
}
.sched-card__rider--empty { color: var(--text-muted); font-style: italic; justify-content: flex-start; }
.sched-card__rider--absent { opacity: .4; text-decoration: line-through; }
.sched-card__rider--signup { background: color-mix(in srgb, var(--color-success, #16a34a) 10%, transparent); }
.sched-card__rhorse { color: var(--text-muted); font-size: .7rem; }
.sched-card__spots-hint { font-size: .68rem; color: var(--text-muted); margin: 4px 0 2px; }
.sched-card__notes { font-size: .72rem; color: var(--text-muted); margin-top: 6px; }
.sched-card__footer {
    margin-top: 10px; padding-top: 8px;
    border-top: 1px solid var(--border-light, var(--border));
    display: flex; gap: 6px; flex-wrap: wrap;
    align-items: center;
}
.sched-card__footer .free-spot { flex: 1 1 auto; min-width: 0; }
.sched-card__free-spots-below {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.sched-card__free-spots-below .free-spot { flex: 1 1 auto; min-width: 0; }
.sched-card__action {
    font-size: .7rem; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 4px;
    padding: 2px 7px; background: none; cursor: pointer;
}
.sched-card__action:hover { background: var(--bg-card-hover); }
.sched-card__badge { font-size: .7rem; padding: 2px 7px; border-radius: 4px; }
.sched-card__badge--cancelled { background: var(--bg-card-hover); color: var(--text-muted); }
.sched-card__footer .slot-badge--cancelled { margin-top: 2px; }

@media (max-width: 600px) {
    .sched-cards { grid-template-columns: 1fr; }
}

.sched-cl { display: flex; flex-direction: column; gap: 0; }
.sched-cl__day-header {
    font-size: .75rem; font-weight: 600; color: var(--text-muted);
    padding: 4px 0 6px;
    border-bottom: 1px solid var(--border);
    margin: 12px 0 6px;
    letter-spacing: .02em;
    cursor: pointer;
}
.sched-cl__day-header:first-child { margin-top: 0; }
.sched-cl__row {
    display: flex; align-items: stretch;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 4px;
    overflow: hidden;
    background: var(--bg-card);
    cursor: default;
    transition: background .12s;
}
.sched-cl__row:hover { background: var(--bg-card-hover); }
/* Cancelled: no whole-row opacity (unreadable in dark mode); strike + readable muted text */
.sched-cl__row--cancelled {
    background: color-mix(in srgb, var(--bg-card) 85%, #57534e 15%);
    border-color: color-mix(in srgb, var(--border) 50%, #57534e 50%);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, transparent 70%, #44403c 30%);
}
.sched-cl__row--cancelled .sched-cl__time,
.sched-cl__row--cancelled .sched-cl__level,
.sched-cl__row--cancelled .sched-cl__sub {
    text-decoration: line-through;
    color: var(--text-secondary);
}
.sched-cl__row--cancelled .sched-cl__pill {
    text-decoration: line-through;
    color: var(--text-secondary);
    background: var(--bg-card-hover);
}
.sched-cl__row--cancelled .sched-cl__pill--free,
.sched-cl__row--cancelled .sched-cl__pill--signup {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    filter: none;
}
.sched-cl__cancelled-banner,
.sched-cl__rescheduled-banner {
    margin-top: 6px;
    margin-bottom: 2px;
}
.sched-cl__cancelled-banner .slot-badge--cancelled,
.sched-cl__rescheduled-banner .slot-badge--rescheduled {
    vertical-align: middle;
}
.sched-cl__accent {
    width: 4px; flex-shrink: 0;
    background: var(--tc, var(--accent));
    align-self: stretch;
}
.sched-cl__time {
    font-size: .75rem; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    width: 44px; padding: 10px 4px 10px 8px;
    flex-shrink: 0; display: flex; align-items: center;
}
.sched-cl__body { flex: 1; padding: 8px 4px; min-width: 0; }
.sched-cl__level { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-cl__sub   { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }
.sched-cl__pills {
    display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px;
}
.sched-cl__pill {
    padding: 1px 6px; border-radius: 20px;
    font-size: .7rem;
    background: var(--bg-card-hover);
    color: var(--text-muted);
    border: none; cursor: default;
}
.sched-cl__pill--empty { cursor: default; opacity: .7; }
.sched-cl__pill--absent { opacity: .4; text-decoration: line-through; cursor: pointer; }
.sched-cl__pill:not(.sched-cl__pill--absent):not(.sched-cl__pill--free):not(.sched-cl__pill--signup):not(.sched-cl__pill--empty) { cursor: pointer; }
.sched-cl__pill--free {
    background: color-mix(in srgb, var(--color-success, #16a34a) 15%, transparent);
    color: var(--color-success, #16a34a);
    cursor: pointer; border: none;
}
.sched-cl__pill--free:hover { filter: brightness(1.1); }
.sched-cl__pill--signup {
    background: color-mix(in srgb, var(--color-success, #16a34a) 10%, transparent);
    color: var(--color-success, #16a34a);
    cursor: pointer;
}
.sched-cl__right {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end; justify-content: center;
    gap: 4px; flex-shrink: 0;
}
.sched-cl__badge {
    font-size: .7rem;
    border: 1px solid var(--border);
    border-radius: 20px; padding: 1px 7px;
    color: var(--text-muted);
    white-space: nowrap;
}
.sched-cl__badge--free {
    background: color-mix(in srgb, var(--color-success, #16a34a) 15%, transparent);
    color: var(--color-success, #16a34a);
    border-color: transparent;
}
.sched-cl__badge--cancelled {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    font-weight: 700;
    letter-spacing: .03em;
}
[data-theme="dark"] .sched-cl__badge--cancelled {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 50%, #dc2626 100%);
    color: #fff;
    border-color: rgba(254, 202, 202, 0.35);
    box-shadow: 0 1px 6px rgba(127, 29, 29, 0.45);
}
.sched-cl__share {
    padding: 0.2rem;
    opacity: 0.75;
}
.sched-cl__share:hover { opacity: 1; }

/* Nimekiri (compact-list): readable type in dark mode (avoid faint --text-muted on cards) */
[data-theme="dark"] .sched-cl__day-header {
    color: var(--text-secondary);
}
[data-theme="dark"] .sched-cl__time {
    color: var(--text-secondary);
}
[data-theme="dark"] .sched-cl__level {
    color: var(--text);
}
[data-theme="dark"] .sched-cl__sub {
    color: var(--text-secondary);
}
[data-theme="dark"] .sched-cl__pill {
    color: var(--text);
}
[data-theme="dark"] .sched-cl__pill--empty {
    opacity: 0.88;
    color: var(--text-secondary);
}
[data-theme="dark"] .sched-cl__pill--absent {
    opacity: 0.72;
    color: var(--text-secondary);
}
[data-theme="dark"] .sched-cl__pill--free,
[data-theme="dark"] .sched-cl__pill--signup {
    color: var(--free-spot-text);
}
[data-theme="dark"] .sched-cl__badge {
    color: var(--text-secondary);
    border-color: color-mix(in srgb, var(--border) 80%, var(--text-secondary) 20%);
}
[data-theme="dark"] .sched-cl .share-link-btn {
    color: var(--text-secondary);
    opacity: 1;
}
/* Keep cancelled rows visually distinct (rules above share equal specificity with non-cancelled) */
[data-theme="dark"] .sched-cl__row--cancelled .sched-cl__time,
[data-theme="dark"] .sched-cl__row--cancelled .sched-cl__level,
[data-theme="dark"] .sched-cl__row--cancelled .sched-cl__sub {
    color: var(--text-secondary);
}
[data-theme="dark"] .sched-cl__row--cancelled .sched-cl__pill {
    color: var(--text-secondary);
}

.sched-day-section { margin-bottom: 1.5rem; }
.sched-day-section__header {
    font-size: .8rem; font-weight: 600; color: var(--text-muted);
    margin-bottom: .5rem; padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.week-view--demo-themes .sched-day-section:last-child { margin-bottom: 0; }

/* Tunniplaan: õpilase oma tund (roheline) ja treeneri oma tund (sinine) */
.class-card.schedule-slot--my-class,
.sched-card.schedule-slot--my-class {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.55), var(--shadow-card, 0 1px 3px rgba(0, 0, 0, 0.08));
}
.class-card.schedule-slot--my-training,
.sched-card.schedule-slot--my-training {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.65), var(--shadow-card, 0 1px 3px rgba(0, 0, 0, 0.08));
}
.week-view-slot.schedule-slot--my-class {
    box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.55);
}
.week-view-slot.schedule-slot--my-training {
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.65);
}
.compact-day-row.schedule-slot--my-class td:first-child {
    box-shadow: inset 3px 0 0 0 rgba(34, 197, 94, 0.85);
}
.compact-day-row.schedule-slot--my-training td:first-child {
    box-shadow: inset 3px 0 0 0 rgba(59, 130, 246, 0.9);
}
.sched-cl__row.schedule-slot--my-class .sched-cl__accent {
    background: rgba(34, 197, 94, 0.95) !important;
}
.sched-cl__row.schedule-slot--my-training .sched-cl__accent {
    background: rgba(59, 130, 246, 0.95) !important;
}
.rider-privacy-note {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--text-muted);
    border-radius: 6px;
    background: color-mix(in srgb, var(--bg-card) 92%, var(--text-muted) 8%);
}
.week-view-slot__masked-roster {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.sched-cl__pill--privacy {
    font-size: 0.78rem;
    color: var(--text-muted);
    border-style: dashed;
    cursor: default;
}
.sched-card__rider--privacy .sched-card__rname {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ========== MOBILE-FIRST RESPONSIVE DESIGN ========== */
/* Strategic breakpoints:
   - Mobile: < 480px (phones)
   - Tablet: 480px - 768px (large phones, tablets)
   - Desktop: 769px+ (desktops)
*/

/* ========== MOBILE HEADER (< 480px) ========== */
@media (max-width: 479px) {
    .header__inner {
        height: auto;
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header__brand {
        flex-shrink: 0;
        margin-right: auto;
    }

    .header__brand h1 {
        font-size: 0.95rem;
        letter-spacing: -0.02em;
    }

    .header__logo {
        height: 2rem;
    }

    .header__nav {
        display: none;
    }

    /* Hamburger menu button (shown on mobile) */
    .nav-hamburger {
        display: flex !important;
        flex-direction: column;
        gap: 0.35rem;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: 0.35rem;
        padding: 0.4rem;
        cursor: pointer;
        color: var(--header-text);
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .nav-hamburger span {
        width: 1.2rem;
        height: 0.15rem;
        background: currentColor;
        border-radius: 0.1rem;
        transition: all 0.3s ease;
    }

    .nav-hamburger:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .theme-toggle {
        padding: 0.4rem;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .theme-toggle svg {
        width: 1.2rem;
        height: 1.2rem;
    }
}

/* Navigation drawer close button */
.nav-drawer__close {
    display: none;
    position: sticky;
    top: 0;
    align-self: flex-start;
    background: none;
    border: none;
    padding: 0.5rem;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    color: var(--text);
    cursor: pointer;
    margin: 0.25rem;
    border-radius: 0.5rem;
    transition: background 0.15s;
}

.nav-drawer__close:hover {
    background: var(--bg-card-hover);
}

.nav-drawer__close svg {
    width: 1.2rem;
    height: 1.2rem;
}

/* Show close button only when drawer is open */
.nav-drawer.open .nav-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Add safe area support for notched devices */
@supports (padding: max(0px)) {
    .nav-drawer {
        padding-top: max(0.5rem, env(safe-area-inset-top));
        padding-left: max(0.5rem, env(safe-area-inset-left));
        padding-right: max(0.5rem, env(safe-area-inset-right));
    }
}

/* ========== MOBILE NAVIGATION DRAWER ========== */
.nav-drawer {
    display: none;
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    z-index: 95;
    flex-direction: column;
    border-top: 1px solid var(--border);
    overflow-y: auto;
    padding: 0.5rem;
    gap: 0.25rem;
}

.nav-drawer.open {
    display: flex;
}

.nav-drawer .nav-link {
    padding: 0.65rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    color: var(--text);
    background: transparent;
}

.nav-drawer .nav-link:hover {
    background: var(--bg-card-hover);
}

.nav-drawer .nav-link.active {
    background: var(--accent-light);
    color: var(--accent);
}

/* ========== EXTRA SMALL PHONES (<360px) ========== */
@media (max-width: 359px) {
    html {
        font-size: 13px;
    }

    body {
        font-size: 13px;
    }

    .main {
        padding: 0.5rem;
    }

    .header {
        padding: 0.5rem;
    }

    .nav-hamburger,
    .theme-toggle {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        padding: 0.3rem;
    }

    button,
    .btn {
        min-height: 40px;
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }

    .week-view {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    /* Ensure minimum tap targets still work */
    .nav-drawer .nav-link {
        min-height: 40px;
        padding: 0.5rem 0.75rem;
    }
}

/* ========== MOBILE MAIN LAYOUT ========== */
@media (max-width: 479px) {
    .main {
        padding: 0.75rem;
        max-width: 100%;
    }

    .week-nav {
        flex-direction: column;
        gap: 0.3rem;
        margin-bottom: 0.75rem;
    }

    /* Prev-week arrow / label / next-week arrow stay together on one row,
       arrows on the left and right of the label — everything else in
       .week-nav (Täna, view toggle, print) still stacks below as its own
       row(s). */
    .week-nav__row {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        width: 100%;
    }

    .week-nav__row .week-nav__label-wrap,
    .week-nav__row .week-nav__label {
        flex: 1;
        min-width: 0;
    }

    .week-nav__row > button {
        flex: 0 0 auto;
        min-height: 44px;
        padding: 0.5rem 0.75rem;
    }

    .week-nav > button {
        min-height: 44px;
        padding: 0.5rem 0.75rem;
    }

    .week-nav__label,
    button.week-nav__label--picker {
        min-width: auto;
        font-size: 0.95rem;
        width: 100%;
    }

    .view-toggle {
        width: 100%;
        order: 1;
        margin-left: 0 !important;
    }

    .view-toggle__btn {
        flex: 1;
        min-height: 44px;
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    .design-demo {
        flex-wrap: wrap;
        gap: 0.3rem;
        margin-bottom: 0.5rem;
    }

    .design-demo__buttons {
        flex-direction: row;
        gap: 0.2rem;
        width: 100%;
    }

    .design-demo__btn {
        flex: 1;
        min-height: 36px;
        font-size: 0.75rem;
        padding: 0.35rem 0.4rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Extra small phones (<360px) - more compact buttons */
@media (max-width: 359px) {
    .design-demo {
        gap: 0.2rem;
        margin-bottom: 0.3rem;
    }

    .design-demo__label {
        width: 100%;
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    .design-demo__buttons {
        width: 100%;
    }

    .design-demo__btn {
        min-height: 32px;
        font-size: 0.7rem;
        padding: 0.25rem 0.3rem;
    }
}

/* ========== MOBILE SCHEDULE ========== */
@media (max-width: 479px) {
    .schedule-container {
        gap: 0.5rem;
    }

    .day-tabs {
        gap: 0.25rem;
        margin-bottom: 0.75rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .day-tab {
        min-height: 44px;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    .class-card {
        margin: 0;
        border-radius: 0.5rem;
    }

    .class-card__header-top {
        flex-wrap: wrap;
        gap: 0.3rem;
        padding: 0.5rem;
    }

    .class-card__level {
        font-size: 0.8rem;
        padding: 0.25rem 0.45rem;
        line-height: 1.2;
    }

    .class-card__times {
        flex-direction: row;
        gap: 0.5rem;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .class-card__time-tall {
        font-size: 0.9rem;
    }

    .class-card__trainer {
        font-size: 0.85rem;
        padding: 0.35rem 0.65rem;
        font-weight: 500;
    }

    .class-card__riders {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .rider-row {
        padding: 0.4rem 0.5rem;
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .rider-row__name {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .rider-row__horse {
        font-size: 0.75rem;
        min-width: auto;
        padding: 0.15rem 0.4rem;
        line-height: 1.3;
    }

    .free-spot {
        padding: 0.4rem;
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .free-spot__label {
        font-size: 0.8rem;
    }

    .event-card {
        margin: 0;
    }

    .event-card__header {
        padding: 0.75rem;
    }

    .event-card__title {
        font-size: 0.95rem;
    }

    .signup-btn,
    .event-btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* ========== MOBILE ADMIN ========== */
@media (max-width: 479px) {
    .admin-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .admin-sidebar-toggle {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        min-height: 44px;
        margin-bottom: 0.5rem;
        padding: 0.6rem 0.9rem;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 0.5rem;
        color: var(--text);
        font-family: inherit;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
    }

    .admin-sidebar-toggle__icon {
        width: 1.2rem;
        height: 1.2rem;
        flex-shrink: 0;
    }

    .admin-sidebar-toggle[aria-expanded="true"] {
        border-color: var(--accent);
        color: var(--accent);
    }

    .admin-sidebar {
        position: static;
        display: none;
        flex-direction: column;
        gap: 0;
        padding: 0;
        border: none;
        height: auto;
        border-radius: 0;
        background: transparent;
        margin-bottom: 0.75rem;
    }

    .admin-sidebar.mobile-open {
        display: flex;
    }

    .admin-sidebar .nav-link {
        padding: 0.6rem 1rem;
        border-radius: 0.5rem;
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .admin-sidebar .nav-link .nav-link-icon {
        width: 1.3rem;
        height: 1.3rem;
        margin-right: 0.5rem;
    }

    .admin-panel {
        border-radius: 0.5rem;
        padding: 0.75rem;
    }

    .admin-panel__title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .admin-table {
        font-size: 0.8rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.4rem;
    }

    .admin-actions {
        flex-direction: column;
        gap: 0.2rem;
    }

    .admin-actions .btn {
        width: 100%;
        min-height: 40px;
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    /* Mobile bottom nav tabs for admin */
    .admin-nav-mobile {
        display: flex;
        gap: 0;
        margin: -0.75rem -0.75rem 0.75rem;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        padding-bottom: 0;
    }

    .admin-nav-mobile__btn {
        flex: 1;
        padding: 0.75rem 0.5rem;
        border: none;
        background: transparent;
        color: var(--text-secondary);
        font-size: 0.8rem;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        min-width: 0;
        white-space: nowrap;
        font-weight: 500;
    }

    .admin-nav-mobile__btn.active {
        color: var(--accent);
        border-bottom-color: var(--accent);
    }
}

/* ========== MOBILE FORMS ========== */
@media (max-width: 479px) {
    .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-group {
        width: 100%;
    }

    .form-label {
        font-size: 0.9rem;
        font-weight: 500;
    }

    .form-input,
    .form-textarea,
    select,
    textarea,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    input[type="number"] {
        width: 100%;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.6rem 0.8rem;
        min-height: 44px;
        border-radius: 0.5rem;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
        cursor: pointer;
    }

    .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 0.6rem 1rem;
        min-height: 44px;
        border-radius: 0.5rem;
        width: 100%;
    }

    .form-row .btn,
    .form-actions .btn {
        width: 100%;
    }
}

/* ========== MOBILE STATS ========== */
/* Overrides the generic "button { width: 100% }" mobile rule above for the
   stats tab/preset/view-toggle rows: these are wrapping chip groups (their
   containers already set flex-wrap:wrap inline), so buttons should size to
   content instead of stacking one-per-row. */
@media (max-width: 479px) {
    .stats-tabs .stats-tab,
    #stats-presets-row .stats-preset-btn,
    .lapsed-view-toggle .lapsed-view-btn {
        width: auto;
        flex-shrink: 0;
    }
}

/* ========== MOBILE MARKETPLACE ========== */
@media (max-width: 479px) {
    .marketplace-ads-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .marketplace-ad-card {
        margin-bottom: 0;
    }

    .marketplace-filters {
        flex-direction: column;
        gap: 0.5rem;
    }

    .marketplace-filter-chip {
        width: 100%;
        padding: 0.5rem 0.75rem;
        min-height: 44px;
        font-size: 0.85rem;
    }

    .marketplace-ad-image {
        width: 100%;
        aspect-ratio: 16/9;
        object-fit: cover;
    }

    .marketplace-ad-title {
        font-size: 0.95rem;
    }

    .marketplace-ad-price {
        font-size: 1.1rem;
        font-weight: 700;
    }

    .marketplace-ad-description {
        font-size: 0.85rem;
        line-height: 1.4;
    }
}

/* ========== MOBILE BUTTONS ========== */
.btn,
button,
a.btn,
.nav-link,
.day-tab,
input[type="button"],
input[type="submit"],
.btn-icon {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon {
    padding: 0.4rem;
    width: 44px;
    height: 44px;
}

/* ========== MOBILE TABLES ========== */
@media (max-width: 479px) {
    .admin-table {
        font-size: 0.75rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.4rem 0.5rem;
        word-break: break-word;
    }

    /* Hide less important columns on mobile */
    .admin-table .hidden-mobile {
        display: none;
    }

    .riders-table__th-actions {
        min-width: 8rem;
    }

    .admin-logs__table {
        min-width: 100%;
        font-size: 0.75rem;
    }

    .admin-logs__table th,
    .admin-logs__table td {
        padding: 0.3rem;
    }
}

/* ========== MOBILE FORM INPUTS (< 480px) — prevent iOS auto-zoom ========== */
/* Fixed px, not rem: the same fix already exists for the 480-768px tablet
   range below; phones need it too, and rem would be unsafe here since the
   root font-size is rescaled smaller at this width elsewhere in the CSS. */
@media (max-width: 479px) {
    .form-input,
    .form-select,
    .form-textarea,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="search"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px;
        min-height: 44px;
    }
}

/* ========== TABLET OPTIMIZATION (480px - 768px) ========== */
@media (min-width: 480px) and (max-width: 768px) {
    .header__brand h1 {
        font-size: 1.05rem;
    }

    .header__nav {
        gap: 0.2rem;
    }

    .nav-link {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
        min-height: 40px;
    }

    .main {
        padding: 1rem;
    }

    .week-nav {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .schedule-container {
        gap: 0.75rem;
    }

    .day-tabs {
        gap: 0.3rem;
        flex-wrap: wrap;
    }

    .admin-sidebar {
        flex-direction: column;
        position: static;
        height: auto;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .marketplace-ads-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-input,
    select,
    textarea {
        font-size: 16px;
        min-height: 44px;
    }

    .btn {
        min-height: 40px;
    }
}

/* ========== PRINT OPTIMIZATION ========== */
@media print {
    .header,
    .week-nav,
    .design-demo,
    .no-print,
    .nav-drawer,
    .nav-hamburger {
        display: none;
    }

    .main {
        padding: 0;
        max-width: 100%;
    }

    .schedule-container {
        gap: 0;
    }
}

/* ========== ACCESSIBILITY: REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== DARK MODE OPTIMIZATIONS ========== */
[data-theme="dark"] .nav-hamburger {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .nav-hamburger:hover {
    background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .nav-drawer {
    background: #1e293b;
    border-top-color: #334155;
}

/* ========== EVENT FORM CARD ========== */
.ev-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: .75rem;
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.ev-form-card__header {
    display: flex; align-items: center; gap: .6rem;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card-hover);
}
.ev-form-card__header-icon {
    display: flex; align-items: center; justify-content: center;
    width: 1.75rem; height: 1.75rem;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    border-radius: .4rem;
    color: var(--accent);
    flex-shrink: 0;
}
.ev-form-card__header-icon svg { width: 1rem; height: 1rem; }
.ev-form-card__title {
    font-size: .95rem; font-weight: 700; color: var(--text);
}
.ev-form-card__body { padding: 1.25rem; }
.ev-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .65rem .75rem;
}
.ev-form-grid .form-group { margin-bottom: 0; }
.ev-form-grid--full { grid-column: 1 / -1; }
.form-hint {
    font-size: .75rem; color: var(--text-muted);
    margin-top: .25rem; line-height: 1.35;
}
.ev-active-toggle {
    display: flex; align-items: center; gap: .5rem;
    font-size: .9rem; font-weight: 500; color: var(--text);
    cursor: pointer; user-select: none;
    padding: .5rem .65rem;
    border: 1px solid var(--border);
    border-radius: .5rem;
    background: var(--bg-card-hover);
    transition: border-color .15s;
    white-space: nowrap;
    height: 2.5rem;
}
.ev-active-toggle:hover { border-color: var(--accent); }
.ev-active-toggle input[type=checkbox] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.05rem;
    height: 1.05rem;
    min-width: 1.05rem;
    margin: 0;
    cursor: pointer;
    border: 2px solid var(--accent);
    border-radius: 3px;
    background: transparent;
    position: relative;
    flex-shrink: 0;
    transition: background .15s;
}
.ev-active-toggle input[type=checkbox]:checked {
    background: var(--accent);
}
.ev-active-toggle input[type=checkbox]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 45%;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: translate(-50%, -50%) rotate(45deg);
}
.ev-form-card__footer {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card-hover);
}

/* ========== SAFE AREA INSETS (iPhone X+, notches) ========== */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(1.25rem, env(safe-area-inset-left));
        padding-right: max(1.25rem, env(safe-area-inset-right));
    }

    @media (max-width: 479px) {
        .header {
            padding-left: max(0.5rem, env(safe-area-inset-left));
            padding-right: max(0.5rem, env(safe-area-inset-right));
        }

        .main {
            padding-left: max(0.75rem, env(safe-area-inset-left));
            padding-right: max(0.75rem, env(safe-area-inset-right));
        }
    }
}

/* ========== IMPERSONATION BANNER ========== */
.impersonation-banner {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem 1.25rem;
    background: #f59e0b;
    color: #1c1400;
    font-size: .875rem;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.impersonation-banner__text {
    display: flex;
    align-items: center;
    gap: .45rem;
}
.impersonation-banner__icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}
.impersonation-banner__exit-form {
    margin: 0;
}
.impersonation-banner__exit-btn {
    background: rgba(0,0,0,.15);
    color: inherit;
    border: 1px solid rgba(0,0,0,.25);
    border-radius: .375rem;
    padding: .3rem .85rem;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background .15s;
}
.impersonation-banner__exit-btn:hover,
.impersonation-banner__exit-btn:focus-visible {
    background: rgba(0,0,0,.28);
    outline: 2px solid rgba(0,0,0,.4);
    outline-offset: 2px;
}
