/* English Club: un singur accent (magenta), temă deschisă/închisă după sistem.
   Scris întâi pentru telefon (acolo se folosește cel mai des); ecranele late primesc ajustări
   din @media (min-width: 641px).
   Colțuri: 14px pe suprafețe și plăci, 10px pe elemente mici, pastilă pe butoane și chip-uri. */

:root {
  color-scheme: light dark;
  --bg: #fbf6f9;
  --surface: #fffcfe;
  --surface-2: #f6ecf2;
  --line: #ecdae5;
  --line-strong: #dcc1d1;
  --text: #26121f;
  --muted: #6c5565;
  --accent: #c2187a;
  --accent-hover: #a5126a;
  --accent-soft: #fce4f1;
  --on-soft: #8c0f54;
  --accent-ink: #fff6fb;
  --danger: #b42335;
  --shadow: 0 1px 2px rgb(38 18 31 / 0.06), 0 12px 32px -16px rgb(38 18 31 / 0.22);
  --r: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
  --font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Înălțimea barei de sus și a celei de jos (telefon), ca elementele lipite să nu intre sub ele. */
  --topbar-h: 56px;
  --tabbar-h: calc(70px + env(safe-area-inset-bottom));
}

/* Tema închisă: după sistem, sau forțată din butonul din antet (data-theme pe <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #150a12;
    --surface: #1f111b;
    --surface-2: #2a1724;
    --line: #3a2233;
    --line-strong: #563248;
    --text: #f8eaf2;
    --muted: #c4a7b9;
    --accent: #ff5fb2;
    --accent-hover: #ff86c5;
    --accent-soft: #3c162e;
    --on-soft: #ffb8dd;
    --accent-ink: #2a0919;
    --danger: #ff8d98;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 14px 34px -16px rgb(0 0 0 / 0.7);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #150a12;
  --surface: #1f111b;
  --surface-2: #2a1724;
  --line: #3a2233;
  --line-strong: #563248;
  --text: #f8eaf2;
  --muted: #c4a7b9;
  --accent: #ff5fb2;
  --accent-hover: #ff86c5;
  --accent-soft: #3c162e;
  --on-soft: #ffb8dd;
  --accent-ink: #2a0919;
  --danger: #ff8d98;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 14px 34px -16px rgb(0 0 0 / 0.7);
}
:root[data-theme='light'] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  /* Loc pentru bara de jos de pe telefon. */
  padding-bottom: calc(var(--tabbar-h) + 16px);
}
body[data-page='login'] { padding-bottom: env(safe-area-inset-bottom); }

h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.1; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }

/* Meniul diferă pentru admin: data-role e pus din <head> (din ultima vizită), apoi confirmat de server. */
html:not([data-role='admin']) [data-for='admin'],
html[data-role='admin'] [data-for='user'] { display: none !important; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.wrap-wide { max-width: 1520px; }

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

/* ---------- Bara de sus ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  /* Fundal plin, fără backdrop-filter: filtrul ar face din antet „containerul” barei fixe de jos
     (.tabbar e în antet), iar bara ar apărea sus, peste el. */
  background: var(--bg);
}
.brand {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  gap: 8px;
  font: 700 17px/1 var(--font-display);
  text-decoration: none;
  letter-spacing: -0.01em;
}
/* Logo-ul aplicației (public/icons/icon.svg, același cu iconița de pe telefon); colțurile rotunjite sunt în desen. */
.brand-mark { display: block; flex: none; width: 32px; height: 32px; }
.brand-tag {
  font: 600 11px/1 var(--font-body);
  color: var(--on-soft);
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 999px;
}
.top-actions { display: flex; gap: 6px; margin-left: auto; }
.round-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease);
}
.round-btn:hover { border-color: var(--accent); }
.round-btn:active { transform: scale(0.94); }

