/* ── Reset & variabili ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:       #b8960c;
  --gold-light: #d4a820;
  --gold-pale:  #f5ecc8;
  --bg:         #faf9f5;
  --card:       #ffffff;
  --text:       #1c1409;
  --muted:      #5a4c36;
  --border:     #e2d9c0;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
  --green:      #2d7a50;
  --green-bg:   #e8f5ee;
  --red:        #c0392b;
  --red-bg:     #fdecea;
  --blue:       #1a5c8a;
  --blue-bg:    #e8f1fa;
  --orange:     #c06a12;
  --orange-bg:  #fef0e2;
  --purple:     #7c3aed;
  /* urgenza lista riparazioni */
  --urgency-red: #fff0f0;
}

/* ── Tema scuro ──────────────────────────────────────────────────────────── */
[data-theme="scuro"] {
  --gold:       #c9a820;
  --gold-light: #d4b835;
  --gold-pale:  #2a2310;
  --bg:         #141210;
  --card:       #1e1b16;
  --text:       #ede8dc;
  --muted:      #9e9282;
  --border:     #3a3326;
  --shadow:     0 2px 12px rgba(0,0,0,.4);
  --green:      #3aa066;
  --green-bg:   #0d2b1a;
  --red:        #d95f52;
  --red-bg:     #2d0f0c;
  --blue:       #4a8ec2;
  --blue-bg:    #0d1f2d;
  --orange:     #d4832a;
  --orange-bg:  #2a1a08;
  --purple:     #a78bfa;
  --urgency-red: #3d0000;
}
[data-theme="scuro"] .form-control {
  background: #252017;
  border-color: var(--border);
  color: var(--text);
}
[data-theme="scuro"] .form-control:focus {
  background: #2c2719;
  border-color: var(--gold);
}
[data-theme="scuro"] .btn-ghost {
  background: #2a2620;
  color: var(--text);
}
[data-theme="scuro"] .btn-ghost:hover { background: var(--border); }
[data-theme="scuro"] .btn-outline:hover { background: var(--gold-pale); }
[data-theme="scuro"] .modal-box { background: var(--card); color: var(--text); }
[data-theme="scuro"] .stato-popup { background: var(--card); }
[data-theme="scuro"] .stato-popup-item:hover:not(:disabled) { background: var(--bg); }
[data-theme="scuro"] .badge-consegnata { background: #2a2a2a; color: #aaa; }
[data-theme="scuro"] .navbar { background: #0e0c09; }
[data-theme="scuro"] .navbar-brand span { color: #c8c0b0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--text);
  color: var(--gold-light);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.navbar-brand {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  color: var(--gold-light);
}
.navbar-brand span { color: #fff; font-weight: 300; }
.navbar-actions { display: flex; gap: .5rem; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  overflow-x: hidden;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: filter .15s, transform .1s;
  min-height: 44px;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-gold    { background: var(--gold);      color: #fff; }
.btn-gold:hover { filter: brightness(1.12); }
.btn-outline { background: transparent; border: 2px solid var(--gold); color: var(--gold); }
.btn-outline:hover { background: var(--gold-pale); }
.btn-green   { background: var(--green);     color: #fff; }
.btn-green:hover { filter: brightness(1.12); }
.btn-red     { background: var(--red);       color: #fff; }
.btn-red:hover { filter: brightness(1.12); }
.btn-blue    { background: var(--blue);      color: #fff; }
.btn-blue:hover { filter: brightness(1.12); }
.btn-ghost   { background: #f0ece0; color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-sm      { padding: .5rem .9rem; font-size: .9rem; min-height: 44px; }
.btn-full    { width: 100%; }

/* ── Form ────────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 1rem; }
.form-label  { display: block; font-size: 1rem; font-weight: 600;
               color: var(--muted); margin-bottom: .35rem; }
.form-control {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #fdfcf8;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,150,12,.15);
  background: #fff;
}
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control    { appearance: none; cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }

/* ── Badge stato ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .4rem .85rem;
  border-radius: 99px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-lavorazione { background: var(--orange-bg); color: var(--orange); }
.badge-preventivo  { background: #f0e6ff;          color: #7c3aed; }
.badge-pronta      { background: var(--green-bg);  color: var(--green); }
.badge-consegnata  { background: #ececec; color: #555; }
.badge-attesa      { background: var(--blue-bg);   color: var(--blue); }
.badge-annullata   { background: var(--red-bg);    color: var(--red); }
.badge-oreficeria  { background: var(--blue-bg);   color: var(--blue); }
.badge-avvisato    { background: var(--blue-bg);   color: var(--blue); font-size: .9rem; }

/* ── Dashboard contatori ────────────────────────────────────────────────── */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: .9rem;
}
.dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .5rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  transition: box-shadow .15s, transform .1s;
}
.dash-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); transform: translateY(-1px); }
.dash-count { font-size: 1.75rem; font-weight: 900; line-height: 1; }
.dash-label { font-size: .85rem; font-weight: 600; text-transform: uppercase;
              letter-spacing: .02em; color: var(--muted);
              overflow-wrap: break-word; line-height: 1.2;
              width: 100%; text-align: center; }
.dash-green  { border-top: 3px solid var(--green); }
.dash-green  .dash-count { color: var(--green); }
.dash-blue   { border-top: 3px solid var(--blue); }
.dash-blue   .dash-count { color: var(--blue); }
.dash-orange { border-top: 3px solid var(--orange); }
.dash-orange .dash-count { color: var(--orange); }
.dash-grey   { border-top: 3px solid var(--muted); }
.dash-grey   .dash-count { color: var(--muted); }
.dash-red    { border-top: 3px solid var(--red); }
.dash-red    .dash-count { color: var(--red); }
.dash-purple { border-top: 3px solid var(--purple); }
.dash-purple .dash-count { color: var(--purple); }
.dash-gold   { border-top: 3px solid var(--gold); }
.dash-gold   .dash-count { color: var(--gold); }
@media (max-width: 540px) { .dashboard { grid-template-columns: repeat(2, 1fr); } }

/* ── Ricerca rapida ─────────────────────────────────────────────────────── */
.quick-search { margin-bottom: .75rem; }

/* ── Cambio stato rapido ────────────────────────────────────────────────── */
.badge-stato-btn {
  cursor: pointer;
  transition: filter .15s, transform .1s;
  user-select: none;
}
.badge-stato-btn:hover  { filter: brightness(.88); }
.badge-stato-btn:active { transform: scale(.95); }

.stato-popup {
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  z-index: 400;
  padding: .3rem;
  min-width: 200px;
}
.stato-popup.hidden { display: none; }

.stato-popup-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .8rem;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  min-height: 48px;
  transition: background .1s;
}
.stato-popup-item:hover:not(:disabled) { background: var(--bg); }
.stato-popup-item.current { opacity: .55; cursor: default; }

/* ── Lista riparazioni ──────────────────────────────────────────────────── */
.rep-grid { display: flex; flex-direction: column; gap: .6rem; }

.rep-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.1rem;
  cursor: pointer;
  color: inherit;
  display: block;
  transition: box-shadow .15s, border-color .15s;
}
.rep-card:hover        { box-shadow: 0 4px 16px rgba(0,0,0,.12); border-color: var(--gold); }
.rep-card.urgente      { background: var(--urgency-red); border-color: var(--red); }
.rep-card.urgente:hover { background: var(--urgency-red); border-color: var(--red); box-shadow: 0 4px 16px rgba(192,57,43,.15); }
.rep-card-header { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.rep-card-desc   { font-size: 1rem; color: var(--muted); margin-top: .5rem;
                   white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-card-footer { display: flex; align-items: center; gap: .7rem; margin-top: .9rem;
                   flex-wrap: wrap; }
.rep-num  { font-size: 1.2rem; font-weight: 800; color: var(--gold); min-width: 60px; }
.rep-nome { font-weight: 600; flex: 1; font-size: 1.05rem; }
.rep-data { font-size: .9rem; color: var(--muted); }
.consegna-tag {
  font-size: .9rem; font-weight: 600; white-space: nowrap;
  padding: .4rem .75rem; border-radius: 99px;
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--border);
}
.consegna-tag.consegna-tag-urgente { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.badge-msg-card {
  font-size: .88rem; background: #f0eaff; color: #7c3aed;
  border: 1px solid #c4b5fd; border-radius: 99px;
  padding: .1rem .45rem; white-space: nowrap;
}
.badge-compro-oro {
  font-size: .88rem; background: #fef3c7; color: #92400e;
  border: 1px solid #fcd34d; border-radius: 99px;
  padding: .1rem .45rem; white-space: nowrap;
}
.badge-link-inviato {
  font-size: .88rem; background: #dcfce7; color: #166534;
  border: 1px solid #86efac; border-radius: 99px;
  padding: .1rem .45rem; white-space: nowrap;
}


/* ── Dettaglio ──────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1.5rem; }
@media (max-width: 540px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-item label { font-size: .9rem; font-weight: 700; color: var(--muted);
                     text-transform: uppercase; letter-spacing: .04em; }
.detail-item p     { font-size: .98rem; margin-top: .15rem; }
.detail-item.full  { grid-column: 1 / -1; }

/* ── Foto ────────────────────────────────────────────────────────────────── */
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
             gap: .6rem; }
.foto-item { position: relative; aspect-ratio: 1; border-radius: 8px;
             overflow: hidden; border: 2px solid var(--border); }
.foto-item img { width: 100%; height: 100%; object-fit: cover; }
.foto-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55);
            color: #fff; border: none; border-radius: 50%; width: 36px; height: 36px;
            font-size: 16px; line-height: 1; cursor: pointer; display: flex;
            align-items: center; justify-content: center; }
.foto-del:hover { background: var(--red); }

/* ── Flash messages ─────────────────────────────────────────────────────── */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: .75rem;
         font-size: .9rem; font-weight: 500; }
.flash-success { background: var(--green-bg); color: var(--green); border: 1px solid #a8d5bb; }
.flash-warning { background: var(--orange-bg); color: var(--orange); border: 1px solid #f5c48a; }
.flash-error   { background: var(--red-bg); color: var(--red); border: 1px solid #f5a8a0; }

/* ── Header pagina ──────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between;
               flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.page-title  { font-size: 1.4rem; font-weight: 800; }
.page-title small { font-size: .95rem; font-weight: 400; color: var(--muted); }

/* ── Tab actions ─────────────────────────────────────────────────────────── */
.action-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }

/* ── Loader ──────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Textarea grande per testo libero ────────────────────────────────────── */
.testo-input { min-height: 160px; font-family: inherit; }

/* ── WhatsApp modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: var(--radius);
  padding: 1.5rem; max-width: 480px; width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
.modal-box h3 { margin-bottom: .75rem; color: var(--green); }
.modal-body   { white-space: pre-wrap; word-break: break-word; overflow-wrap: break-word;
                font-size: .9rem; background: var(--green-bg);
                border: 1px solid #a8d5bb; border-radius: 8px; padding: .75rem;
                margin-bottom: 1rem; }
.modal-actions { display: flex; gap: .5rem; flex-wrap: wrap; }


/* ── No results ──────────────────────────────────────────────────────────── */
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .95rem; }

/* ── Estrazione in corso ─────────────────────────────────────────────────── */
#estrai-status { font-size: .95rem; color: var(--muted); margin-top: .4rem; min-height: 1.2em; }
#form-extracted { transition: opacity .3s; }
#form-extracted.hidden { display: none; }

/* ── FAB estesi (stile Gmail: pill con label a riposo, icona-only dopo scroll) ── */
.fab-home,
.fab-filter {
  position: fixed;
  bottom: 20px;
  height: 54px;
  min-width: 54px;
  padding: 0 22px 0 18px;
  border-radius: 28px;
  background: #fff;
  color: #2d3748;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  border: 1px solid #d4d4d4;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  z-index: 300;
  overflow: hidden;
  transition: filter .15s, transform .1s, box-shadow .15s,
              padding .22s ease, min-width .22s ease, border-radius .22s ease;
}
[data-theme="scuro"] .fab-home,
[data-theme="scuro"] .fab-filter {
  background: #1f2937;
  color: #f5f5f4;
  border-color: #e5e5e5;
  box-shadow: 0 6px 20px rgba(0,0,0,.55);
}
.fab-home  { right: 20px; }
.fab-filter { left: 20px; }

.fab-home .fab-icon,
.fab-filter .fab-icon { font-size: 1.35rem; line-height: 1; }

.fab-home .fab-label,
.fab-filter .fab-label {
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 140px;
  opacity: 1;
  transition: max-width .22s ease, opacity .18s ease, margin .22s ease;
}

.fab-home.shrunk,
.fab-filter.shrunk {
  padding: 0;
  width: 54px;
  min-width: 54px;
  border-radius: 50%;
  justify-content: center;
  gap: 0;
}
.fab-home.shrunk .fab-label,
.fab-filter.shrunk .fab-label {
  max-width: 0;
  opacity: 0;
  margin: 0;
}

.fab-home:hover,
.fab-filter:hover  { filter: brightness(1.15); box-shadow: 0 6px 22px rgba(0,0,0,.3); }
.fab-home:active,
.fab-filter:active { transform: scale(.95); }

@media (max-width: 540px) {
  .fab-home,
  .fab-filter {
    bottom: 24px;
    height: 50px;
    min-width: 50px;
    padding: 0 18px 0 14px;
  }
  .fab-home  { right: 16px; }
  .fab-filter { left: 16px; }
  .fab-home.shrunk,
  .fab-filter.shrunk { width: 50px; min-width: 50px; }
  .fab-home .fab-icon,
  .fab-filter .fab-icon { font-size: 1.25rem; }
}
.fab-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
.fab-filter.has-filters .fab-dot { display: block; }

/* ── Filter Drawer ───────────────────────────────────────────────────────── */
.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 310;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.filter-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.filter-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 380px;
  max-width: 100vw;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 32px rgba(0,0,0,.18);
  z-index: 311;
  padding: 1.25rem;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.filter-drawer.open { transform: translateY(0); }
.filter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}
.filter-drawer-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
}
.filter-drawer-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: .2rem .4rem;
  border-radius: 6px;
  transition: background .15s;
}
.filter-drawer-close:hover { background: var(--border); }
.filter-drawer-actions {
  display: flex;
  gap: .6rem;
  margin-top: 1rem;
}
@media (max-width: 540px) {
  .filter-drawer { width: 100%; }
}

