/* Reweke Proposals Portal — design system (brand: Deep Teal #1A7A7A, Mint #4ECDC4, White, Slate #F4F6F9) */
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --brand: #1A7A7A; --brand-700: #136262; --brand-100: #D5EEEE; --brand-50: #EDF7F7; --mint: #4ECDC4;
  --bg: #FFFFFF; --soft: #F4F6F9; --line: #E4E9EF; --line-strong: #CFD7E0;
  --text: #0E1B2C; --muted: #5D6B7C; --faint: #8794A3;
  --danger: #C0362C; --danger-50: #FDEDEB; --warn: #B45309; --warn-50: #FEF3E2; --ok: #1E7B4B; --ok-50: #E6F5EC; --info: #2456C7; --info-50: #E8EFFD;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --sidebar: 248px; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-head: "Plus Jakarta Sans", var(--font);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 650; letter-spacing: -.01em; margin: 0; color: var(--text); }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .strong { font-weight: 600; }
.hidden { display: none !important; } .nowrap { white-space: nowrap; } .right { text-align: right; } .grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; } .gap-lg { gap: 20px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mono { font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px 14px; border-right: 1px solid var(--line); background: var(--bg); z-index: 30; }
.sidebar .logo { display: block; padding: 4px 8px 22px; } .sidebar .logo img { width: 150px; height: auto; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; text-decoration: none; position: relative; }
.nav a:hover { background: var(--soft); color: var(--text); }
.nav a.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mint); }
.nav .label { margin: 16px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.sidebar .foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.usercard { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); display: grid; place-items: center; font-weight: 700; flex: none; }
.usercard .who { line-height: 1.25; min-width: 0; } .usercard .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot .links { display: flex; gap: 6px; margin-top: 6px; } .foot .ver { margin: 8px 8px 0; font-size: 11.5px; color: var(--faint); }
.main { min-width: 0; }
.topbar { display: none; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.topbar img { height: 26px; }
.content { max-width: 1320px; margin: 0 auto; padding: 28px 32px 90px; }
.scrim { display: none; }

/* ---------- Components ---------- */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card > h3:first-child, .card-head { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 8px; font-weight: 500; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: 600 13.5px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, box-shadow .12s; }
.btn:hover { background: var(--brand-700); text-decoration: none; }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid rgba(78, 205, 196, .55); outline-offset: 1px; }
.btn.secondary { background: var(--bg); color: var(--text); border-color: var(--line-strong); } .btn.secondary:hover { background: var(--soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { background: var(--soft); color: var(--text); }
.btn.danger { background: var(--danger); border-color: var(--danger); } .btn.danger:hover { background: #a02b22; }
.btn.warn { background: var(--warn); border-color: var(--warn); } .btn.warn:hover { background: #92400e; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; } .btn.icon { width: 34px; padding: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

input, select, textarea { font: 14px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; height: 38px; width: 100%; }
textarea { height: auto; min-height: 84px; resize: vertical; line-height: 1.45; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); padding: 0; }
input[type=file] { height: auto; padding: 6px; }
input[type=number] { text-align: right; }
input:disabled, select:disabled { background: var(--soft); color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.draft { background: var(--soft); color: var(--muted); } .badge.submitted { background: var(--info-50); color: var(--info); }
.badge.returned { background: var(--warn-50); color: var(--warn); } .badge.finalized { background: var(--ok-50); color: var(--ok); }
.badge.declined { background: var(--danger-50); color: var(--danger); }
.badge.accepted { background: var(--ok-50); color: var(--ok); }
.badge.ok { background: var(--ok-50); color: var(--ok); } .badge.off { background: var(--soft); color: var(--faint); } .badge.bad { background: var(--danger-50); color: var(--danger); }
.badge.plain::before { display: none; } .badge.role { background: var(--brand-50); color: var(--brand-700); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--soft); font-size: 11.5px; color: var(--muted); margin: 2px 4px 2px 0; }

.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.notice.info { background: var(--info-50); color: #1c419a; } .notice.warn { background: var(--warn-50); color: #7c3a06; } .notice.err { background: var(--danger-50); color: #8f2820; } .notice.ok { background: var(--ok-50); color: #155c39; }
.notice b { display: block; }
.msa-ro { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 4px 10px; border: 1px solid var(--line); background: var(--soft); border-radius: 8px; }
.msa-flag { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; vertical-align: middle; margin-right: 4px; cursor: help; }
.msa-bar { display: block; position: relative; height: 8px; min-width: 110px; background: var(--soft); border-radius: 6px; overflow: hidden; margin-bottom: 2px; }
.msa-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--mint); } .msa-bar i.c { background: var(--brand); } .msa-bar i.over { background: var(--danger); }
#grid input.w-num { width: 74px; } #grid input.w-code { width: 88px; } #grid input.w-desc { width: 150px; } #grid select { width: 108px; }
.msa-k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--soft); }
th.num, td.num { text-align: right; } td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Il kit è la riga di prezzo che conta: più prominente (sfondo, bordo colorato, cifre più grandi). */
tr.kit-head td { background: var(--brand-50); font-weight: 600; color: var(--brand-700); border-bottom: 1px solid var(--brand-100); border-top: 2px solid var(--brand-100); }
tr.kit-head:first-child td { border-top-color: transparent; }
tr.kit-head td.num { color: var(--brand-700); font-size: 14px; }
tr.kit-head td.strong.num { font-size: 15px; font-weight: 700; }
tr.kit-head.plain td { font-weight: 600; color: var(--muted); background: var(--soft); font-size: 12.5px; }
tr.kit-head .badge.role.plain { background: var(--brand); color: #fff; font-weight: 700; }
/* I componenti di un kit restano sempre inseriti con il proprio prezzo (bill of materials), ma sono
   visivamente secondari: il totale che conta è quello del kit, non la somma di queste righe. */
tr.kit-member td:not(.num) { color: var(--muted); }
tr.kit-member td.num.faint { font-style: italic; }

/* KPI / totals */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg); }
.kpi .k { font-size: 12.5px; color: var(--muted); font-weight: 500; } .kpi .v { font-family: var(--font-head); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; } .kpi .s { font-size: 12px; color: var(--faint); }
.kpi.brand { background: var(--brand); border-color: var(--brand); } .kpi.brand .k, .kpi.brand .v, .kpi.brand .s { color: #fff; } .kpi.brand .s { opacity: .8; }
.kpi.soft { background: var(--brand-50); border-color: var(--brand-100); }

/* stepper */
.stepper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 20px; }
.step { display: flex; align-items: center; gap: 8px; color: var(--faint); font-weight: 600; font-size: 13px; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--faint); font-size: 12px; }
.step.done { color: var(--brand); } .step.done .dot { background: var(--brand); color: #fff; }
.step.now { color: var(--text); } .step.now .dot { background: var(--mint); color: #063; box-shadow: 0 0 0 4px rgba(78, 205, 196, .25); }
.step.returned .dot { background: var(--warn); color: #fff; box-shadow: 0 0 0 4px var(--warn-50); }
.step-line { width: 34px; height: 2px; background: var(--line); } .step-line.done { background: var(--brand); }

/* item images */
.thumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 56px; }
.thumb { position: relative; width: 44px; height: 44px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); cursor: zoom-in; flex: none; padding: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 1px; right: 1px; width: 17px; height: 17px; border-radius: 50%; border: 0; background: rgba(14, 27, 44, .75); color: #fff; font-size: 11px; line-height: 17px; padding: 0; cursor: pointer; display: grid; place-items: center; }
.thumb-add { width: 44px; height: 44px; border-radius: 8px; border: 1.5px dashed var(--line-strong); background: var(--bg); color: var(--faint); display: grid; place-items: center; cursor: pointer; padding: 0; }
.thumb-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgba(8, 16, 28, .82); }
.lightbox .frame { position: relative; background: #fff; border-radius: 14px; padding: 10px; box-shadow: var(--shadow-lg); }
.lightbox img { display: block; max-width: min(92vw, 1100px); max-height: 80vh; border-radius: 8px; }
.lightbox .bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 0; gap: 10px; }

/* inputs inside item rows */
.items input { height: 34px; padding: 5px 8px; } .items td { padding: 8px 8px; } .items .w-code { min-width: 110px; } .items .w-desc { min-width: 200px; } .items .w-num { min-width: 92px; }
.items select { height: 34px; padding: 4px 8px; min-width: 120px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 3px solid var(--mint); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline .when { color: var(--faint); font-size: 12px; } .timeline ul.changes { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.bubble { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.bubble.reweke { background: var(--warn-50); border-color: #f5d9a8; } .bubble.trade { background: var(--brand-50); border-color: var(--brand-100); }
.bubble .who { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.actionbar { position: sticky; bottom: 0; margin: 20px -32px -90px; padding: 12px 32px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; z-index: 10; }
.actionbar .msg { margin-right: auto; color: var(--muted); font-size: 13px; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, 94vw); box-shadow: var(--shadow-lg); color: var(--text); }
dialog::backdrop { background: rgba(8, 16, 28, .5); }
dialog form, dialog .dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
dialog h2 { margin-bottom: 2px; }
.toasts { position: fixed; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .18s ease-out; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--danger); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.perm-grid > div { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
details.more summary { cursor: pointer; color: var(--brand); font-size: 12.5px; }
.secret-note { font-size: 12px; color: var(--faint); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 46%) 1fr; }
.auth-hero { background: linear-gradient(155deg, #1A7A7A 0%, #0f5252 70%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero img { width: 210px; }
.auth-hero h1 { color: #fff; font-size: 34px; line-height: 1.15; max-width: 440px; } .auth-hero p { color: #cdeeea; max-width: 420px; font-size: 15px; }
.auth-hero ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; color: #e4f6f4; } .auth-hero li::before { content: "✓"; color: var(--mint); font-weight: 800; margin-right: 10px; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form .box { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-form .mobile-logo { display: none; width: 160px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 16, 28, .45); z-index: 25; }
  .topbar { display: flex; }
  .content { padding: 20px 16px 90px; }
  .actionbar { margin: 20px -16px -90px; padding: 10px 16px; }
  .auth { grid-template-columns: 1fr; } .auth-hero { display: none; } .auth-form .mobile-logo { display: block; }
}
@media (max-width: 860px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: var(--bg); box-shadow: var(--shadow); }
  .rtable tr.kit-head { background: var(--brand-50); }
  .rtable td { display: flex; justify-content: space-between; align-items: center; gap: 14px; border: 0; padding: 6px 0; text-align: right; }
  .rtable td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: 0 0 38%; }
  .rtable td.nolabel::before { display: none; } .rtable td.nolabel { justify-content: flex-start; }
  .rtable td > input, .rtable td > select { max-width: 60%; } .rtable td.num { white-space: normal; }
  .rtable tr.kit-head td { justify-content: space-between; }
  .items input, .items select { max-width: 62%; min-width: 0; } .items .w-code, .items .w-desc, .items .w-num { min-width: 0; }
  .tablewrap { overflow-x: visible; }
  h1 { font-size: 21px; } .kpi .v { font-size: 19px; }
  .stepper .step-line { width: 14px; }
}
@media print { .sidebar, .topbar, .actionbar, .btn { display: none !important; } .shell { display: block; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* delta highlight (history) */
.delta-up { color: var(--danger); font-weight: 600; }
.delta-down { color: var(--ok); font-weight: 600; }
.w-num { width: 110px; }
.hidden { display: none !important; }

/* inline controls inside flex rows keep their natural width (kit header, exchange-rate row) */
.row > input, .row > select { width: auto; flex: 0 1 auto; }
.row > input.w-desc { width: 260px; max-width: 100%; }
.row > input.w-num { width: 96px; }
@media (max-width: 860px) { .toasts { left: 16px; right: 16px; top: 12px; max-width: none; } }

/* clients: removed-from-CRM rows */
tr.row-inactive td { opacity: .55; }
tr.row-inactive .badge.bad { opacity: 1; }

/* ---------- Trade Portal: richieste, offerte, proforma, ordini ---------- */
.linkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 16px; background: var(--soft); border-radius: 10px; }
.linkbar .sep { color: var(--faint); }
.docs { display: flex; flex-wrap: wrap; gap: 8px; }
.doc { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); background: var(--bg); font-weight: 500; }
.doc:hover { background: var(--brand-50); text-decoration: none; border-color: var(--brand); }
.docrow { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sep-line { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.bubble.internal { background: var(--soft); border-style: dashed; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.w-auto { width: auto; }
label.inline { display: flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
dialog.wide { width: min(880px, 96vw); max-height: 94vh; overflow: auto; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.photo { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(14, 27, 44, .75); color: #fff; font-size: 14px; line-height: 22px; padding: 0; cursor: pointer; }
.badge.ok::before { background: currentColor; }

/* Selettore lingua e testo solo per screen reader */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.lang-pick select { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line, #d7dde5); border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }

.mybrand { display: flex !important; align-items: center; gap: 8px; } .mybrand b { font-family: var(--font-head); font-size: 22px; color: var(--brand-700); } .mybrand img { width: 130px !important; }

/* ---------- Topbar unica a tutta larghezza (logo una sola volta, in alto a sinistra) ---------- */
.shell { grid-template-rows: 60px 1fr; }
.shell > .topbar { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 24px; position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--line); background: var(--bg); justify-content: flex-start; }
.topbar .top-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.topbar .top-brand b { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--brand-700); }
.topbar .top-brand img { height: 28px; width: auto; display: block; }
.topbar .top-mod { padding-left: 14px; border-left: 1px solid var(--line-strong); font: 600 12px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.topbar .menu-btn { display: none; }
.shell > .sidebar { grid-row: 2; top: 60px; height: calc(100vh - 60px); padding-top: 16px; }
.shell > .main { grid-row: 2; grid-column: 2; }
@media (max-width: 1000px) {
  .shell > .main { grid-column: 1; }
  .shell > .topbar { padding: 0 12px; }
  .topbar .menu-btn { display: inline-flex; }
  .shell > .sidebar { position: fixed; top: 60px; bottom: 0; height: auto; }
  .topbar .top-mod { display: none; }
}

/* ---------- Selettore lingua nella topbar ---------- */
.lang-top { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-right: 6px; }
.lang-top .ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lang-top .lang-text { font-size: 13px; font-weight: 500; }
.lang-top .lang-pick select { height: 34px; padding: 0 28px 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background-color: var(--bg); color: var(--text); font: 600 13px var(--font); cursor: pointer; }
.lang-top .lang-pick select:hover { border-color: var(--brand); }
@media (max-width: 700px) { .lang-top .lang-text { display: none; } }
.lang-top .lang-pick select { min-width: 110px; }
@media (max-width: 700px) {
  .lang-top { margin-right: 0; gap: 4px; } .lang-top .lang-pick select { min-width: 0; width: 92px; padding: 0 22px 0 8px; font-size: 12.5px; }
  .topbar .top-brand b { font-size: 18px; } .topbar .top-brand img { height: 22px; }
  .shell > .topbar { gap: 8px; } .topbar .top-brand { min-width: 0; flex: 0 1 auto; }
}
@media (max-width: 700px) { .lang-top .lang-pick select { width: 106px; } }

/* Campioni e moduli: campi con larghezza adeguata al dato, non a tutto schermo */
.fgrid { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-start; }
.fgrid .field { flex: 0 0 auto; width: 200px; max-width: 100%; }
.fgrid .field.sm { width: 150px; } .fgrid .field.md { width: 260px; } .fgrid .field.lg { width: 440px; } .fgrid .field.full { width: 100%; max-width: 760px; }
.fgrid .field input[type=number] { max-width: 100%; }
.items input.w-unit { width: 90px; min-width: 80px; } .items select.w-cur { width: 86px; min-width: 80px; }
.kvgrid { display: flex; flex-wrap: wrap; gap: 14px 36px; } .kv { display: flex; flex-direction: column; gap: 3px; min-width: 150px; max-width: 520px; } .kv b { font-weight: 600; }
.static { padding: 8px 0; font-weight: 700; } .check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
@media (max-width: 640px) { .fgrid .field, .fgrid .field.sm, .fgrid .field.md, .fgrid .field.lg { width: 100%; } .kv { min-width: 0; } }
/* Etichette su due righe: riserva lo spazio, così i campi della stessa riga restano allineati */
.fgrid .field > label { min-height: 2.5em; display: flex; align-items: flex-end; line-height: 1.25; }
@media (max-width: 640px) { .fgrid .field > label { min-height: 0; } }
/* Righe con campi di testo alti: gli altri campi partono dall'alto, allineati ai testi */
.items.top td { vertical-align: top; } .items.top th { padding-left: 8px; padding-right: 8px; text-align: left; }
.tipi { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 4px; border: 1px solid var(--muted); border-radius: 50%; font: italic 700 10px/1 serif; text-transform: none; letter-spacing: 0; color: var(--muted); cursor: help; vertical-align: 1px; }
.tipi:hover, .tipi:focus { background: var(--brand-700); border-color: var(--brand-700); color: #fff; outline: none; }
#tipBox { position: fixed; z-index: 1000; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: #0E1B2C; color: #fff; font-size: 12.5px; font-weight: 400; line-height: 1.35; letter-spacing: 0; text-transform: none; box-shadow: 0 6px 18px rgba(0,0,0,.25); pointer-events: none; }
/* Intestazioni di tabelle con campi: stesso margine interno delle celle, così il testo parte dove inizia il campo */
.items th { padding-left: 8px; padding-right: 8px; }
.items:has(input) th.num { text-align: left; }

/* Spedizioni (dati dall'app Shipping) */
.ship-card { max-width: 980px; } .bigeta { font: 700 26px var(--font-head); color: var(--brand); } .grow { flex: 1; }
.ship-card h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); } .cline { padding: 6px 0; border-bottom: 1px dashed var(--line); } .cline:last-child { border-bottom: 0; }
.ship-track { display: flex; margin: 14px 0 6px; } .ship-track .st { flex: 1; text-align: center; font-size: 12px; color: var(--faint); position: relative; padding-top: 22px; }
.ship-track .st::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 3px; background: var(--line); }
.ship-track .st::after { content: ""; position: absolute; top: 0; left: calc(50% - 8px); width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--line); }
.ship-track .st.done { color: var(--text); } .ship-track .st.done::before, .ship-track .st.done::after { background: var(--brand); border-color: var(--brand); }
.ship-track .st.now { color: var(--brand); font-weight: 700; } .ship-track .st.now::after { background: var(--mint); border-color: var(--brand); }
.ship-card .timeline li.fut { color: var(--faint); } .ship-card .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .ship-card .two { grid-template-columns: 1fr; } }
