/* Barber Manager · tutto il colore del negozio passa da --c1 (principale) e --c2 (accento),
   impostati dall'app con i colori scelti in Impostazioni. */
:root {
  --c1: #1f2a44; --c2: #c8a24a; --d1: #1f2a44; --d2: #c8a24a; --su-c1: #fff; --su-c2: #1b1b1b;
  --fondo: #f5f4f1; --carta: #fff; --testo: #1d1d1f; --tenue: #6b6b70; --linea: #e4e2dd;
  --ok: #2e7d4f; --male: #b3261e; --attenzione: #b26a00;
  --r: 12px; --ombra: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --riga: 26px; /* altezza di 15 minuti in agenda */
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--testo); background: var(--fondo); -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
a { color: inherit; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--linea); border-radius: 9px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c2); outline-offset: 0; border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: .82rem; color: var(--tenue); margin-bottom: .7rem; }
label > input, label > select, label > textarea { margin-top: .25rem; color: var(--testo); font-size: .95rem; }
.riga-campi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 .8rem; }
.spunta { display: flex; align-items: center; gap: .5rem; color: var(--testo); font-size: .92rem; }
.spunta input { width: auto; }
[hidden] { display: none !important; }

/* pulsanti */
.btn { border: 1px solid var(--linea); background: #fff; padding: .5rem .9rem; border-radius: 9px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; }
.btn:hover { border-color: #cfccc5; }
.btn.primario { background: var(--c1); color: var(--su-c1); border-color: var(--c1); }
.btn.accento { background: var(--c2); color: var(--su-c2); border-color: var(--c2); }
.btn.pericolo { color: var(--male); }
.btn.piccolo { padding: .3rem .6rem; font-size: .85rem; }
.btn.largo { width: 100%; justify-content: center; padding: .7rem; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--tenue); cursor: pointer; text-decoration: underline; }
.gruppo { display: inline-flex; border: 1px solid var(--linea); border-radius: 9px; overflow: hidden; background: #fff; }
.gruppo button { border: 0; background: none; padding: .45rem .8rem; cursor: pointer; }
.gruppo button.attivo { background: var(--c1); color: var(--su-c1); }

/* accesso */
#accesso { min-height: 100%; display: grid; place-items: center; padding: 1rem; background: var(--c1); }
.scheda-accesso { background: #fff; padding: 2rem; border-radius: 16px; width: min(380px, 100%); box-shadow: var(--ombra); }
.marchio-accesso { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.5rem; text-align: center; }
.forbici { color: var(--c2); }
.errore { color: var(--male); min-height: 1.2em; font-size: .9rem; }
.nota { color: var(--tenue); font-size: .8rem; text-align: center; margin: .5rem 0 0; }

/* struttura */
#app { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.barra { background: var(--c1); color: var(--su-c1); display: flex; flex-direction: column; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; }
.marchio { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; padding: .25rem .5rem 1.25rem; }
.marchio img { max-height: 42px; max-width: 120px; object-fit: contain; }
#menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#menu a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 9px; cursor: pointer; text-decoration: none; opacity: .82; position: relative; }
#menu a i { font-style: normal; width: 1.3em; text-align: center; }
#menu a:hover { opacity: 1; background: rgba(255,255,255,.08); }
#menu a.attivo { opacity: 1; background: var(--c2); color: var(--su-c2); }
#menu a b { margin-left: auto; background: var(--male); color: #fff; font-size: .72rem; border-radius: 99px; padding: 0 .45rem; }
.chi { font-size: .82rem; opacity: .8; display: flex; justify-content: space-between; gap: .5rem; padding: .5rem; }
.chi .link { color: inherit; }
main { padding: 1.25rem 1.5rem 3rem; min-width: 0; }
.testata { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.testata h1 { margin-right: auto; }
.carta { background: var(--carta); border-radius: var(--r); box-shadow: var(--ombra); padding: 1rem 1.1rem; }
.griglia { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.tenue { color: var(--tenue); }
.piccolo { font-size: .85rem; }
.destra { text-align: right; }
.vuoto { color: var(--tenue); text-align: center; padding: 2rem 1rem; }

/* tabelle ed elenchi */
.tabella { width: 100%; border-collapse: collapse; }
.tabella th { text-align: left; font-size: .78rem; color: var(--tenue); font-weight: 600; padding: .45rem .5rem; border-bottom: 1px solid var(--linea); }
.tabella td { padding: .55rem .5rem; border-bottom: 1px solid var(--linea); vertical-align: top; }
.tabella tr.clic { cursor: pointer; }
.tabella tr.clic:hover td { background: #faf9f6; }
.scorri { overflow-x: auto; }
.pill { display: inline-block; font-size: .75rem; padding: .05rem .5rem; border-radius: 99px; background: #eeece7; color: #444; white-space: nowrap; }
.pill.ok { background: #e3f1e8; color: var(--ok); }
.pill.male { background: #fbe7e5; color: var(--male); }
.pill.att { background: #fdf0dc; color: var(--attenzione); }
.pallino { display: inline-block; width: .7em; height: .7em; border-radius: 50%; vertical-align: middle; margin-right: .3rem; }

/* agenda */
.agenda-wrap { overflow: auto; background: var(--carta); border-radius: var(--r); box-shadow: var(--ombra); max-height: calc(100vh - 150px); }
.agenda { display: grid; position: relative; min-width: 100%; }
.agenda .testa { position: sticky; top: 0; z-index: 3; background: var(--carta); border-bottom: 1px solid var(--linea); padding: .5rem; font-weight: 600; text-align: center; font-size: .9rem; }
.agenda .testa small { display: block; font-weight: 400; color: var(--tenue); font-size: .75rem; }
.agenda .testa.oggi { color: var(--c1); box-shadow: inset 0 -3px var(--c2); }
.ore { position: sticky; left: 0; z-index: 2; background: var(--carta); border-right: 1px solid var(--linea); }
.ore div { height: calc(var(--riga) * 4); font-size: .72rem; color: var(--tenue); text-align: right; padding: .1rem .4rem 0; }
.colonna { position: relative; border-right: 1px solid var(--linea); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--riga) * 4 - 1px), var(--linea) calc(var(--riga) * 4 - 1px), var(--linea) calc(var(--riga) * 4)), repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--riga) * 2 - 1px), #f1efea calc(var(--riga) * 2 - 1px), #f1efea calc(var(--riga) * 2)); cursor: copy; }
.colonna.chiuso { background-color: #f3f2ee; cursor: default; }
.sotto { display: grid; height: 100%; }
.sotto > .colonna:last-child { border-right: 0; }
.giorno-sett { border-right: 2px solid var(--linea); }
.app { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: .2rem .4rem; font-size: .78rem; line-height: 1.2; overflow: hidden; cursor: grab; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); touch-action: none; user-select: none; z-index: 1; }
.app b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app span { opacity: .9; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app.fatto { opacity: .55; }
.app.corto span { display: none; }
.app.corto { padding-top: .1rem; }
.app.noshow { opacity: .45; background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,.25) 6px 12px); }
.app.arrivato { outline: 3px solid var(--c2); }
.app.trascina { opacity: .85; cursor: grabbing; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.ora-adesso { position: absolute; left: 0; right: 0; height: 2px; background: var(--male); z-index: 2; pointer-events: none; }
.legenda { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--tenue); margin-top: .6rem; }

/* cruscotto */
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi .carta { padding: .85rem 1rem; }
.kpi .v { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; margin: .1rem 0; }
.kpi .t { font-size: .78rem; color: var(--tenue); }
.delta { font-size: .8rem; font-weight: 600; }
.delta.su { color: var(--ok); } .delta.giu { color: var(--male); }
.grafico { position: relative; height: 260px; }
.grafico.basso { height: 210px; }
.barre .voce { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .6rem; margin-bottom: .55rem; font-size: .88rem; }
.barre .traccia { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: #efede8; overflow: hidden; }
.barre .traccia i { display: block; height: 100%; background: var(--d1); border-radius: 99px; }
.barre .traccia i.prod { background: var(--d2); }

/* scheda cliente */
.cliente-testa { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--c1); color: var(--su-c1); display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; flex: none; }
.numeri { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.numeri div { background: var(--carta); border-radius: 10px; padding: .6rem .8rem; box-shadow: var(--ombra); }
.numeri b { display: block; font-size: 1.15rem; }
.numeri span { font-size: .75rem; color: var(--tenue); }
.schede { display: flex; gap: .25rem; border-bottom: 1px solid var(--linea); margin-bottom: 1rem; overflow-x: auto; }
.schede button { border: 0; background: none; padding: .55rem .8rem; cursor: pointer; color: var(--tenue); border-bottom: 2px solid transparent; white-space: nowrap; }
.schede button.attivo { color: var(--testo); border-color: var(--c2); font-weight: 600; }
.foto-griglia { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.foto-griglia figure { margin: 0; position: relative; }
.foto-griglia img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 10px; display: block; background: #eee; }
.foto-griglia figcaption { font-size: .75rem; color: var(--tenue); margin-top: .2rem; display: flex; justify-content: space-between; }
.scontrino { border-bottom: 1px dashed var(--linea); padding: .6rem 0; }
.scontrino:last-child { border: 0; }
.scontrino .su { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; color: var(--tenue); }
.scontrino .voci { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }

/* cassa */
.listino-tasti { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .45rem; max-height: 300px; overflow: auto; padding: 2px; }
.listino-tasti button { border: 1px solid var(--linea); background: #fff; border-radius: 9px; padding: .5rem .55rem; text-align: left; cursor: pointer; font-size: .85rem; line-height: 1.25; }
.listino-tasti button:hover { border-color: var(--c2); }
.listino-tasti button small { display: block; color: var(--tenue); }
.listino-tasti button.prod { background: #fbf8f0; }
.carrello td input { width: 80px; padding: .3rem .4rem; }
.totale { font-size: 1.6rem; font-weight: 700; text-align: right; margin: .5rem 0; }
.cerca-cliente { position: relative; }
.suggerimenti { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--linea); border-radius: 9px; box-shadow: var(--ombra); z-index: 20; max-height: 240px; overflow: auto; }
.suggerimenti div { padding: .5rem .7rem; cursor: pointer; font-size: .9rem; }
.suggerimenti div:hover { background: #f6f5f1; }

/* modale e avviso */
#modale { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; }
.modale-fondo { position: absolute; inset: 0; background: rgba(20,20,25,.45); }
.modale-box { position: relative; background: #fff; border-radius: 16px; width: min(640px, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.25rem 1.3rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modale-box.largo { width: min(920px, 100%); }
.modale-testa { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.modale-testa h2 { margin: 0; }
.chiudi { border: 0; background: none; font-size: 1.4rem; cursor: pointer; color: var(--tenue); line-height: 1; }
.azioni { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; margin-top: 1rem; }
.azioni .sx { margin-right: auto; }
#avviso { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: .65rem 1.1rem; border-radius: 10px; z-index: 60; box-shadow: var(--ombra); max-width: calc(100% - 2rem); }
#avviso.male { background: var(--male); }
.colori { display: flex; gap: 1rem; flex-wrap: wrap; }
.colori label { display: flex; align-items: center; gap: .5rem; }
.colori input[type=color] { width: 46px; height: 36px; padding: 2px; }
.anteprima-tema { border-radius: 12px; overflow: hidden; border: 1px solid var(--linea); display: grid; grid-template-columns: 90px 1fr; height: 120px; }
.anteprima-tema .b { background: var(--c1); }
.anteprima-tema .b i { display: block; margin: 40px 10px 0; height: 14px; border-radius: 5px; background: var(--c2); }
.anteprima-tema .m { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.anteprima-tema .m i { height: 10px; border-radius: 5px; background: #eee; }
.anteprima-tema .m i:first-child { width: 40%; background: var(--c1); }

/* telefono */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  .barra { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 30; flex-direction: row; padding: .3rem .3rem calc(.3rem + env(safe-area-inset-bottom, 0px)); }
  .marchio, .chi { display: none; }
  #menu { flex-direction: row; justify-content: space-around; }
  #menu a { flex-direction: column; gap: 0; padding: .35rem .1rem; font-size: .62rem; flex: 1; min-width: 0; text-align: center; }
  #menu a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #menu a i { font-size: 1.15rem; }
  #menu a b { position: absolute; top: 0; right: 15%; }
  main { padding: 1rem .9rem 6rem; }
  .g2, .g3, .g21, .g12 { grid-template-columns: 1fr; }
  .agenda-wrap { max-height: calc(100vh - 210px); }
  .testata h1 { width: 100%; }
}
