/* Area clienti Tirrena Sistemi: colori dai design tokens condivisi della suite. */
:root {
  --navy: #00007f;
  --orange: #ff5400;
  --surface: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--surface); }
a { color: var(--navy); }
a:hover { color: var(--orange); }
h1 { font-size: 1.6rem; margin: 0 0 .4rem; color: var(--navy); }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; color: var(--navy); }
.card h2:not(:first-child) { margin-top: 1.4rem; }
p { margin: 0 0 .8rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { text-align: right; }

/* Testata */
.top { background: var(--card); border-bottom: 3px solid var(--navy); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 8px; }
.brand img { display: block; height: 34px; width: auto; }
.who { text-align: right; line-height: 1.25; min-width: 0; }
.who strong { display: block; color: var(--navy); overflow-wrap: anywhere; }
.who span { color: var(--muted); font-size: .85rem; }
.nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding-bottom: 0; }
.nav a, .nav .link { padding: 10px 12px; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; margin-bottom: -3px; white-space: nowrap; font: inherit; }
.nav a.on { color: var(--navy); border-bottom-color: var(--orange); font-weight: 600; }
.nav a:hover, .nav .link:hover { color: var(--orange); }
.nav .logout { margin-left: auto; }
.link { background: none; border: 0; cursor: pointer; color: var(--muted); }

.page { padding-top: 24px; padding-bottom: 32px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: .6rem; }
.foot { color: var(--muted); font-size: .8rem; padding-top: 8px; padding-bottom: 24px; text-align: center; }

/* Pagine di accesso */
.auth { min-height: 88vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-top: 4px solid var(--navy); border-radius: var(--radius); padding: 28px 24px; box-shadow: 0 8px 30px rgba(15, 23, 42, .06); }
.auth-logo { display: block; margin: 0 auto 4px; max-width: 220px; height: auto; }
.auth-sub { text-align: center; color: var(--orange); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; margin-bottom: 1.4rem; }
.auth-card h1 { font-size: 1.3rem; }

/* Moduli */
.form { display: flex; flex-direction: column; gap: 6px; margin: 1rem 0; }
.form label { font-weight: 600; font-size: .9rem; margin-top: 6px; }
.form input[type=email], .form input[type=password], .form input[type=text] { width: 100%; padding: 11px 12px; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); }
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.form input[readonly] { background: var(--surface); color: var(--muted); }
.form .check { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.form .check input { margin-top: 4px; }
.code { font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; }
.btn { display: inline-block; margin-top: 10px; padding: 11px 18px; background: var(--navy); color: #fff; border: 0; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: #000066; color: #fff; }
.btn-light { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.btn-light:hover { background: var(--navy); color: #fff; }

.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-info { background: #f0f9ff; border-color: #bae6fd; color: #075985; }

/* Riquadri */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--navy); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--text); }
a.tile:hover { border-color: var(--orange); color: var(--text); }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile-value { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.tile-note { font-size: .85rem; color: var(--muted); }
.tile-danger { border-left-color: var(--danger); }
.tile-danger .tile-value { color: var(--danger); }
.tile-ok { border-left-color: var(--ok); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.note { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; padding: 10px 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.list { list-style: none; margin: 0 0 .6rem; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 1rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

/* Tabelle */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th.num { text-align: right; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-neutral { background: #f1f5f9; color: #334155; }

@media (max-width: 720px) {
  h1 { font-size: 1.35rem; }
  .grid2 { grid-template-columns: 1fr; }
  .who span { display: none; }
  .brand img { height: 28px; }
  /* Tabelle in schede impilate */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table td { border: 0; padding: 3px 0 3px 38%; position: relative; text-align: right; min-height: 1.9em; }
  .table td::before { content: attr(data-label); position: absolute; left: 0; top: 3px; color: var(--muted); font-size: .85rem; text-align: left; }
  .table td.num { text-align: right; }
  .nav a, .nav .link { padding: 10px 8px; }
}

/* Intestazione dentro una scheda senza margini interni */
.card-pad { padding: 14px 18px 4px; margin: 0; }
.card ul { padding-left: 1.2rem; margin: 0 0 1rem; }
.card ul li { margin-bottom: .3rem; }

/* Catalogo */
h2.cat { margin: 1.4rem 0 .6rem; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.product { background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--navy); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.product h3 { margin: 0; font-size: 1.05rem; color: var(--navy); }
.product p { margin: 0; }
.product .price { font-size: 1.2rem; font-weight: 700; color: var(--navy); margin-top: auto; padding-top: 6px; }
.product-row { display: flex; gap: 8px; align-items: flex-end; }
.product-row label { display: flex; flex-direction: column; gap: 2px; }
.product-row .grow { flex: 1; }
.product-row .qty { width: 90px; }
.product input[type=text], .product input[type=number], .textarea { width: 100%; padding: 9px 10px; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); }
.product .btn { margin-top: 6px; }
