/* ORDER - order.dash-rec.com — stile compatto mobile-first, colori neutri.
   Accento = colore azienda (--az-color: REC #b02234 / AZN #e89b00). */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: #f4f4f2; color: #222;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ---------- header ---------- */
.oc-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border-bottom: 2px solid var(--az-color, #b02234);
  padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top));
}
.oc-brand { font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.oc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--az-color, #b02234); display: inline-block; }
.oc-nav { display: flex; align-items: center; gap: 12px; font-size: 13.5px; overflow-x: auto; }
.oc-nav a { text-decoration: none; color: #444; white-space: nowrap; }
.oc-nav a:hover { color: #000; }
.oc-azswitch { display: flex; border: 1px solid #ccc; border-radius: 6px; overflow: hidden; }
.oc-azswitch button { border: 0; background: #fff; padding: 3px 9px; font-size: 12.5px; color: #555; }
.oc-azswitch button.on { background: var(--az-color, #b02234); color: #fff; font-weight: 600; }
.oc-main { max-width: 1100px; margin: 0 auto; padding: 14px 12px 40px; }

/* ---------- login ---------- */
.oc-loginpage { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: #ececea; }
.oc-login { background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: 26px 24px; width: min(360px, 92vw); }
.oc-login h1 { margin: 0; font-size: 21px; }
.oc-login .oc-sub { margin: 2px 0 16px; color: #777; font-size: 13px; }
.oc-login label { display: block; font-size: 13px; color: #555; margin-bottom: 12px; }
.oc-login input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid #ccc; border-radius: 7px; font-size: 15px; }
.oc-login button { width: 100%; padding: 10px; border: 0; border-radius: 7px; background: #b02234; color: #fff; font-weight: 600; }
.oc-err { background: #fbeaea; border: 1px solid #e3b1b1; color: #8c1c1c; border-radius: 7px; padding: 8px 10px; font-size: 13.5px; margin-bottom: 12px; }

/* ---------- card / liste ---------- */
.oc-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.oc-h h1 { font-size: 19px; margin: 0; }
.oc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.oc-card { background: #fff; border: 1px solid #ddd; border-radius: 10px; overflow: hidden; text-decoration: none; display: block; }
.oc-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #eee; }
.oc-card .t { padding: 9px 11px; font-weight: 600; font-size: 14px; }
.oc-card .s { padding: 0 11px 9px; color: #777; font-size: 12.5px; }
.oc-empty { color: #777; background: #fff; border: 1px dashed #ccc; border-radius: 10px; padding: 26px; text-align: center; }

.oc-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; font-size: 13.5px; }
.oc-table th { text-align: left; background: #f0f0ee; padding: 7px 9px; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; color: #666; }
.oc-table td { padding: 7px 9px; border-top: 1px solid #eee; }
.oc-table tr[data-href] { cursor: pointer; }
.oc-table tr[data-href]:hover { background: #fafaf7; }

.oc-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.oc-badge.bozza      { background: #eee; color: #666; }
.oc-badge.inviato    { background: #fff3d6; color: #8a6100; }
.oc-badge.confermato { background: #e2f2e4; color: #1e6b2c; }
.oc-badge.rifiutato  { background: #fbeaea; color: #8c1c1c; }

.oc-btn { display: inline-block; border: 1px solid #ccc; background: #fff; border-radius: 7px; padding: 7px 13px; font-size: 13.5px; text-decoration: none; color: #333; }
.oc-btn:hover { background: #f6f6f4; }
.oc-btn.primary { background: var(--az-color, #b02234); border-color: var(--az-color, #b02234); color: #fff; font-weight: 600; }
.oc-btn.danger { color: #8c1c1c; border-color: #d9a6a6; }
.oc-btn:disabled { opacity: .5; cursor: default; }

/* ---------- viewer catalogo (agente): split-screen + fit altezza ---------- */
.oc-vh { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; flex-wrap: wrap; }
.oc-vh #ocCatSel { max-width: 260px; }
.oc-search { position: relative; flex: 1; min-width: 180px; }
.oc-search input { width: 100%; padding: 8px 11px; border: 1px solid #ccc; border-radius: 7px; font-size: 14px; }
.oc-search-res { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 90; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.oc-search-res .cat { font-size: 11px; color: #999; text-transform: uppercase; }

.oc-split { display: flex; gap: 14px; align-items: flex-start; }
.oc-left { flex: 1; min-width: 0; }
.oc-pagewrap { position: relative; margin: 0 auto; width: fit-content; max-width: 100%; background: #fff; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }
/* la pagina si adatta all'ALTEZZA dello schermo: sempre tutta visibile */
.oc-pageimg { display: block; max-width: 100%; max-height: calc(100dvh - 215px); width: auto; height: auto; user-select: none; -webkit-user-drag: none; }
body.has-cartbar .oc-pageimg { max-height: calc(100dvh - 265px); }

/* pannello laterale (quantita' / matrice / carrello) */
.oc-panel { width: 420px; max-width: 44vw; background: #fff; border: 1px solid #ddd; border-radius: 10px; position: sticky; top: 58px; max-height: calc(100dvh - 130px); display: flex; flex-direction: column; }
.oc-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; border-bottom: 1px solid #eee; gap: 8px; }
.oc-panel-head h2 { margin: 0; font-size: 14.5px; }
.oc-panel-head .x { background: none; border: 0; font-size: 21px; line-height: 1; color: #888; padding: 2px 6px; cursor: pointer; }
.oc-panel-body { padding: 12px 13px; overflow: auto; }
@media (max-width: 860px) {
  /* su telefono il pannello diventa un foglio in basso: la pagina resta visibile sopra */
  .oc-split { display: block; }
  .oc-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 58dvh; border-radius: 14px 14px 0 0; z-index: 80; box-shadow: 0 -8px 24px rgba(0,0,0,.18); }
  body.has-panel .oc-pageimg { max-height: calc(42dvh - 40px); }
}
.oc-zone {
  position: absolute; border: 2px solid rgba(176,34,52,.55); background: rgba(176,34,52,.07);
  border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
}
.oc-zone .ztx { pointer-events: none; line-height: 1.15; word-break: break-word; padding: 1px 3px; }
.oc-zone.nostyle { border-color: transparent; background: transparent; }
.oc-zone.nostyle:hover, .oc-zone.nostyle:active { background: rgba(0,0,0,.06); }
.oc-zone:hover, .oc-zone:active { filter: brightness(.96); }
.oc-zone.incart { outline: 2px solid #1e6b2c; outline-offset: 1px; }
.oc-zone .n { position: absolute; top: -9px; right: -9px; background: #1e6b2c; color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.oc-pagenav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0; }
.oc-pagenav .pg { min-width: 70px; text-align: center; color: #666; font-size: 13.5px; }
.oc-thumbs { display: flex; gap: 7px; overflow-x: auto; padding: 4px 0 8px; }
.oc-thumbs img { height: 66px; border: 2px solid transparent; border-radius: 5px; cursor: pointer; background: #eee; }
.oc-thumbs img.on { border-color: var(--az-color, #b02234); }

/* ---------- barra carrello ---------- */
.oc-cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #232323; color: #fff; padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.oc-cartbar .tot { font-size: 13.5px; color: #ddd; }
.oc-cartbar .tot b { color: #fff; font-size: 15px; }
.oc-cartbar button { background: var(--az-color, #b02234); color: #fff; border: 0; border-radius: 7px; padding: 9px 16px; font-weight: 600; }
body.has-cartbar .oc-main { padding-bottom: 90px; }

/* ---------- modali ---------- */
.oc-modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .oc-modal { align-items: center; } }
.oc-modal[hidden] { display: none; }
.oc-modal .box {
  background: #fff; width: min(860px, 100vw); max-height: min(92vh, 100%);
  border-radius: 12px 12px 0 0; display: flex; flex-direction: column;
}
@media (min-width: 700px) { .oc-modal .box { border-radius: 12px; } }
.oc-modal .bhead { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #eee; gap: 10px; }
.oc-modal .bhead h2 { margin: 0; font-size: 15.5px; }
.oc-modal .bhead .x { background: none; border: 0; font-size: 22px; line-height: 1; color: #888; padding: 2px 6px; }
.oc-modal .bbody { padding: 12px 14px; overflow: auto; }
.oc-modal .bfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid #eee; }

/* matrice taglia/colore */
.oc-mx { overflow-x: auto; }
.oc-mx table { border-collapse: collapse; font-size: 12.5px; }
.oc-mx th, .oc-mx td { border: 1px solid #e2e2e0; padding: 3px; text-align: center; }
.oc-mx th { background: #f5f5f3; font-size: 11px; padding: 4px 6px; }
.oc-mx td.col { text-align: left; padding: 4px 7px; white-space: nowrap; font-weight: 600; }
.oc-mx td.col small { color: #888; font-weight: 400; }
.oc-mx input { width: 46px; padding: 4px 2px; text-align: center; border: 1px solid #ccc; border-radius: 4px; }
.oc-mx td.empty { background: #f2f2f0; }

/* carrello / righe ordine */
.oc-rows { width: 100%; border-collapse: collapse; font-size: 13px; }
.oc-rows th { text-align: left; color: #666; font-size: 11px; text-transform: uppercase; padding: 5px 6px; border-bottom: 1px solid #ddd; }
.oc-rows td { padding: 5px 6px; border-bottom: 1px solid #f0f0ee; vertical-align: middle; }
.oc-rows input { width: 100%; border: 1px solid #d5d5d3; border-radius: 5px; padding: 5px 6px; font-size: 13px; }
.oc-rows input.num { text-align: right; width: 74px; }
.oc-rows input.qta { text-align: center; width: 58px; }
.oc-rows .del { background: none; border: 0; color: #b02234; font-size: 16px; padding: 2px 6px; }
.oc-rows tr.przmod input.num.prz { border-color: #d9a12c; background: #fff8e6; }
.oc-rows input.sc.scman { border-color: #d9a12c; background: #fff8e6; }
.oc-rows input.sc.scauto { color: #1e6b2c; }
.oc-price-note { font-size: 11px; color: #8a6100; }

/* campo con etichetta */
.oc-field { display: block; font-size: 12.5px; color: #555; margin-bottom: 10px; }
.oc-field input, .oc-field select, .oc-field textarea { display: block; width: 100%; margin-top: 3px; padding: 8px 9px; border: 1px solid #ccc; border-radius: 7px; font-size: 14px; }
.oc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .oc-grid2 { grid-template-columns: 1fr; } }

/* suggerimenti cliente */
.oc-sugg { border: 1px solid #ddd; border-radius: 7px; max-height: 230px; overflow: auto; margin-top: -6px; background: #fff; }
.oc-sugg div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f2f2f0; font-size: 13.5px; }
.oc-sugg div:hover { background: #f7f7f5; }
.oc-sugg small { color: #888; }

.oc-spin { display: inline-block; width: 34px; height: 34px; border: 4px solid #e2e2e0; border-top-color: var(--az-color, #b02234); border-radius: 50%; animation: ocspin .8s linear infinite; }
@keyframes ocspin { to { transform: rotate(360deg); } }

.oc-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 200; background: #232323; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13.5px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
.oc-toast.show { opacity: 1; }
.oc-toast.error { background: #8c1c1c; }