/* ── Avviso stampante ────────────────────────────────────────────────────── */
.printer-warn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 600;
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid #f5c48a;
  cursor: default;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

/* Safe area per iPhone con home bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .container {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
  }
  .fab-home {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .fab-filter {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* Dashboard: font più compatti su mobile */
@media (max-width: 600px) {
  .dash-count { font-size: 1.4rem; }
  .dash-label { font-size: .78rem; }
}

/* Contenitore e card: meno padding su mobile */
@media (max-width: 600px) {
  .container { padding: .5rem .65rem; }
  .card      { padding: .9rem .8rem; margin-bottom: .75rem; }
}

/* Assicura che il contenuto non finisca sotto i FAB */
@media (max-width: 600px) {
  .container { padding-bottom: 5rem; }
}

/* Navbar: più compatta su schermi piccoli */
@media (max-width: 480px) {
  .navbar { padding: .55rem .75rem; }
  .navbar-brand { font-size: 1.05rem; }
  .navbar-actions { gap: .3rem; }
  .navbar-actions .btn {
    padding: .3rem .55rem;
    font-size: .85rem;
    min-height: 44px;
  }
}
@media (max-width: 360px) {
  /* Schermi molto piccoli: nasconde "Impostazioni", resta solo ⚙ */
  .navbar-actions .btn-settings-label { display: none; }
}

