/* ========================================================================
   Famly - Main layout, typography, base components
   ======================================================================== */

/* === Globální okamžitá odezva na dotek (feedback napříč celou aplikací) === */
button, a, [data-action], [role="button"], .chip, .segment,
.modal-close, .nav-item, label.switch, .color-swatch, .icon-pick-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:active, a.btn:active, a.btn-icon:active, [data-action]:active,
.chip:active, .segment:active, .modal-close:active, .btn-icon:active,
.btn-icon-sm:active, .icon-pick-btn:active {
  transform: scale(0.93);
  transition: transform 60ms ease-out;
}

/* === Reset === */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: var(--brand-primary-light);
  text-decoration: none;
}

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

ul, ol { list-style: none; }

/* === Animovane pozadi s "blobs" === */

.bg-blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.bg-blobs::before,
.bg-blobs::after,
.bg-blobs .blob {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}

.bg-blobs::before {
  width: 60vw;
  height: 60vw;
  background: var(--blob-1);
  top: -10%;
  left: -10%;
  animation: blobFloat1 22s var(--ease-in-out) infinite;
}

.bg-blobs::after {
  width: 50vw;
  height: 50vw;
  background: var(--blob-2);
  bottom: -15%;
  right: -10%;
  animation: blobFloat2 26s var(--ease-in-out) infinite;
}

.bg-blobs .blob-3 {
  width: 45vw;
  height: 45vw;
  background: var(--blob-3);
  top: 30%;
  right: 20%;
  animation: blobFloat3 30s var(--ease-in-out) infinite;
  opacity: 0.35;
}

[data-theme="light"] .bg-blobs::before,
[data-theme="light"] .bg-blobs::after,
[data-theme="light"] .bg-blobs .blob {
  opacity: 0.45;
}

/* === Typografie === */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

.text-sm  { font-size: var(--fs-sm); }
.text-md  { font-size: var(--fs-md); }
.text-lg  { font-size: var(--fs-lg); }
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-danger    { color: var(--color-danger); }
.text-info      { color: var(--color-info); }

.text-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.font-medium   { font-weight: var(--fw-medium); }
.font-semibold { font-weight: var(--fw-semibold); }
.font-bold     { font-weight: var(--fw-bold); }

.font-mono { font-family: var(--font-mono); }

/* === Hlavni layout === */

#app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-top: var(--safe-top);
  padding-bottom: 0;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  overflow: hidden;
}

.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-5);
  position: relative;
  z-index: var(--z-sticky);
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
.app-header .logo:active { transform: scale(0.96); }

.app-header .logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.app-main {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: var(--sp-6) var(--sp-5) calc(var(--nav-height) + var(--safe-bottom) + var(--sp-5));
}

.app-main::-webkit-scrollbar { width: 0; display: none; }

.view-container {
  max-width: var(--max-content-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* === Bottom navigation === */

.bottom-nav {
  position: fixed;
  bottom: var(--safe-bottom);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--sp-5) * 2 - var(--safe-left) - var(--safe-right));
  max-width: 520px;
  height: var(--nav-height);
  margin-bottom: var(--sp-3);
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--sp-3);
  border-radius: var(--r-2xl);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--sp-2) var(--sp-1);
  border-radius: var(--r-md);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: var(--fw-medium);
  position: relative;
  transition: color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-spring);
}

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.nav-item.active {
  color: var(--section-accent);
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 8px var(--section-glow));
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-item .nav-indicator {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--section-accent), var(--section-accent-2));
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out);
}

.nav-item.active .nav-indicator { opacity: 1; }

/* === Tlacitka === */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 48px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-lg);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease-spring),
    background-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

/* Když se popisek do tlačítka nevejde (úzké displeje), oříznout s výpustkou –
   bez toho by text tvrdě uřízl overflow:hidden na hraně tlačítka. */
.btn > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.btn-primary:hover { box-shadow: var(--shadow-lg), var(--shadow-glow); }

.btn-secondary {
  background: var(--glass-bg-strong);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--state-hover); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-sm { height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-sm); border-radius: var(--r-md); }
.btn-lg { height: 56px; padding: 0 var(--sp-6); font-size: var(--fs-md); border-radius: var(--r-xl); }
.btn-block { width: 100%; }

/* === Formulare === */

/* Formuláře v modalech mají konzistentní vertikální rytmus. */
.modal-sheet form { display: flex; flex-direction: column; gap: var(--sp-4); }

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: 12px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
  padding-left: var(--sp-1);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--sp-4);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--r-md);
  color: var(--input-text);
  /* 16px je minimum, jinak iOS Safari při fokusu políčko přizoomuje
     (--fs-base je 15px). Nesnižovat pod 16px na žádném vstupu. */
  font-size: 16px;
  font-weight: var(--fw-medium);
  outline: none;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

.form-textarea { min-height: 100px; padding: var(--sp-3) var(--sp-4); resize: vertical; }

/* Dlouhý placeholder v úzkém poli oříznout s výpustkou, ne uprostřed slova. */
.form-input::placeholder { text-overflow: ellipsis; }

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px var(--state-focus);
}

