/*
 * Rezerwacje stolików - style aplikacji.
 * Tokeny w tokens/*.css to kopia 1:1 z design systemu ProstaKoncepcja
 * (prototyp: Rezerwacje stolików restauracyjnych/_ds/.../tokens). Tutaj tylko
 * komponenty design systemu przepisane z JSX na klasy oraz układ planu i grafiku.
 */

:root {
  /* Kreskowanie stanu "zajęty bez rezerwacji" (walkinPattern z prototypu) */
  --walk-bg: repeating-linear-gradient(135deg, var(--amber-050) 0 6px, color-mix(in oklch, var(--amber-500) 30%, var(--amber-050)) 6px 9px);
  --ease: var(--ease-standard);
}

html, body { height: 100%; }
body { background: var(--surface-page); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Ikony: Lucide (lucide-static 0.454.0, ISC) jako maska CSS, kolor z currentColor */
.i {
  display: inline-block; width: 20px; height: 20px; flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}
.i-utensils{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2'/%3E%3Cpath d='M7 2v20'/%3E%3Cpath d='M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7'/%3E%3C/svg%3E")}
.i-arrow-left{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='m12 19-7-7 7-7'/%3E%3Cpath d='M19 12H5'/%3E%3C/svg%3E")}
.i-chevron-left{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E")}
.i-chevron-right{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E")}
.i-chevron-down{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}
.i-user{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E")}
.i-phone{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E")}
.i-users{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E")}
.i-circle-alert{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' x2='12' y1='8' y2='12'/%3E%3Cline x1='12' x2='12.01' y1='16' y2='16'/%3E%3C/svg%3E")}
.i-triangle-alert{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E")}
.i-circle-check{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E")}
.i-info{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E")}
.i-log-out{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' x2='9' y1='12' y2='12'/%3E%3C/svg%3E")}
.i-x{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E")}
.i-plus{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M5 12h14'/%3E%3Cpath d='M12 5v14'/%3E%3C/svg%3E")}
.i-check{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")}
.i-rotate-ccw{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' %3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E")}

/* ---------- Szkielet aplikacji: 240px sidebar, 56px górny pasek */
.app { display: flex; height: 100vh; height: 100dvh; font-family: var(--font-sans); color: var(--text-body); background: var(--surface-page); }

.sidebar { width: 240px; flex: 0 0 240px; background: var(--surface-card); border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; }
.sidebar-brand { height: 56px; flex: 0 0 56px; display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--border-subtle); }
.wordmark { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: var(--tracking-heading); line-height: 1; color: var(--text-heading); }
.wordmark-dot { width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--accent-500); flex: 0 0 auto; }
.sidebar-nav { padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav .eyebrow { padding: 0 10px 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius-2); font-size: var(--text-sm); font-weight: 500; color: var(--text-heading); text-decoration: none; background: var(--surface-active); }
.nav-item:hover { color: var(--text-heading); }
.nav-item .i { width: 18px; height: 18px; }
.sidebar-meta { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border-subtle); display: flex; align-items: center; gap: 10px; }
.sidebar-meta-tekst { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar-meta strong { font-size: var(--text-sm); font-weight: 500; color: var(--text-heading); }
.sidebar-meta span { font-size: var(--text-xs); color: var(--text-subtle); }
.sidebar-note { padding: 0 20px 16px; font-size: var(--text-xs); color: var(--text-subtle); }
.sidebar-note.warn { color: var(--status-warning-fg); }

.eyebrow { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-subtle); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; flex: 0 0 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 32px; background: var(--surface-card); border-bottom: 1px solid var(--border-subtle); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--text-sm); white-space: nowrap; }
.crumb-link { border: none; background: transparent; padding: 0; color: var(--text-muted); cursor: pointer; transition: color var(--duration-fast) var(--ease); }
.crumb-link:hover { color: var(--text-heading); }
.crumb-sep { color: var(--text-disabled); }
.crumb-cur { color: var(--text-heading); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.clock { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.clock-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-500); }
.clock-sim { padding: 1px 6px; border: 1px solid var(--border-default); border-radius: var(--radius-1); color: var(--text-subtle); font-size: var(--text-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.clock-bok { display: none; }

/* ---------- Ekrany i animacja zoom (open/back z prototypu) */
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; overflow: auto; }
.screen-table { background: var(--surface-page); }
.screen.is-anim { transition: transform var(--duration-slow) var(--ease), opacity var(--duration-slow) var(--ease); }
.screen-inner { padding: 32px; display: flex; flex-direction: column; gap: 24px; max-width: 1480px; }
.screen-table .screen-inner { padding: 24px 32px 48px; }

.page-head { display: flex; flex-direction: column; gap: 8px; }
.page-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--text-3xl); letter-spacing: var(--tracking-display); line-height: var(--leading-tight); color: var(--text-heading); }
.page-lead { font-size: var(--text-sm); color: var(--text-muted); }

.card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-3); box-shadow: var(--shadow-xs); }
.row-wrap { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }

/* ---------- Stany stolika (4) */
.st-free { --st-bg: var(--paper-000); --st-bd: var(--ink-400); --st-fg: var(--ink-900); --st-dot: var(--green-500); }
.st-today { --st-bg: var(--paper-000); --st-bd: var(--ink-600); --st-fg: var(--ink-900); --st-dot: var(--paper-000); }
.st-reserved { --st-bg: var(--crimson-050); --st-bd: var(--crimson-500); --st-fg: var(--crimson-600); --st-dot: var(--crimson-500); }
.st-walkin { --st-bg: var(--walk-bg); --st-bd: var(--amber-500); --st-fg: var(--amber-600); --st-dot: var(--amber-500); }

/* ---------- Ekran 1: legenda i plan */
.plan-card { flex: 1 1 620px; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; margin: 0; padding: 16px 24px; list-style: none; border-bottom: 1px solid var(--border-subtle); }
.legend li { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); }
.swatch { position: relative; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 4px; background: var(--st-bg); border: 1.5px solid var(--st-bd); }
.swatch.st-today::after { content: ''; position: absolute; top: -5px; right: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-900); border: 1.5px solid var(--paper-000); }
.count { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-subtle); }

.plan-body { padding: 24px; overflow-x: auto; }
.plan { position: relative; width: 100%; min-width: 600px; aspect-ratio: 1000 / 640; background: var(--surface-page); border: 2px solid var(--ink-400); border-radius: 4px; }
.plan-label { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-subtle); }
.plan-small { font-family: var(--font-mono); font-size: 10px; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-subtle); }
.plan-kitchen { position: absolute; left: 0; top: 0; width: 52%; height: 17.2%; background: var(--surface-sunken); border-right: 1px solid var(--ink-300); border-bottom: 1px solid var(--ink-300); display: flex; align-items: center; justify-content: center; }
.plan-pass { position: absolute; left: 38%; top: 17.2%; width: 12%; height: 5px; background: var(--ink-300); border-radius: 0 0 2px 2px; }
.plan-pass-label { position: absolute; left: 38%; top: 18.6%; }
.plan-bar { position: absolute; left: 56%; top: 0; width: 44%; height: 12.5%; background: var(--ink-100); border-left: 1px solid var(--ink-300); border-bottom: 1px solid var(--ink-300); display: flex; align-items: center; justify-content: center; }
.plan-bar .plan-label { color: var(--text-muted); }
.plan-reception { position: absolute; left: 17%; top: 93.8%; width: 12%; height: 3.8%; background: var(--ink-100); border: 1px solid var(--ink-300); border-radius: 2px; display: flex; align-items: center; justify-content: center; }
.plan-reception .plan-small { color: var(--text-muted); }
.plan-door { position: absolute; left: 4%; bottom: -2px; width: 11%; height: 4px; background: var(--surface-page); }
.plan-door-label { position: absolute; left: 4%; width: 11%; bottom: 1.2%; text-align: center; }
.plan-stool { position: absolute; border-radius: 50%; background: var(--paper-000); border: 1px solid var(--ink-300); }
.plan-window { position: absolute; left: -2px; width: 4px; background: var(--paper-000); border-top: 1px solid var(--ink-400); border-bottom: 1px solid var(--ink-400); }
.plan-plant { position: absolute; border-radius: 50%; background: var(--green-050); border: 1px solid color-mix(in oklch, var(--green-500) 55%, transparent); display: flex; align-items: center; justify-content: center; }
.plan-plant::after { content: ''; width: 52%; height: 52%; border-radius: 50%; background: color-mix(in oklch, var(--green-500) 30%, var(--green-050)); }

/* Stolik-hotspot: krzesła + blat */
.tbl { position: absolute; z-index: 2; padding: 0; border: 0; background: none; cursor: pointer; transition: transform 160ms var(--ease); }
.tbl.is-hover { transform: translateY(-3px); z-index: 5; }
.tbl:focus-visible { box-shadow: none; }
.tbl-chair { position: absolute; border-radius: 5px; background: var(--paper-000); border: 1px solid var(--ink-300); }
.tbl-top { position: absolute; inset: 0; border-radius: 6px; background: var(--st-bg); border: 1.5px solid var(--st-bd); box-shadow: var(--shadow-xs); transition: box-shadow 160ms var(--ease), border-color 160ms; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--st-fg); }
.tbl.is-round .tbl-top { border-radius: 50%; }
.tbl.is-hover .tbl-top { border-color: var(--ink-900); box-shadow: var(--shadow-md); }
.tbl:focus-visible .tbl-top { border-color: var(--accent-500); box-shadow: var(--focus-ring); }
.tbl-num { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: var(--tracking-heading); line-height: 1; }
.tbl.is-large .tbl-num { font-size: 22px; }
.tbl-sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.02em; white-space: nowrap; }
.tbl-badge { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ink-900); color: var(--paper-000); border: 2px solid var(--paper-000); font-family: var(--font-mono); font-size: 10px; display: flex; align-items: center; justify-content: center; }

/* Dymek nad stolikiem */
.tip { position: absolute; z-index: 40; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none; width: max-content; min-width: 190px; max-width: 280px; padding: 10px 12px; background: var(--ink-950); color: var(--paper-050); border-radius: var(--radius-2); box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 5px; }
.tip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.tip-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.tip-seats { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--ink-300); white-space: nowrap; }
.tip-status { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); }
.tip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-dot); }
.tip-detail { font-size: var(--text-xs); color: var(--ink-300); }

