/* ===== Marchio Socage / Platform Service su layout ProgettoWeb2 ===== */
:root {
  --brand: #0b71bc;
  --brand-strong: #0d68b3;
  --brand-dark: #173459;
  --brand-soft: #d9ebf8;
  --accent: #82c454;
  --series-1: #0b71bc;
  --sidebar-bg: #14202f;
  --sidebar-active: #0b71bc;
  --bs-body-font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-primary: #0b71bc;
  --bs-primary-rgb: 11, 113, 188;
  --bs-link-color: #0b71bc;
  --bs-link-color-rgb: 11, 113, 188;
  --field-ok: #ffffff;
  --field-error: #ffa500;
}

body { font-family: var(--bs-body-font-family); }
.btn-primary { --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); }
.page-header h1, .section-title h2 { position: relative; padding-bottom: 6px; }
.page-header h1::after, .section-title h2::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 42px; height: 3px; border-radius: 2px; background: var(--accent);
}

/* Login */
.socage-login { background:
  linear-gradient(rgba(244,245,247,.86), rgba(244,245,247,.94)), url("../img/brand/home-sede-socage.jpg") center/cover no-repeat; }
.login-logo { max-width: 290px; width: 100%; height: auto; }
.login-version { color: var(--brand); }

/* Top bar */
.topbar .brand-logo { height: 38px; width: auto; }
.topbar .brand-sub { color: var(--ink-muted); font-weight: 500; font-size: .85rem; border-left: 1px solid var(--hairline); padding-left: 10px; }
@media (max-width: 991.98px) { .topbar .brand-sub { display: none; } .topbar .brand-logo { height: 30px; } }
.manuals-menu .dropdown-item i { width: 20px; }

/* Stato di connessione IoT (icone del portale GWT) */
.online-state { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; white-space: nowrap; }
.online-state img { width: 22px; height: 22px; }
.hw-badge { font-size: .75rem; font-weight: 700; color: var(--ink-2); background: #eef1f5; border-radius: 6px; padding: 2px 7px; }

/* Home dopo il login */
.home-hero { border-radius: 12px; overflow: hidden; position: relative; min-height: 180px; background: url("../img/brand/home-sede-socage.jpg") center/cover; }
.home-hero .overlay { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,32,47,.82), rgba(20,32,47,.15)); color: #fff; padding: 22px 26px; display: flex; flex-direction: column; justify-content: flex-end; }

/* ===== Finestre modali: intestazione blu come le card-header ===== */
.modal-header { background: var(--brand-strong); color: #fff; border-bottom: 0; padding: .75rem 1rem; }
.modal-header .modal-title { font-size: 1rem; font-weight: 600; }
.modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); opacity: .85; }
.modal-header .btn-close:hover { opacity: 1; }