.form-input.valid   { border-color: var(--color-success); }
.form-input.invalid { border-color: var(--color-danger); animation: shake 400ms var(--ease-out); }

.form-error {
  font-size: var(--fs-xs);
  color: var(--color-danger);
  padding-left: var(--sp-1);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.form-hint {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  padding-left: var(--sp-1);
}

/* Rozbalovací kalkulačka maker (Nastavení → Makra a kalorie) */
.macro-calc {
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-4);
  background: var(--glass-bg-soft);
}
.macro-calc-summary {
  cursor: pointer;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  list-style: none;
  padding: var(--sp-1) 0;
}
.macro-calc-summary::-webkit-details-marker { display: none; }
.macro-calc[open] .macro-calc-summary { color: var(--text-primary); margin-bottom: var(--sp-3); }
.macro-calc-body { display: flex; flex-direction: column; gap: var(--sp-3); }

/* Karty 3 metod hubnutí (výsledek kalkulačky) */
.plan-base { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--text-secondary); text-align: center; }
.plan-label { margin: var(--sp-3) 0 var(--sp-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-primary); }
.method-card {
  display: block; width: 100%; text-align: left;
  padding: var(--sp-3); margin-bottom: var(--sp-2);
  border-radius: var(--r-lg); border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  transition: transform 60ms var(--ease-out), border-color var(--t-fast);
}
.method-card:active { transform: scale(0.98); border-color: var(--brand-primary); }
.method-main { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.method-name { font-weight: var(--fw-bold); font-size: var(--fs-base); color: var(--text-primary); }
.method-kcal { font-weight: var(--fw-bold); color: var(--brand-primary); white-space: nowrap; }
.method-sub { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: 3px; }

/* === PIN input === */

.pin-input-container {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  padding: var(--sp-5) 0;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--glass-border-strong);
  background: transparent;
  transition: all var(--t-fast) var(--ease-spring);
}

.pin-dot.filled {
  background: var(--brand-gradient);
  border-color: transparent;
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(124,58,237,0.5);
}

.pin-dot.error {
  border-color: var(--color-danger);
  animation: shake 400ms var(--ease-out);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  width: min(320px, 100%);
  margin: 0 auto;
}

.pin-key {
  aspect-ratio: 1 / 1;
  min-height: 72px;
  border-radius: var(--r-xl);
  font-size: 26px;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: transform var(--t-fast) var(--ease-spring), background-color var(--t-fast) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-key:active {
  transform: scale(0.93);
  background: var(--state-active);
}

.pin-key.delete,
.pin-key.biometric {
  font-size: 22px;
  font-weight: var(--fw-medium);
  background: transparent;
  border-color: transparent;
}

/* === Switch === */

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-full);
  transition: background-color var(--t-base) var(--ease-out);
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base) var(--ease-spring);
}

.switch input:checked + .switch-slider {
  background: var(--brand-gradient);
  border-color: transparent;
}

.switch input:checked + .switch-slider::before {
  transform: translateY(-50%) translateX(20px);
}

/* === Progress bar === */

.progress {
  width: 100%;
  height: 8px;
  background: var(--glass-bg-strong);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--brand-gradient);
  transition: width var(--t-slow) var(--ease-out);
  position: relative;
}

.progress-fill.green  { background: linear-gradient(90deg, #10B981, #34D399); }
.progress-fill.orange { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.progress-fill.red    { background: linear-gradient(90deg, #EF4444, #F87171); }

/* === Avatar === */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  border: 2px solid var(--glass-border);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

button.avatar, .avatar-editable { padding: 0; cursor: pointer; flex-shrink: 0; }

.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-sm); }
.avatar-lg { width: 64px; height: 64px; font-size: var(--fs-lg); }
.avatar-xl { width: 96px; height: 96px; font-size: var(--fs-2xl); border-width: 3px; }

/* === Toast notifikace === */

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: calc(100vw - var(--sp-5) * 2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: toastIn 350ms var(--ease-spring);
}

.toast.removing { animation: toastOut 250ms var(--ease-out) forwards; }

.toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Akční tlačítko toastu (např. „Vrátit" po smazání) */
.toast-action {
  flex-shrink: 0;
  margin-left: auto;
  padding: var(--sp-1) var(--sp-3);
  border: none;
  border-radius: var(--r-full);
  background: var(--glass-bg-strong);
  color: var(--brand-primary-light);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
.toast-action:active { transform: scale(0.95); }

.toast.success .toast-icon { color: var(--color-success); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.error   .toast-icon { color: var(--color-danger); }
.toast.info    .toast-icon { color: var(--color-info); }

/* === Skeleton loader === */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--glass-bg) 0%,
    var(--glass-bg-strong) 50%,
    var(--glass-bg) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1400ms linear infinite;
  border-radius: var(--r-md);
}

.skeleton-text {
  height: 14px;
  margin: 6px 0;
}

.skeleton-title { height: 22px; width: 60%; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }

/* === Empty state === */

.empty-state {
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  background: var(--brand-gradient-soft);
  color: var(--brand-primary-light);
  margin-bottom: var(--sp-1);
}
.empty-state .empty-icon svg {
  width: 34px;
  height: 34px;
  opacity: 0.95;
}

.empty-state-compact { padding: var(--sp-5) var(--sp-4); gap: var(--sp-2); }
.empty-state-compact .empty-title { font-size: var(--fs-base); }
.empty-state .empty-mascot { margin-bottom: calc(var(--sp-2) * -1); }
.empty-state .empty-mascot .sed-mascot { display: block; margin: 0 auto; }

.empty-state .empty-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Drobná prázdná zpráva uvnitř sekce (pod-seznamy) – jednotný vzhled. */
.empty-inline {
  padding: var(--sp-3) 0;
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  text-align: center;
}

/* === Dashboard greeting === */

.greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-2);
}

.greeting-text { display: flex; flex-direction: column; gap: 2px; }
.greeting-hello { font-size: var(--fs-sm); color: var(--text-tertiary); font-weight: var(--fw-medium); }
.greeting-name  { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; }

/* === Karty (grid layout) === */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  align-items: start;
}

.cards-grid .card-full { grid-column: span 2; }

/* Stejně vysoké karty v párovém řádku, obsah hezky odshora */
.cards-grid > .card { display: flex; flex-direction: column; }
.cards-grid > .card .card-header { margin-bottom: var(--sp-2); }

/* === Listy === */

.list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-spring);
  cursor: pointer;
}