/* Panel "Oznacz zajęcie" */
.walk-card { flex: 0 1 320px; min-width: 280px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); letter-spacing: var(--tracking-heading); color: var(--text-heading); }
.card-lead { font-size: var(--text-xs); color: var(--text-muted); }
.walk-head { display: flex; flex-direction: column; gap: 4px; }
.walk-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.walk-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border-subtle); }
.mini { width: 30px; height: 30px; flex: 0 0 30px; padding: 0; border-radius: 4px; background: var(--st-bg); border: 1.5px solid var(--st-bd); color: var(--st-fg); font-family: var(--font-display); font-weight: 600; font-size: 13px; cursor: pointer; }
.mini.is-round { border-radius: 50%; }
.walk-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.walk-name { font-size: var(--text-sm); font-weight: 500; color: var(--text-heading); }
.walk-name span { font-weight: 400; color: var(--text-subtle); }
.walk-detail { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Komponenty design systemu */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 var(--space-4); font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 500; letter-spacing: 0.005em; white-space: nowrap; border: 1px solid transparent; border-radius: var(--radius-2); cursor: pointer; transition: background-color var(--duration-fast) var(--ease), transform var(--duration-instant) var(--ease), border-color var(--duration-fast) var(--ease); }
.btn .i { width: 18px; height: 18px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-sm { height: 32px; padding: 0 var(--space-3); gap: 6px; }
.btn-sm .i { width: 16px; height: 16px; }
.btn-primary { background: var(--accent-500); color: var(--paper-000); border-color: var(--accent-500); }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-secondary { background: var(--surface-card); color: var(--text-heading); border-color: var(--border-default); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-heading); }
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--surface-hover); }
.btn-danger { background: var(--crimson-500); color: var(--paper-000); border-color: var(--crimson-500); }
.btn-danger:hover { background: var(--crimson-600); border-color: var(--crimson-600); }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 auto; padding: 0; border: 1px solid transparent; border-radius: var(--radius-2); background: transparent; color: var(--text-muted); cursor: pointer; transition: background-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease); }
.icon-btn:hover { background: var(--surface-hover); color: var(--text-heading); }
.icon-btn-sm { width: 32px; height: 32px; }
.icon-btn-sm .i { width: 16px; height: 16px; }
.icon-btn-outline { background: var(--surface-card); color: var(--text-heading); border-color: var(--border-default); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; white-space: nowrap; border: 1px solid transparent; border-radius: var(--radius-1); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.badge-neutral { color: var(--text-muted); background: var(--ink-050); border-color: var(--border-subtle); }
.badge-success { color: var(--status-success-fg); background: var(--status-success-bg); }
.badge-warning { color: var(--status-warning-fg); background: var(--status-warning-bg); }
.badge-danger { color: var(--status-danger-fg); background: var(--status-danger-bg); }

.switch { display: inline-flex; align-items: center; gap: var(--space-3); padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.switch.has-desc { align-items: flex-start; }
.switch:disabled { cursor: not-allowed; opacity: .55; }
.switch:focus-visible { box-shadow: none; }
.switch:focus-visible .switch-track { box-shadow: var(--focus-ring); }
.switch-track { display: inline-flex; width: 36px; height: 20px; flex: 0 0 auto; padding: 2px; border-radius: var(--radius-full); background: var(--ink-300); transition: background-color var(--duration-base) var(--ease); }
.switch.has-desc .switch-track { margin-top: 2px; }
.switch-thumb { width: 16px; height: 16px; border-radius: var(--radius-full); background: var(--paper-000); box-shadow: var(--shadow-sm); transition: transform var(--duration-base) var(--ease); }
.switch[aria-checked="true"] .switch-track { background: var(--accent-500); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(16px); }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-label { font-size: var(--text-sm); color: var(--text-body); }
.switch-desc { font-size: var(--text-xs); color: var(--text-subtle); }

.tabs-scroll { overflow-x: auto; white-space: nowrap; scrollbar-width: thin; padding-bottom: 2px; }
.tabs { display: flex; gap: var(--space-6); min-width: max-content; border-bottom: 1px solid var(--border-subtle); }
.tab { display: inline-flex; align-items: center; gap: 8px; margin-bottom: -1px; padding: 0 0 10px; background: transparent; border: none; border-bottom: 2px solid transparent; font-size: var(--text-sm); font-weight: 400; color: var(--text-muted); white-space: nowrap; cursor: pointer; transition: color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease); }
.tab:hover { color: var(--text-heading); }
.tab:focus-visible { border-radius: var(--radius-1); }
.tab[aria-selected="true"] { border-bottom-color: var(--accent-500); font-weight: 600; color: var(--text-heading); }
.tab-count { font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: 400; color: var(--text-subtle); }

.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field-label { display: flex; gap: 4px; font-size: var(--text-sm); font-weight: 500; color: var(--text-heading); }
.field-req { color: var(--accent-500); }
.field-msg { font-size: var(--text-xs); line-height: 1.45; color: var(--text-subtle); }
.field-msg.is-error { color: var(--status-danger-fg); }
.control { position: relative; display: flex; align-items: center; width: 100%; }
.control > .i { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-subtle); pointer-events: none; }
.control > .i-chevron-down { left: auto; right: 12px; }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-body); background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-2); outline: none; transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease); }
.input.has-icon { padding-left: 36px; }
.select { padding: 0 34px 0 12px; appearance: none; -webkit-appearance: none; cursor: pointer; }
.textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-500); box-shadow: var(--ring-focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--crimson-500); }
.input::placeholder, .textarea::placeholder { color: var(--text-disabled); }

