/* Service Plus Portal — mockup statico. Palette e temi ripresi da UI/src/style/scss/_colors.scss */
:root {
  --brand-01-600: #E12121; --brand-01-700: #B12121; --brand-02: #2A2A2B; --brand-03: #FFFFFF;
  --ui-01: #DDDDDD; --ui-02: #BABABA; --ui-03: #7A7A7A; --ui-04: #EEEEEE;
  --side: #C9372C; --side-dark: #A82A22;
  --blue: #5B9BE0; --green: #6BB85A; --yellow: #E2B23A; --lightblue: #63A9E6; --navy: #4C6FBF;
}
.riello-theme   { --brand-01-600:#E12121; --brand-01-700:#B12121; --side:#C9372C; --side-dark:#A82A22; }
.beretta-theme  { --brand-01-600:#A9B000; --brand-01-700:#727800; --side:#8C9300; --side-dark:#6E7300; }
.sylber-theme   { --brand-01-600:#2d844b; --brand-01-700:#297844; --side:#2d844b; --side-dark:#21633a; }
.eni-theme      { --brand-01-600:#545658; --brand-01-700:#5F6163; --side:#545658; --side-dark:#3f4143; }
.thermital-theme{ --brand-01-600:#435f90; --brand-01-700:#3A517A; --side:#435f90; --side-dark:#344a70; }
.carrier-theme  { --brand-01-600:#1A4FA0; --brand-01-700:#163F80; --side:#1A4FA0; --side-dark:#123a77; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Open Sans', Segoe UI, Arial, sans-serif; color: var(--brand-02); background: #fff; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
svg.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--ui-03); }
.demo-ribbon { position: fixed; right: -46px; bottom: 22px; transform: rotate(-45deg); background: #2A2A2B; color: #fff; font-size: 11px; letter-spacing: 2px; padding: 4px 56px; z-index: 50; opacity: .85; }

/* ---------- Selezione company/brand ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 54px; padding: 0 16px; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.portal-title { font-family: 'Saira', 'Open Sans'; font-weight: 600; line-height: 1.05; font-size: 16px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ui-04); color: var(--brand-02); display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 1px solid var(--ui-01); }
.brandsel { padding: 24px 16px; }
.brandsel h2 { font-weight: 300; font-size: 21px; margin: 6px 0 24px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--ui-01); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 0 10px; color: #444; font-size: 15px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs a.on { color: var(--brand-01-600); border-color: var(--brand-01-600); font-weight: 600; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.brand-card { border: 1px solid var(--ui-01); height: 148px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; font-size: 13.5px; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.brand-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.10); transform: translateY(-2px); }
.brand-card img { max-height: 46px; max-width: 170px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 212px 1fr; height: 100vh; }
.shell.collapsed { grid-template-columns: 0 1fr; }
.side { background: var(--side); color: #fff; overflow-y: auto; overflow-x: hidden; }
.side .ptitle { font-family: 'Saira', 'Open Sans'; font-weight: 600; font-size: 18px; padding: 16px 8px 14px; }
.side .grp { border-bottom: 1px solid rgba(255,255,255,.25); margin: 0 8px; }
.side .item { display: flex; align-items: center; gap: 9px; padding: 10px 2px; font-size: 14px; cursor: pointer; }
.side .item .chev { margin-left: auto; opacity: .7; width: 14px; height: 14px; }
.side .item.on { background: var(--side-dark); margin: 0 -8px; padding: 10px 10px; font-weight: 600; }
.side .sub { padding: 0 0 8px 8px; display: none; }
.side .grp.open .sub { display: block; }
.side .sub a { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 12.5px; opacity: .95; }
.side .sub a svg.ic { width: 15px; height: 15px; }
.side .sub a.on { opacity: .55; }
.side .sub a:hover, .side .item:hover { text-decoration: underline; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.header { display: flex; align-items: center; gap: 14px; padding: 6px 14px; height: 62px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.05); z-index: 5; position: relative; }
.collapse-btn { background: var(--brand-01-600); color: #fff; border: 0; width: 20px; height: 24px; border-radius: 3px; display: grid; place-items: center; margin-left: -14px; }
.company-switch { display: flex; align-items: center; gap: 12px; border: 1px solid var(--ui-01); border-radius: 3px; padding: 5px 12px; cursor: pointer; }
.company-switch img { height: 30px; }
.company-switch .t1 { font-size: 11.5px; } .company-switch .t2 { font-size: 11.5px; text-transform: uppercase; }
.header .spacer { flex: 1; }
.search { display: flex; align-items: center; border: 1px solid var(--ui-01); border-radius: 3px; padding: 6px 10px; width: 260px; gap: 6px; }
.search input { border: 0; outline: 0; flex: 1; font-size: 14px; }
.hbtn { display: flex; align-items: center; gap: 6px; color: var(--brand-01-600); background: none; border: 0; font-size: 14px; position: relative; padding: 6px; }
.hbtn svg.ic { width: 22px; height: 22px; }
.hbtn .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-01-600); border: 1px solid #fff; }
.dropdown { position: absolute; top: 100%; right: 0; background: #fff; border: 1px solid var(--ui-01); box-shadow: 0 6px 18px rgba(0,0,0,.12); min-width: 180px; z-index: 30; border-radius: 4px; padding: 4px 0; }
.dropdown a { display: block; padding: 9px 16px; color: var(--brand-02); font-size: 15px; }
.dropdown a:hover { background: var(--ui-04); }
.dropdown a.on { background: var(--brand-02); color: #fff; }
.content { flex: 1; overflow: auto; background: #fff; }
.page-head { background: var(--ui-04); padding: 18px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 64px; }
.page-head h1 { font-weight: 400; font-size: 21px; margin: 0; }
.page-head h1 .bc { color: var(--ui-03); }
.page-head .tools { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.ibtn { background: #fff; border: 1px solid var(--ui-01); color: var(--brand-01-600); border-radius: 3px; height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; font-size: 13px; }
.btn { background: var(--brand-01-600); color: #fff; border: 0; border-radius: 3px; padding: 8px 14px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.btn.ghost { background: #fff; color: var(--brand-02); border: 1px solid var(--ui-01); }

/* ---------- Home ---------- */
.home { padding: 18px; display: grid; grid-template-columns: 2fr 1fr; gap: 18px; background: var(--ui-04); min-height: 100%; align-content: start; }
.panel { background: #e7e7e7; border-radius: 6px; padding: 18px; }
.panel h3 { margin: 0 0 14px; font-weight: 400; font-size: 26px; font-family: 'Saira', 'Open Sans'; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile { background: #f4f4f4; border-radius: 3px; display: flex; align-items: center; gap: 14px; padding: 10px; cursor: pointer; border: 1px solid #e2e2e2; }
.tile:hover { background: #fff; }
.tile .sq { width: 46px; height: 46px; border-radius: 4px; background: var(--brand-01-700); color: #fff; display: grid; place-items: center; }
.tile .sq svg.ic { width: 24px; height: 24px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; grid-column: 1 / -1; }
.kpi { background: #fff; border-radius: 6px; padding: 14px 16px; border-left: 4px solid var(--brand-01-600); }
.kpi .v { font-size: 26px; font-weight: 600; } .kpi .l { font-size: 12.5px; color: var(--ui-03); }
.news { grid-column: 1 / -1; }
.news h3 { text-align: center; }
.news-row { display: flex; align-items: center; gap: 16px; background: #f4f4f4; padding: 12px 16px; border-bottom: 1px solid #e0e0e0; cursor: pointer; }
.news-row:hover { background: #fff; }
.news-row b { font-size: 13.5px; text-transform: uppercase; }
.news-row .cat { font-size: 12.5px; color: var(--ui-03); }
.news-row .date { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--ui-03); }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--ui-01); margin-left: 6px; }
.tag.new { background: var(--brand-01-600); color: #fff; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { background: #fff; width: min(1100px, 100%); max-height: 90vh; overflow: auto; border-radius: 3px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal .mh { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--ui-01); font-weight: 700; text-transform: uppercase; }
.modal .mh .x { margin-left: auto; background: none; border: 0; font-size: 26px; color: var(--ui-03); line-height: 1; }
.modal .mb { padding: 18px 32px 40px; line-height: 1.6; font-size: 15px; }

/* ---------- Placeholder ---------- */
.todo { padding: 60px; text-align: center; color: var(--ui-03); }

/* ---------- Griglie ---------- */
.gridarea { position: relative; display: flex; min-height: calc(100% - 64px); }
.gridwrap { flex: 1; overflow-x: auto; min-width: 0; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-weight: 400; color: #555; padding: 12px 10px; border-bottom: 1px solid var(--ui-01); white-space: nowrap; background: #fff; position: sticky; top: 0; z-index: 1; }
table.grid th .thf { width: 14px; height: 14px; color: var(--brand-01-600); vertical-align: -2px; margin-left: 6px; }
table.grid td { padding: 9px 10px; border-bottom: 1px solid #f0f0f0; font-weight: 300; text-transform: uppercase; white-space: nowrap; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: #fafafa; }
table.grid tbody tr.sel { background: var(--support-04, #fde8e8); }
.eye { color: var(--brand-01-600); display: inline-flex; }
.eye svg.ic { width: 21px; height: 21px; }
.pager { padding: 12px; color: var(--ui-03); font-size: 12px; text-align: right; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11.5px; font-weight: 600; text-transform: none; color: #fff; background: var(--c); white-space: nowrap; }
.blogo { height: 18px; max-width: 70px; vertical-align: middle; }

/* ---------- Pannello di dettaglio ---------- */
.detail { width: 47%; min-width: 460px; background: #f7f7f7; border-left: 1px solid var(--ui-01); box-shadow: -6px 0 16px rgba(0,0,0,.08); padding: 10px 16px 30px; position: sticky; top: 0; align-self: flex-start; max-height: calc(100vh - 140px); overflow: auto; }
.dtop { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.dtabs { display: flex; gap: 22px; border-bottom: 1px solid var(--ui-01); margin-bottom: 12px; }
.dtabs a { padding: 8px 0; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dtabs a.on { color: var(--brand-01-600); border-color: var(--brand-01-600); font-weight: 600; }
.dcard { background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 16px; margin-bottom: 14px; display: flex; gap: 10px; }
.dcard h4 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; color: var(--ui-03); letter-spacing: .5px; }
.dicon { order: 2; color: var(--brand-01-600); } .dicon svg.ic { width: 34px; height: 34px; stroke-width: 1.3; }
.fgrid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.f label { display: block; font-size: 12px; margin-bottom: 4px; }
.f .fv { border: 1px solid #ececec; background: #fbfbfb; border-radius: 3px; padding: 7px 10px; color: #666; font-size: 13px; min-height: 33px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f .chk { display: flex; align-items: center; gap: 6px; padding-top: 20px; font-size: 13px; }
.f input[type=checkbox], table.grid input[type=checkbox] { accent-color: var(--brand-01-600); width: 15px; height: 15px; }

/* ---------- Gerarchie ---------- */
.hier { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; padding: 8px 18px 30px; }
.hier-tree { border: 1px solid var(--ui-01); border-radius: 4px; padding: 10px; max-height: calc(100vh - 220px); overflow: auto; }
ul.tree { list-style: none; margin: 0; padding-left: 18px; }
.hier-tree > ul.tree { padding-left: 0; }
.node { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 3px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.node:hover { background: var(--ui-04); }
.node.sel { background: var(--support-04, #fde8e8); outline: 1px solid var(--brand-01-600); }
.node .tg { width: 18px; display: inline-flex; color: var(--ui-03); }
.node .pill { font-size: 10.5px; padding: 1px 8px; }
.hcounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hcounts div { background: var(--ui-04); border-radius: 4px; padding: 10px; }
.hcounts b { display: block; font-size: 22px; } .hcounts span { font-size: 12px; color: var(--ui-03); }
.rules { margin: 0; padding-left: 18px; line-height: 1.8; }

/* ---------- Attività ---------- */
.bigpill { background: var(--c); color: #fff; border-radius: 22px; padding: 6px 18px; font-size: 20px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.bigpill svg.ic { width: 22px; height: 22px; }
.acttabs { padding: 0 18px; margin-top: 14px; gap: 26px; }
.actbody { padding: 10px 18px 40px; }
.two { display: grid; grid-template-columns: 1fr 1.4fr; gap: 30px; }
.treeline { display: flex; align-items: center; gap: 6px; margin: 4px 0 12px; font-size: 13px; }
.calcnote { margin: 16px 0 0 18px; background: #fff7e0; border: 1px solid #f1d98c; border-radius: 4px; padding: 10px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
table.calc td { text-transform: none; font-weight: 400; }
table.grid tfoot td { border-top: 2px solid var(--ui-01); padding: 12px 10px; font-size: 14px; }
.f select { width: 100%; border: 1px solid var(--ui-01); border-radius: 3px; padding: 7px 8px; font: inherit; font-size: 13px; background: #fff; }
.wizard { display: flex; gap: 0; margin: 6px 0 16px; }
.wizard span { flex: 1; text-align: center; padding: 8px; background: var(--ui-04); color: var(--ui-03); font-size: 13px; clip-path: polygon(0 0, 94% 0, 100% 50%, 94% 100%, 0 100%, 6% 50%); }
.wizard span.on { background: var(--brand-01-600); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--ui-01); border-radius: 14px; padding: 3px 10px; font-size: 12px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.chip.on { border-color: var(--brand-01-600); background: var(--support-04, #fde8e8); }
.chip input { display: none; }
h3.sect { font-weight: 400; font-size: 18px; margin: 22px 0 8px; }

/* ---------- Prefattura ---------- */
.chk2 { display: flex; gap: 6px; align-items: center; }
.page-head .tools .f .fv { min-width: 120px; }
.presum { display: flex; align-items: center; gap: 26px; padding: 12px 18px; background: #fff; border-bottom: 1px solid var(--ui-01); font-size: 13px; position: sticky; top: 0; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.presum .btn { margin-left: auto; }
.outpill { border: 1px solid #333; border-radius: 12px; padding: 2px 10px; font-size: 12px; text-transform: none; font-weight: 600; }
tr.sub > td { background: #fff; padding: 0 0 8px; }
table.inner { background: #fdeeee; } table.inner th { background: #fff; position: static; font-size: 12px; }
table.inner td { font-size: 12px; text-transform: none; }
.pdf { background: #fff; color: #222; max-width: 820px; margin: 0 auto; padding: 30px 40px; font-size: 13px; box-shadow: 0 0 0 1px #ddd; }
.pdfhead { display: flex; align-items: flex-start; gap: 20px; }
.pdfhead img { height: 60px; max-width: 200px; margin-right: auto; }
.pdfto { border: 1.5px solid #333; border-radius: 6px; background: #f3f3f3; padding: 10px 12px; width: 300px; min-height: 110px; font-size: 12px; }
svg.qr { width: 110px; height: 110px; fill: #000; }
.pdftot { background: #f0f0f0; border-collapse: collapse; margin: 20px 0; } .pdftot td { padding: 3px 10px; width: 240px; } .pdftot td + td { text-align: right; width: 120px; } .pdftot tr.t td { padding-top: 8px; font-weight: 600; }
.pdflines { width: 100%; border-collapse: collapse; font-size: 11.5px; } .pdflines th { background: #d9534f; color: #fff; text-align: left; padding: 4px; } .pdflines td { border-bottom: 1px solid #f1c0c0; padding: 4px; }
hr.pdfsep { border: 0; border-top: 2px dashed var(--ui-02); margin: 26px 0; }

/* ---------- Resi e qualità ---------- */
.steps { display: flex; margin: 6px 0 14px; } .steps span { flex: 1; text-align: center; padding: 7px; font-size: 12.5px; background: var(--ui-01); color: #555; clip-path: polygon(0 0, 92% 0, 100% 50%, 92% 100%, 0 100%, 8% 50%); }
.steps span.on { background: var(--green); color: #fff; }
.bar { display: grid; grid-template-columns: 150px 1fr 40px 40px; gap: 10px; align-items: center; margin: 10px 0; font-size: 13px; }
.bar div { background: var(--ui-04); height: 18px; border-radius: 3px; } .bar i { display: block; height: 100%; background: var(--brand-01-600); border-radius: 3px; }
.bar em { color: var(--ui-03); font-style: normal; font-size: 12px; }
.detail table.grid td, .detail table.grid th { white-space: normal; text-transform: none; }

/* ---------- Agenda ---------- */
.cal { display: grid; grid-template-columns: 270px 1fr; gap: 18px; padding: 14px 18px 30px; }
.mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 12px; }
.mini .mh2 { grid-column: 1 / -1; padding: 6px; font-size: 13px; }
.mini b { font-weight: 400; color: var(--ui-03); font-size: 11px; padding: 4px 0; }
.mini span { padding: 7px 0; cursor: pointer; border-radius: 2px; }
.mini span:hover { background: var(--ui-04); } .mini span.out { color: var(--ui-02); }
.mini span.on { background: var(--brand-01-600); color: #fff; }
.calsrc { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; margin-top: 14px; }
.calsrc b { margin-top: 8px; }
.week { display: grid; grid-template-columns: 56px repeat(7, 1fr); grid-template-rows: 52px repeat(10, 40px); position: relative; border-left: 1px solid #eee; }
.wd { font-size: 12px; color: var(--ui-03); padding: 4px 8px; border-bottom: 1px solid #eee; text-transform: capitalize; }
.wd span { font-size: 24px; color: var(--brand-02); font-weight: 300; } .wd.today { background: var(--ui-04); }
.hr { font-size: 11px; color: var(--ui-03); padding-right: 6px; text-align: right; border-top: 1px solid #f3f3f3; }
.slot { border-top: 1px solid #f3f3f3; border-left: 1px solid #f3f3f3; }
.appt { background: color-mix(in srgb, var(--c) 18%, #fff); border-left: 4px solid var(--c); border-radius: 3px; font-size: 11px; padding: 3px 6px; overflow: hidden; margin: 1px 3px; line-height: 1.35; z-index: 1; }

/* ---------- Customer portal, SAP, news ---------- */
.phone { width: 340px; margin: 0 auto; border: 10px solid #222; border-radius: 34px; padding: 26px 18px; background: #fff; }
.pscreen { display: flex; flex-direction: column; gap: 10px; font-size: 13px; } .pscreen h3 { margin: 6px 0 0; }
.flowline { display: flex; align-items: center; gap: 12px; margin: 6px 0 22px; flex-wrap: wrap; }
.flowline > div { display: flex; align-items: center; gap: 10px; background: var(--ui-04); border-radius: 6px; padding: 10px 14px; flex: 1; min-width: 190px; }
.flowline .sq { width: 40px; height: 40px; border-radius: 4px; background: var(--brand-01-700); color: #fff; display: grid; place-items: center; }
.flowline small { display: block; color: var(--ui-03); font-size: 11.5px; } .flowline b { display: block; }
.flowline .arrow { font-size: 22px; color: var(--ui-02); }
code { background: var(--ui-04); padding: 1px 6px; border-radius: 3px; font-size: 12px; }
.editor { border: 1px solid var(--ui-01); border-radius: 4px; margin: 14px 0; }
.editor .tb { display: flex; gap: 14px; padding: 8px 12px; border-bottom: 1px solid var(--ui-01); background: #fafafa; align-items: center; }
.editor .ed { padding: 4px 16px; font-size: 13.5px; line-height: 1.55; }
.pscreen img { align-self: center; width: auto; max-width: 180px; object-fit: contain; }