/* Page header: titolo più piccolo su mobile */
@media (max-width: 480px) {
  .page-title { font-size: 1.2rem; }
  .page-header { margin-top: .5rem; margin-bottom: .75rem; }
}

/* Action bar: griglia 2 colonne su mobile */
@media (max-width: 600px) {
  .action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
  }
  .action-bar > .btn,
  .action-bar > a.btn { width: 100%; }
  .action-bar > form  { width: 100%; }
  .action-bar > form > .btn { width: 100%; }

  /* Avviso stampante occupa riga intera */
  .action-bar > .printer-warn { grid-column: 1 / -1; justify-content: center; }

  /* Pulsante elimina: riga intera in basso */
  .action-bar > .action-delete { grid-column: 1 / -1; }
  .action-bar > .action-delete .btn { width: 100%; }
}

/* Lista riparazioni: card più compatta su mobile */
@media (max-width: 480px) {
  .rep-card { padding: .75rem .8rem; }
  .rep-num  { font-size: 1rem; min-width: 50px; }
  .rep-nome { font-size: .95rem; }
}

/* Form: meno spazio tra campi su mobile */
@media (max-width: 600px) {
  .form-group { margin-bottom: .75rem; }
  .card-title { margin-bottom: .75rem; }
}

/* Modal WhatsApp: adatta su mobile */
@media (max-width: 480px) {
  .modal-box { padding: 1rem; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
}

/* ── Paginazione ─────────────────────────────────────────────────────────── */
.paginazione {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem .5rem 5rem;
  gap: .75rem;
}
.pag-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .55rem 1rem;
  font-size: .9rem; font-weight: 600; color: var(--gold);
  text-decoration: none; white-space: nowrap;
}
.pag-btn:hover { background: var(--border); }
.pag-btn.disabled { color: var(--muted); pointer-events: none; }
.pag-info { font-size: .95rem; color: var(--muted); white-space: nowrap; }