.alert { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius-2); font-size: var(--text-xs); line-height: 1.45; }
.alert .i { width: 16px; height: 16px; margin-top: 1px; }
.alert-danger { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.alert-warning { flex-direction: column; gap: 8px; background: var(--status-warning-bg); color: var(--status-warning-fg); }
.alert-row { display: flex; gap: 10px; }
.link-btn { align-self: flex-start; margin-left: 26px; padding: 0; border: none; background: transparent; font-weight: 500; color: var(--text-link); text-align: left; cursor: pointer; transition: color var(--duration-fast) var(--ease); }
.link-btn:hover { color: var(--text-link-hover); }

/* Lewy dolny róg: prawa kolumna (formularz, przełączniki zajęcia) zostaje odkryta */
.toast-wrap { position: absolute; left: 24px; bottom: 24px; z-index: 100; max-width: calc(100% - 32px); }
.toast { display: flex; align-items: flex-start; gap: var(--space-3); width: 380px; max-width: 100%; padding: var(--space-4); background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-3); box-shadow: var(--shadow-lg); animation: toast-in var(--duration-base) var(--ease-out); }
.toast > .i { width: 18px; height: 18px; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toast-title { font-size: var(--text-sm); font-weight: 500; color: var(--text-heading); }
.toast-desc { font-size: var(--text-xs); color: var(--text-muted); }
.toast-action { margin-top: 6px; margin-left: 0; }
.tone-neutral { color: var(--text-muted); }
.tone-success { color: var(--status-success-fg); }
.tone-warning { color: var(--status-warning-fg); }
.tone-danger { color: var(--status-danger-fg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dialog { width: 440px; max-width: calc(100% - 32px); padding: 0; background: var(--surface-card); color: var(--text-body); border: 1px solid var(--border-subtle); border-radius: var(--radius-3); box-shadow: var(--shadow-lg); overflow: hidden; }
.dialog::backdrop { background: rgba(28, 27, 25, .42); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-6) var(--space-6) var(--space-4); }
.dialog-head > div { flex: 1; display: flex; flex-direction: column; gap: var(--space-2); }
.dialog-title { margin: 0; font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--text-heading); }
.dialog-desc { font-size: var(--text-sm); color: var(--text-muted); }
.dialog-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border-subtle); background: var(--surface-sunken); }

