/* ==========================================================================
   Backoffice Assistenza STUDDED — stile posta (tipo Outlook)
   Cartelle a sinistra · elenco al centro · lettura a destra.
   Chiaro, ordinato, un solo colore d'accento; colori solo per tipi e stati.
   ========================================================================== */
:root {
  color-scheme: light;
  --bg: #f3f3f2;
  --pane: #ffffff;
  --nav: #f7f7f6;
  --ink: #1b1b1b;
  --ink-2: #555553;
  --ink-3: #8b8b88;
  --line: #e7e6e3;
  --line-2: #d6d5d1;
  --hover: #f2f2f0;
  --sel: #e9eef7;
  --accent: #1f5fbf;
  --accent-2: #174a96;
  --accent-soft: #e8effa;
  --danger: #c42b1c;
  --warn: #a35a00;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --t-blue: #dbe7f8; --t-peach: #f7e0d8; --t-lime: #e4efcf; --t-sand: #efe8da;

  --cat-reso: #d97706;
  --cat-taglie: #2563eb;
  --cat-ordine: #16a34a;
  --cat-esaurito: #9333ea;
  --cat-pagamento: #0891b2;
  --cat-collab: #db2777;
  --cat-altro: #8b8b88;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.ico { flex: none; display: block; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.boot { min-height: 100vh; display: grid; place-items: center; }

/* ---- Marchio ---- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 14px; width: auto; display: block; }
.brand span { font-size: 13px; color: var(--ink-3); border-left: 1px solid var(--line-2); padding-left: 10px; }

/* ---- Bottoni ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--pane); color: var(--ink); padding: 7px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: 500; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 6px; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.danger:hover { background: #fbe9e7; color: var(--danger); }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent); }
.link:hover { text-decoration: underline; }

/* ---- Campi ---- */
select, input, textarea { border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 10px; background: var(--pane); width: 100%; font-size: 13.5px; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
textarea { resize: vertical; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-3); }
.msg-err { color: var(--danger); font-size: 13px; }
.msg-err.pad { padding: 8px 14px; }
.msg-ok { color: #1a7f37; font-size: 13px; }

/* ---- Avatar ---- */
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: #2b2b2b; background: var(--t-blue); }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.t-blue { background: var(--t-blue); } .t-peach { background: var(--t-peach); } .t-lime { background: var(--t-lime); } .t-sand { background: var(--t-sand); }
.me-badge { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-weight: 600; font-size: 12px; display: inline-grid; place-items: center; cursor: pointer; }

/* ---- Accesso ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 360px; background: var(--pane); border: 1px solid var(--line); border-radius: 12px; padding: 32px 28px 26px; display: grid; gap: 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, .06); }
.login-title { font-size: 24px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
.login-box .btn { padding: 10px; font-size: 14px; background: var(--accent); border-color: var(--accent); color: #fff; }
.login-box .link { justify-self: center; font-size: 12.5px; color: var(--ink-3); }

/* ---- Struttura a 3 colonne ---- */
.shell { display: grid; grid-template-columns: 228px 380px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.nav { background: var(--nav); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 10px 12px; min-height: 0; overflow-y: auto; }
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; }
.nav-brand img { height: 14px; width: auto; }
.nav-brand span { font-size: 13px; color: var(--ink-3); border-left: 1px solid var(--line-2); padding-left: 10px; }
.nav-sec { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); font-size: 13.5px; position: relative; }
.nav-item .ico { color: var(--ink-2); }
.nav-item:hover { background: var(--hover); }
.nav-item.on { background: var(--sel); font-weight: 600; }
.nav-item.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.nav-item.on .ico { color: var(--accent); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-n { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav-n.strong, .nav-n.unread { color: #fff; background: var(--accent); border-radius: 999px; padding: 0 7px; font-weight: 600; line-height: 18px; }
.nav-me { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--line); margin-top: 10px; font-size: 13px; }

/* ---- Colonna elenco ---- */
.col-list { background: var(--pane); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list-head { padding: 16px 14px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.mobile-top, .view-mobile { display: none; }
.list-title { display: flex; align-items: baseline; gap: 8px; }
.list-title h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.list-n { font-size: 13px; color: var(--ink-3); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mini { background: var(--nav); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; display: grid; min-width: 0; }
.mini-v { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.mini-l { font-size: 11.5px; color: var(--ink-3); }
.mini-btn { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.mini-btn:hover { background: var(--hover); }
.mini-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.badge { font-size: 10.5px; font-weight: 500; padding: 1px 6px; border-radius: 999px; background: var(--hover); color: var(--ink-2); white-space: nowrap; }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--ink-3); background: var(--pane); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.search input { border: 0; padding: 7px 0; box-shadow: none !important; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-2); background: var(--pane); color: var(--ink-2); padding: 3px 10px; border-radius: 999px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.list { flex: 1; overflow-y: auto; }
.empty { padding: 56px 20px; color: var(--ink-3); display: grid; justify-items: center; gap: 8px; text-align: center; }

/* Riga dell'elenco */
.row { display: flex; gap: 11px; padding: 11px 14px 11px 13px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; cursor: pointer; position: relative; }
.row:hover { background: var(--hover); }
.row.unread { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.row.unread:hover { background: var(--hover); }
.row.unread.sel { background: var(--sel); }
/* Pallino "da leggere" */
.unread-dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); align-self: center; }
.row-top .row-name { margin-right: auto; }
.chip-unread { display: inline-flex; align-items: center; gap: 6px; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip-unread.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-unread.on .unread-dot { background: #fff; }
.row.sel { background: var(--sel); }
.row-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--hover); color: var(--ink-2); display: grid; place-items: center; }
.row-body { flex: 1; min-width: 0; }
.row-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.row.unread .row-name, .row.unread .row-subj { font-weight: 600; }
.row.unread .row-subj { color: var(--accent); }
.row-when { flex: none; font-size: 12px; color: var(--ink-3); }
.row.unread .row-when { color: var(--accent); font-weight: 600; }
.row-subj, .row-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-subj { font-size: 13.5px; }
.row-prev { font-size: 13px; color: var(--ink-3); }
.row-tags { display: flex; gap: 6px; align-items: center; margin-top: 6px; min-width: 0; }
.tag { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-2); background: var(--hover); border-radius: 4px; padding: 1px 7px; white-space: nowrap; }
.tag.cat { color: var(--c, var(--cat-altro)); background: color-mix(in srgb, var(--c, var(--cat-altro)) 10%, transparent); }
.tag.cat i { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--cat-altro)); }
.tag.late { color: var(--warn); background: #fbf0e1; }
.cat-reso { --c: var(--cat-reso); }
.cat-taglie { --c: var(--cat-taglie); }
.cat-ordine-spedizione { --c: var(--cat-ordine); }
.cat-prodotto-esaurito { --c: var(--cat-esaurito); }
.cat-pagamento { --c: var(--cat-pagamento); }
.cat-collaborazione { --c: var(--cat-collab); }
.cat-altro { --c: var(--cat-altro); }
.owner { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 600; background: var(--hover); color: var(--ink-2); }
.owner.me { background: var(--accent); color: #fff; }
.owner.none { background: none; border: 1px dashed var(--line-2); color: var(--ink-3); }
.row-actions { position: absolute; right: 10px; top: 28px; display: none; gap: 2px; background: var(--pane); border: 1px solid var(--line); border-radius: 6px; padding: 2px; box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.row:hover .row-actions { display: flex; }

/* ---- Pannello di lettura ---- */
.col-detail { min-width: 0; min-height: 0; background: var(--pane); }
.placeholder { height: 100%; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--ink-3); }
.reader { height: 100%; display: flex; flex-direction: column; min-height: 0; position: relative; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--pane); }
.tb { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.tb .ico { color: var(--ink-2); }
.tb:hover { background: var(--hover); }
.tb:disabled { opacity: .45; cursor: default; }
.tb.primary { color: var(--accent); font-weight: 600; }
.tb.primary .ico, .tb.accent .ico { color: var(--accent); }
.tb.accent { background: var(--accent-soft); color: var(--accent); font-weight: 600; margin-left: auto; }
.tb.danger { background: var(--danger); color: #fff; }
.tb.back { display: none; }
.r-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.r-head { padding: 20px 28px 16px; display: grid; gap: 14px; border-bottom: 1px solid var(--line); }
.r-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.r-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.r-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.r-who { display: grid; line-height: 1.3; min-width: 0; }
.r-who b { font-weight: 600; }
.r-who a { font-size: 12.5px; color: var(--ink-3); text-decoration: none; }
.r-who a:hover { color: var(--accent); }
.r-sub { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.r-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 200px)); gap: 10px; }
.r-fields select { padding: 5px 8px; font-size: 13px; }

/* Messaggi come email impilate */
.thread { padding: 18px 28px; display: grid; gap: 12px; align-content: start; }
.mail { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--pane); max-width: 820px; }
.mail.out { background: #fafbfd; border-left: 3px solid var(--accent); }
.mail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mail-head .avatar { width: 30px; height: 30px; font-size: 11px; }
.mail-who { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.mail-who span { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-head time { font-size: 12px; color: var(--ink-3); flex: none; }
.mail-text, .msg-quoted { white-space: pre-wrap; word-break: break-word; }
.msg-quoted { color: var(--ink-2); border-left: 2px solid var(--line-2); padding-left: 10px; margin-top: 8px; font-size: 13px; }
.msg-att { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.mail .link { margin-top: 8px; display: inline-block; font-size: 12px; }

.notes { margin: 0 28px 20px; padding: 12px 14px; background: #fffbea; border: 1px solid #f1e5b4; border-radius: var(--radius); display: grid; gap: 8px; max-width: 820px; }
.notes-h { font-size: 12.5px; font-weight: 600; color: #7a6416; }
.notes-h span { font-weight: 400; color: #9a8a4e; margin-left: 6px; }
.note { font-size: 13px; }
.note b { font-weight: 600; margin-right: 4px; }
.note-add { display: flex; gap: 8px; }
.note-add input { background: #fff; }

.composer { border-top: 1px solid var(--line); padding: 10px 28px 14px; display: grid; gap: 8px; background: var(--pane); }
.ai-bar { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; }
.ai-tag { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.ai-sum { flex: 1; min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-box { border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--pane); }
.reply-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.reply-box textarea { border: 0; resize: none; min-height: 52px; max-height: 280px; padding: 10px 12px; box-shadow: none; display: block; border-radius: var(--radius); font-size: 14px; }
.reply-box textarea:focus { box-shadow: none; }
.composer-bar { display: flex; gap: 10px; align-items: center; padding: 6px 6px 6px 12px; border-top: 1px solid var(--line); }
.hint { font-size: 12px; color: var(--ink-3); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1b1b1b; color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 13px; z-index: 30; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); animation: pop .2s ease-out; }
.toast.undo { display: flex; align-items: center; gap: 14px; padding: 6px 6px 6px 16px; }
.toast.undo button { border: 0; border-radius: 4px; background: #fff; color: var(--ink); font-weight: 600; padding: 5px 12px; cursor: pointer; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Resi ---- */
.ret-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 4px; font-size: 11.5px; white-space: nowrap; color: var(--rc); background: color-mix(in srgb, var(--rc) 11%, transparent); }
.ret-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--rc); }
.r-title .ret-pill { font-size: 12.5px; padding: 3px 10px; }
.rs-richiesto { --rc: #1f5fbf; }
.rs-approvato { --rc: #0e7490; }
.rs-ritiro-prenotato { --rc: #7c3aed; }
.rs-ricevuto-in-magazzino { --rc: #c2410c; }
.rs-rimborsato { --rc: #15803d; }
.rs-rifiutato { --rc: #b91c1c; }
.ret-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.ret-tools .btn { flex: 1; }
.r-body { padding: 18px 28px 28px; display: grid; gap: 16px; max-width: 900px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stepper li { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); padding-top: 9px; border-top: 3px solid var(--line); line-height: 1.2; }
.stepper li span { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--hover); color: var(--ink-3); }
.stepper li.done { color: var(--ink-2); border-color: #9fbbe6; }
.stepper li.done span { background: var(--accent-soft); color: var(--accent); }
.stepper li.on { color: var(--ink); font-weight: 600; border-color: var(--accent); }
.stepper li.on span { background: var(--accent); color: #fff; }
.act { border: 1px solid #c9d8f0; background: #f7faff; border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; }
.act-title { font-size: 15px; font-weight: 600; }
.act-sub { font-size: 13px; color: var(--ink-2); margin-top: -6px; }
.act-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.act label { max-width: 360px; }
.gls { margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--pane); border: 1px solid var(--line); font: 12.5px/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--ink-2); white-space: pre-wrap; user-select: all; }
.notify { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.notify input { width: 15px; height: 15px; accent-color: var(--accent); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.info h3 { margin: 0 0 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); display: flex; gap: 8px; align-items: baseline; }
.info h3 .muted, .info h3 .link { text-transform: none; letter-spacing: 0; font-weight: 400; }
.info h3 .link { margin-left: auto; }
.info p { margin: 0; font-size: 13.5px; }
.info p.big { font-size: 20px; font-weight: 600; }
.info p.warn { color: var(--warn); font-size: 13px; }
.ret-item { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.ret-item:first-of-type { border-top: 0; }
.ret-item img, .ret-item .ph { width: 48px; height: 62px; border-radius: 4px; object-fit: cover; background: var(--hover); }
.ret-item-t { font-weight: 500; }
.ret-item-m { font-size: 12.5px; color: var(--ink-3); }
.ret-reason { margin-top: 4px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.ret-reason span { color: var(--ink-2); font-style: italic; }
.ret-item-p { font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pick-edit { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history li { display: grid; padding-left: 12px; border-left: 2px solid var(--line-2); font-size: 13px; }
.history li span { font-size: 12px; color: var(--ink-3); }
.history li:first-child { border-color: var(--accent); }

/* ---- Prodotti esauriti ---- */
.stock-count { flex: none; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.stock-count.done { background: var(--hover); color: var(--ink-3); }
.import-box { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: #fffbea; border: 1px solid #f1e5b4; border-radius: 6px; padding: 8px 10px; font-size: 12.5px; color: #7a6416; }
.stock-req { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.stock-req:first-of-type { border-top: 0; }
.stock-req-body { min-width: 0; display: grid; gap: 1px; }
.stock-req-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.stock-req-top span { font-size: 12px; color: var(--ink-3); }
.stock-req-body a { font-size: 12.5px; color: var(--ink-3); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.stock-req-text { margin-top: 6px; font-size: 13px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; background: var(--nav); border-radius: 6px; padding: 8px 10px; }
button.ret-pill { border: 0; cursor: pointer; font: inherit; font-size: 11.5px; }

/* ---- Schermi medi ---- */
@media (max-width: 1240px) {
  .shell { grid-template-columns: 200px 330px minmax(0, 1fr); }
  .r-head, .thread, .composer, .r-body { padding-left: 20px; padding-right: 20px; }
  .notes { margin-left: 20px; margin-right: 20px; }
  .r-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1040px) {
  .shell { grid-template-columns: 60px 320px minmax(0, 1fr); }
  .nav { padding: 12px 8px; }
  .nav-brand span, .nav-sec, .nav-label, .nav-n:not(.strong):not(.unread), .nav-me .icon-btn { display: none; }
  .nav-brand img { height: 10px; }
  .nav-item { justify-content: center; padding: 9px; }
  .nav-n.strong, .nav-n.unread { position: absolute; top: 2px; right: 2px; font-size: 10px; padding: 0 5px; line-height: 15px; }
  .nav-me { justify-content: center; }
  .info-grid { grid-template-columns: 1fr; }
}

/* ---- Telefono: una colonna alla volta ---- */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 100dvh; }
  .nav { display: none; }
  .col-list { border-right: 0; min-height: 100dvh; }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; }
  .view-mobile { display: block; }
  .list { overflow: visible; }
  .shell.has-sel .col-list { display: none; }
  .shell:not(.has-sel) .col-detail { display: none; }
  .reader { height: auto; min-height: 100dvh; }
  .r-scroll { overflow: visible; }
  .toolbar { position: sticky; top: 0; z-index: 5; }
  .tb.back { display: inline-flex; }
  .tb.accent { margin-left: 0; }
  .r-head, .thread, .composer, .r-body { padding-left: 16px; padding-right: 16px; }
  .notes { margin-left: 16px; margin-right: 16px; }
  .r-fields { grid-template-columns: 1fr 1fr; }
  .r-sub { margin-left: 0; width: 100%; }
  .composer { position: sticky; bottom: 0; }
  .hint { display: none; }
  .row-actions { display: flex; position: static; box-shadow: none; border: 0; padding: 0; align-self: center; }
  .stepper li { font-size: 0; gap: 0; }
  .stepper li.on { font-size: 11px; gap: 6px; }
  .pick-edit { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---- Scrivi a un cliente ---- */
.nav-new { display: flex; align-items: center; gap: 9px; width: 100%; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.nav-new:hover { filter: brightness(1.08); }
.nav-new.on { background: var(--accent-soft); color: var(--accent); }
.nav-new .ico { color: inherit; }
.oc-search { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.oc-search label { width: 200px; }
.oc-lines { display: flex; flex-wrap: wrap; gap: 10px; }
.oc-line { display: flex; gap: 8px; align-items: center; font-size: 13px; max-width: 260px; }
.oc-line img, .oc-line .ph { width: 36px; height: 46px; border-radius: 4px; object-fit: cover; background: var(--hover); flex: none; }
.oc-line span { display: grid; }
.oc-line i { font-style: normal; color: var(--ink-3); font-size: 12px; }
.oc-prev { font-size: 12.5px; color: #7a6416; background: #fffbea; border: 1px solid #f1e5b4; border-radius: 6px; padding: 8px 10px; }
.oc-warn { font-size: 12.5px; color: var(--warn); }
.oc-tpl { padding: 0; }
.act label.oc-field { max-width: none; }
.act textarea { min-height: 220px; }
.mobile-top .btn-xs { margin-right: 8px; }
@media (max-width: 1040px) {
  .nav-new { justify-content: center; padding: 9px; }
}

/* Ordini da evadere */
.uf-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.uf-bar .spacer { flex: 1; }
.uf-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.uf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.uf-table th, .uf-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.uf-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); background: var(--nav); position: sticky; top: 0; }
.uf-table tr:last-child td { border-bottom: 0; }
.uf-table td.num { text-align: right; white-space: nowrap; }
.uf-table .muted { font-size: 11px; }
.uf-pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; white-space: nowrap; }
.uf-pill.ship { background: #e8f0fe; color: #1a4fb3; }
.uf-pill.pick { background: #fdf1e3; color: #9a5a0c; }
.uf-table td.uf-items { min-width: 220px; }
.uf-table td.uf-items > div + div { margin-top: 6px; }
/* Corrispettivi */
.corr-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.corr-kpi > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; background: var(--pane); }
.corr-kpi span { font-size: 12px; color: var(--ink-3); }
.corr-kpi b { font-size: 18px; }
.corr-kpi small { font-size: 11px; color: var(--ink-3); }
.corr-table tfoot td { font-weight: 600; border-top: 2px solid var(--ink); }
.corr-note { font-size: 12px; }
@media (max-width: 700px) { .corr-kpi { grid-template-columns: 1fr 1fr; } }
