/*
 * FARO RSF - Design system
 * Progettazione e direzione del prodotto: Marco Orlando.
 * Copyright (c) 2026 Marco Orlando. Tutti i diritti riservati.
 */
:root {
  --faro-ink: #121716;
  --faro-ink-soft: #202725;
  --faro-paper: #f2f5f3;
  --faro-panel: #ffffff;
  --faro-muted: #63706b;
  --faro-line: #d5dcda;
  --faro-line-strong: #aeb9b5;
  --faro-red: #a62b2b;
  --faro-amber: #a65a17;
  --faro-green: #196247;
  --faro-blue: #285478;
  --faro-violet: #5c486f;
  --faro-shadow: 0 12px 32px rgba(18, 23, 22, .09);
  --faro-sidebar: 226px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--faro-paper); }
body.faro-home {
  min-height: 100vh;
  margin: 0;
  background: var(--faro-paper);
  color: var(--faro-ink);
  font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.faro-skip { position: fixed; left: 12px; top: -60px; z-index: 10050; padding: 10px 14px; background: #fff; color: #111; border: 2px solid #111; }
.faro-skip:focus { top: 12px; }

.faro-layout { min-height: 100vh; display: grid; grid-template-columns: var(--faro-sidebar) minmax(0, 1fr); }
.faro-rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--faro-ink); color: #fff; border-right: 1px solid #000; }
.faro-brand { min-height: 84px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.15); }
.faro-brand strong { display: block; font-family: "Arial Narrow", Impact, sans-serif; font-size: 30px; line-height: 1; letter-spacing: 0; }
.faro-brand strong span { color: #d8a66b; }
.faro-brand small { display: block; margin-top: 6px; color: #aeb8b4; font-size: 9px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.faro-company { padding: 13px 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.faro-company b, .faro-company span { display: block; }
.faro-company b { font-size: 11px; }
.faro-company span { margin-top: 3px; color: #aeb8b4; font-size: 10px; line-height: 1.35; }
.faro-nav { padding: 12px 8px; display: grid; gap: 3px; }
.faro-nav-label { padding: 10px 10px 5px; color: #7f8d88; font-size: 8px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.faro-nav a { min-height: 39px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-left: 3px solid transparent; color: #c7cfcc; text-decoration: none; font-size: 11px; font-weight: 750; }
.faro-nav a:hover, .faro-nav a[aria-current="page"] { background: rgba(255,255,255,.08); color: #fff; }
.faro-nav a[aria-current="page"] { border-left-color: #d8a66b; }
.faro-nav-mark { width: 25px; height: 25px; display: grid; place-items: center; flex: none; border: 1px solid rgba(255,255,255,.22); border-radius: 4px; color: #fff; font-size: 9px; font-weight: 900; }
.faro-rail-foot { margin-top: auto; padding: 15px 18px; border-top: 1px solid rgba(255,255,255,.12); color: #82908b; font-size: 9px; line-height: 1.5; }

.faro-workspace { min-width: 0; }
.top.faro-top { height: 58px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--faro-line); backdrop-filter: blur(10px); }
.faro-top-title { min-width: 0; flex: 1; }
.faro-top-title b { display: block; font-size: 13px; }
.faro-top-title span { display: block; margin-top: 1px; color: var(--faro-muted); font-size: 10px; }
.faro-live { display: inline-flex; align-items: center; gap: 7px; color: var(--faro-green); font-size: 10px; font-weight: 850; white-space: nowrap; }
.faro-live:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faro-green); box-shadow: 0 0 0 4px rgba(25,98,71,.11); }

.faro-main { width: min(1460px, 100%); margin: 0 auto; padding: 24px; }
.faro-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.faro-eyebrow { margin-bottom: 5px; color: var(--faro-amber); font-size: 9px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.faro-heading h1 { margin: 0; font-size: clamp(26px, 3vw, 40px); line-height: 1; letter-spacing: 0; }
.faro-heading p { max-width: 650px; margin: 7px 0 0; color: var(--faro-muted); font-size: 12px; line-height: 1.5; }
.faro-date { color: var(--faro-muted); font-size: 10px; white-space: nowrap; }

.faro-modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.faro-module { min-width: 0; min-height: 184px; display: flex; flex-direction: column; padding: 16px; background: var(--faro-panel); border: 1px solid var(--faro-line); border-top: 4px solid var(--module-accent); border-radius: 6px; box-shadow: 0 3px 12px rgba(18,23,22,.04); }
.faro-module.mog { --module-accent: var(--faro-violet); }
.faro-module.gare { --module-accent: var(--faro-amber); }
.faro-module.cantieri { --module-accent: var(--faro-green); }
.faro-module-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.faro-module-code { color: var(--faro-muted); font-size: 9px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.faro-module h2 { margin: 3px 0 0; font-size: 21px; letter-spacing: 0; }
.faro-module-state { padding: 4px 7px; border: 1px solid var(--faro-line); border-radius: 4px; color: var(--faro-green); background: #f3faf6; font-size: 9px; font-weight: 850; white-space: nowrap; }
.faro-module p { margin: 13px 0; color: var(--faro-muted); font-size: 11px; line-height: 1.5; }
.faro-module-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 13px; }
.faro-module-meta span { padding: 4px 6px; border: 1px solid var(--faro-line); border-radius: 3px; color: #4f5a56; background: #f8faf9; font-size: 9px; font-weight: 750; }
.faro-module-actions { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.faro-open { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; border-radius: 4px; background: var(--faro-ink); color: #fff; text-decoration: none; font-size: 10px; font-weight: 850; }
.faro-open:hover { background: var(--faro-ink-soft); }
.faro-module-actions small { color: var(--faro-muted); font-size: 9px; }

.faro-signal { margin: 12px 0 0; display: grid; grid-template-columns: 1.3fr repeat(4, minmax(100px, .65fr)); background: var(--faro-panel); border: 1px solid var(--faro-line); border-radius: 6px; overflow: hidden; }
.faro-signal-intro, .faro-signal-item { min-height: 66px; padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; }
.faro-signal-intro { background: var(--faro-ink); color: #fff; }
.faro-signal-intro b { font-size: 12px; }
.faro-signal-intro span { margin-top: 4px; color: #aeb8b4; font-size: 9px; }
.faro-signal-item { border-left: 1px solid var(--faro-line); }
.faro-signal-item b { font-size: 11px; }
.faro-signal-item span { margin-top: 3px; color: var(--faro-muted); font-size: 9px; }
.faro-signal-item.good b { color: var(--faro-green); }

.faro-band { margin-top: 12px; background: var(--faro-panel); border: 1px solid var(--faro-line); border-radius: 6px; overflow: hidden; }
.faro-band-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 15px; border-bottom: 1px solid var(--faro-line); }
.faro-band-head h2 { margin: 0; font-size: 15px; }
.faro-band-head p { margin: 3px 0 0; color: var(--faro-muted); font-size: 10px; }
.backend-pill { padding: 6px 8px; border: 1px solid var(--faro-line); border-radius: 4px; background: #f8faf9; color: var(--faro-muted); font-size: 9px; font-weight: 750; white-space: nowrap; }
.tender-grid, .ops-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.tender-card, .op-card { min-width: 0; padding: 13px; border: 1px solid var(--faro-line); border-radius: 5px; background: #fff; }
.tender-card h3, .op-top h3 { margin: 0; font-size: 15px; }
.tender-card p, .op-body p { margin: 7px 0 10px; color: var(--faro-muted); font-size: 10px; line-height: 1.45; }
.tender-meta, .op-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.tender-meta span, .op-meta span { min-width: 0; padding: 6px; border: 1px solid #e1e6e4; background: #f8faf9; color: var(--faro-muted); font-size: 8px; font-weight: 800; text-transform: uppercase; overflow-wrap: anywhere; }
.tender-meta b, .op-meta b { display: block; margin-top: 2px; color: var(--faro-ink); font-size: 10px; text-transform: none; }
.risk, .op-state { display: inline-flex; width: max-content; max-width: 100%; margin-top: 9px; padding: 4px 6px; border-radius: 3px; font-size: 9px; font-weight: 850; }
.risk.high { color: var(--faro-red); background: #fff3f3; border: 1px solid #eebcbc; }
.risk.medium, .op-state { color: #865018; background: #fff8ed; border: 1px solid #ebcf9f; }
.risk.low { color: var(--faro-green); background: #eff9f3; border: 1px solid #b7dfc7; }
.tender-docs, .op-actions button, .doc-row-actions button, .retry { min-height: 32px; border: 1px solid var(--faro-ink); border-radius: 4px; background: #fff; color: var(--faro-ink); padding: 0 10px; font-size: 9px; font-weight: 850; cursor: pointer; }
.tender-docs { width: 100%; margin-top: 10px; background: var(--faro-ink); color: #fff; }
.op-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.op-body { margin-top: 8px; }
.op-section { margin-top: 10px; }
.op-section h4 { margin: 0 0 5px; color: var(--faro-muted); font-size: 8px; letter-spacing: .12em; text-transform: uppercase; }
.op-list { margin: 0; padding: 0; display: grid; gap: 4px; }
.op-list li { list-style: none; padding: 6px; border-left: 3px solid var(--faro-line-strong); background: #f8faf9; font-size: 9px; line-height: 1.4; }
.op-list li.block { border-left-color: var(--faro-red); color: #781f1f; background: #fff4f4; }
.op-actions { display: flex; gap: 6px; margin-top: 10px; }
.op-actions button:first-child { background: var(--faro-ink); color: #fff; }

.doc-archive { border-top: 1px solid var(--faro-line); }
.doc-toolbar { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 7px; padding: 10px 12px; background: #f6f8f7; border-bottom: 1px solid var(--faro-line); }
.doc-toolbar select, .doc-toolbar input { width: 100%; min-height: 36px; margin: 0; padding: 0 10px; border: 1px solid var(--faro-line-strong); border-radius: 4px; background: #fff; color: var(--faro-ink); font-size: 10px; }
.doc-table-wrap { max-height: 310px; overflow: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.doc-table th { position: sticky; top: 0; z-index: 1; padding: 8px; background: #f6f8f7; color: var(--faro-muted); text-align: left; font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.doc-table td { padding: 8px; border-top: 1px solid #e7ebe9; vertical-align: top; }
.doc-table tr:hover td { background: #fafcfb; }
.doc-table .mono { margin-top: 2px; color: var(--faro-muted); font: 8px Consolas, monospace; overflow-wrap: anywhere; }
.doc-row-actions { display: flex; gap: 4px; }
.doc-row-actions button:first-child { background: var(--faro-ink); color: #fff; }
.doc-summary { min-height: 39px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--faro-line); }
.doc-summary span { padding: 4px 6px; border: 1px solid var(--faro-line); border-radius: 3px; color: var(--faro-muted); font-size: 8px; font-weight: 800; }
.state { grid-column: 1 / -1; padding: 24px 16px; text-align: center; color: var(--faro-muted); }
.state svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.state b, .state p { display: block; }
.state b { margin-top: 7px; color: var(--faro-ink); font-size: 12px; }
.state p { max-width: 460px; margin: 5px auto 10px; font-size: 10px; line-height: 1.45; }
.state.error { color: var(--faro-red); }
.skel { position: relative; overflow: hidden; background: #e7ebe9; border-radius: 3px; }
.skel:after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent); animation: faro-skel 1.1s infinite; }
.skel-line { height: 10px; margin: 3px 0; }
@keyframes faro-skel { to { transform: translateX(100%); } }

.faro-legal-note { margin-top: 12px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--faro-line); border-radius: 5px; color: var(--faro-muted); background: #e9eeec; font-size: 9px; line-height: 1.45; }
.faro-legal-note a { color: var(--faro-ink); font-weight: 850; white-space: nowrap; }

.legal-page { min-height: 100vh; margin: 0; padding: 36px 18px; background: var(--faro-paper); color: var(--faro-ink); font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif; }
.legal-sheet { width: min(900px, 100%); margin: 0 auto; background: #fff; border: 1px solid var(--faro-line); border-top: 5px solid var(--faro-ink); border-radius: 6px; box-shadow: var(--faro-shadow); }
.legal-head { padding: 28px 30px 20px; border-bottom: 1px solid var(--faro-line); }
.legal-head a { display: inline-block; margin-bottom: 20px; color: var(--faro-muted); font-size: 10px; font-weight: 800; text-decoration: none; }
.legal-head h1 { margin: 0; font-size: 30px; }
.legal-head p { margin: 8px 0 0; color: var(--faro-muted); font-size: 12px; line-height: 1.5; }
.legal-content { padding: 26px 30px 32px; }
.legal-content section + section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--faro-line); }
.legal-content h2 { margin: 0 0 9px; font-size: 15px; }
.legal-content p, .legal-content li { color: #48524f; font-size: 11px; line-height: 1.65; }
.legal-content ul { margin: 0; padding-left: 19px; }
.legal-content a { color: var(--faro-blue); font-weight: 750; }
.legal-claim { padding: 14px 16px; border-left: 4px solid var(--faro-amber); background: #fff8ee; color: #553719; font-size: 12px; font-weight: 750; line-height: 1.55; }
.legal-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.legal-meta div { padding: 10px; border: 1px solid var(--faro-line); background: #f8faf9; }
.legal-meta b, .legal-meta span { display: block; }
.legal-meta b { font-size: 9px; text-transform: uppercase; }
.legal-meta span { margin-top: 3px; color: var(--faro-muted); font-size: 10px; }

/* Visual layer shared by the three operational modules. */
body:not(.faro-home) { background: var(--faro-paper) !important; color: var(--faro-ink) !important; font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif !important; }
body:not(.faro-home) #sb, body:not(.faro-home) #sidebar { background: #eef2f0 !important; border-right: 1px solid var(--faro-line-strong) !important; }
body:not(.faro-home) .topbar { min-height: 48px !important; background: rgba(255,255,255,.97) !important; border-bottom: 1px solid var(--faro-line) !important; }
body:not(.faro-home) .sb-logo, body:not(.faro-home) .sb-top { border-bottom-color: var(--faro-line) !important; }
body:not(.faro-home) .sb-user, body:not(.faro-home) .sb-azienda, body:not(.faro-home) .sb-project { background: var(--faro-ink) !important; }
body:not(.faro-home) .si, body:not(.faro-home) .sb-item { border-radius: 0 !important; }
body:not(.faro-home) .si:hover, body:not(.faro-home) .sb-item:hover { background: #e2e8e5 !important; }
body:not(.faro-home) .si.active, body:not(.faro-home) .sb-item.active { background: #dce4e0 !important; }
body:not(.faro-home) .card, body:not(.faro-home) .panel, body:not(.faro-home) .modal { border-radius: 5px !important; box-shadow: none !important; }
body:not(.faro-home) button, body:not(.faro-home) .btn { border-radius: 4px !important; }
body:not(.faro-home) input, body:not(.faro-home) select, body:not(.faro-home) textarea { border-radius: 4px !important; }

@media (max-width: 1060px) {
  .faro-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .faro-modules, .tender-grid, .ops-grid { grid-template-columns: 1fr; }
  .faro-signal { grid-template-columns: repeat(2, 1fr); }
  .faro-signal-intro { grid-column: 1 / -1; }
  .faro-signal-item:nth-child(even) { border-left: 0; }
}
@media (max-width: 820px) {
  .faro-layout { display: block; }
  .faro-rail { display: none; }
  .top.faro-top { height: 52px; padding: 0 12px; }
  .faro-live { display: none; }
  .faro-main { padding: 16px 12px calc(82px + env(safe-area-inset-bottom)); }
  .faro-heading { display: block; }
  .faro-date { margin-top: 8px; }
  .faro-modules { grid-template-columns: 1fr; }
  .faro-module { min-height: 164px; }
  .faro-signal { grid-template-columns: 1fr 1fr; }
  .faro-signal-intro { grid-column: 1 / -1; }
  .faro-band-head { align-items: flex-start; }
  .doc-toolbar { grid-template-columns: 1fr; }
  .doc-table-wrap { max-height: 62vh; overflow-x: hidden; padding: 8px; }
  .doc-table thead { display: none; }
  .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; width: 100%; }
  .doc-table tr { margin-bottom: 8px; padding: 8px 10px; border: 1px solid var(--faro-line); border-radius: 4px; }
  .doc-table td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; border-bottom: 1px solid #edf0ef; }
  .doc-table td:before { content: attr(data-label); flex: none; color: var(--faro-muted); font-size: 8px; font-weight: 850; text-transform: uppercase; }
  .doc-table td:last-child { border-bottom: 0; }
  .doc-table td[colspan] { display: block; }
  .doc-table td[colspan]:before { content: ""; }
  .faro-legal-note { align-items: flex-start; }
}
@media (max-width: 480px) {
  .faro-signal { grid-template-columns: 1fr; }
  .faro-signal-intro { grid-column: auto; }
  .faro-signal-item { border-left: 0; border-top: 1px solid var(--faro-line); }
  .faro-band-head { display: block; }
  .backend-pill { display: inline-flex; margin-top: 8px; }
  .tender-meta, .op-meta { grid-template-columns: 1fr; }
  .faro-legal-note { display: block; }
  .faro-legal-note a { display: inline-block; margin-top: 7px; }
  .legal-page { padding: 12px; }
  .legal-head, .legal-content { padding-left: 18px; padding-right: 18px; }
  .legal-meta { grid-template-columns: 1fr; }
}
