:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-alt: #fafbfc;
    --primary: #1f6feb;
    --primary-fg: #ffffff;
    --danger: #d23939;
    --text: #1c1f24;
    --muted: #6b7280;
    --border: #e3e6eb;
    --hover-bg: #f0f7ff;
    --notice-bg: #e7f5ff;
    --notice-border: #b6e0fe;
    --notice-fg: #114b85;
    --error-bg: #fff0f0;
    --error-border: #f5c6c6;
    --error-fg: #8b1f1f;
    --internal: #fff8e1;
    --booked-row: #fafcff;
    --blocked-row: #fdf6f6;
    --weekend-fg: #c08400;
    --cal-pending-bg: #fff0a8;
    --cal-pending-accent: #e6a500;
    --cal-progress-bg: #cee0fb;
    --cal-progress-accent: #1976d2;
    --cal-ready-bg: #bfeaf2;
    --cal-ready-accent: #0097a7;
    --cal-confirmed-bg: #c8e6c9;
    --cal-confirmed-accent: #2e7d32;
    --cal-done-bg: #dee1e6;
    --cal-done-accent: #6b7280;
    --selected-bg: #e7f0ff;
    --selected-bg-hover: #dbe8ff;
    --range-bg: #c7dcff;
    --range-banner-bg: #e7f0ff;
    --range-banner-border: #b9d2ff;
    --chip-bg: #f0f3f7;
    --tag-free-bg: #e6f7ed;
    --tag-free-fg: #0a7a3d;
    --tag-booked-bg: #e7f0ff;
    --tag-booked-fg: #1f6feb;
    --tag-blocked-bg: #fde0e0;
    --tag-blocked-fg: #d23939;
    --status-confirmed: #1f6feb;
    --status-progress: #b58900;
    --status-ready: #2e8b57;
    --radius: 10px;
    --shadow: 0 2px 6px rgba(0,0,0,0.06);
}