/* ---------- Navigarea: bară fixă jos pe telefon, pastile în antet pe ecran lat ---------- */
.tabbar {
  position: fixed;
  z-index: 7;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  min-height: 56px;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.tabbar i {
  display: grid;
  place-items: center;
  width: 58px;
  height: 30px;
  border-radius: 999px;
  font-size: 22px;
  transition: background-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.tabbar a:active i { transform: scale(0.92); }
.tabbar a[aria-current='page'] { color: var(--text); }
.tabbar a[aria-current='page'] i { background: var(--accent-soft); color: var(--on-soft); }

/* ---------- Câmpuri și butoane ---------- */
.field { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > legend, .signup .field > label {
  font: 700 19px/1.2 var(--font-display);
  letter-spacing: -0.01em;
  padding: 0;
  margin-bottom: 4px;
}
.field > label { font-weight: 600; font-size: 15px; }

/* 17px: sub 16px, iPhone-ul mărește pagina când atingi câmpul. */
.input, .field input[type='text'], .field input[type='password'], .select {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-size: 17px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: border-color 0.2s;
}
.input:focus, .field input:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field input[aria-invalid='true'] { border-color: var(--danger); }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.help { font-size: 14px; color: var(--muted); }
.help strong { color: var(--text); font-weight: 600; }
.error { font-size: 14px; font-weight: 500; color: var(--danger); }

.pass { position: relative; }
.pass input { padding-right: 52px; }
.pass-eye {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}
.pass-eye:hover { color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease), opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn i { font-size: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary.is-busy { opacity: 0.7; cursor: progress; }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn-block { width: 100%; height: 54px; font-size: 16px; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-sm i { font-size: 16px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.icon-btn i { font-size: 16px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.is-confirm { background: var(--accent); color: var(--accent-ink); }
.icon-danger { color: var(--danger); }

.text-btn {
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--on-soft);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Comutator: „Am cont / Cont nou”, „Toți / Fără înscrieri”. */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}
.seg button {
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.seg button[aria-selected='true'], .seg button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}
.seg-sm button { height: 36px; font-size: 14px; }
.seg button span { margin-left: 4px; color: var(--muted); font-weight: 500; }

.count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--on-soft);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- Login ---------- */
.auth { display: grid; gap: 24px; max-width: 480px; padding-top: 16px; padding-bottom: 40px; }
.auth-intro h1 { font-size: clamp(36px, 10.5vw, 56px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; }
.hl { color: var(--accent); }
.auth-dates {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--on-soft);
  font-size: 14px;
  font-weight: 600;
}
.auth-dates i { font-size: 17px; }
.auth-card {
  display: grid;
  gap: 22px;
  padding: 18px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.auth-title { font-size: 24px; letter-spacing: -0.02em; }
.auth-form { display: grid; gap: 18px; }
.auth-switch { text-align: center; font-size: 15px; color: var(--muted); }
.auth-help { text-align: center; }

/* ---------- Capul paginilor ---------- */
.page { padding-top: 8px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0 22px;
}
.page-head h1 { font-size: clamp(30px, 8vw, 50px); font-weight: 800; letter-spacing: -0.03em; }
.page-head p { margin-top: 8px; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
.page-actions .btn { flex: 1; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 22px; letter-spacing: -0.02em; }

/* ---------- Acasă ---------- */
.greet { padding: 18px 0 22px; }
.greet h1 { font-size: clamp(40px, 12vw, 64px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; overflow-wrap: anywhere; }
.greet-sub { margin-top: 12px; font-size: 16px; color: var(--muted); max-width: 46ch; }

.wk-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 12px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.wk-title span { font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.wk { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wk-day {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
}
.wk-day.is-today { border-color: var(--accent); border-width: 1.5px; }
.wk-date {
  display: grid;
  justify-items: center;
  padding: 6px 0;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  line-height: 1.1;
}
.wk-date span { font-size: 11px; font-weight: 600; }
.wk-date strong { font: 800 21px/1 var(--font-display); }
.wk-date .wk-week { font-size: 20px; padding-top: 2px; }

.mine-empty {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 20px;
  border-radius: var(--r);
  border: 1.5px dashed var(--line-strong);
  color: var(--muted);
}
.mine-empty > i { font-size: 28px; color: var(--accent); }

/* Setările (public/js/settings.js): rotița din antet deschide fereastra de jos. */
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.settings-body { display: grid; }
.set-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 0; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--on-soft);
  font-size: 22px;
}
.set-text { display: grid; gap: 2px; }
.set-text strong { font-weight: 600; }
.set-text > span { color: var(--muted); font-size: 14px; line-height: 1.45; }
.set-link { justify-self: start; margin: 2px 0 -6px; padding-left: 0; font-size: 14px; }
/* Codul QR spre APK (Setări pe calculator): alb chiar și pe tema închisă, altfel camera nu-l citește. */
.set-qr { width: 104px; height: 104px; border-radius: 8px; border: 1px solid var(--line); image-rendering: pixelated; }
.set-steps { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
.set-steps b { color: var(--text); font-weight: 600; }
.set-steps i { vertical-align: -2px; color: var(--accent); }
.set-logout { margin-top: 10px; }

/* Comutatorul: pastilă cu un cerc care alunecă; magenta când e pornit. */
.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background 0.25s var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.3s var(--ease);
}
.switch[aria-checked='true'] { background: var(--accent); }
.switch[aria-checked='true']::after { transform: translateX(20px); }
.switch:disabled { opacity: 0.5; cursor: progress; }

/* Întrebarea de la prima intrare (doar iPhone, unde permisiunea cere o atingere). */
.ask { display: grid; justify-items: start; gap: 10px; }
.ask p { color: var(--muted); margin-bottom: 6px; }
.ask .sheet-actions { width: 100%; }

.poster-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--on-soft);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.poster-link i { font-size: 17px; }
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.entry { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 46px; }
.entry-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 18px;
}
.entry-text { display: grid; min-width: 0; }
.entry-text strong { font-weight: 600; font-size: 15px; line-height: 1.25; }
.entry-text span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Afișul pe tot ecranul */
.photo {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0d0609;
  cursor: zoom-out;
}
.photo::backdrop { background: #0d0609; }
.photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.photo-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.14);
  color: #fff6fb;
  font-size: 20px;
  cursor: pointer;
}
.photo-close:hover { background: rgb(255 255 255 / 0.24); }
.photo[open] img { animation: pop-in 0.35s var(--ease); }

/* ---------- Înscriere ---------- */
.signup { display: grid; gap: 30px; }

/* Plăcile pentru zile și responsabilități sunt radio-uri native, stilizate. */
.days input, .roles input { position: absolute; opacity: 0; pointer-events: none; }

.days { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.day-tile {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px 2px 10px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1.5px solid var(--line);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background-color 0.2s, transform 0.25s var(--ease);
}
.day-tile:hover { border-color: var(--line-strong); }
.day-tile:active { transform: scale(0.96); }
.day-dow { font-size: 13px; font-weight: 600; color: var(--muted); }
.day-num { font: 800 28px/1.05 var(--font-display); letter-spacing: -0.03em; }
.day-meta { font-size: 11px; color: var(--muted); }
/* Pe plăcile înguste, bifa iese în colț, ca să nu acopere ziua. */
.day-mine {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--on-soft);
  font-size: 10px;
  box-shadow: 0 0 0 2px var(--bg);
}
.day-tile:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-tile:has(input:checked) .day-dow,
.day-tile:has(input:checked) .day-meta { color: var(--accent-ink); opacity: 0.9; }
.day-tile:has(input:checked) .day-mine { background: var(--accent-ink); color: var(--accent); }
.day-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.roles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.role-tile {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1.5px solid var(--line);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.25s var(--ease);
}
.role-tile:hover { border-color: var(--line-strong); }
.role-tile:active { transform: scale(0.985); }
.role-tile.is-new { animation: pop-in 0.5s var(--ease); }
.role-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--on-soft);
  font-size: 22px;
  transition: background-color 0.2s, color 0.2s;
}
.role-body { display: grid; gap: 3px; min-width: 0; }
.role-title { font: 700 17px/1.25 var(--font-display); }
.role-desc { font-size: 14px; color: var(--muted); }
.role-foot { display: grid; gap: 1px; margin-top: 8px; font-size: 13px; }
.role-status { font-weight: 600; color: var(--on-soft); }
.role-who { color: var(--muted); overflow-wrap: anywhere; }

/* Rolul ales: chenar mai gros (inset), fără halou. */
.role-tile:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}
.role-tile:has(input:checked) .role-icon { background: var(--accent); color: var(--accent-ink); }
.role-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.role-tile.is-full { cursor: not-allowed; opacity: 0.55; }
.role-tile.is-full:hover { border-color: var(--line); }
.role-tile.is-full .role-status { color: var(--muted); }
.role-tile.is-mine { cursor: default; border-style: dashed; border-color: var(--accent); }
.role-week {
  justify-self: start;
  margin-bottom: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--on-soft);
  font-size: 12px;
  font-weight: 600;
}

#who-name { margin-top: 2px; }

.submit-row {
  position: static;
  bottom: calc(var(--tabbar-h) + 10px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: var(--r);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
/* Bara rămâne lipită jos doar după ce ai ales ceva, ca să nu acopere lista degeaba. */
.signup.has-selection .submit-row { position: sticky; }
.summary { font-size: 14px; color: var(--muted); min-width: 0; }
.summary strong { color: var(--text); font-weight: 600; }
.summary a { color: var(--on-soft); font-weight: 600; }

/* ---------- Programul pe zile ---------- */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 86%;
  gap: 12px;
  margin: 0 -16px;
  padding: 0 16px 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  scrollbar-width: thin;
}
.day-col {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  border-radius: var(--r);
  background: var(--surface-2);
  scroll-snap-align: start;
  animation: rise 0.55s var(--ease) both;
  animation-delay: calc(var(--i) * 50ms);
}
.day-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 10px 10px 12px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
}
.day-head .day-dow { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: inherit; opacity: 0.9; }
.day-head .day-date { font: 800 26px/1.05 var(--font-display); letter-spacing: -0.02em; }
.day-head .day-fill { font-size: 13px; font-weight: 600; opacity: 0.9; }

.slot { padding: 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.slot-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-bottom: 9px; }
.slot-head i { font-size: 18px; color: var(--accent); }
.slot-head h3 { font: 700 15px/1.2 var(--font-display); }
.slot-cap { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
html[data-role='admin'] .slot.is-uncovered { border-style: dashed; border-color: var(--accent); }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--on-soft);
  font-size: 13px;
  font-weight: 500;
  animation: pop-in 0.4s var(--ease) both;
}
.chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.is-me { background: var(--accent); color: var(--accent-ink); }
.me-tag { font-size: 11px; font-weight: 600; opacity: 0.85; }
.chip-free { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); animation: none; }
/* Zona de atingere a × e mai mare decât iconița. */
.chip-x {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -6px -9px -6px -4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.75;
}
.chip-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 18%, transparent); }

