/* ScodinzolHouse Gestionale — Design System */
:root {
  --bg: #0d1b2a;
  --card: #1a2a3a;
  --card2: #243447;
  --gold: #c9a84c;
  --gold-dim: #a08030;
  --text: #e8e4dc;
  --text-dim: #8a9bb0;
  --green: #4caf7d;
  --red: #e05c5c;
  --amber: #e0a040;
  --blue: #4a90d9;
  --border: rgba(201,168,76,0.15);
  --tab-h: 60px;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  overflow: hidden;
}

/* ─── LAYOUT ─── */
#app { display: flex; flex-direction: column; height: 100vh; }

#header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#header .logo { font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: 0.5px; }
#header .subtitle { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
#header .btn-refresh {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--gold);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
}
#header .btn-refresh:active { opacity: 0.7; }

#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(var(--tab-h) + 12px);
}

/* ─── TAB BAR ─── */
#tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tab-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: color 0.15s;
}
.tab-btn svg { width: 22px; height: 22px; }
.tab-btn.active { color: var(--gold); }

/* ─── TABS ─── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── CARDS ─── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px;
  margin-bottom: 10px;
}
.card-title { font-size: 12px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }

/* ─── KPI ROW ─── */
.kpi-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.kpi-chip {
  flex: 1;
  background: var(--card2);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}
.kpi-chip .val { font-size: 22px; font-weight: 800; color: var(--gold); line-height: 1; }
.kpi-chip .lbl { font-size: 10px; color: var(--text-dim); margin-top: 4px; font-weight: 600; }

