/*
 * Tempsite: styles on the design system of Kalendarz (Taksonomia UTM 4.0.0 kit).
 * Tokens below are copied from CALENDAR_main/app/src/styles/tokens.css; components mirror the kit
 * (components/ui: button, field, surface, overlay, feedback, pin-input) in plain CSS.
 * Rules: Medicover blue as the only accent, Geist and Geist Mono, flat fills, borders instead of
 * shadows (shadows only on floating layers), light and dark, phones, WCAG AA.
 */

@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------- tokens (Kalendarz tokens.css) */
:root {
  color-scheme: light dark;

  /* surfaces */
  --bg: light-dark(#f6f7f9, #0b0f14);
  --surface: light-dark(#ffffff, #12171e);
  --surface-2: light-dark(#f9fafb, #171d26);
  --surface-3: light-dark(#f2f4f7, #1d2430);
  --border: light-dark(#e4e7ec, #232b36);
  --border-strong: light-dark(#d0d5dd, #344150);

  /* text: 4.5:1 or more on --bg and --surface in both themes */
  --text: light-dark(#101828, #f2f4f7);
  --text-2: light-dark(#344054, #cdd3dc);
  --text-3: light-dark(#5f6b7e, #96a0ae);

  /* brand accent (Medicover blue) */
  --accent: light-dark(#00539f, #5ba3ea);
  --accent-hover: light-dark(#00468a, #7ab6f0);
  --accent-active: light-dark(#003b75, #94c4f3);
  --accent-soft: light-dark(#edf3fa, #14263a);
  --accent-soft-2: light-dark(#dce8f5, #1b3350);
  --accent-fg: light-dark(#ffffff, #0b0f14);

  /* status: always paired with an icon or text, never color alone */
  --ok: light-dark(#067647, #47cd89);
  --ok-soft: light-dark(#ecfdf3, #0f2a1d);
  --warn: light-dark(#b54708, #f5b451);
  --warn-soft: light-dark(#fffaeb, #2e2410);
  --danger: light-dark(#b42318, #f97066);
  --danger-soft: light-dark(#fef3f2, #2d1414);
  --danger-hover: light-dark(#912018, #fb8a81);

  --ring: light-dark(#00539f, #7ab6f0);
  --overlay: light-dark(rgb(16 24 40 / 0.45), rgb(0 0 0 / 0.6));
  --shadow-pop:
    0 12px 32px light-dark(rgb(16 24 40 / 0.12), rgb(0 0 0 / 0.5)), 0 2px 6px light-dark(rgb(16 24 40 / 0.08), rgb(0 0 0 / 0.4));

  /* type */
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* shape and motion */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 240ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  /* layers */
  --z-sticky: 10;
  --z-nav: 20;
  --z-overlay: 40;
  --z-toast: 60;

  /* Tempsite layout */
  --nav-w: 256px;
  --toast-ok: light-dark(#47cd89, #067647);
  --toast-warn: light-dark(#fdb022, #b54708);
  --toast-action: light-dark(#9cc8f2, #00539f);
}
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur: 0ms; --dur-slow: 0ms; }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01' on;
}
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
::selection { background: var(--accent-soft-2); color: var(--text); }
button, [role='button'], summary, label[for] { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
code, kbd, samp, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }
input, textarea, select { font-size: max(16px, 1em); }
@media (min-width: 640px) { input, textarea, select { font-size: 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; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.meta-text { font-size: 0.8125rem; line-height: 1.25rem; }
.noscript { padding: 24px; text-align: center; }
.scroll-thin { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.i { width: 18px; height: 18px; flex: none; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(4px); } }
@keyframes sheet { from { transform: translateY(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------------------------------------------------------------- spinner, boot */
.boot { min-height: 50dvh; display: grid; place-items: center; color: var(--text-3); }
.spinner { width: 16px; height: 16px; animation: spin 0.8s linear infinite; flex: none; }

/* ---------------------------------------------------------------- buttons (kit: button.tsx) */
.btn {
  position: relative; display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500; white-space: nowrap; user-select: none; text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  /* secondary is the default */
  border-color: var(--border-strong); background: var(--surface); color: var(--text);
}
.btn:hover { border-color: var(--text-3); background: var(--surface-2); color: var(--text); }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled='true'] { pointer-events: none; opacity: 0.5; }
.btn .i { width: 16px; height: 16px; }
.btn-primary { border-color: transparent; background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { border-color: transparent; background: var(--accent-hover); color: var(--accent-fg); }
.btn-primary:active { background: var(--accent-active); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { border-color: transparent; background: var(--surface-3); color: var(--text); }
.btn-soft { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { border-color: transparent; background: var(--accent-soft-2); color: var(--accent); }
.btn-danger { border-color: transparent; background: var(--danger); color: var(--accent-fg); }
.btn-danger:hover { border-color: transparent; background: var(--danger-hover); color: var(--accent-fg); }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { border-color: transparent; background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 0.8125rem; }
.btn-sm .i { width: 14px; height: 14px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 0.9375rem; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon .i { width: 18px; height: 18px; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-sm .i { width: 16px; height: 16px; }
.btn-block { width: 100%; }
@media (max-width: 639px) {
  .btn { height: 40px; }
  .btn-sm { height: 36px; }
  .btn-lg { height: 44px; }
  .btn-icon { width: 40px; }
  .btn-icon.btn-sm { width: 36px; }
}

/* ---------------------------------------------------------------- fields (kit: field.tsx) */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.label { display: flex; align-items: center; min-height: 24px; font-size: 0.875rem; font-weight: 500; color: var(--text-2); }
.hint { font-size: 0.8125rem; line-height: 1.25rem; color: var(--text-3); }
.error-text { display: flex; align-items: flex-start; gap: 6px; font-size: 0.8125rem; line-height: 1.25rem; font-weight: 500; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.textarea { height: auto; padding: 9px 12px; line-height: 1.5; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:hover:not(:disabled), .select:hover:not(:disabled), .textarea:hover:not(:disabled) { border-color: var(--text-3); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); outline: none; }
.input[aria-invalid='true'] { border-color: var(--danger); }
.input.mono { font-family: var(--font-mono); font-size: 0.8125rem; }
@media (max-width: 639px) { .input, .select { height: 44px; } }
.select-wrap { position: relative; display: block; }
.select { appearance: none; padding-right: 36px; }
.select-wrap > .i { position: absolute; top: 50%; right: 12px; width: 16px; height: 16px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.select-sm { height: 32px; font-size: 0.8125rem; padding-left: 10px; }
@media (max-width: 639px) { .select-sm { height: 36px; } }

/* Toggle (kit: field.tsx Toggle) */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { position: relative; width: 36px; height: 20px; flex: none; border-radius: 999px; background: var(--border-strong); transition: background-color var(--dur) var(--ease); }
.toggle .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform var(--dur) var(--ease); }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--ring); outline-offset: 2px; }
.toggle input:disabled + .track { opacity: 0.5; }

/* Segmented control (kit: field.tsx Segmented) */
.segmented { display: inline-flex; flex-wrap: nowrap; gap: 0; border-radius: var(--radius-lg); background: var(--surface-3); padding: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-3); font-size: 0.875rem; font-weight: 500;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed='true'], .segmented button[aria-checked='true'] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.segmented.sm button { height: 28px; font-size: 0.8125rem; padding: 0 10px; }
.segmented .count { color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 500; }
@media (max-width: 639px) { .segmented button { height: 40px; } .segmented.sm button { height: 36px; } }

/* ---------------------------------------------------------------- display (kit: surface.tsx) */
.card { border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head:last-child, .card-head.flush { border-bottom: 0; }
.card-head h2 { display: flex; align-items: center; gap: 8px; font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.card-head p { margin-top: 2px; font-size: 0.8125rem; line-height: 1.25rem; color: var(--text-3); }
.card-head .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-body { padding: 16px; }
@media (min-width: 640px) { .card-head { padding: 14px 20px; } .card-body { padding: 16px 20px; } }
.count-pill { border-radius: 999px; background: var(--surface-3); padding: 1px 8px; font-size: 0.75rem; font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head > div:first-child { max-width: 42rem; min-width: 0; }
.page-head h1 { font-size: 1.375rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; color: var(--text); outline: none; }
.page-head p { margin-top: 6px; font-size: 0.875rem; color: var(--text-3); }
.page-head .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (min-width: 640px) { .page-head { margin-bottom: 24px; } .page-head h1 { font-size: 1.5rem; } }

.badge { display: inline-flex; max-width: 100%; height: 24px; align-items: center; gap: 6px; border-radius: 999px; padding: 0 10px; font-size: 0.75rem; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge .i { width: 14px; height: 14px; }
.badge > span { overflow: hidden; text-overflow: ellipsis; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--border-strong); }
.dot.on { background: var(--ok); }

.notice { display: flex; align-items: flex-start; gap: 10px; border-radius: var(--radius-lg); padding: 10px 16px; font-size: 0.8125rem; line-height: 1.25rem; color: var(--text-2); background: var(--surface-3); }
.notice > .i { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }
.notice > div { min-width: 0; flex: 1; }
.notice.accent { background: var(--accent-soft); }
.notice.accent > .i { color: var(--accent); }
.notice.warn { background: var(--warn-soft); }
.notice.warn > .i { color: var(--warn); }
.notice.danger { background: var(--danger-soft); }
.notice.danger > .i { color: var(--danger); }
.notice.ok { background: var(--ok-soft); }
.notice.ok > .i { color: var(--ok); }

.empty { display: flex; flex-direction: column; align-items: center; padding: 48px 24px; text-align: center; }
.empty.compact { padding: 32px 24px; }
.empty .tile { margin-bottom: 12px; display: grid; width: 44px; height: 44px; place-items: center; border-radius: var(--radius-xl); background: var(--accent-soft); color: var(--accent); }
.empty .tile .i { width: 20px; height: 20px; }
.empty h3 { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.empty p { margin-top: 4px; max-width: 24rem; font-size: 0.875rem; color: var(--text-3); }
.empty .actions { margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.kbd { display: inline-flex; height: 20px; min-width: 20px; align-items: center; justify-content: center; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 6px; font-family: var(--font-sans); font-size: 0.6875rem; font-weight: 500; color: var(--text-3); }

.rows > .row + .row { border-top: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; }
@media (min-width: 640px) { .row { padding: 12px 20px; } }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.row-sub { font-size: 0.8125rem; line-height: 1.25rem; color: var(--text-3); overflow-wrap: anywhere; }
.row-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.tile { display: grid; width: 36px; height: 36px; place-items: center; flex: none; border-radius: var(--radius-md); background: var(--surface-3); color: var(--text-2); }
.tile.accent { background: var(--accent-soft); color: var(--accent); }
.tile .i { width: 18px; height: 18px; }
@media (max-width: 559px) { .row { flex-wrap: wrap; } .row-actions { width: 100%; justify-content: flex-end; } }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width var(--dur) var(--ease); }

/* ---------------------------------------------------------------- shell (kit: Shell.tsx) */
.shell { min-height: 100dvh; background: var(--bg); color: var(--text); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: var(--z-nav); display: none; flex-direction: column; width: var(--nav-w); border-right: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; text-decoration: none; color: var(--text); }
.brand-mark { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border-radius: 10px; background: var(--accent); color: var(--accent-fg); }
.brand-mark .i { width: 20px; height: 20px; }
.brand-name { display: block; font-size: 0.9375rem; line-height: 1.25; font-weight: 600; color: var(--text); }
.brand-sub { display: block; font-size: 0.75rem; color: var(--text-3); }
.nav { flex: 1; overflow-y: auto; padding: 0 12px 12px; display: grid; align-content: start; gap: 2px; }
.nav-item {
  position: relative; display: flex; height: 36px; width: 100%; align-items: center; gap: 12px; padding: 0 10px;
  border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 500; text-decoration: none; color: var(--text-2);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item[aria-current='page'] { background: var(--accent-soft); color: var(--accent); }
.nav-item .i { width: 18px; height: 18px; }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-foot { display: grid; gap: 2px; border-top: 1px solid var(--border); padding: 12px; }
.session-box { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-md); }
.session-box .who { flex: 1; min-width: 0; }
.session-box .who b { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-box .who span { display: block; font-size: 0.75rem; color: var(--text-3); }
.header { position: sticky; top: 0; z-index: var(--z-sticky); border-bottom: 1px solid var(--border); background: var(--bg); padding-top: env(safe-area-inset-top); }
.header-row { display: flex; height: 56px; align-items: center; gap: 6px; padding: 0 16px; }
.header-mark { display: grid; width: 32px; height: 32px; flex: none; place-items: center; border-radius: var(--radius-md); background: var(--accent); color: var(--accent-fg); }
.header-mark .i { width: 20px; height: 20px; }
.header-title { margin-left: 4px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 0.9375rem; font-weight: 600; white-space: nowrap; color: var(--text); }
.header .spacer { flex: 1; }
.header-actions { display: flex; flex: none; align-items: center; gap: 2px; }
/* Narrow phones: the session badge shows only its icon; the words stay for screen readers. */
@media (max-width: 399px) {
  .header .badge { padding: 0 7px; }
  .header .badge > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.content { min-width: 0; }
.main { margin: 0 auto; padding: 24px 16px 96px; max-width: 1280px; outline: none; }
.main.narrow { max-width: 960px; }
.bottom-nav { position: fixed; inset: auto 0 0 0; z-index: var(--z-nav); border-top: 1px solid var(--border); background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav .inner { margin: 0 auto; display: grid; height: 64px; max-width: 36rem; grid-auto-flow: column; grid-auto-columns: 1fr; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 0.6875rem; font-weight: 500; text-decoration: none; color: var(--text-3); transition: color var(--dur-fast) var(--ease); }
.bottom-nav a .pill { display: grid; height: 28px; width: 48px; place-items: center; border-radius: 999px; transition: background-color var(--dur-fast) var(--ease); }
.bottom-nav a .i { width: 20px; height: 20px; }
.bottom-nav a[aria-current='page'] { color: var(--accent); }
.bottom-nav a[aria-current='page'] .pill { background: var(--accent-soft); }
@media (max-width: 479px) {
  .bottom-nav a.wide-only { display: none; }
  .bottom-nav a.in-section { color: var(--accent); }
  .bottom-nav a.in-section .pill { background: var(--accent-soft); }
}
@media (min-width: 640px) { .header-row { padding: 0 24px; gap: 8px; } .main { padding: 24px 24px 96px; } }
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .shell { padding-left: var(--nav-w); }
  .header-row { padding: 0 32px; }
  .header-mark, .header-title.phone { display: none; }
  .main { padding: 24px 32px 48px; }
  .bottom-nav { display: none; }
}

/* ---------------------------------------------------------------- sign-in (kit: Auth.tsx, login.css) */
.auth { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: var(--bg); animation: fade-in var(--dur) var(--ease); }
.auth-col { display: grid; gap: 16px; width: 100%; max-width: 440px; justify-items: center; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: var(--radius-xl); background: var(--accent); color: var(--accent-fg); }
.auth-brand .mark .i { width: 20px; height: 20px; }
.auth-brand b { font-size: 1.125rem; font-weight: 600; color: var(--text); }
.auth-card { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); padding: 24px; display: grid; gap: 16px; }
.auth-card h1 { font-size: 1.125rem; font-weight: 600; color: var(--text); }
.auth-card .sub { margin-top: 4px; font-size: 0.8125rem; line-height: 1.25rem; color: var(--text-3); }
.auth-form { display: grid; gap: 12px; }
.auth-foot { font-size: 0.75rem; color: var(--text-3); text-align: center; max-width: 360px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 0.75rem; }
.or::before, .or::after { content: ''; height: 1px; flex: 1; background: var(--border); }

/* PIN entry (kit: pin-input.tsx): one real input drawn as cells */
.pin { position: relative; width: 100%; }
.pin input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; cursor: text; border: 0; padding: 0; }
.pin .cells { display: grid; gap: 8px; }
.pin .cell { display: grid; aspect-ratio: 1; place-items: center; border-radius: var(--radius-lg); border: 1px solid var(--border-strong); background: var(--surface); transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.pin .cell.cur { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.pin .cell.on::after { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--text); }
.pin.error .cell { border-color: var(--danger); }
.pin.error { animation: shake 320ms ease; }
.pin input:disabled ~ .cells { opacity: 0.55; }

.steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; align-items: flex-start; gap: 10px; font-size: 0.875rem; color: var(--text-2); }
.steps li::before { content: counter(s); display: grid; width: 22px; height: 22px; flex: none; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 0.75rem; font-weight: 600; }
.steps li[data-state='done']::before { content: '✓'; background: var(--ok-soft); color: var(--ok); }
.steps li[data-state='now']::before { background: var(--accent); color: var(--accent-fg); }
.steps li[data-state='now'] { color: var(--text); font-weight: 500; }

/* ---------------------------------------------------------------- composer */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.composer { overflow: clip; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.composer textarea {
  display: block; width: 100%; min-height: 96px; max-height: 50vh; padding: 16px 20px 8px; border: 0; background: transparent;
  resize: none; font-size: 0.9375rem; line-height: 1.55; outline: none; color: var(--text);
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
@media (min-width: 640px) { .composer-bar { padding: 10px 12px 12px 20px; } }
.composer-bar .to { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; flex: 1; }
.composer-bar .to > span { font-size: 0.8125rem; color: var(--text-3); }
.composer-bar .end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.composer-bar .select-wrap { width: 136px; }
.to-note { display: flex; flex-basis: 100%; align-items: center; gap: 6px; font-size: 0.75rem; line-height: 1rem; color: var(--warn); }
.to-note:empty { display: none; }
.to-note .i { width: 14px; height: 14px; }
@media (max-width: 639px) {
  .composer-bar .to { flex-basis: 100%; }
  .composer-bar .end { margin-left: 0; width: 100%; }
  .composer-bar .end .select-wrap { flex: 1; width: auto; }
}

/* ---------------------------------------------------------------- feed */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
/* The filters may shrink below their content: the segmented control then scrolls inside, the page does not. */
.toolbar > .filters { min-width: 0; max-width: 100%; }
.search { position: relative; margin-left: auto; width: 240px; max-width: 100%; }
.search .i { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input {
  height: 32px; width: 100%; border-radius: var(--radius-md); border: 1px solid transparent; background: var(--surface-3); padding: 0 12px 0 36px;
  font-size: 0.8125rem; color: var(--text); transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.search input::placeholder { color: var(--text-3); }
.search input:hover { border-color: var(--border); }
.search input:focus { border-color: var(--accent); background: var(--surface); outline: none; }
@media (max-width: 639px) { .search { width: 100%; margin-left: 0; } .search input { height: 40px; } }
.day { padding: 8px 4px 0; font-size: 0.8125rem; font-weight: 600; color: var(--text-3); }
.feed { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease);
}
@media (min-width: 640px) { .item { padding: 14px 16px 14px 20px; } }
.item:hover { border-color: var(--border-strong); }
.item.is-new { animation: rise var(--dur-slow) var(--ease); }
.item-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.item-title { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.item-title.mono { font-family: var(--font-mono); font-size: 0.8125rem; }
.item-text { max-height: 4.65em; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.875rem; line-height: 1.55; color: var(--text); }
.item-text.open { max-height: none; }
.item-more { justify-self: start; border: 0; padding: 0; background: none; color: var(--accent); font-size: 0.8125rem; font-weight: 500; }
.item-more:hover { text-decoration: underline; }
.item-link { font-family: var(--font-mono); font-size: 0.8125rem; overflow-wrap: anywhere; }
.item-body > .badge { justify-self: start; }
.item-thumb { width: 100%; max-width: 300px; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface-3); }
.item-thumb.contain { width: auto; max-width: min(100%, 360px); max-height: 220px; aspect-ratio: auto; object-fit: contain; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 0.75rem; color: var(--text-3); }
.item-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.item-meta .i { width: 14px; height: 14px; }
.item-meta .route { color: var(--text-2); }
.item-meta .route .i { color: var(--text-3); }
.item-actions { display: flex; align-items: center; gap: 4px; }
@media (max-width: 559px) {
  .item { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .item > .tile { width: 32px; height: 32px; }
  .item-actions { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 8px; }
}
.usage { display: grid; gap: 6px; font-size: 0.75rem; color: var(--text-3); }

/* Phones: fields at 16px or more, or iOS Safari zooms the page when one gets focus. */
@media (max-width: 639px) {
  .composer textarea, .search input, .select-sm, .input.mono { font-size: 16px; }
}

/* ---------------------------------------------------------------- snapshots */
.host-head { display: flex; align-items: center; gap: 8px; margin: 8px 0 -4px; font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.host-head .mono { font-weight: 500; }
.snap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.snap { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.snap .shot { display: grid; aspect-ratio: 16 / 10; place-items: center; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--surface-3); color: var(--text-3); }
.snap .shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.snap .shot .i { width: 28px; height: 28px; }
.snap-body { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; padding: 12px 16px 14px; }
.snap-title { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 500; color: var(--text); }
.snap-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-3); text-decoration: none; }
.snap-url:hover { color: var(--accent); text-decoration: underline; }
.snap-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }

/* ---------------------------------------------------------------- devices */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.device { display: grid; align-content: start; }
.device-top { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 12px; }
@media (min-width: 640px) { .device-top { padding: 16px 20px 12px; } }
.device-name { font-size: 0.9375rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.device-state { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 0.8125rem; color: var(--text-3); }
.facts { display: grid; gap: 8px; padding: 0 16px 16px; font-size: 0.8125rem; line-height: 1.25rem; color: var(--text-2); }
@media (min-width: 640px) { .facts { padding: 0 20px 16px; } }
.facts > div { display: flex; align-items: flex-start; gap: 8px; }
.facts .i { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }
.facts .mono { font-size: 0.75rem; overflow-wrap: anywhere; }
.device-foot { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--border); padding: 12px 16px; }
@media (min-width: 640px) { .device-foot { padding: 12px 20px; } }
.pair-code { padding: 18px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); text-align: center; font-family: var(--font-mono); font-size: 1.75rem; font-weight: 600; letter-spacing: 0.08em; user-select: all; font-variant-numeric: tabular-nums; color: var(--text); }
.pair-code.expired { color: var(--text-3); text-decoration: line-through; }
.center-line { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.8125rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.done { display: grid; justify-items: center; gap: 8px; padding: 12px 0; text-align: center; }
.done .tile { width: 44px; height: 44px; border-radius: var(--radius-xl); background: var(--ok-soft); color: var(--ok); }
.done .tile .i { width: 22px; height: 22px; }
.done h3 { font-size: 0.9375rem; font-weight: 600; }

/* ---------------------------------------------------------------- security */
.manage { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.notice.manage > div { flex: 1 1 12rem; } /* on a phone the button goes below the text, not beside a narrow column */
.checks > .check + .check { border-top: 1px solid var(--border); }
.check { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 10px 16px; }
@media (min-width: 640px) { .check { padding: 10px 20px; } }
.check > .i { width: 18px; height: 18px; margin-top: 1px; }
.check.ok > .i { color: var(--ok); }
.check.warn > .i { color: var(--warn); }
.check.bad > .i { color: var(--danger); }
.check .d { font-size: 0.8125rem; line-height: 1.25rem; color: var(--text-3); overflow-wrap: anywhere; }
.log > .log-row + .log-row { border-top: 1px solid var(--border); }
.log-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 9px 16px; font-size: 0.8125rem; }
@media (min-width: 640px) { .log-row { padding: 9px 20px; } }
.log-row time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.log-row .who { font-size: 0.75rem; color: var(--text-3); }
.log-row.fail .what { color: var(--danger); font-weight: 500; }
.log-row .what { overflow-wrap: anywhere; }
.log-row .who { overflow-wrap: anywhere; }
.log-row .who .mono { font-size: 0.75rem; }
.log-row .what.err { font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.125rem; color: var(--text-2); }
/* Dziennik zdarzeń: the exact time with seconds, the relative time below it, the category as a pill. */
.log.events .log-row { grid-template-columns: 148px minmax(0, 1fr); }
.log-row .when { display: grid; align-content: start; gap: 2px; }
.log-row .when time { white-space: nowrap; }
.log-row .ago { font-size: 0.75rem; color: var(--text-3); }
.log-row .cat { display: inline-block; margin-right: 2px; border-radius: 999px; background: var(--surface-3); padding: 0 7px; font-size: 0.6875rem; font-weight: 500; color: var(--text-2); }
.log-more { display: flex; justify-content: center; border-top: 1px solid var(--border); padding: 12px 16px; }
@media (max-width: 559px) {
  .log-row, .log.events .log-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .log-row .when { display: flex; flex-wrap: wrap; gap: 0 8px; }
}
.pin-note { border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- overlays (kit: overlay.tsx, feedback.tsx) */
.toasts { position: fixed; left: 50%; bottom: 24px; z-index: var(--z-toast); display: grid; gap: 8px; width: min(28rem, calc(100vw - 32px)); transform: translateX(-50%); pointer-events: none; }
@media (max-width: 1023px) { .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); } }
@media (max-width: 639px) {
  /* While a dialog is open the toasts live in it (the rest of the page is inert). On phones the
     dialog is a sheet at the bottom: toasts go to the top, clear of its buttons. */
  dialog .toasts { top: calc(16px + env(safe-area-inset-top)); bottom: auto; }
}
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px 10px 14px; border-radius: var(--radius-xl); background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); font-size: 0.875rem; animation: rise var(--dur-slow) var(--ease); }
.toast > .i { width: 18px; height: 18px; margin-top: 2px; color: var(--toast-ok); }
.toast.warn > .i, .toast.error > .i { color: var(--toast-warn); }
.toast .msg { flex: 1; min-width: 0; padding: 1px 0; }
.toast .act { margin: -2px 0; flex: none; border: 0; border-radius: var(--radius-md); background: none; padding: 4px 8px; font-size: 0.875rem; font-weight: 600; color: var(--toast-action); }
.toast .act:hover { background: light-dark(rgb(255 255 255 / 0.1), rgb(0 0 0 / 0.06)); }
.toast .x { margin: -2px 0; display: grid; width: 28px; height: 28px; flex: none; place-items: center; border: 0; border-radius: var(--radius-md); background: none; color: inherit; opacity: 0.6; }
.toast .x:hover { opacity: 1; }
.toast .x .i { width: 16px; height: 16px; }
.toast.leaving { animation: fade-out var(--dur-fast) var(--ease-in) forwards; }

dialog.dlg {
  margin: auto; padding: 0; display: flex; flex-direction: column; width: calc(100vw - 32px); max-width: 32rem; max-height: min(88dvh, 760px);
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
dialog.dlg:not([open]) { display: none; }
dialog.dlg[open] { animation: pop var(--dur) var(--ease); }
dialog.dlg::backdrop { background: var(--overlay); animation: fade-in var(--dur) var(--ease); }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 20px 4px; }
.dlg-head h2 { font-size: 1.0625rem; font-weight: 600; color: var(--text); }
.dlg-head p { margin-top: 4px; font-size: 0.875rem; color: var(--text-3); }
.dlg-close { margin: -4px -8px 0 0; display: grid; width: 36px; height: 36px; flex: none; place-items: center; border: 0; border-radius: var(--radius-md); background: none; color: var(--text-3); transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.dlg-close:hover { background: var(--surface-3); color: var(--text); }
.dlg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }
.dlg-body > p { color: var(--text-2); }
.dlg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); padding: 14px 20px; }
@media (min-width: 640px) { .dlg-head { padding: 20px 24px 4px; } .dlg-body { padding: 16px 24px; } .dlg-foot { padding: 14px 24px; } }
@media (max-width: 639px) {
  dialog.dlg { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog.dlg[open] { animation: sheet var(--dur-slow) var(--ease); }
}

.menu { position: fixed; z-index: var(--z-overlay); min-width: 224px; display: grid; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-pop); animation: pop var(--dur) var(--ease); }
.menu button { display: flex; height: 36px; align-items: center; gap: 10px; border: 0; border-radius: var(--radius-md); background: none; padding: 0 10px; text-align: left; font-size: 0.875rem; color: var(--text); outline: none; user-select: none; }
.menu button .i { width: 16px; height: 16px; color: var(--text-3); }
.menu button:hover, .menu button:focus-visible { background: var(--surface-3); }
.menu button.danger, .menu button.danger .i { color: var(--danger); }
.menu button.danger:hover, .menu button.danger:focus-visible { background: var(--danger-soft); }
.menu hr { margin: 4px 0; height: 1px; border: 0; background: var(--border); }
@media (max-width: 639px) { .menu button { height: 44px; } }

.drop { position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; place-items: center; padding: 24px; background: var(--overlay); animation: fade-in var(--dur-fast) var(--ease); }
.drop-box { display: grid; justify-items: center; gap: 8px; padding: 36px 48px; border: 2px dashed var(--accent); border-radius: var(--radius-xl); background: var(--surface); text-align: center; }
.drop-box .tile { width: 44px; height: 44px; border-radius: var(--radius-xl); }
.drop-box .tile .i { width: 22px; height: 22px; }
.drop-box b { font-size: 1.0625rem; font-weight: 600; }
.drop-box span { color: var(--text-3); }

.min0 { min-width: 0; }
@media (max-width: 1023px) { .hide-phone { display: none !important; } }
.snap-body > .badge { justify-self: start; }