[data-theme="dark"] {
    --bg: #0f1419;
    --surface: #1a1f26;
    --surface-alt: #14181e;
    --primary: #4d8ff5;
    --primary-fg: #0f1419;
    --danger: #ef6b6b;
    --text: #e6e8eb;
    --muted: #8b939e;
    --border: #2a2f37;
    --hover-bg: #1f2630;
    --notice-bg: #142537;
    --notice-border: #2a4467;
    --notice-fg: #a3c5ef;
    --error-bg: #2c1717;
    --error-border: #5a2828;
    --error-fg: #f0a0a0;
    --internal: #3a3520;
    --booked-row: #1a2030;
    --blocked-row: #2a1c1c;
    --weekend-fg: #e0b463;
    --cal-pending-bg: #3d3415;
    --cal-pending-accent: #e6b800;
    --cal-progress-bg: #1e3a6e;
    --cal-progress-accent: #5fa0f5;
    --cal-ready-bg: #0f4e5d;
    --cal-ready-accent: #4ec4d8;
    --cal-confirmed-bg: #1a4d2e;
    --cal-confirmed-accent: #6cc880;
    --cal-done-bg: #363b46;
    --cal-done-accent: #8b939e;
    --selected-bg: #1f3358;
    --selected-bg-hover: #294070;
    --range-bg: #2a4583;
    --range-banner-bg: #1c2c4d;
    --range-banner-border: #2e466b;
    --chip-bg: #252a32;
    --tag-free-bg: #163025;
    --tag-free-fg: #6ec99c;
    --tag-booked-bg: #1a2740;
    --tag-booked-fg: #6ea8f5;
    --tag-blocked-bg: #2c1717;
    --tag-blocked-fg: #f0a0a0;
    --status-confirmed: #4d8ff5;
    --status-progress: #e0b463;
    --status-ready: #6ec99c;
    --shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Smooth transition when toggling */
html, body, .topbar, .card, .staff-table th, .filter-bar, .day-panel,
.generate-panel, .range-banner, .calendar-grid, .calendar-grid td a,
.calendar-grid th, .topbar-user, .quick-toggle, input, select, textarea, .btn {
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 720px; margin: 0 auto; padding: 16px; }
body.staff .container { max-width: 1200px; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nav a { padding: 6px 4px; }
.lang-switcher a { font-size: 0.8rem; padding: 2px 4px; border: 1px solid transparent; }
.lang-switcher a.active { border-color: var(--primary); border-radius: 4px; }
.logout-form { display: inline; }
.link-btn { background: none; border: none; cursor: pointer; color: var(--primary); font: inherit; padding: 0; }

.topbar-user {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: var(--chip-bg);
    border-radius: 999px;
    font-size: 0.9rem;
    color: var(--text);
}
.topbar-user-name { font-weight: 600; }
.topbar-user-role {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 3px;
    color: #fff;
}
.topbar-user-role.role-admin { background: #b04a4a; }
.topbar-user-role.role-staff { background: var(--primary); }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 10px;
    color: var(--text);
    border-radius: 6px;
    line-height: 1;
    min-width: 36px;
    min-height: 32px;
}
.theme-toggle:hover { background: var(--chip-bg); }
.theme-toggle .theme-icon { display: none; }
[data-theme="light"] .theme-toggle .theme-icon-light { display: inline-block; }
[data-theme="dark"] .theme-toggle .theme-icon-dark { display: inline-block; }
/* Fallback when no data-theme attribute is set yet (very early paint) */
html:not([data-theme]) .theme-toggle .theme-icon-light { display: inline-block; }

@media (max-width: 599px) {
    .topbar-user { padding: 2px 8px; font-size: 0.8rem; }
    .topbar-user-role { display: none; }
}

.btn {
    display: inline-block; padding: 10px 16px; border: 1px solid var(--border);
    border-radius: var(--radius); background: var(--surface); cursor: pointer;
    font: inherit; min-height: 44px; min-width: 44px;
}
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn.danger { background: var(--danger); color: white; border-color: var(--danger); }

.hero { padding: 24px 0; }
.hero h1 { font-size: 1.6rem; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0 0 16px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero illustration on the landing page — single image replaces the
   old 3-card feature grid. Centered, capped so it never blows up huge
   on widescreens. Inherits `color` for SVG line work, so it follows
   the light/dark theme automatically. */
.hero-art {
    margin: 24px auto 0;
    max-width: 560px;
    text-align: center;
    color: var(--text);
}
.hero-art svg,
.hero-art img {
    width: 100%;
    height: auto;
    display: block;
}

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card-list { list-style: none; padding: 0; margin: 0; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.card-actions .inline-form { margin: 0; }

.form-section { max-width: 480px; margin: 0 auto; }

/* Visual hint above the OTP phone input — replaces the old "+36..." placeholder.
   The SVG inherits `color` from the surrounding text so it adapts to the theme. */
.phone-hint {
    margin: 16px 0 20px;
    text-align: center;
    color: var(--muted);
}
.phone-hint svg {
    width: 96px;
    height: 76px;
    color: var(--accent, currentColor);
}
.phone-hint figcaption {
    font-size: 0.875rem;
    margin-top: 4px;
}
form.stack, form > label { display: block; }
form label { display: block; margin: 12px 0; }
form input, form select, form textarea {
    width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font: inherit; background: var(--surface); color: var(--text);
}
form input::placeholder, form textarea::placeholder { color: var(--muted); }
/* Date/time pickers tend to keep their native UA colors in dark mode; this nudges them. */
form input[type="date"], form input[type="time"], form input[type="number"] { color-scheme: light dark; }
[data-theme="dark"] form input[type="date"],
[data-theme="dark"] form input[type="time"],
[data-theme="dark"] form input[type="number"] { color-scheme: dark; }
form .checkbox { display: flex; align-items: center; gap: 8px; }
form .checkbox input { width: auto; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
form.inline label { margin: 0; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.error { color: var(--error-fg); padding: 8px 12px; background: var(--error-bg); border: 1px solid var(--error-border); border-radius: var(--radius); }
.notice { color: var(--notice-fg); padding: 8px 12px; background: var(--notice-bg); border: 1px solid var(--notice-border); border-radius: var(--radius); }
.row-actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.row-actions .btn { padding: 6px 10px; min-height: 32px; min-width: 0; font-size: 0.9rem; }
.inline-form { display: inline; margin: 0; }

.slot-list { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.slot {
    display: flex; flex-direction: column; align-items: center; padding: 12px; gap: 4px;
    border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
    background: var(--surface);
}
.slot input { display: none; }
.slot.disabled { opacity: 0.4; cursor: not-allowed; }
.slot input:checked + span { color: var(--primary); font-weight: 600; }
.slot .capacity { color: var(--muted); font-size: 0.85rem; }

.detail { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }

.notes { list-style: none; padding: 0; }
.notes li { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0; }
.notes li.internal { background: var(--internal); }
.notes .tag { display: inline-block; font-size: 0.75rem; background: #b58900; color: white; padding: 2px 6px; border-radius: 4px; margin-left: 8px; }

.staff-table { width: 100%; border-collapse: collapse; }
.staff-table th, .staff-table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.staff-table th { background: var(--surface); position: sticky; top: 60px; }

.muted { color: var(--muted); }

.day-nav { display: flex; align-items: center; gap: 8px; margin: 16px 0 12px; flex-wrap: wrap; }
.day-nav .day-label { color: var(--muted); flex: 1; text-align: center; }

.slot-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.slot-grid .slot-form { margin: 0; }
.slot-grid .slot-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; padding: 16px 8px; gap: 2px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer;
}
.slot-grid .slot-btn:hover { border-color: var(--primary); background: var(--hover-bg); }
.slot-grid .slot-btn .time { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.slot-grid .slot-btn .time-end { font-size: 0.8rem; color: var(--muted); }

.slot-extras { margin-top: 16px; padding: 8px; }
.slot-extras summary { cursor: pointer; color: var(--primary); }

.quick-toggle {
    display: flex; align-items: center; gap: 8px;
    margin: 8px 0 12px;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.quick-toggle a { font-weight: 600; text-decoration: none; }
.quick-toggle .quick-on { color: #c08400; }
.quick-toggle .quick-off { color: var(--muted); }
.quick-marker { font-size: 1.1rem; margin-right: 4px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.tag-free { background: var(--tag-free-bg); color: var(--tag-free-fg); }
.tag-booked { background: var(--tag-booked-bg); color: var(--tag-booked-fg); }
.tag-blocked { background: var(--tag-blocked-bg); color: var(--tag-blocked-fg); }

.staff-table tr.booked { background: var(--booked-row); }
.staff-table tr.blocked { background: var(--blocked-row); }

/* Admin SMS template editor — one card per template code, three rows inside
   for HU/SK/EN. The lang-badge colors mimic the language picker chips. */
.sms-templates-page { max-width: 900px; margin: 0 auto; }
.template-group {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 18px; margin: 16px 0;
}
.template-group header h2 { margin: 0 0 4px; }
.template-group header h2 code { font-size: 0.95rem; }
.template-group .var-chip {
    display: inline-block;
    background: rgba(0,0,0,0.06); padding: 0 6px; border-radius: 4px;
    margin: 0 4px 0 0; font-size: 0.85em;
}
[data-theme="dark"] .template-group .var-chip { background: rgba(255,255,255,0.08); }
.template-form { margin: 10px 0; }
.template-form label { display: flex; gap: 12px; align-items: flex-start; margin: 0; }
.template-form textarea {
    flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
}
.template-form .lang-badge {
    display: inline-block; min-width: 36px; text-align: center;
    background: var(--accent, currentColor); color: #fff;
    font-weight: 700; font-size: 0.85rem;
    padding: 4px 8px; border-radius: 4px;
    margin-top: 12px;
}
.template-form .form-actions {
    display: flex; gap: 10px; align-items: center; justify-content: flex-end;
    margin-top: 6px;
}

/* Callback-request indicators — customer ticked "please call me back about
   details" on their booking. The dashboard row + the calendar cell get a
   subtle marker; the booking detail page gets a prominent action banner. */
.row-callback { background: rgba(245, 158, 11, 0.05); }
.callback-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.9em;
    vertical-align: middle;
}
.cal-badge-callback {
    background: rgba(245, 158, 11, 0.85);
    color: #fff;
    border-radius: 8px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 4px;
    display: inline-block;
}
.callback-banner {
    display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
    justify-content: space-between;
    background: rgba(245, 158, 11, 0.15);
    border: 2px solid #f59e0b;
    border-radius: var(--radius);
    padding: 14px 18px; margin: 12px 0 20px;
}
.callback-banner strong { font-size: 1.05rem; }
.callback-banner p { margin: 4px 0 0; color: var(--muted); }
.callback-banner form { margin: 0; }
[data-theme="dark"] .callback-banner { background: rgba(245, 158, 11, 0.18); }

.callback-checkbox {
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid #f59e0b;
    padding: 8px 12px;
    border-radius: 4px;
}

/* Filter bar — flex-based so it auto-fits varying numbers of fields and
   buttons across pages (Dashboard, Customers, AuditLog, SMS). Each field
   grows to fill space but never narrower than ~160 px; if the buttons
   don't fit on the field row they wrap to a new line on the right. */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}
.filter-bar > label {
    margin: 0;
    flex: 1 1 160px;
    min-width: 0;     /* allow shrink below content size (long select options) */
}
.filter-bar .filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;   /* push the action buttons to the right edge */
}
.result-count { margin: 8px 0; font-size: 0.9rem; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; flex-wrap: wrap; }

.view-tabs {
    display: flex; gap: 4px; margin: 16px 0;
    border-bottom: 1px solid var(--border);
}
.view-tab {
    padding: 10px 16px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    font-weight: 600;
}
.view-tab:hover { color: var(--text); text-decoration: none; }
.view-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Staff dashboard calendar variant — cell color reflects the day's dominant status.
   Each status cell has a tinted background PLUS a 4px solid colored stripe on the left,
   so the status is visible at a glance even on small / pale screens. */
.calendar-grid td.cal-status-pending a,
.calendar-grid td.cal-status-progress a,
.calendar-grid td.cal-status-ready a,
.calendar-grid td.cal-status-confirmed a,
.calendar-grid td.cal-status-done a {
    border-left: 4px solid transparent;
    padding-left: 5px;   /* keep total horizontal padding similar to other cells */
}
.calendar-grid td.cal-status-pending a   { background: var(--cal-pending-bg);   border-left-color: var(--cal-pending-accent); }
.calendar-grid td.cal-status-progress a  { background: var(--cal-progress-bg);  border-left-color: var(--cal-progress-accent); }
.calendar-grid td.cal-status-ready a     { background: var(--cal-ready-bg);     border-left-color: var(--cal-ready-accent); }
.calendar-grid td.cal-status-confirmed a { background: var(--cal-confirmed-bg); border-left-color: var(--cal-confirmed-accent); }
.calendar-grid td.cal-status-done a      { background: var(--cal-done-bg);      border-left-color: var(--cal-done-accent); }
.calendar-grid td.cal-status-done .cal-num { color: var(--muted); }

.cal-count-label { color: var(--muted); font-size: 0.75rem; margin-left: 2px; }
.cal-count-empty { color: #c8ccd4; font-size: 1rem; }
.cal-extra {
    margin-left: 4px;
    font-size: 0.75rem;
    color: var(--text);
    background: var(--chip-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-weight: 600;
}

.cal-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
}
.cal-badge-pending { background: #c08400; }
.calendar-grid td { position: relative; }

/* Legend uses the bold accent colors (not the cell tints) so they pop. */
.legend-dot.legend-pending   { background: var(--cal-pending-accent); }
.legend-dot.legend-progress  { background: var(--cal-progress-accent); }
.legend-dot.legend-ready     { background: var(--cal-ready-accent); }
.legend-dot.legend-confirmed { background: var(--cal-confirmed-accent); }
.legend-dot.legend-done      { background: var(--cal-done-accent); }

/* Month-nav row (used by Admin/Slots and Staff/Dashboard calendar views).
   Selector covers both .slots-admin and .staff-dashboard parents so the arrows,
   the month label, and the "Today" button line up on a single row. */
.slots-admin .month-nav,
.staff-dashboard .month-nav {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: 24px 0 16px;
}
.slots-admin .month-nav h2,
.staff-dashboard .month-nav h2 {
    margin: 0; flex: 1; text-align: center;
    font-size: 1.4rem; font-weight: 600; text-transform: capitalize;
}
.slots-admin .month-nav .btn,
.staff-dashboard .month-nav .btn { padding: 8px 14px; min-width: 0; }

/* Staff manual page — booking lifecycle explainer. Single-column reading
   layout with a colored status grid and an SVG state diagram. */
.manual-page { max-width: 900px; margin: 0 auto; }
.manual-page .lead { font-size: 1.05rem; color: var(--muted); margin-bottom: 24px; }
.manual-page h2 { margin-top: 36px; }

.rule-callout {
    display: flex; gap: 16px; align-items: flex-start;
    background: var(--surface); border: 2px solid var(--accent, currentColor);
    border-radius: var(--radius); padding: 16px 20px; margin: 16px 0 24px;
}
.rule-callout-icon { color: var(--accent, currentColor); flex-shrink: 0; }
.rule-callout p { margin: 6px 0 0; color: var(--muted); }

.tip-callout {
    background: var(--surface); border-left: 4px solid var(--accent, currentColor);
    border-radius: var(--radius); padding: 12px 16px; margin: 32px 0 16px;
}
.tip-callout p { margin: 6px 0 0; color: var(--muted); }

.status-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    margin: 16px 0;
}
.status-card {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 6px solid currentColor;
    border-radius: var(--radius); padding: 12px 14px;
}
.status-card .status-badge {
    display: inline-block; font-size: 0.85rem; font-weight: 600;
    padding: 2px 10px; border-radius: 12px;
    color: #fff;
    /* Background is provided per anchor class below — we can't use
       `currentColor` here because `color: #fff` (set on this same element
       for the label) overrides it, leaving a white-on-white pill. */
}
.status-card p { margin: 8px 0 0; color: var(--text); font-size: 0.95rem; }

/* Color anchor classes — drive both the left border (via currentColor) and
   the badge background (explicit). Keep these in sync. */
.ms-pending   { color: #f59e0b; }
.ms-confirmed { color: #3b82f6; }
.ms-progress  { color: #8b5cf6; }
.ms-awaiting  { color: #f97316; }
.ms-ready     { color: #10b981; }
.ms-completed { color: #374151; }
.ms-cancelled { color: #6b7280; }
.ms-noshow    { color: #6b7280; }

.ms-pending   .status-badge { background: #f59e0b; }
.ms-confirmed .status-badge { background: #3b82f6; }
.ms-progress  .status-badge { background: #8b5cf6; }
.ms-awaiting  .status-badge { background: #f97316; }
.ms-ready     .status-badge { background: #10b981; }
.ms-completed .status-badge { background: #374151; }
.ms-cancelled .status-badge { background: #6b7280; }
.ms-noshow    .status-badge { background: #6b7280; }

.manual-diagram {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px;
    overflow-x: auto;
}
.manual-diagram svg {
    display: block; width: 100%; height: auto;
    min-width: 600px;   /* don't squish text into illegibility */
    color: var(--text);
}

/* Transition labels on the lifecycle diagram. `paint-order: stroke` puts a
   surface-colored halo BEHIND each glyph's fill, which keeps the text
   legible regardless of what color box / line happens to sit underneath.
   Without this, a 2px stroked group makes the text muddy on dark themes. */
.manual-diagram .diagram-labels text {
    fill: var(--text);
    stroke: var(--surface);
    stroke-width: 4;
    stroke-linejoin: round;
    paint-order: stroke fill;
    font-size: 13px;
    font-weight: 600;
}
.manual-diagram .diagram-labels text.small { font-size: 11px; font-weight: 500; }
.manual-diagram .diagram-labels text.muted { fill: var(--muted); }

.scenario-list {
    padding-left: 24px;
    line-height: 1.55;
}
.scenario-list li { margin: 12px 0; }
.scenario-list strong { display: block; margin-bottom: 4px; }
.scenario-list p { margin: 0; color: var(--muted); }

.sms-examples { list-style: none; padding: 0; }
.sms-examples li { margin: 16px 0; }
.sms-examples strong { display: block; margin-bottom: 4px; }
.sms-examples blockquote {
    background: var(--surface); border-left: 3px solid var(--accent, currentColor);
    border-radius: 4px;
    margin: 0; padding: 8px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem; color: var(--text);
}

/* Admin SMS gateway / wall — chronological feed of inbound + outbound.
   Color-coded rows: inbound = subtle blue tint, outbound = subtle neutral,
   unknown sender = warning yellow border, ambiguous (multi-active) = orange. */
.admin-sms .sms-feed { list-style: none; padding: 0; margin: 16px 0; }
.admin-sms .sms-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 10px 0;
}
.admin-sms .sms-row.sms-in  { border-left-color: #3b82f6; }
.admin-sms .sms-row.sms-out { border-left-color: #6b7280; }
.admin-sms .sms-row.sms-unknown { border-left-color: #f59e0b; }
.admin-sms .sms-row.sms-ambiguous { border-left-color: #f97316; }

.admin-sms .sms-head {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 0.9rem; color: var(--muted);
}
.admin-sms .sms-head .sms-dir { font-weight: 700; color: var(--text); }
.admin-sms .sms-head .sms-customer { color: var(--text); }
.admin-sms .sms-tag {
    font-size: 0.75rem; padding: 1px 8px; border-radius: 10px;
    background: rgba(245, 158, 11, 0.15); color: #b45309;
}
.admin-sms .sms-tag.warn { background: rgba(245, 158, 11, 0.18); color: #92400e; }
[data-theme="dark"] .admin-sms .sms-tag.warn { color: #fbbf24; }

.admin-sms .sms-body {
    margin: 8px 0;
    padding: 8px 12px;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}
[data-theme="dark"] .admin-sms .sms-body { background: rgba(255,255,255,0.04); }

.admin-sms .sms-links { margin-top: 8px; }
.admin-sms .sms-links ul { list-style: none; padding: 0; margin: 4px 0; }
.admin-sms .sms-links li { margin: 3px 0; }
.admin-sms .sms-links code { background: rgba(0,0,0,0.05); padding: 0 4px; border-radius: 3px; }
[data-theme="dark"] .admin-sms .sms-links code { background: rgba(255,255,255,0.06); }
.admin-sms .sms-ambig-note {
    background: rgba(249, 115, 22, 0.12);
    border-left: 3px solid #f97316;
    padding: 4px 10px; margin: 4px 0;
    font-size: 0.9rem;
}

.admin-sms .sms-reply { margin-top: 10px; }
.admin-sms .sms-reply summary {
    cursor: pointer; display: inline-block;
    list-style: none;
}
.admin-sms .sms-reply summary::-webkit-details-marker { display: none; }
.admin-sms .sms-reply form { margin-top: 10px; max-width: 540px; }

/* Dominant SVG chevron for navigation arrow buttons. Replaces the thin
   "←/→" Unicode glyph used in month-nav and day-nav rows. `currentColor`
   makes it follow the surrounding text color (and the theme). */
.nav-arrow {
    width: 22px; height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
    display: inline-block;
}
.slots-admin .btn.ghost { background: transparent; border-color: transparent; color: var(--primary); margin-left: 4px; }

.calendar-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.calendar-grid th {
    padding: 12px 8px;
    text-align: center;
    background: var(--surface-alt);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.calendar-grid th.weekend { color: var(--weekend-fg); }

.calendar-grid td {
    height: 96px;
    vertical-align: top;
    padding: 0;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.calendar-grid tr td:last-child { border-right: none; }
.calendar-grid tr:last-child td { border-bottom: none; }
.calendar-grid td.cal-empty { background: var(--surface-alt); }

.calendar-grid td a {
    display: block;
    height: 100%;
    padding: 8px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.12s ease;
}
.calendar-grid td a:hover { background: var(--hover-bg); }
.calendar-grid td.cal-none a { color: var(--muted); }
.calendar-grid td.cal-selected a { background: var(--selected-bg); }
.calendar-grid td.cal-selected a:hover { background: var(--selected-bg-hover); }
.calendar-grid td.cal-in-range a { background: var(--selected-bg); }
.calendar-grid td.cal-in-range a:hover { background: var(--selected-bg-hover); }
.calendar-grid td.cal-range-start a,
.calendar-grid td.cal-range-end a {
    background: var(--range-bg);
    box-shadow: inset 0 0 0 2px var(--primary);
}

.calendar-grid a { user-select: none; }

.range-banner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 10px 14px; margin: 0 0 12px;
    background: var(--range-banner-bg); border: 1px solid var(--range-banner-border); border-radius: var(--radius);
    color: var(--text);
}
.range-banner .range-actions { display: flex; gap: 8px; }
.small { font-size: 0.85rem; }

.cal-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.95rem;
}
.cal-today .cal-num {
    background: var(--primary);
    color: #fff;
}

.cal-count {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.2;
}
.cal-count strong { color: var(--text); font-weight: 600; }

/* Small status dot prefix on the count */
.cal-some .cal-count::before,
.cal-full .cal-count::before,
.cal-blocked .cal-count::before {
    content: "";
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.cal-some .cal-count::before { background: #2e8b57; }
.cal-full .cal-count::before { background: #c08400; }
.cal-blocked .cal-count::before { background: var(--danger); }

.calendar-legend {
    display: flex; gap: 18px; flex-wrap: wrap;
    color: var(--muted); font-size: 0.85rem;
    margin: 12px 0 24px;
}
.legend-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.legend-dot.cal-some { background: #2e8b57; }
.legend-dot.cal-full { background: #c08400; }
.legend-dot.cal-blocked { background: var(--danger); }
.legend-dot.cal-none { background: #d0d4dc; }

.day-panel {
    margin-top: 24px; padding: 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.day-panel h3 { margin: 0 0 12px; }
.day-panel .day-actions { margin-bottom: 16px; }

.generate-panel {
    margin-top: 24px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 16px;
}
.generate-panel summary {
    cursor: pointer; font-weight: 600;
    padding: 6px 0; color: var(--primary);
    list-style: none;
}
.generate-panel summary::before { content: "▸ "; }
.generate-panel[open] summary::before { content: "▾ "; }
.generate-panel .row { display: flex; gap: 12px; flex-wrap: wrap; }
.generate-panel .row label { flex: 1 1 140px; }
.dow-picker {
    border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px 12px;
}
.dow-picker legend { padding: 0 6px; color: var(--muted); font-size: 0.85rem; }
.dow-picker label {
    margin: 4px 12px 4px 0;
    display: inline-flex; align-items: center; gap: 4px;
}

@media (max-width: 599px) {
    .calendar-grid td { height: 72px; }
    .calendar-grid td a { padding: 4px 6px; }
    .cal-num { width: 26px; height: 26px; font-size: 0.85rem; }
    .calendar-grid .cal-count { font-size: 0.7rem; margin-top: 4px; }
    .slots-admin .month-nav h2,
    .staff-dashboard .month-nav h2 { font-size: 1.1rem; }
}

.footer { text-align: center; color: var(--muted); padding: 16px; }

@media (max-width: 599px) {
    .nav { gap: 8px; }
    .nav a { font-size: 0.9rem; }
    .topbar { flex-wrap: wrap; }
}
