/* Piattaforma admin Mirkoro: chiara, leggibile al telefono, bersagli ampi. */
:root {
  --gold: #b8860b;
  --gold-dark: #8a6508;
  --ink: #1d1d1f;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f5f7;
  --card: #ffffff;
  --ok-bg: #e8f6ec; --ok-fg: #1a7a3a;
  --warn-bg: #fff5e0; --warn-fg: #8a5a00;
  --err-bg: #fdecec; --err-fg: #b3261e;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-text-size-adjust: 100%;
}
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
p { margin: .35rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.booting { padding: 2rem; color: var(--muted); }

/* Accesso */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px 20px; box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.login-card h1 { margin: .75rem 0 .5rem; }
.brand { display: flex; align-items: baseline; gap: .6rem; }
.brand-name { font-weight: 800; color: var(--gold-dark); letter-spacing: .3px; }
.brand-sub { font-size: .75rem; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.qr { display: block; width: 200px; height: 200px; margin: 12px auto; background: #fff; }
.secret code { display: block; word-break: break-all; padding: 8px; background: var(--bg); border-radius: 8px; user-select: all; }
.code-input { font-size: 1.6rem; letter-spacing: .4rem; text-align: center; }

/* Moduli */
.form { display: flex; flex-direction: column; gap: .4rem; }
label { font-size: .9rem; font-weight: 600; margin-top: .4rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
input, select, textarea {
  font: inherit; padding: .65rem .75rem; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; min-height: 44px; width: 100%;
}
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.form-error { color: var(--err-fg); background: var(--err-bg); border-radius: 8px; padding: .5rem .75rem; }
.form-error[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: .25rem; }

/* Pulsanti */
.btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: .55rem 1rem; border-radius: 10px;
  border: 1px solid #d1d5db; background: #fff; color: var(--ink); cursor: pointer;
}
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-primary:active { background: var(--gold-dark); }
.btn-link { border: none; background: none; color: var(--muted); text-decoration: underline; }

/* Struttura */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding: .6rem 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.menu { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.menu a { padding: .5rem .75rem; border-radius: 8px; color: var(--ink); text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }
.menu a.active { background: var(--warn-bg); color: var(--gold-dark); font-weight: 700; }
.who { font-size: .85rem; color: var(--muted); }
.content { max-width: 980px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-wrap: break-word; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-host:empty { display: none; }

/* Stato del negozio e richieste */
.shop-status { border-radius: 10px; padding: .6rem .8rem; }
.shop-status.ok { background: var(--ok-bg); color: var(--ok-fg); }
.shop-status.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pending-requests:empty { display: none; }
.pending-requests { background: var(--card); border: 1px dashed var(--gold); border-radius: var(--radius); padding: .6rem .9rem; }
.pending-requests ul { margin: .25rem 0 0; padding-left: 1.1rem; }

/* Schede e liste */
.tabs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: 2px; }
.tab { font: inherit; white-space: nowrap; min-height: 40px; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: .3rem; }
.card-head { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.card-main { font-size: 1.1rem; font-weight: 700; }
.choices { display: grid; gap: .4rem; }
.choice { display: flex; align-items: center; gap: .6rem; min-height: 48px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--gold); outline: 1px solid var(--gold); }
.choice input { width: 22px; height: 22px; min-height: 0; margin: 0; }
.iban { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0; }
.iban-full { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; letter-spacing: .04rem; user-select: all; word-break: break-all; }
.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
/* Pagamenti: una riga per modo di pagamento, con il suo pulsante. */
.pay-line { display: flex; align-items: center; justify-content: space-between; gap: .4rem .75rem; flex-wrap: wrap; padding-top: .5rem; border-top: 1px solid var(--line); }
.pay-line p { margin: 0; }
.badge { font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.badge-au { background: #fff4d6; border-color: #f0d38a; color: var(--gold-dark); }
.badge-ag { background: #eef0f3; border-color: #cfd4dc; color: #4b5563; }
.badge-warn { background: var(--warn-bg); border-color: #f1d99a; color: var(--warn-fg); }

/* Codice admin */
.code-display { text-align: center; }
.code { font-size: 2.8rem; font-weight: 800; letter-spacing: .25rem; font-variant-numeric: tabular-nums; margin: .5rem 0; }

/* Registro */
.log { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.log table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.log th, .log td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }

/* Avvisi */
.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(92vw, 520px); }
.toast { padding: .75rem 1rem; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.toast-ok { background: var(--ok-fg); }
.toast-error { background: var(--err-fg); }

@media (max-width: 600px) {
  /* Telefono: in alto marchio, nome ed Esci, sotto il menu su una riga che scorre. */
  .topbar { padding: .5rem 12px; gap: .25rem .75rem; }
  .topbar .brand-name { flex: 1; }
  .who { order: 2; min-width: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #logout { order: 3; }
  .menu { order: 4; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px .25rem; }
  .menu::-webkit-scrollbar { display: none; }
  .menu a { flex: 0 0 auto; white-space: nowrap; }
  .code { font-size: 2.3rem; }
}
