/* Agenda Bimajoderma — stil scris de mână, fără framework.
   Desenat întâi pentru telefon (~390px), apoi lăsat să crească.

   Patru mărimi de text în toată aplicația: 22 / 17 / 15 / 13.
   BILET = albastru, PLATĂ = chihlimbar, NETIPIZAT = violet — perechea rămâne
   distinctă și la daltonism, dar culoarea nu e niciodată singurul canal:
   fiecare element are și etichetă text. */

:root {
  --bg:            #f6f7f9;
  --surface:       #ffffff;
  --surface-2:     #f2f4f7;
  --text:          #16181d;
  --text-soft:     #5b6472;
  --muted:         #98a1b0;
  --border:        #e6e9ee;
  --border-strong: #cfd5df;

  --brand:         #0d9488;
  --brand-dark:    #0b7a70;
  --brand-soft:    #e9f8f6;

  --bilet:         #2563eb;
  --bilet-soft:    #eef4ff;
  --plata:         #b45309;
  --plata-soft:    #fdf6e9;
  --nec:           #7c3aed;
  --nec-soft:      #f4f1ff;

  --ok:            #0f9d58;
  --danger:        #c02b45;

  --f1: 22px;   /* titluri de ecran, cifre mari */
  --f2: 17px;   /* text principal */
  --f3: 15px;   /* text secundar */
  --f4: 13px;   /* etichete, meta */

  --r:    14px;
  --r-lg: 20px;
  --tap:  44px;
  --pad:  14px;
  --safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--f3);
  line-height: 1.45;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 12px var(--pad) 104px; }