/* Autocomplete clienti (dropdown condiviso /nuova + /riparazione edit) */
.ac-dropdown {
  position: absolute;
  z-index: 1050;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 152px;
  overflow-y: auto;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
  -webkit-overflow-scrolling: touch;
}
.ac-row {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 18px;
  min-height: 38px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.ac-row:last-child { border-bottom: none; }
.ac-row .ac-tel { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.ac-row:hover,
.ac-row.active { background: var(--gold-pale); }

/* Riparazioni consegnate: meno evidenti in lista */
.rep-card-consegnata {
  opacity: .55;
  filter: grayscale(.6);
  transition: opacity .2s, filter .2s;
}
.rep-card-consegnata:hover,
.rep-card-consegnata:focus-within {
  opacity: 1;
  filter: none;
}

/* ── Menu hamburger navbar ─────────────────────────────────────────────────── */
.menu-hamburger { position: relative; }
.menu-hamburger > .btn {
  font-size: 1.15rem; line-height: 1;
  padding: .3rem .55rem;
}
.menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  padding: .35rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  z-index: 5000;
}
.menu-dropdown[hidden] { display: none; }
.menu-dropdown .menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: .6rem .8rem;
  font: inherit;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text, inherit);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.menu-dropdown .menu-item:hover,
.menu-dropdown .menu-item:focus-visible {
  background: var(--gold-pale);
  outline: none;
}
.menu-dropdown .menu-form { margin: 0; }