/* ---------- Ekran 2: nagłówek stolika */
.table-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.table-title { display: flex; align-items: flex-start; gap: 12px; }
.table-title > div { display: flex; flex-direction: column; gap: 6px; }
.table-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--text-muted); }
.table-meta small { font-size: var(--text-xs); color: var(--text-subtle); }
.walk-toggle { padding: 12px 16px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-3); }

/* ---------- Kalendarz */
.cal-card { flex: 1 1 600px; min-width: 0; overflow: hidden; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); }
.cal-nav { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cal-label { margin-left: 6px; font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); color: var(--text-heading); }
.seg { display: flex; gap: 4px; padding: 3px; background: var(--surface-sunken); border-radius: var(--radius-2); }
.seg .btn-ghost:hover { background: var(--surface-card); }

.cal-view { overflow-x: auto; }
.cal-grid.is-week { min-width: 640px; }
.cal-head { display: flex; border-bottom: 1px solid var(--border-subtle); }
.cal-gutter { width: 56px; flex: 0 0 56px; }
.cal-colhead { flex: 1; min-width: 0; padding: 10px 8px; border-left: 1px solid var(--border-subtle); display: flex; align-items: baseline; gap: 6px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.cal-colhead.is-today { color: var(--accent-600); }
.cal-dow { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.cal-dnum { font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); }
.cal-scroll { max-height: 560px; overflow-y: auto; padding-top: 8px; }
.cal-body { display: flex; position: relative; }
.cal-hours { position: relative; width: 56px; flex: 0 0 56px; }
.cal-hour { position: absolute; right: 8px; transform: translateY(-50%); font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-subtle); }
.cal-now-label { position: absolute; right: 6px; z-index: 4; transform: translateY(-50%); padding: 1px 4px; background: var(--accent-500); color: var(--paper-000); border-radius: 2px; font-family: var(--font-mono); font-size: 10px; }
.cal-cols { position: relative; flex: 1; min-width: 0; display: flex; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border-subtle); pointer-events: none; }
.cal-line.is-half { border-top: 1px dashed var(--ink-050); }
.cal-col { position: relative; flex: 1; min-width: 0; border-left: 1px solid var(--border-subtle); }
.cal-col.can-add { cursor: copy; }
.cal-past { position: absolute; left: 0; right: 0; top: 0; background: color-mix(in oklch, var(--paper-100) 70%, transparent); pointer-events: none; }
.cal-block { position: absolute; left: 4px; right: 4px; z-index: 2; display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; overflow: hidden; text-align: left; border: 1px solid; border-radius: var(--radius-2); cursor: pointer; }
.cal-block-title { font-size: var(--text-xs); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block-sub { font-family: var(--font-mono); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block.is-upcoming { background: var(--crimson-050); color: var(--crimson-600); border-color: color-mix(in oklch, var(--crimson-500) 40%, transparent); }
.cal-block.is-past { background: var(--ink-050); color: var(--ink-500); border-color: var(--ink-200); }
.cal-block.is-walk { background: var(--walk-bg); color: var(--amber-600); border-color: var(--amber-500); }
.cal-block.is-sel { box-shadow: var(--shadow-md); border-color: var(--crimson-500); }
.cal-block.is-walk.is-sel { border-color: var(--amber-600); }
.cal-ghost { position: absolute; left: 4px; right: 4px; z-index: 1; display: flex; align-items: flex-start; gap: 4px; padding: 5px 8px; border: 1px dashed var(--ink-500); border-radius: var(--radius-2); background: color-mix(in oklch, var(--paper-000) 80%, transparent); color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; pointer-events: none; }
.cal-nowline { position: absolute; left: 0; right: 0; z-index: 3; border-top: 2px solid var(--accent-500); pointer-events: none; }
.cal-nowline::before { content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-500); }

.month-head, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head { border-bottom: 1px solid var(--border-subtle); }
.month-head span { padding: 10px; font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-subtle); }
.month-cell { min-width: 0; min-height: 96px; display: flex; flex-direction: column; gap: 3px; padding: 8px; text-align: left; background: var(--surface-card); border: 0; border-right: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); border-radius: 0; cursor: pointer; transition: background-color var(--duration-fast) var(--ease); }
.month-cell.is-out { background: var(--surface-sunken); }
.month-cell:hover { background: var(--surface-hover); }
.month-num { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); color: var(--text-heading); }
.month-cell.is-out .month-num { color: var(--text-disabled); }
.month-cell.is-today .month-num { color: var(--accent-600); }
.month-item { padding: 2px 5px; border-radius: 2px; font-family: var(--font-mono); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--crimson-050); color: var(--crimson-600); }
.month-item.is-past { background: var(--ink-050); color: var(--ink-500); }
.month-more { font-family: var(--font-mono); font-size: 10px; color: var(--text-subtle); }