.spacer { flex: 1 1 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- Butoane ---------------- */

.btn {
  min-height: var(--tap); padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; font-size: var(--f3); font-weight: 600;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background .15s, opacity .15s;
}
.btn:active { opacity: .7; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small   { min-height: var(--tap); padding: 0 14px; font-size: var(--f4); border-radius: 11px; }

.ghost-btn {
  width: var(--tap); height: var(--tap); min-width: var(--tap); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; font-size: var(--f2); line-height: 1; color: var(--text-soft);
}
.ghost-btn:active { background: var(--surface-2); }
.ghost-btn:disabled { opacity: .4; }

/* ---------------- Antet ---------------- */

.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.top-in {
  max-width: 1100px; margin: 0 auto; padding: 6px var(--pad) 10px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center;
}

.top-row { grid-column: 1; display: flex; align-items: center; min-height: 48px; }
.top-row h1 { font-size: var(--f1); font-weight: 700; letter-spacing: -.4px; }
.top-acts { grid-column: 2; display: flex; align-items: center; gap: 6px; }

/* Comutatorul de vedere — o singură vedere pe ecran o dată */
.seg {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  background: var(--surface-2); border-radius: 11px; padding: 3px;
}
.seg button {
  min-height: var(--tap); border-radius: 9px; font-size: var(--f3); font-weight: 600;
  color: var(--text-soft); transition: background .15s, color .15s;
}
.seg button[aria-selected="true"] {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 3px rgba(22,24,29,.12);
}

.nav { grid-column: 1 / -1; display: flex; align-items: center; gap: 2px; }
.nav-title {
  font-size: var(--f2); font-weight: 600; flex: 1 1 auto;
  text-align: center; letter-spacing: -.2px;
}
.nav .btn.small { margin-left: 4px; }

/* ---------------- Banner mod demonstrativ ---------------- */

.banner {
  display: none; margin-bottom: 12px; padding: 11px 13px; border-radius: var(--r);
  background: var(--plata-soft); border: 1px solid #f0dcb4; color: #8a4a08;
  font-size: var(--f4);
}
.banner.show { display: block; }

.note { margin-top: 14px; font-size: var(--f4); color: var(--muted); text-align: center; }

/* ---------------- Bara de alertă: pacienți noi de instruit ----------------
   Apare doar când există ceva de făcut. O bară permanentă ar deveni invizibilă. */

.alertbar {
  display: none; width: 100%; margin-bottom: 12px; padding: 11px 13px;
  border-radius: var(--r); text-align: left;
  background: var(--nec-soft); border: 1px solid #ddd3fb;
  align-items: center; gap: 12px; min-height: var(--tap);
}
.alertbar.show { display: flex; }
.alertbar:active { background: #ece5fd; }
.alertbar .ab-n {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--nec); color: #fff; font-size: var(--f4); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.alertbar .ab-t { display: flex; flex-direction: column; min-width: 0; }
.alertbar .ab-t b { font-size: var(--f3); font-weight: 600; color: #4c1d95; }
.alertbar .ab-t span { font-size: var(--f4); color: var(--text-soft); }
.alertbar::after { content: '›'; margin-left: auto; color: var(--nec); font-size: var(--f2); flex: none; }

/* ---------------- Vederea LUNĂ ----------------
   O căsuță de zi are două elemente: numărul și perechea de bare de ocupare.
   Fără cifre, fără procente — nivelul se citește din lungimea barei. */

.dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.dow div { text-align: center; font-size: var(--f4); color: var(--muted); }

.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.day {
  min-height: 56px; width: 100%; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
  padding: 5px 0 8px; font-size: var(--f2); color: var(--text);
}
.day:active { background: var(--surface-2); }
.day.empty > * { visibility: hidden; }   /* păstrează linia de grilă, ascunde conținutul */
.day.closed { color: var(--muted); opacity: .5; }
.day.past { color: var(--muted); }

.day .dnum {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.day.today .dnum { background: var(--brand); color: #fff; font-weight: 600; }

/* Ocuparea zilei: sus bilet, jos plată. Șinele rămân vizibile și când sunt goale,
   ca absența umplerii să însemne „liber", nu „lipsă de date". */
.day .bars { display: flex; flex-direction: column; gap: 2px; width: 26px; }
.day .bars i {
  display: block; height: 3px; border-radius: 2px;
  background: var(--border); position: relative;
}
.day .bars i::after {
  content: ''; position: absolute; inset: 0 auto 0 0;
  width: var(--p, 0%); border-radius: 2px;
}
.day .bars .bB::after { background: var(--bilet); }
.day .bars .bP::after { background: var(--plata); }
.day.past .bars { opacity: .4; }

/* ---------------- Vederea SĂPTĂMÂNĂ ----------------
   Pe telefon: listă verticală pe zile. Pe desktop: coloane. Aceleași elemente. */

.week { display: flex; flex-direction: column; gap: 12px; }

.wday {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.wday.today { border-color: var(--brand); }
.wday-head {
  padding: 12px 14px 10px; border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.wday-name { font-size: var(--f2); font-weight: 600; }
.wday.today .wday-name { color: var(--brand-dark); }
.wday-meta { font-size: var(--f4); color: var(--text-soft); margin-left: auto; }
.wday-list { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.wday-empty { padding: 6px 4px; font-size: var(--f3); color: var(--muted); }

.add-row {
  min-height: var(--tap); border-radius: 12px; width: 100%;
  border: 1px dashed var(--border-strong); color: var(--text-soft); font-size: var(--f3);
}
.add-row:active { background: var(--surface-2); }

/* Card de programare — inspirat din VetIM, curățat de zgomot */
.appt {
  width: 100%; text-align: left; border-radius: 12px; padding: 10px 12px;
  background: var(--surface-2); border-left: 4px solid var(--border-strong);
  display: flex; flex-direction: column; gap: 3px; min-height: var(--tap);
}
.appt:active { background: #e9ecf1; }
.appt.t-bilet { border-left-color: var(--bilet); background: var(--bilet-soft); }
.appt.t-plata { border-left-color: var(--plata); background: var(--plata-soft); }
.appt.t-necunoscut { border-left-color: var(--nec); background: var(--nec-soft); }
.appt.done { opacity: .55; }

.appt-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: var(--f4); }
.appt-row > * { white-space: nowrap; }
.appt-row .hour { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.appt-row .tag { color: var(--text-soft); }
.appt.t-bilet .tag { color: var(--bilet); }
.appt.t-plata .tag { color: var(--plata); }
.appt.t-necunoscut .tag { color: var(--nec); }
.appt-row .st { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: var(--text-soft); }
.appt-row .st i { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.appt .pname { font-size: var(--f3); font-weight: 600; overflow-wrap: anywhere; }
.appt .pmeta { font-size: var(--f4); color: var(--text-soft); overflow-wrap: anywhere; }

/* ---------------- Vederea AN ---------------- */

.year { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 14px; align-items: start; }
.ymonth { width: 100%; align-self: start; text-align: left; border-radius: var(--r); padding: 4px; }
.ymonth:active { background: var(--surface-2); }
.ym-name { display: block; font-size: var(--f3); font-weight: 600; color: var(--brand-dark); margin-bottom: 4px; }
.ygrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.ycell {
  aspect-ratio: 1 / 1; align-self: center; display: flex; align-items: center; justify-content: center;
  font-size: var(--f4); color: var(--text-soft); border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.ycell.empty { visibility: hidden; }
.ycell.has { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.ycell.today { background: var(--brand); color: #fff; font-weight: 600; }

/* ---------------- Acțiunea principală, ancorată jos pe telefon ---------------- */

.newbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px var(--pad) calc(10px + var(--safe));
  background: linear-gradient(to top, var(--bg) 62%, rgba(246,247,249,0));
}
.newbar .btn { width: 100%; }
.desk-only { display: none; }

/* ---------------- Foaie (telefon) / modal (desktop) ---------------- */

.overlay {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(22,24,29,.42);
}
.overlay.show { display: block; }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0;
  animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }

.sheet-head {
  padding: 16px var(--pad) 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 8px; flex: none;
}
.sheet-titles { flex: 1 1 auto; min-width: 0; }
.sheet-head h3 { font-size: var(--f2); font-weight: 600; letter-spacing: -.2px; }
.sheet-sub { font-size: var(--f4); color: var(--text-soft); margin-top: 2px; }
.sheet-sub:empty { display: none; }

.sheet-body {
  padding: var(--pad); overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 16px;
}
.sheet-foot {
  padding: 12px var(--pad) calc(12px + var(--safe));
  border-top: 1px solid var(--border); background: var(--surface);
  display: flex; gap: 10px; flex: none;
}
.sheet-foot:empty { display: none; }
.sheet-foot .btn { flex: 1; }

/* ---------------- Conținut de foaie ---------------- */

.hint { font-size: var(--f4); color: var(--text-soft); }

/* Rezumatul zilei — text, fără bare de progres */
.sum { display: flex; flex-direction: column; gap: 8px; }
.sum-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 12px; background: var(--surface-2); font-size: var(--f3);
}
.sum-row i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sum-row.bilet { background: var(--bilet-soft); } .sum-row.bilet i { background: var(--bilet); }
.sum-row.plata { background: var(--plata-soft); } .sum-row.plata i { background: var(--plata); }
.sum-row b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.sum-row .full { color: var(--text-soft); font-weight: 400; font-size: var(--f4); }

.daylist { display: flex; flex-direction: column; gap: 8px; }

/* Detaliul unei programări */
.detail { display: flex; flex-direction: column; gap: 6px; }
.detail .big { font-size: var(--f1); font-weight: 600; letter-spacing: -.4px; overflow-wrap: anywhere; }
.detail .line { font-size: var(--f3); color: var(--text-soft); overflow-wrap: anywhere; }
.detail .line a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }

/* ---------------- Contact și mementouri ----------------
   Rând de pacient: oră + tip sus, numele, motivul, apoi acțiunile.
   Pe telefon rândurile sunt carduri; pe desktop devin coloane de tabel (vezi media query). */

/* Trecerea din foaia zilei către lista de contact */
.rowlink {
  min-height: var(--tap); width: 100%; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: var(--f3); font-weight: 600; text-align: left; padding: 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.rowlink::after { content: '›'; margin-left: auto; color: var(--muted); font-size: var(--f2); }
.rowlink:active { background: var(--surface-2); }

.csum { font-size: var(--f4); color: var(--text-soft); }

.clist { display: flex; flex-direction: column; gap: 10px; }

.crow {
  border: 1px solid var(--border); border-left: 4px solid var(--border-strong);
  border-radius: 12px; padding: 11px 13px; background: var(--surface);
  display: flex; flex-direction: column; gap: 4px;
}
.crow.t-bilet { border-left-color: var(--bilet); }
.crow.t-plata { border-left-color: var(--plata); }
.crow.t-necunoscut { border-left-color: var(--nec); }

.crow-top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: var(--f4); }
.crow-top .hour { font-weight: 600; font-variant-numeric: tabular-nums; }
.crow-top .tag { color: var(--text-soft); }
.crow.t-bilet .crow-top .tag { color: var(--bilet); }
.crow.t-plata .crow-top .tag { color: var(--plata); }
.crow.t-necunoscut .crow-top .tag { color: var(--nec); }
.crow-top .sent { margin-left: auto; color: var(--ok); font-weight: 600; }

.cname { font-size: var(--f2); font-weight: 600; overflow-wrap: anywhere; }
.cwhy { font-size: var(--f4); color: var(--text-soft); overflow-wrap: anywhere; }

.cwarn { font-size: var(--f4); color: var(--danger); }

.cacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.cbtn {
  min-height: var(--tap); padding: 0 14px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--f4); font-weight: 600; text-decoration: none;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.cbtn:active { background: var(--surface-2); }
.cbtn.call { font-variant-numeric: tabular-nums; color: var(--brand-dark); border-color: #bfe3df; }
.cbtn.wa { background: var(--brand); border-color: var(--brand); color: #fff; }
.cbtn.sms { color: var(--text-soft); }

/* Rând de alertă — apelul e acțiunea principală, deci e singurul buton plin. */
.crow.alerta { border-left-color: var(--nec); }
.crow.alerta.urgent { border-left-color: var(--danger); background: #fffafb; }
.crow.alerta .crow-top .hour { color: var(--nec); text-transform: capitalize; }
.crow.alerta.urgent .crow-top .hour { color: var(--danger); }
.cbtn.suna {
  background: var(--brand); border-color: var(--brand); color: #fff;
  font-variant-numeric: tabular-nums;
}
.cbtn.gata { color: var(--ok); border-color: #b9e3cb; }
.cbtn.gata:disabled { opacity: .5; }

/* Eticheta „nou” de pe cardul de programare */
.appt-row .nou {
  color: var(--nec); background: var(--nec-soft);
  border-radius: 999px; padding: 1px 8px; font-weight: 600;
}

/* Textul mementoului, exact cum pleacă */
.preview {
  white-space: pre-wrap; overflow-wrap: anywhere;
  padding: 13px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: var(--f3); color: var(--text);
}

/* Listă de acțiuni în foaie */
.acts { display: flex; flex-direction: column; gap: 8px; }
.acts button, .acts a {
  min-height: var(--tap); border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: var(--f3); text-align: left; padding: 0 14px;
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.acts button:active, .acts a:active { background: var(--surface-2); }
.acts .del { color: var(--danger); border-color: #efc8d0; }
.acts i { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Câmpuri de formular */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: var(--f4); color: var(--text-soft); }
.field input {
  min-height: var(--tap); padding: 0 13px; border: 1px solid var(--border-strong);
  border-radius: 12px; background: var(--surface); font-size: var(--f3); width: 100%;
}
.field input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

/* Bifă (pacient nou) — buton întreg, nu casetă mică: ținta de apăsare e tot rândul */
.check {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: var(--tap); padding: 10px 13px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.check:active { background: var(--surface-2); }
.check .box {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  border: 2px solid var(--border-strong); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; line-height: 1; color: transparent;
}
.check .box::after { content: '✓'; }
.check.on { border-color: var(--nec); background: var(--nec-soft); }
.check.on .box { border-color: var(--nec); background: var(--nec); color: #fff; }
.check .lab { display: flex; flex-direction: column; min-width: 0; }
.check .lab b { font-size: var(--f3); font-weight: 600; }
.check.on .lab b { color: #4c1d95; }
.check .lab span { font-size: var(--f4); color: var(--text-soft); }

/* Alegerea tipului */
.tip-pick { display: flex; flex-direction: column; gap: 8px; }
.tip-opt {
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 11px 13px;
  text-align: left; min-height: 60px; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface);
}
.tip-opt .t { font-size: var(--f3); font-weight: 600; }
.tip-opt .q { font-size: var(--f4); color: var(--text-soft); }
.tip-opt[data-tip="bilet"] .t { color: var(--bilet); }
.tip-opt[data-tip="plata"] .t { color: var(--plata); }
.tip-opt[data-tip="bilet"].on { border-color: var(--bilet); background: var(--bilet-soft); }
.tip-opt[data-tip="plata"].on { border-color: var(--plata); background: var(--plata-soft); }
.tip-opt:disabled { opacity: .5; cursor: not-allowed; }

/* Redirecționare când cota de bilete e plină.
   Ton neutru, nu de eroare — cota completă e o stare normală a zilei, nu o defecțiune. */
.redirect {
  border: 1px solid #c7d9fb; background: var(--bilet-soft);
  border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.redirect .r-titlu { font-size: var(--f3); font-weight: 600; color: var(--bilet); }
.redirect .r-sub { font-size: var(--f4); color: var(--text-soft); }
.redirect .r-act {
  min-height: var(--tap); border-radius: 12px; margin-top: 2px;
  background: var(--bilet); color: #fff; font-size: var(--f3); font-weight: 600;
  display: flex; align-items: center; justify-content: center; padding: 0 14px; text-align: center;
}
.redirect .r-alt {
  align-self: flex-start; min-height: var(--tap); padding: 0 2px;
  color: var(--text-soft); font-size: var(--f4); text-decoration: underline;
}

/* Sloturi libere */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; max-height: 232px; overflow-y: auto; padding: 2px; }
.slot {
  min-height: var(--tap); border-radius: 11px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: var(--f3); font-variant-numeric: tabular-nums;
}
.slot.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.slot.current { border-style: dashed; }
.slots-empty { font-size: var(--f3); color: var(--text-soft); }

.msg { font-size: var(--f3); padding: 11px 13px; border-radius: 12px; display: none; }
.msg.show { display: block; }
.msg.err { background: #fdeef1; color: var(--danger); }
.msg.info { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------------- Ecran PIN ---------------- */

.pin-overlay { background: var(--brand-soft); }
.pin-overlay.show { display: flex; align-items: center; justify-content: center; padding: var(--pad); }
.pin-overlay .sheet {
  position: relative; inset: auto; max-width: 340px; width: 100%;
  border-radius: var(--r-lg); animation: none;
}
.pin-dots { display: flex; gap: 10px; justify-content: center; }
.pin-dots i { width: 13px; height: 13px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-strong); }
.pin-dots i.on { background: var(--brand); border-color: var(--brand); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { min-height: 56px; border: 1px solid var(--border-strong); border-radius: 12px; font-size: var(--f1); background: var(--surface); }
.keypad button:active { background: var(--brand-soft); }

/* ---------------- Toast ---------------- */

#toasts {
  position: fixed; left: 50%; bottom: calc(78px + var(--safe)); transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: calc(100% - 28px); max-width: 440px; pointer-events: none;
}
.toast {
  pointer-events: auto; width: 100%; padding: 12px 15px; border-radius: 12px;
  font-size: var(--f3); color: #fff; background: var(--text);
  box-shadow: 0 8px 24px rgba(22,24,29,.24); animation: rise .18s ease-out;
}
.toast.ok  { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ================= Desktop ================= */

@media (min-width: 760px) {
  :root { --pad: 24px; }

  .wrap { padding-bottom: 48px; }
  .newbar { display: none; }
  .desk-only { display: inline-flex; }

  .top-in { padding: 10px var(--pad) 12px; grid-template-columns: 1fr auto 1fr; gap: 10px 16px; }
  .top-row  { grid-column: 1; grid-row: 1; }
  .seg      { grid-column: 2; grid-row: 1; width: 340px; }
  .top-acts { grid-column: 3; grid-row: 1; justify-self: end; }
  .nav      { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .nav-title { flex: 0 1 auto; min-width: 190px; }

  .mgrid { gap: 0; }
  .day {
    min-height: 78px; justify-content: flex-start; align-items: flex-start;
    padding: 7px 10px 10px; border-top: 1px solid var(--border); border-radius: 0;
  }
  .day .dnum { width: 32px; height: 32px; }
  .day .bars { width: 40px; margin-left: 9px; }
  .day .bars i { height: 4px; }
  .day:hover { background: var(--surface-2); }
  .dow div { text-align: left; padding-left: 12px; }

  .week { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: start; }
  .wday-head { flex-direction: column; align-items: flex-start; gap: 0; }
  .wday-meta { margin-left: 0; }

  .year { grid-template-columns: repeat(4, 1fr); gap: 24px 20px; }
  .ymonth:hover { background: var(--surface-2); }

  .overlay.show { display: flex; align-items: center; justify-content: center; padding: 24px; }
  .sheet {
    position: relative; inset: auto; width: 100%; max-width: 560px; max-height: 86vh;
    border-radius: var(--r-lg); box-shadow: 0 24px 60px rgba(22,24,29,.28);
    animation: pop .16s ease-out;
  }
  @keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
  .sheet-foot { padding-bottom: 12px; }

  .tip-pick { flex-direction: row; }
  .tip-pick .tip-opt { flex: 1; }

  /* Lista de contact rămâne pe carduri și pe desktop: foaia are 560px, iar împărțirea pe
     coloane rupea numele și motivul pe câte trei rânduri. Se schimbă doar spațierea. */
  .crow { padding: 12px 14px; }
  .cacts { flex-wrap: nowrap; }
  .cbtn { min-height: 40px; }

  #toasts { bottom: 24px; }
}

@media (min-width: 1100px) {
  .wrap { padding-top: 20px; }
  .day { min-height: 92px; }
}