.list-item:active { transform: scale(0.98); background: var(--state-active); }

/* Automatické položky (svátky/narozeniny) – jen informativní, bez interakce. */
.list-item-static { cursor: default; }
.list-item-static:active { transform: none; background: transparent; }

.list-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg-strong);
  flex-shrink: 0;
}

.list-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item-title { font-weight: var(--fw-semibold); font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-meta { font-size: var(--fs-sm); color: var(--text-tertiary); }
.list-item-trailing { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }

/* === Modal / Bottom sheet === */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn var(--t-base) var(--ease-out);
}

.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  /* --kb-height = výška softwarové klávesnice (js/utils/keyboard.js).
     Sheet se o ni zvedne a zkrátí, aby ho klávesnice na iOS nepřekryla. */
  max-height: calc(88dvh - var(--kb-height, 0px));
  margin: 0 var(--sp-3) calc(var(--safe-bottom) + var(--sp-3) + var(--kb-height, 0px));
  transition: margin-bottom 200ms var(--ease-out), max-height 200ms var(--ease-out);
  border-radius: var(--r-3xl);
  padding: var(--sp-5);
  padding-bottom: calc(var(--sp-5) + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  animation: sheetUp 350ms var(--ease-spring);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--text-muted);
  border-radius: var(--r-full);
  margin: 0 auto var(--sp-2);
  opacity: 0.5;
}

/* Zavírací animace modalu */
.modal-backdrop.removing { animation: fadeOut 280ms var(--ease-out) forwards; }
.modal-backdrop.removing .modal-sheet { animation: sheetDown 280ms var(--ease-out) forwards; }
/* Během tažení prstem (swipe-to-dismiss) řídí polohu sheetu inline transform,
   ne CSS animace – jinak by animace přepsala tažení a poskočilo by to. */
.modal-sheet.sheet-dragging { animation: none !important; }
.modal-close {
  transition: transform var(--t-fast) var(--ease-spring), background var(--t-fast);
}
.modal-close:active { transform: scale(0.85) rotate(90deg); }

.modal-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); }

.modal-close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--glass-bg-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* === Badge / Chip === */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  background: var(--glass-bg-strong);
  color: var(--text-secondary);
}

.badge.success { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.badge.warning { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.badge.danger  { background: rgba(239, 68, 68, 0.15);  color: #F87171; }
.badge.info    { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.badge.primary { background: rgba(124, 58, 237, 0.18); color: #A78BFA; }

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-2);
  border-radius: var(--r-xl);
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  transition: transform var(--t-fast) var(--ease-spring);
}

.quick-action:active { transform: scale(0.95); }

/* === FAB (Floating Action Button) === */

.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--sp-5));
  right: calc(var(--sp-5) + var(--safe-right));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--section-accent), var(--section-accent-2));
  color: #fff;
  box-shadow: var(--shadow-lg), 0 0 32px var(--section-glow);
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--t-fast) var(--ease-spring);
}

.fab:active { transform: scale(0.92); }
.fab svg { width: 24px; height: 24px; }

/* === Utility === */

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.flex-1        { flex: 1; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }

.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

.text-center { text-align: center; }
.text-right  { text-align: right; }

.full-width  { width: 100%; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.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;
}

:focus-visible {
  outline: 2px solid var(--section-accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

button:focus:not(:focus-visible) { outline: none; }

/* Přístupnost: dlouhý text (postup receptu, poznámky, ingredience) jde označit
   a zkopírovat i na iOS – tlačítka zůstávají neoznačitelná (mají user-select:none). */
.recipe-steps, .recipe-step, .ingredient-rows, .ingredient-row,
.list-item-title, .list-item-meta, .task-title,
textarea, .modal-title, .card-value, .stat-value {
  -webkit-user-select: text;
  user-select: text;
}