/* Pe telefon zilele se derulează în lateral; butoanele de sus sar direct la o zi. */
.day-jump {
  position: sticky;
  top: var(--topbar-h);
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 6px;
  margin: 0 -16px 12px;
  padding: 8px 16px 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.day-jump button {
  display: grid;
  justify-items: center;
  padding: 6px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.day-jump strong { font: 800 18px/1.1 var(--font-display); color: var(--text); }
.day-jump button[aria-current='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-jump button[aria-current='true'] strong { color: var(--accent-ink); }

/* ---------- Echipa (admin) ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { display: grid; gap: 2px; padding: 14px 12px; }
.stat:nth-child(even) { border-left: 1px solid var(--line); }
.stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
.stat-num { font: 800 30px/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: 18px; color: var(--muted); font-weight: 700; }
.stat-label { font-size: 14px; color: var(--muted); }
.stat.is-warn .stat-num { color: var(--accent); }

.gaps { margin-bottom: 20px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.gaps summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.gaps summary::-webkit-details-marker { display: none; }
.gaps summary > i { color: var(--accent); font-size: 20px; }
.gaps summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.25s var(--ease);
}
.gaps[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
#gaps-list { display: grid; gap: 16px; padding: 4px 16px 16px; }
.gap-day h3 { margin-bottom: 8px; font: 600 14px/1.2 var(--font-body); color: var(--muted); }
.gap-day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.gap-day a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px dashed var(--accent);
  color: var(--on-soft);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.gap-day a:hover { background: var(--accent-soft); }

.people-tools { display: grid; gap: 10px; margin-bottom: 14px; }
.search { position: relative; }
.search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.search input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  font-size: 17px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

.people { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.person { padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.person.is-idle { border-style: dashed; }
.person header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.person-id { display: grid; min-width: 0; }
.person h3 { font-size: 18px; overflow-wrap: anywhere; }
.person-user { font-size: 13px; color: var(--muted); }
.person ul { list-style: none; margin: 0; padding: 0; display: grid; }
.person li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 40px; font-size: 14px; }
.p-day { color: var(--muted); font-weight: 600; }
.person-none { font-size: 14px; color: var(--muted); }
.person-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.person-actions .icon-danger { margin-left: auto; }
.people-empty { color: var(--muted); padding: 24px 0; }

/* Fereastra „Parolă nouă”: foaie de jos pe telefon, fereastră centrată pe ecran lat. */
.sheet {
  width: 100%;
  max-width: 100%;
  margin: auto 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.sheet::backdrop { background: rgb(20 6 14 / 0.5); }
.sheet[open] { animation: sheet-up 0.35s var(--ease); }
.sheet form { display: grid; gap: 14px; }
.sheet h2 { font-size: 22px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }

/* ---------- Stări ---------- */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 12px 12px 18px;
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--on-soft);
  font-weight: 500;
}

.skeleton {
  display: block;
  border-radius: var(--r);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.day-skel { height: 84px; }
.role-skel { height: 128px; }
.col-skel { height: 520px; }
.row-skel { height: 66px; }
.person-skel { height: 150px; }
#my-week .skeleton + .skeleton, .people .skeleton + .skeleton { margin-top: 0; }
#my-week { display: grid; gap: 8px; }

.toast {
  position: fixed;
  left: 50%;
  top: max(12px, env(safe-area-inset-top));
  z-index: 10;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 14px 18px;
  border-radius: var(--r);
  background: var(--text);
  color: var(--bg);
  font-weight: 500;
  font-size: 15px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -16px);
  transition: opacity 0.3s, transform 0.4s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
/* Mesajul e popover (vezi toast() din common.js): anulează poziționarea implicită a browserului. */
.toast[popover] { right: auto; bottom: auto; height: auto; margin: 0; border: 0; overflow: visible; }

/* ---------- Mișcare ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.9); } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: no-preference) {
  .auth-intro, .greet { animation: rise 0.6s var(--ease) both; }
  .auth-card { animation: rise 0.6s var(--ease) 0.08s both; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Telefoane foarte înguste: rămâne doar sigla „EC”, numele e oricum mare în pagină. */
@media (max-width: 370px) {
  .brand-name { display: none; }
  .day-num { font-size: 24px; }
}

/* ---------- Ecran lat ---------- */
@media (min-width: 641px) {
  :root { --topbar-h: 68px; }
  body { padding-bottom: 60px; }
  .wrap { padding: 0 24px; }
  .topbar { position: static; gap: 16px; background: none; }
  .brand { font-size: 19px; gap: 10px; }
  .brand-mark { width: 36px; height: 36px; }
  .tabbar {
    position: static;
    display: flex;
    gap: 4px;
    margin-left: auto;
    padding: 0;
    background: none;
    border: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .tabbar a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 0;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s, background-color 0.2s;
  }
  .tabbar a:hover { color: var(--text); background: var(--surface-2); }
  .tabbar i { width: auto; height: auto; font-size: 18px; background: none !important; color: inherit !important; }
  .tabbar a[aria-current='page'] { color: var(--on-soft); background: var(--accent-soft); }
  .top-actions { margin-left: 0; }

  .auth { margin-top: 4vh; padding-top: 0; }
  .auth-card { padding: 26px; }
  .page { padding-top: 0; }
  .page-head { padding: 28px 0 26px; }
  .page-actions { width: auto; }
  .page-actions .btn { flex: none; }
  .greet { padding: 32px 0 28px; }

  .signup { gap: 34px; }
  .days { gap: 10px; }
  .day-tile { padding: 14px 6px 12px; }
  .day-num { font-size: 32px; }
  .day-meta { font-size: 12px; }
  .day-mine { top: 7px; right: 7px; width: 20px; height: 20px; font-size: 11px; box-shadow: none; }
  .roles { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
  .role-tile { padding: 16px; }
  .submit-row { bottom: 16px; border-radius: 999px; padding: 12px 12px 12px 22px; }
  .summary { font-size: 15px; }

  .board { grid-auto-columns: minmax(210px, 1fr); margin: 0; padding: 0 0 40px; }
  .day-col { padding: 12px; }
  .day-jump { display: none; }
  .chip { padding: 4px 11px; }
  .chip-x { width: 18px; height: 18px; margin: 0 -5px 0 0; font-size: 12px; }

  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
  .stat { padding: 18px 20px; }
  .stat + .stat { border-left: 1px solid var(--line); }
  .stat:nth-child(n + 3) { border-top: 0; }
  .stat-num { font-size: 38px; }
  .stat-num small { font-size: 20px; }
  .people-tools { grid-template-columns: minmax(0, 360px) auto; justify-content: space-between; align-items: center; }
  .people { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

  .sheet { width: min(440px, calc(100vw - 32px)); margin: auto; padding: 24px; border-radius: 18px; }
  .sheet-actions { justify-content: flex-end; }
  .sheet-actions .btn { flex: none; }
}

/* ---------- Print (programul, din contul de admin) ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f6ecf2; --text: #1a0d16; --muted: #555; }
  body { padding: 0; }
  .topbar, .tabbar, .page-actions, .day-jump, .toast, .banner, .chip-x, .chip-free { display: none !important; }
  .board { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); overflow: visible; margin: 0; padding: 0; }
  .day-col { break-inside: avoid; animation: none; }
  .day-head, .chip.is-me { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