/* ---------- Panel boczny: szczegóły / formularz */
.side-card { flex: 0 1 360px; min-width: 300px; padding: 24px; }
.side-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); letter-spacing: var(--tracking-heading); color: var(--text-heading); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-head { display: flex; flex-direction: column; gap: 4px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; }
.form-grid.is-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.form-actions { display: flex; gap: 8px; padding-top: 4px; }
.form-actions .btn-primary { flex: 1; }
.detail { display: flex; flex-direction: column; gap: 20px; }
.detail-head { display: flex; flex-direction: column; gap: 6px; }
.detail-rows { margin: 0; display: flex; flex-direction: column; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--border-subtle); font-size: var(--text-sm); }
.detail-row dt { color: var(--text-muted); }
.detail-row dd { margin: 0; color: var(--text-heading); text-align: right; overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Węższe ekrany (tablet przy recepcji, telefon) */
@media (max-width: 960px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; flex: 0 0 auto; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .sidebar-brand { flex: 1; border-bottom: 0; }
  .sidebar-nav, .sidebar-meta-tekst, .sidebar-note { display: none; }
  .sidebar-meta { margin: 0; padding: 0 12px; border-top: 0; }
  .clock-bok { display: flex; }
  .topbar { display: none; }
  .screen-inner, .screen-table .screen-inner { padding: 20px 16px 40px; }
  .walk-card, .side-card { flex-basis: 100%; min-width: 0; }
  .toast-wrap { left: 16px; right: 16px; bottom: 16px; }
  .toast { width: 100%; }
}
@media (max-width: 640px) {
  .clock-date { display: none; }
  .page-title { font-size: var(--text-2xl); }
  .plan-body { padding: 16px; }
  .plan { min-width: 0; }
  .tbl-num { font-size: 10px; }
  .tbl.is-large .tbl-num { font-size: 13px; }
  .tbl-sub { display: none; }
  .tbl-badge { min-width: 14px; height: 14px; font-size: 8px; }
  .plan-reception .plan-small, .plan-door-label { display: none; }
  .legend { padding: 12px 16px; gap: 10px 20px; }
  .cal-toolbar { padding: 12px; }
  .cal-label { font-size: var(--text-md); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