/* ─── CANE CARD ─── */
.dog-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}
.dog-card.checked-in { border-color: var(--green); }
.dog-card.checked-out { opacity: 0.55; }
.dog-card .dog-header { display: flex; align-items: center; justify-content: space-between; }
.dog-name { font-size: 15px; font-weight: 700; }
.dog-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}
.badge-pensione { background: rgba(74,144,217,0.2); color: #4a90d9; }
.badge-day_care { background: rgba(201,168,76,0.2); color: var(--gold); }
.badge-dw { background: rgba(160,108,213,0.2); color: #b58ae0; }
.dog-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.dog-note { font-size: 11px; color: var(--amber); margin-top: 3px; font-style: italic; }
.dog-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-checkin, .btn-checkout, .btn-nota-toggle {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.btn-checkin { background: var(--green); color: #fff; }
.btn-checkout { background: var(--red); color: #fff; }
.btn-nota-toggle { background: var(--card2); color: var(--text-dim); border: 1px solid var(--border); }
.btn-checkin:active, .btn-checkout:active, .btn-nota-toggle:active { opacity: 0.75; }
.dog-status { font-size: 11px; color: var(--green); margin-top: 6px; font-weight: 600; }
.dog-status.out { color: var(--text-dim); }

/* ─── STAFF CHIPS ─── */
.staff-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.staff-chip {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
}
.staff-chip .orario { color: var(--text-dim); font-weight: 400; }

/* ─── SETTIMANA ─── */
.week-day {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.week-day.today { border-color: var(--gold); }
.week-day-header { display: flex; align-items: center; justify-content: space-between; }
.week-day-label { font-size: 13px; font-weight: 700; }
.week-day.today .week-day-label { color: var(--gold); }
.week-day-right { text-align: right; }
.week-day-count { font-size: 20px; font-weight: 800; color: var(--gold); line-height: 1; }
.week-day-count-lbl { font-size: 10px; color: var(--text-dim); }
.week-bar-wrap { margin-top: 8px; background: var(--card2); border-radius: 4px; height: 4px; }
.week-bar { height: 4px; border-radius: 4px; background: var(--gold); }
.week-staff { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.week-day-dogs { margin-top: 10px; display: none; border-top: 1px solid var(--border); padding-top: 10px; }
.week-day-dogs.open { display: block; }
.week-dog-pill {
  display: inline-block;
  background: var(--card2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  margin: 2px 3px 2px 0;
}

/* ─── CLIENTI ─── */
#clienti-search {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
}
#clienti-search:focus { border-color: var(--gold); }
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-chip {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.filter-chip.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.client-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.client-card:active { opacity: 0.8; }
.client-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.client-name { font-size: 14px; font-weight: 700; }
.client-tipo { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.tipo-privato { background: rgba(74,144,217,0.15); color: #4a90d9; }
.tipo-azienda { background: rgba(201,168,76,0.15); color: var(--gold); }
.client-meta { font-size: 11px; color: var(--text-dim); margin-top: 5px; }
.client-meta a { color: var(--text-dim); text-decoration: none; }
.client-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.client-fatturato { font-size: 16px; font-weight: 800; color: var(--gold); }
.client-nfat { font-size: 11px; color: var(--text-dim); }
.no-results { text-align: center; color: var(--text-dim); padding: 40px 0; font-size: 13px; }

/* ─── KPI TAB ─── */
.kpi-person-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.kpi-person-name { font-size: 14px; font-weight: 800; color: var(--gold); margin-bottom: 2px; }
.kpi-person-role { font-size: 11px; color: var(--text-dim); margin-bottom: 12px; }
.kpi-metric { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.kpi-metric:last-child { border-bottom: none; }
.kpi-metric-name { font-size: 12px; color: var(--text-dim); }
.kpi-metric-right { text-align: right; }
.kpi-metric-val { font-size: 15px; font-weight: 800; }
.kpi-metric-val.green { color: var(--green); }
.kpi-metric-val.amber { color: var(--amber); }
.kpi-metric-val.red { color: var(--red); }
.kpi-metric-val.neutral { color: var(--text); }
.kpi-target { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.progress-wrap { margin-top: 10px; }
.progress-bar-bg { background: var(--card2); border-radius: 4px; height: 8px; }
.progress-bar-fill { height: 8px; border-radius: 4px; background: var(--green); max-width: 100%; }
.progress-label { font-size: 10px; color: var(--text-dim); margin-top: 4px; display: flex; justify-content: space-between; }

.finanza-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.finanza-item {
  background: var(--card2);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.finanza-item .val { font-size: 18px; font-weight: 800; color: var(--gold); }
.finanza-item .lbl { font-size: 10px; color: var(--text-dim); margin-top: 3px; }

/* ─── FAB ─── */
#fab {
  position: fixed;
  bottom: calc(var(--tab-h) + 14px);
  right: 16px;
  width: 52px; height: 52px;
  background: var(--gold);
  border-radius: 50%;
  border: none;
  color: var(--bg);
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 99;
  line-height: 1;
}
#fab:active { transform: scale(0.92); }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid var(--border);
  padding: 20px 18px 32px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 16px; font-weight: 800; }
.modal-close {
  background: none; border: none;
  color: var(--text-dim); font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-type-row { display: flex; gap: 8px; margin-bottom: 16px; }
.modal-type-btn {
  flex: 1; padding: 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card2);
  color: var(--text-dim); font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.modal-type-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.form-group { margin-bottom: 12px; }
.form-label { font-size: 11px; color: var(--text-dim); font-weight: 700; margin-bottom: 5px; display: block; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); }
.form-select option { background: var(--card2); color: var(--text); }
.form-textarea { resize: none; height: 80px; }
.btn-submit {
  width: 100%; padding: 13px;
  background: var(--gold); color: var(--bg);
  border: none; border-radius: 10px;
  font-family: inherit; font-size: 15px; font-weight: 800;
  cursor: pointer; margin-top: 4px;
}
.btn-submit:active { opacity: 0.8; }
.modal-form { display: none; }
.modal-form.active { display: block; }

/* ─── NOTA INLINE ─── */
.nota-inline { margin-top: 8px; display: none; }
.nota-inline.open { display: flex; gap: 6px; }
.nota-inline input {
  flex: 1; background: var(--card2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; color: var(--text);
  font-family: inherit; font-size: 13px; outline: none;
}
.nota-inline input:focus { border-color: var(--gold); }
.nota-inline button {
  background: var(--gold); color: var(--bg); border: none;
  border-radius: 8px; padding: 7px 14px; font-family: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ─── TOAST ─── */
#toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 300;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }

/* ─── SECTION LABEL ─── */
.section-label {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin: 14px 0 8px;
}
.section-label:first-child { margin-top: 4px; }

/* ─── SCROLLBAR ─── */
#content::-webkit-scrollbar { width: 3px; }
#content::-webkit-scrollbar-track { background: transparent; }
#content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── DESKTOP ─── */
@media (min-width: 768px) {
  #content { max-width: 560px; margin: 0 auto; }
  #tabbar { max-width: 560px; left: 50%; transform: translateX(-50%); border-radius: var(--radius) var(--radius) 0 0; }
  #fab { right: calc(50% - 280px + 16px); }
}

/* ─── LOGIN (cloud) ─── */
#login-screen { position:fixed; top:0; left:0; right:0; bottom:0; z-index:1000; background:var(--bg); display:grid; place-items:center; padding:16px; }
.login-box { width:min(340px, 100%); background:var(--card); border:1px solid var(--border); border-radius:16px; padding:32px 24px; text-align:center; }
.login-logo { width:64px; height:64px; border-radius:16px; background:var(--gold); color:var(--bg); font-weight:800; font-size:24px; display:flex; align-items:center; justify-content:center; margin:0 auto 16px; }
.login-title { font-size:22px; font-weight:800; color:var(--text); }
.login-sub { font-size:13px; color:var(--text-dim); margin-bottom:24px; }
.login-box input { width:100%; padding:13px 14px; margin-bottom:12px; background:var(--card2); border:1px solid var(--border); border-radius:10px; color:var(--text); font-family:inherit; font-size:15px; }
.login-box input:focus { outline:none; border-color:var(--gold); }
#li-btn { width:100%; padding:14px; background:var(--gold); color:var(--bg); border:none; border-radius:10px; font-weight:700; font-size:15px; font-family:inherit; cursor:pointer; margin-top:4px; }
#li-btn:disabled { opacity:.6; }
#li-err { color:var(--red); font-size:13px; margin-top:12px; min-height:18px; }

/* ─── FIX overflow orizzontale (flexbox min-width) ─── */
html, body { overflow-x: hidden; max-width: 100%; }
#app, #header, #content { max-width: 100%; overflow-x: hidden; }
.tab-panel, .card, .dog-card, .client-card, .week-day, .kpi-person-card { max-width: 100%; box-sizing: border-box; }
.dog-header, .client-header, .dog-meta, .client-meta, .dog-actions, .week-day-header, .kpi-metric, .client-footer { min-width: 0; }
.dog-header > *:not(.dog-badge), .client-header > *:not(.client-tipo) { min-width: 0; overflow: hidden; }
.client-meta, .dog-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── PROGRAMMA TECNICO nella card cane ─── */
.dog-programma { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.prog-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; cursor: pointer; }
.prog-item input { width: 17px; height: 17px; accent-color: var(--green); }
.prog-item.prog-done span { text-decoration: line-through; color: var(--text-dim); }
.prog-fb { background: none; border: 1px solid var(--border); color: var(--gold); border-radius: 6px; font-size: 11px; padding: 2px 7px; cursor: pointer; margin-left: auto; }

/* ─── OGGI semplificata ─── */
.oggi-riepilogo { padding: 4px 2px 14px; }
.oggi-big { font-size: 24px; font-weight: 800; color: var(--gold); }
.oggi-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.btn-big { font-size: 16px !important; padding: 14px !important; }
.prog-title { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.prog-add { width: 100%; margin-top: 6px; padding: 10px; background: var(--card2); color: var(--text-dim); border: 1px dashed var(--border); border-radius: 8px; font-family: inherit; font-size: 13px; }
.prog-fb-text { margin-left: 24px; }
.comeandata { margin-top: 10px; }
.umore-row { display: flex; gap: 6px; }
.umore-btn { flex: 1; padding: 10px 4px; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.umore-btn.umore-on { background: var(--gold); color: var(--bg); border-color: var(--gold); }

/* ─── TAB CANI ─── */
#cani-search { width: 100%; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: inherit; font-size: 15px; margin-bottom: 10px; }
.cane-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 6px; cursor: pointer; }
.cane-row-avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--gold); color: var(--bg); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.cane-row-nome { font-weight: 700; flex: 1; }
.cane-row-arrow { color: var(--text-dim); font-size: 20px; }
.diario-data { font-weight: 700; font-size: 13px; color: var(--gold); margin-bottom: 6px; }
.diario-att { font-size: 13px; padding: 3px 0; }
.diario-fb { color: var(--text-dim); font-style: italic; }

/* ─── TIMELINE giornata ─── */
.timeline { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.tl-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; border-bottom: 1px dashed rgba(255,255,255,.04); }
.tl-row:last-child { border-bottom: none; }
.tl-ora { font-weight: 800; color: var(--gold); min-width: 44px; }
.tl-verso { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 12px; }
.tl-in { background: rgba(76,175,125,.15); color: var(--green); }
.tl-out { background: rgba(224,160,64,.15); color: var(--amber); }
.tl-nome { font-weight: 600; flex: 1; }
.tl-check { color: var(--green); font-weight: 800; }
.tl-fatto .tl-nome { color: var(--text-dim); }

/* ─── CLIENTI umani ─── */
.cliente-cani { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.cliente-cane { background: var(--card2); border: 1px solid var(--border); border-radius: 14px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.cliente-cane:active { border-color: var(--gold); }

/* ─── SCHEDE campi (cane/cliente) ─── */
.campo-riga { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed rgba(255,255,255,.04); }
.campo-label { color: var(--text-dim); flex-shrink: 0; }
.campo-val { font-weight: 600; text-align: right; }
.campo-riga-edit { margin-bottom: 8px; }
.campo-riga-edit .campo-label { display: block; font-size: 11px; margin-bottom: 3px; }
.campo-input { width: 100%; padding: 10px 12px; background: var(--card2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: inherit; font-size: 14px; }
.campo-input:focus { outline: none; border-color: var(--gold); }
.link-oro { color: var(--gold); cursor: pointer; text-decoration: underline; }


/* ─── INFO VITALI sulla card (allergie, farmaci, cibo, emergenza) ─── */
.vital-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.vchip { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 12px; background: var(--card2); border: 1px solid var(--border); color: var(--text-dim); text-decoration: none; }
.vchip-red { background: rgba(200,80,80,.15); border-color: rgba(200,80,80,.4); color: var(--red); }
.vchip-amber { background: rgba(224,160,64,.12); border-color: rgba(224,160,64,.35); color: var(--amber); }
.vchip-tel { color: var(--gold); border-color: rgba(201,168,76,.4); }

/* nome cane tappabile -> scheda */
.dog-name-link { cursor: pointer; }
.dog-name-link:active { opacity: .6; }
.dog-name-arrow { color: var(--gold); font-weight: 800; }

/* ─── DIARIO DI OGGI: bottoni evento + elenco registrazioni ─── */
.fisio { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.fisio-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.fisio-label { font-size: 11px; font-weight: 700; color: var(--text-dim); min-width: 68px; flex-shrink: 0; }
.fisio-btns { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.fisio-btn { padding: 7px 10px; background: var(--card2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.fisio-btn:active { background: var(--gold); color: var(--bg); }
.prog-hint { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: .7; }
.diario-eventi { margin-top: 8px; background: var(--card2); border-radius: 10px; padding: 6px 10px; }
.evento-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; border-bottom: 1px dashed rgba(255,255,255,.05); cursor: pointer; }
.evento-row:last-child { border-bottom: none; }
.evento-ora { font-weight: 800; color: var(--gold); min-width: 40px; }
.evento-txt { flex: 1; }
.evento-x { color: var(--text-dim); font-size: 10px; }

/* ─── REPORT WHATSAPP ─── */
.btn-report { width: 100%; padding: 11px; border: 1px solid rgba(201,168,76,.5); border-radius: 10px; background: rgba(201,168,76,.1); color: var(--gold); font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-report:active { background: var(--gold); color: var(--bg); }

/* ─── RIGA COMPATTA (colpo d'occhio) + accordion ─── */
.dog-compact { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; }
.dog-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dog-dot.st-in { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dog-dot.st-wait { background: var(--gold); }
.dog-dot.st-out { background: var(--text-dim); opacity: .5; }
.dog-compact-main { flex: 1; min-width: 0; }
.dog-compact-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.dog-compact-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.dog-icons { font-size: 12px; margin-top: 3px; color: var(--text); opacity: .9; }
.dog-chevron { color: var(--text-dim); font-size: 12px; flex-shrink: 0; padding: 4px; }
.warn-mini { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; margin-left: 3px; }
.warn-red { background: rgba(200,80,80,.18); color: var(--red); }
.warn-amber { background: rgba(224,160,64,.15); color: var(--amber); }
.dog-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tl-app { background: rgba(125,140,224,.18); color: #8f9ce6; }

/* ─── SERVIZI ESTERNI Area 1 (walking, appuntamenti): famiglia viola ─── */
.tl-walk { background: rgba(160,108,213,.18); color: #b58ae0; }
.dog-dot.st-walk { background: #b58ae0; }
.btn-walk { background: #8a63b8 !important; }
.prog-del { background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 6px; font-size: 10px; padding: 2px 7px; cursor: pointer; flex-shrink: 0; }
.prog-del:active { color: var(--red); border-color: var(--red); }

/* ─── PIANO GIORNATA TABELLARE ─── */
.tlb-head, .tlb-row { display: grid; grid-template-columns: 1fr 84px 84px; gap: 8px; align-items: center; }
.tlb-head { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); padding: 2px 0 6px; border-bottom: 1px solid var(--border); }
.tlb-row { padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,.05); font-size: 13px; }
.tlb-row:last-of-type { border-bottom: none; }
.tlb-row.done { opacity: .5; }
.tlb-nome { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlb-ora { font-weight: 800; font-size: 14px; color: var(--gold); }
.tlb-ora.fatto { color: var(--green); }
.tlb-sep { margin-top: 12px; padding: 6px 0; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #b58ae0; border-bottom: 1px solid rgba(160,108,213,.3); }
.tlb-ext { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed rgba(160,108,213,.15); font-size: 13px; }
.tlb-ext:last-child { border-bottom: none; }
.tlb-ext.done { opacity: .55; }
.tlb-ext-ora { font-weight: 800; font-size: 14px; color: #b58ae0; flex-shrink: 0; min-width: 100px; }
.tlb-ext-label { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tl-fine { font-weight: 400; font-size: 11px; color: var(--text-dim); }

/* orario avvenuto = verde, previsto = oro */
.tl-fatto .tl-ora { color: var(--green); }

/* ─── PIPELINE PROGETTI (Area 2) ─── */
.stato-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.stato-chip { padding: 5px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--card2); color: var(--text-dim); font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.stato-chip.on { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.stato-chip.on-perso { background: var(--red); color: #fff; border-color: var(--red); }

/* ─── PANNELLO ADMIN (quadro entrambe le aree) ─── */
.adm-riga { display: grid; grid-template-columns: 1.4fr 1fr 1fr 44px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,.05); }
.adm-riga:last-child { border-bottom: none; }
.adm-nome { font-weight: 700; font-size: 13px; }
.adm-val { font-weight: 800; font-size: 14px; }
.adm-lbl { display: block; font-size: 9px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.adm-pct { font-size: 11px; font-weight: 700; color: var(--text-dim); text-align: right; }
.adm-tot { border-top: 1px solid var(--border); margin-top: 2px; }

.week-day-count span { margin-left: 3px; }

/* ─── FIX MOBILE: la tab bar non deve coprire l'ultima riga ─── */
#tabbar { height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
#content { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 32px); }

/* Scelta multipla a pastiglie nella scheda cane: si tocca con un dito, non si scrive.
   Riusa .filter-chip (stessa faccia del resto dell'app) e va a capo da solo:
   chi compila ha il guinzaglio nell'altra mano. */
.chip-multi { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.chip-multi .filter-chip { font-size: 12px; padding: 7px 11px; }

/* Contrasti alzati: bianco su verde faceva 2.71:1 — sotto ogni soglia leggibile,
   e "Arrivato" e' il bottone piu' premuto della giornata, spesso al sole. */
.btn-checkin  { color: var(--bg); }
.btn-checkout { color: var(--bg); }

/* Bersagli da dito: erano 23-31px, sotto i 44 minimi. Il caso peggiore era il
   telefono d'emergenza a 23px: cane che sta male, mano occupata dal guinzaglio. */
.btn-checkin, .btn-checkout, .btn-nota-toggle { padding: 13px 14px; }
.chip-multi .filter-chip { padding: 12px 13px; }
.vchip-tel { padding: 13px 14px; font-size: 13px; font-weight: 800; }
.dog-chevron { padding: 14px; }

/* L'errore deve poter andare a capo e restare leggibile (era nowrap: usciva dallo
   schermo da entrambi i lati). */
#toast { white-space: normal; max-width: min(90vw, 420px); text-align: center; line-height: 1.4; }

/* ANNULLA — il tasto che rimette a posto un tocco sbagliato (17/07).
   Volutamente defilato: non deve competere con "Arrivato" e "Fatto", che sono i tasti
   della giornata. Ma 44px di altezza come tutti: si preme col pollice, in cortile. */
.btn-annulla {
  background: transparent; color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 14px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; min-height: 44px;
}
.btn-annulla:active { background: rgba(255,255,255,.06); color: var(--text); }
.dog-annulla-riga {
  display: flex; align-items: center; gap: 10px; margin: 6px 0 2px;
  font-size: 13px; color: var(--text-dim);
}
.btn-annulla-mini { padding: 6px 10px; min-height: 32px; font-size: 12px; }