/* ===== Monitor (telemetria JClient): barra comandi ===== */
.monitor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; }
.monitor-toolbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.monitor-toolbar .dropdown-menu { font-size: .9rem; }
.monitor-toolbar .vr { height: 24px; align-self: center; }
.monitor-toolbar .machine-desc { font-weight: 600; font-size: .9rem; }
.online-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: .78rem; color: var(--ink-2) !important; }
.online-badge.on { background: rgba(12,163,12,.1) !important; border-color: rgba(12,163,12,.35) !important; color: #0a7d0a !important; }
.heartbeat { display: inline-block; width: 16px; height: 16px; border: 3px solid rgba(0,0,0,.1); border-top-color: var(--accent); border-radius: 50%; transition: transform .35s ease; }
.heartbeat.idle { opacity: .35; }
.monitor-progress { height: 4px; }

/* ===== Campi e controlli condivisi da v1 e v2 ===== */
.jc-card { border-color: var(--hairline); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.jc-card > .card-header, .jc2-card > .card-header {
  background: var(--brand-strong); color: #fff; border-bottom: 0; padding: 7px 12px;
  font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.form-control.jc-mon, .form-control.jc-par {
  height: 26px; min-height: 0; padding: 0 6px; font-size: .8rem; border-radius: 5px;
  font-variant-numeric: tabular-nums; text-align: right;
}
.form-control.jc-mon { background: #f1f3f5; border-color: #e2e5e9; color: var(--ink); font-weight: 600; }
.form-control.jc-par:read-only { background: #f7f7f8; color: var(--ink-2); border-style: dashed; }
.form-control.jc-par:not(:read-only) { background: #fff; border-color: #b9c3cf; }
.form-control.jc-par.changed { border-color: var(--brand); box-shadow: 0 0 0 .15rem rgba(11,113,188,.18); }
.form-control.state-pending { background: #fff4d6 !important; border-color: #f0b429 !important; }
.form-control.state-error { background: #ffe3cc !important; border-color: var(--field-error) !important; }
.jc-mon.big { height: 32px; font-size: 1rem; }
.jc-table th { position: sticky; top: 0; }

/* ===== Telemetria v1 (pannelli, gruppi e campi del JClient) ===== */
.jc1-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; border-bottom-color: var(--hairline); }
.jc1-tabs .nav-link { white-space: nowrap; color: var(--ink-2); font-size: .88rem; padding: .5rem .9rem; }
.jc1-tabs .nav-link:hover { color: var(--brand); }
.jc1-tabs .nav-link.active { color: var(--brand-strong); font-weight: 600; border-color: var(--hairline) var(--hairline) #fff; }
.jc1-tabcontent { padding-top: 14px; }
.jc1-flow { padding: 10px 12px; }
.jc1-scroll { padding: 8px; overflow: auto; max-height: calc(100vh - 230px); background: #fff; }
.jc1-fixed { position: relative; width: max-content; }
.jc1-bg { display: block; max-width: none; }
.jc1 label { cursor: default; }
.jc1-field { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 0; vertical-align: middle; width: 200px; }
.jc1-field[style*="absolute"] { width: auto; padding: 0; }
.jc1-field input { flex: none; }
.jc1-field label { font-size: .72rem; line-height: 1.15; color: var(--ink-2); margin: 0; }
.jc1-fixed .jc1-field label { white-space: nowrap; background: rgba(255,255,255,.85); border-radius: 3px; padding: 0 3px; }
.jc1-led { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 0; width: 150px; vertical-align: middle; }
.jc1-led[style*="absolute"] { width: auto; padding: 0; }
.jc1-led label { font-size: .72rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jc1-shape { display: inline-block; flex: none; transition: background-color .15s; box-shadow: inset 0 0 0 1px rgba(0,0,0,.28); }
.jc1-shape.rectangle { height: 14px; border-radius: 3px; }
.jc1-shape.circle { height: 16px; max-width: 16px; min-width: 16px !important; border-radius: 50%; }
.jc1-shape.triangle_up { height: 18px; clip-path: polygon(50% 0, 100% 100%, 0 100%); box-shadow: none; }
.jc1-shape.triangle_down { height: 18px; clip-path: polygon(50% 100%, 100% 0, 0 0); box-shadow: none; }
.jc1-shape.triangle_left { height: 18px; clip-path: polygon(100% 0, 0 50%, 100% 100%); box-shadow: none; }
.jc1-shape.triangle_right { height: 18px; clip-path: polygon(0 0, 100% 50%, 0 100%); box-shadow: none; }
.jc1-label { display: block; margin: 10px 0 6px; padding: 5px 10px; background: #f1f4f8; border-left: 3px solid var(--brand); border-radius: 0 6px 6px 0; }
.jc1-label:first-child { margin-top: 0; }
.jc1-label label { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); }
.jc1-label.fixed { position: absolute; margin: 0; padding: 2px 4px; background: none; border: 0; white-space: nowrap; }
.jc1-subgroup { margin: 12px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--hairline); }
.jc1-subgroup label { font-weight: 650; font-size: .85rem; color: var(--brand-strong); }
.jc1-checkgrp { display: block; padding: 4px 0; }
.jc1-checkgrp .form-check-inline { margin-right: 14px; font-size: .82rem; }
.jc1-button { display: flex; margin: 6px 0; width: max-content; }
.jc1-button.fixed { margin: 0; padding: 2px 8px; font-size: .75rem; justify-content: center; }
.jc1-digit { display: inline-block; height: 56px; width: auto; }
.jc1-displayer { font-weight: 700; font-size: .85rem; }

/* ===== Telemetria v2 (sezioni, tab e celle del JClient) ===== */
.jc2 { display: grid; grid-template-columns: 1fr; min-height: 560px; overflow: hidden; }
.jc2-side { padding: 12px 8px; border-bottom: 1px solid var(--hairline); background: #fafbfc; }
.jc2-zoom { display: flex; align-items: center; gap: 8px; padding: 0 6px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--hairline); }
.jc2-zoom .form-range { flex: 1; }
.jc2-zoom-val { font-size: .75rem; color: var(--ink-muted); width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.jc2-main { padding: 16px; overflow: auto; }
@media (min-width: 992px) {
  .jc2 { grid-template-columns: 250px minmax(0, 1fr); }
  .jc2-side, .jc2-main { overflow: auto; max-height: calc(100vh - 200px); }
  .jc2-side { border-bottom: 0; border-right: 1px solid var(--hairline); }
}

/* Navigazione: sezioni comprimibili e voci come la sidebar del portale */
.jc2-nav summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; border-radius: 6px; user-select: none; }
.jc2-nav summary::-webkit-details-marker { display: none; }
.jc2-chev { font-size: .7rem; transition: transform .15s; color: var(--ink-muted); }
.jc2-nav details[open] > summary .jc2-chev { transform: rotate(90deg); }
.jc2-sec > summary { padding: 6px 6px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-top: 4px; }
.jc2-group > summary { padding: 5px 6px; font-size: .84rem; font-weight: 600; color: var(--ink); }
.jc2-nav summary:hover { background: #eef1f5; }
.jc2-list { list-style: none; margin: 0 0 2px; padding-left: 12px; }
.jc2-list .jc2-list { padding-left: 14px; border-left: 1px solid var(--hairline); margin-left: 10px; }
.jc2-leaf { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 10px; border-radius: 6px; font-size: .84rem; color: var(--ink-2); }
.jc2-leaf:hover { background: #eef1f5; color: var(--ink); }
.jc2-leaf.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }

/* Intestazione del tab e griglia righe x colonne */
.jc2-head { margin-bottom: 14px; }
.jc2-head .breadcrumb { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.jc2-head .breadcrumb-item { color: var(--ink-muted); }
.jc2-title { font-size: 1.3rem; font-weight: 650; margin: 0; padding-bottom: 8px; position: relative; }
.jc2-title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 42px; height: 3px; border-radius: 2px; background: var(--accent); }
.jc2-grid { width: 100%; border-collapse: separate; border-spacing: 12px; margin: -12px; width: calc(100% + 24px); }
.jc2-grid td { height: 1px; vertical-align: top; padding: 0; }
.jc2-grid td:empty { display: none; }
.jc2-card { border-color: var(--hairline); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.jc2-card > .card-body { padding: 8px 10px; }
.jc2-wrap { position: relative; }
.jc2-wrap.fixed { margin: 6px 0 0 4px; }
.jc2-bg { position: absolute; left: -4px; top: -6px; max-width: none; pointer-events: none; }
.jc2-card.has-bg > .card-body { background: #fff; }

/* Controlli */
.jc2-c { position: relative; white-space: nowrap; }
.jc2-c.flow { display: grid; grid-template-columns: 84px minmax(0, 1fr); column-gap: 8px; align-items: center; padding: 3px 0; }
.jc2-c.flow.long { grid-template-columns: 200px minmax(0, 1fr); }
.jc2-c:not(.flow):not(.btnbox):not(.sdo):not(.jc2-text) { display: grid; grid-template-columns: 64px auto; column-gap: 6px; align-items: center; }
.jc2-c > label { font-size: .72rem; line-height: 1.15; color: var(--ink-2); margin: 0; white-space: normal; }
.jc2-c:not(.flow) > label { white-space: nowrap; }
.jc2-c.btnbox { display: inline-block; }
.jc2-c.sdo { display: inline-flex; gap: 4px; }
.jc2-c.sdo .form-control { width: 76px; }
.jc2-c.jc2-text { display: block; padding: 4px 2px; line-height: 1.2; }
.jc2-text { white-space: nowrap; }
.jc2-check { display: flex; align-items: center; gap: 6px; min-height: 26px; margin: 0; padding-left: 0; font-size: .8rem; }
.jc2-check .form-check-input { margin: 0; float: none; flex: none; }
.jc2-check .form-check-label { color: var(--ink-2); }
.jc2-btnrow { margin: 4px 0; }
.jc2-c .jc2-btn { padding: 2px 10px; font-size: .75rem; }
.jc2-ledbox svg { width: 100%; height: 100%; display: block; overflow: visible; }
.jc2-ledbox text { font-size: .8em; fill: var(--ink-2); }
.jc2-ledbox .jc2-led { stroke: rgba(0,0,0,.25); stroke-width: 1; transition: fill .15s; }
.jc2-rect { pointer-events: none; }
.jc2-img { max-width: none; }

/* Campi e tabelle condivisi da Firmware e Report */
.jc-field { display: flex; align-items: center; gap: 8px; }
.jc-field label { flex: 1; font-size: .82rem; color: var(--ink-2); margin: 0; }
.jc-field input { width: 110px; text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; padding: 2px 8px; background: var(--field-ok); }
.jc-field input.monitor { background: #f6f8fa; font-weight: 600; border-color: #e3e6ea; }
.jc-field input.state-error { background: var(--field-error) !important; }
.jc-field input.state-pending { background: #fff6dc; }
.jc-field input.changed { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,113,188,.15); }
/* Firmware → Installed: versioni testuali lunghe (es. BootLoader_v1.2), il campo occupa lo spazio disponibile */
.fw-field label { flex: 0 0 110px; }
.fw-field input { flex: 1; width: auto; min-width: 0; text-align: left; }
.jc-table { font-size: .8rem; margin: 0; }
.jc-table th { background: #333; color: #fff; font-weight: 600; white-space: nowrap; }
.jc-table td { white-space: nowrap; }
.io-on { color: #2e7d32; } .io-off { color: #9aa0a6; }

/* Firmware */
.fw-log { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; background: #111; color: #d7f5c4; border-radius: 8px; padding: 10px; height: 200px; overflow: auto; white-space: pre-wrap; }

/* Optional */
#opt-map { height: 360px; border-radius: 10px; }
.multi-cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cal-month { border: 1px solid var(--hairline); border-radius: 10px; padding: 8px; background: var(--surface); }
.cal-month .title { font-weight: 650; text-align: center; margin-bottom: 4px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: .78rem; }
.cal-grid .dow { color: var(--ink-muted); font-weight: 600; }
.cal-grid button { border: 0; background: transparent; border-radius: 6px; padding: 4px 0; font-size: .8rem; }
.cal-grid button:hover:not(:disabled) { background: var(--brand-soft); }
.cal-grid button.selected { background: var(--brand); color: #fff; font-weight: 600; }
.cal-grid button:disabled { color: #c3c7cc; }
.cal-grid button.today { outline: 1px solid var(--accent); }
.feedback { font-size: .8rem; color: var(--ink-2); }

/* Commesse */
.job-card .badge-open { background: #e7f5df; color: #2e6b12; }
.job-card .badge-closed { background: #eceff3; color: #5b6470; }
