/* ==========================================================================
   GlobalConcept — Piattaforma DVR
   Design tokens and layout transcribed from the reference mockup.
   No framework, no external requests: fonts are served from static/fonts/.
   ========================================================================== */

@font-face {
  font-family: 'Manrope';
  src: url("../fonts/manrope-var.938c6e8019b6.woff2") format('woff2-variations'),
       url("../fonts/manrope-var.938c6e8019b6.woff2") format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url("../fonts/ibm-plex-mono-400.79936b18df9f.woff2") format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url("../fonts/ibm-plex-mono-500.b1c8a895f5fd.woff2") format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url("../fonts/ibm-plex-mono-600.5a2ce7798732.woff2") format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #1e73be;
  --blue-dark: #175a94;
  --blue-soft: #e2f1fb;
  --blue-border: #b6d9ef;
  --blue-bg: #f1f8fd;
  --ink: #3a3d41;
  --ink-2: #4a5b64;
  --ink-3: #58595b;
  --grey: #6a7b85;
  --grey-2: #7d8d95;
  --grey-3: #9aa8ae;
  --line: #dfe4e2;
  --line-2: #eceeec;
  --line-3: #f2f4f2;
  --page: #eceee9;
  --card: #fff;
  --card-2: #fafbfa;
  --amber: #9a6412;
  --amber-bg: #fff4e0;
  --red: #a33127;
  --red-bg: #fdeceb;
  --dark: #3a3d41;
  --cyan: #7ec9ee;
  --radius: 12px;
  --radius-sm: 9px;
  --sidebar-w: 238px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

a { color: var(--blue-dark); text-decoration: none; }
input, select, textarea, button { font-family: inherit; }
::placeholder { color: var(--grey-3); }

@keyframes grow { from { width: 0; } }
@keyframes fadein { from { opacity: 0; } }
@keyframes popin { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--blue);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  margin: 14px 0 14px 14px;
  border-radius: 16px;
}

.sidebar-logo { padding: 22px 16px 4px; display: flex; align-items: center; }
.sidebar-logo img { width: 198px; height: auto; filter: brightness(0) invert(1); }

.sidebar nav {
  padding: 8px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.nav-label {
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .62);
  padding: 14px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .92);
}

.nav-item:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .16); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; flex: none; line-height: 1; opacity: .95; }
.nav-item .label { flex: 1; white-space: nowrap; }

.nav-badge {
  font-size: 10.5px;
  font-family: 'IBM Plex Mono', monospace;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar-account {
  margin: 14px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .12);
  display: flex;
  align-items: center;
  gap: 11px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  flex: none;
}

.sidebar-account .who { min-width: 0; flex: 1; }
.sidebar-account .n { font-size: 13px; font-weight: 700; }
.sidebar-account .r { font-size: 11px; color: rgba(255, 255, 255, .68); }
.sidebar-account .caret { font-size: 10px; color: rgba(255, 255, 255, .7); }

/* ---------- main ---------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.search {
  flex: 1;
  max-width: 460px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.search input { flex: 1; border: 0; outline: 0; font-size: 13px; background: transparent; color: var(--ink); min-width: 0; }
.search .ico { color: var(--grey-3); font-size: 14px; }
.inline-search { max-width: 320px; margin-left: 0; }

.content { flex: 1; padding: 22px 14px 20px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  white-space: nowrap;
}

.btn:hover { background: var(--blue-dark); color: #fff; }
.btn.ghost { background: var(--blue-bg); color: var(--blue-dark); border-color: var(--blue-border); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.plain { background: var(--card); color: var(--ink-2); border-color: var(--line); }
.btn.plain:hover { background: var(--card-2); color: var(--ink); }
.btn.disabled, .btn[disabled] { background: #dfe4e2; color: #9aa8ae; border-color: transparent; pointer-events: none; }

.linkbtn { background: none; border: 0; color: var(--grey-2); cursor: pointer; font-size: 13px; padding: 4px 6px; }
.linkbtn:hover { color: var(--red); }
.card-link { font-size: 11.5px; color: var(--blue); font-weight: 600; }

/* ---------- cards ---------- */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 13.5px; font-weight: 700; }
.card-sub { font-size: 11.5px; color: var(--grey-2); margin-top: 2px; font-weight: 400; }
.card-body { padding: 18px 20px; }
.card-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
}

.stepbar-card { padding: 0; }
.stepbar-card .steps { padding: 16px 20px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
/* grid-auto-rows guards the row height: without it a zero-height child would
   collapse the whole track and the cards would vanish behind their heading. */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; grid-auto-rows: minmax(56px, auto); }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .k-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--grey-2); }
.kpi .k-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 8px; }
.kpi .k-note { font-size: 11.5px; color: var(--grey); margin-top: 3px; }

/* ---------- rows & tables ---------- */

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-3);
}
.row:last-child { border-bottom: 0; }
.row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.row .body { flex: 1; min-width: 0; }
.row .t { font-size: 13px; font-weight: 600; }
.row .m { font-size: 11.5px; color: var(--grey-2); margin-top: 1px; }
.row .time { font-size: 11px; color: var(--grey-3); width: 82px; text-align: right; }

.pill {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--grey-2);
  font-weight: 700;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-2);
}
td { padding: 12px 18px; border-bottom: 1px solid var(--line-3); font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--card-2); }
td.num { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--grey); }
td.actions, .actions { color: var(--grey-3); text-align: right; white-space: nowrap; letter-spacing: 3px; }

.doccell { display: flex; align-items: center; gap: 11px; color: inherit; }
.doccell .t { font-size: 13px; font-weight: 600; }
.doccell .m { font-size: 11px; color: var(--grey-2); margin-top: 1px; }

.docico {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800;
}

.ini {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--blue-soft); color: var(--blue-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}

.tabs { display: flex; gap: 4px; }
.tab {
  font-size: 12.5px; font-weight: 600; color: var(--grey-2);
  padding: 7px 12px; border-radius: 8px;
}
.tab:hover { background: var(--card-2); }
.tab.on { background: var(--blue-soft); color: var(--blue-dark); }
.tab-n { font-size: 11px; opacity: .75; }

.filter {
  font-size: 12px; color: var(--ink-2); font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; background: var(--card);
}

.pager { display: flex; gap: 4px; }
.pg {
  min-width: 26px; height: 26px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--grey); border: 1px solid var(--line); background: var(--card);
}
.pg.on { background: var(--blue-soft); color: var(--blue-dark); border-color: var(--blue-border); font-weight: 700; }

/* ---------- dark panel ---------- */

.panel-dark { background: var(--dark); border-radius: var(--radius); padding: 18px; color: #fff; }
.panel-dark .eyebrow { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); }
.panel-dark .h { font-size: 15px; font-weight: 700; margin-top: 8px; }

.queue { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 14px; }
.queue .q-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }
.queue .q-name { color: rgba(255, 255, 255, .85); }
.queue .q-pct { font-family: 'IBM Plex Mono', monospace; color: var(--cyan); }
.queue .q-bar { height: 5px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.queue .q-fill { height: 100%; border-radius: 4px; background: var(--blue); animation: grow 1.2s ease; }
.queue .q-step { font-size: 10.5px; color: rgba(255, 255, 255, .42); margin-top: 4px; }

/* The deadlines card has no separate header strip: title and grid share one
   18px padded block, matching the mockup's 124px total height. */
.scad-card { padding: 18px; }
.scad-card .card-title { margin-bottom: 12px; }

.scad {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px;
}
.scad .body { flex: 1; min-width: 0; }
.scad .t { font-size: 13px; font-weight: 700; }
.scad .m { font-size: 11.5px; color: var(--grey-2); margin-top: 2px; }
.scad .due { font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--grey-2);
  font-weight: 600;
}

.input {
  width: 100%;
  border: 1px solid #dbe1de;
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  font-size: 13.5px;
  font-weight: 600;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
}
.input:focus { border-color: var(--blue-border); background: #fff; }
select.input { cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.imported { margin-top: 20px; animation: fadein .3s ease; }

.empty {
  margin-top: 20px;
  border: 1px dashed #d3dad6;
  border-radius: 11px;
  padding: 36px;
  text-align: center;
  background: var(--card-2);
}
.empty .ico { font-size: 22px; color: #c2ccc7; }
.empty .t { font-size: 13px; font-weight: 700; margin-top: 8px; }
.empty .s { font-size: 12px; color: var(--grey-2); margin-top: 4px; line-height: 1.6; }

.note-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--blue-dark);
  background: var(--blue-soft);
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ---------- wizard ---------- */

.steps { display: flex; align-items: center; gap: 10px; }
.step { display: flex; align-items: center; gap: 9px; flex: 1; }
.step:last-child { flex: none; }
.step .n {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
  border: 1.5px solid var(--line); background: var(--card); color: var(--grey-2);
  flex: none;
}
.step .lbl { display: none; font-size: 12px; font-weight: 700; color: var(--grey-2); white-space: nowrap; }
.step .line { flex: 1; min-width: 10px; height: 2px; border-radius: 2px; background: var(--line); }
.step.done .n { background: var(--blue-soft); border-color: var(--blue-border); color: var(--blue-dark); }
.step.done .lbl { color: var(--blue-dark); }
.step.done .line { background: var(--blue-border); }
.step.active .n { background: var(--blue); border-color: var(--blue); color: #fff; }
.step.active .lbl { display: block; color: var(--ink); }

.gen-split { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.gen-aside { display: flex; flex-direction: column; gap: 16px; }
.big-num { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }

.risk-group { padding: 4px 20px 10px; }
.risk-group h4 {
  margin: 0;
  padding: 14px 0 10px;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--grey-2);
  display: flex; align-items: center; gap: 9px;
}
.gdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.gname { flex: none; }
.gline { flex: 1; height: 1px; background: var(--line-2); }
.gcount { font-size: 10.5px; color: var(--grey-3); letter-spacing: 0; }

.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.risk {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
.risk:hover { border-color: var(--blue-border); }
.risk.static { cursor: default; }
.risk input { accent-color: var(--blue); width: 15px; height: 15px; cursor: pointer; flex: none; }
.risk .rbody { flex: 1; min-width: 0; }
.risk .rlabel { display: block; font-weight: 600; }
.risk .rmeta { display: block; font-size: 11px; color: var(--grey-3); margin-top: 3px; }
.risk .code { font-size: 11.5px; color: var(--grey-3); flex: none; }
.risk .rnorm { font-size: 11px; color: var(--grey-3); white-space: nowrap; }
.risk.on { border-color: var(--blue); background: var(--blue-bg); }

.aside-empty { padding: 34px 20px; text-align: center; font-size: 12px; color: var(--grey-2); line-height: 1.6; }
.aside-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--grey-2);
}
.aside-foot .strong { font-size: 13px; font-weight: 700; color: var(--ink); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-radius: 20px;
  padding: 5px 10px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tpl {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  background: var(--card);
}
.tpl:hover { border-color: var(--blue-border); }
.tpl.on { border-color: var(--blue); background: var(--blue-bg); }
.tpl input { accent-color: var(--blue); width: 16px; height: 16px; flex: none; }
.tplbody { flex: 1; min-width: 0; }
.tpl .t { font-size: 13.5px; font-weight: 700; }
.tpl .d { font-size: 12px; color: var(--grey-2); margin-top: 3px; line-height: 1.5; }
.tpl .m { font-size: 11px; color: var(--grey-3); white-space: nowrap; }

.dropzone {
  border: 1px dashed #d3dad6;
  border-radius: 11px;
  padding: 30px;
  text-align: center;
  background: var(--card-2);
}
.dropzone .ico { font-size: 22px; color: #c2ccc7; }
.dropzone .t { font-size: 13px; font-weight: 700; margin-top: 8px; }

.filelist { margin-top: 16px; }
.filerow {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 13px; margin-bottom: 7px;
}
.filerow .ico { color: var(--grey-2); }
.filerow .body { flex: 1; min-width: 0; }
.filerow .t { font-size: 13px; font-weight: 600; }
.attach-risks { margin-top: 6px; align-items: flex-start; }
.attach-risks select { max-width: 360px; font-size: 12px; }

.archive-row {
  display: flex; align-items: center; gap: 11px;
  margin-top: 16px; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--card-2);
}
.archive-row .ico { font-size: 15px; color: var(--grey-2); }
.archive-row .t { font-size: 13px; font-weight: 600; }

.summary-block { padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.summary-block h4 {
  margin: 0 0 10px;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--grey-2);
}
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 7px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--grey-2); }
.kv dd { margin: 0; font-weight: 600; }

.setlist { padding: 6px; }
.setrow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; color: var(--ink-2); font-size: 13px; font-weight: 600;
}
.setrow:hover { background: var(--card-2); }
.setrow.on { background: #f0f6fb; color: var(--ink); }
.setrow .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.setrow .sname { flex: 1; min-width: 0; }
.setrow .snum { font-size: 11.5px; color: var(--grey-3); }

.success { text-align: center; padding: 46px 20px; animation: popin .35s ease; }
.success .mark {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--blue-soft); color: var(--blue-dark);
  font-size: 24px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.success .stitle { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.success p { margin: 8px auto 0; max-width: 460px; line-height: 1.6; font-size: 13px; }

.progress-bar { height: 6px; border-radius: 3px; background: var(--blue-soft); overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); transition: width .4s ease; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }

.muted { color: var(--grey-2); }
.small { font-size: 11.5px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.inline { display: flex; align-items: center; gap: 9px; }
.activity-row { margin: 6px 0; }
.hazard-card { margin-top: 16px; }
.hazard-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.hazard-row.open { background: #fff7ec; }
.hazard-row .hazard-text { flex: 1; }
.hazard-opt { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.hazard-proposed { background: #eef3fb; color: #3a5a8c; }
.activity-row .activity-name { min-width: 220px; }

/* The mockup keeps the full desktop layout well below 1024px; only very
   narrow viewports collapse. */
@media (max-width: 860px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .queue { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .gen-split { grid-template-columns: 1fr; }
  .search { max-width: none; width: 100%; margin-left: 0; order: 3; }
  /* A fixed 238px sidebar would squeeze the content column to nothing on a
     narrow window, leaving cards too thin to render their contents. */
  .sidebar { width: 64px; }
  .sidebar .label, .sidebar .nav-label, .nav-badge,
  .sidebar-account .who, .sidebar-account .caret { display: none; }
  .sidebar-logo { justify-content: center; padding: 18px 8px 4px; }
  .sidebar-logo img { width: 40px; object-fit: contain; }
  .nav-item { justify-content: center; padding: 10px 8px; }
  .sidebar-account { justify-content: center; padding: 10px 8px; }
}

.banner {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 20px; padding: 12px 15px;
  border: 1px solid #f2dcae; border-radius: 10px; background: var(--amber-bg);
}
.banner .ico { font-size: 15px; color: var(--amber); }
.banner .t { font-size: 13px; font-weight: 700; color: var(--amber); }
.banner > div { flex: 1; min-width: 0; }

.messages { display: flex; flex-direction: column; gap: 8px; }
.message {
  padding: 11px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: var(--card);
}
.message.error { background: var(--red-bg); border-color: #f3cdc9; color: var(--red); }
.message.success { background: var(--blue-soft); border-color: var(--blue-border); color: var(--blue-dark); }

.kb-spend {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px 18px; border-bottom: 1px solid var(--line-2); background: var(--card-2);
}
.kb-spend > div:first-child { flex: 1; min-width: 0; }
.spend-bar {
  height: 6px; border-radius: 4px; background: var(--line);
  overflow: hidden; margin-top: 7px; max-width: 420px;
}
.spend-fill { height: 100%; border-radius: 4px; background: var(--blue); }

/* ---------- login ---------- */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 380px; padding: 20px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand img { width: 168px; height: auto; }
.login-sub {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--grey-2); margin-top: 6px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-btn { justify-content: center; width: 100%; margin-top: 4px; }
.login-foot { text-align: center; margin-top: 16px; }


/* ---------- management screens ---------- */

.form-grid.wide { grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .span-all { grid-column: 1 / -1; }
.field.check { flex-direction: row; align-items: center; gap: 9px; }
.field.check label { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
.field.check input { accent-color: var(--blue); width: 16px; height: 16px; }
.field-error { font-size: 11.5px; color: var(--red); }
select.input[multiple] { min-height: 150px; font-weight: 400; }
.input[type="checkbox"] { width: auto; }

.tile {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; color: var(--ink);
}
.tile:hover { border-color: var(--blue-border); background: var(--blue-bg); color: var(--ink); }
.tile-ico {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: var(--blue-soft); color: var(--blue-dark);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.tile-body .t { font-size: 13.5px; font-weight: 700; }
.tile-body .m { font-size: 11.5px; color: var(--grey-2); margin-top: 3px; }

.inline-form { display: inline; }
td.actions a, td.actions .linkbtn {
  font-size: 12px; font-weight: 600; color: var(--blue); margin-left: 10px;
  letter-spacing: 0;
}
td.actions .linkbtn:hover { color: var(--red); }

ul.checkbox-list, .field ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.field ul li label { display: flex; align-items: center; gap: 7px; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 500; }

.sub-head {
  margin: 20px 0 10px; font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--grey-2);
}
.kv.narrow { grid-template-columns: 110px 1fr; }

/* ---------- wizard: add box, catalogues, inline measures ---------- */

.add-box {
  padding: 14px 20px;
  background: var(--blue-bg);
  border-bottom: 1px solid var(--blue-border);
}
.import-box { background: var(--card-2); border-bottom-color: var(--line); }
.import-box .small { margin-top: 8px; }
.import-box input[type=file] { padding: 8px 10px; font-size: 12.5px; max-width: 340px; }
.add-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--blue-dark); font-weight: 700; margin-bottom: 8px;
}

.more-block { margin-top: 18px; }
.more-block summary {
  font-size: 12px; font-weight: 600; color: var(--blue);
  cursor: pointer; padding: 8px 0; list-style: none;
}
.more-block summary::before { content: "▸ "; }
.more-block[open] summary::before { content: "▾ "; }
.more-block .risk-grid { margin-top: 10px; }

.risk.proposed { border-style: dashed; border-color: var(--blue-border); background: #fbfdff; }
.tag-sugg {
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--blue-dark); background: var(--blue-soft);
  padding: 1px 6px; border-radius: 20px; margin-left: 6px;
}
.rwhy { display: block; font-size: 11px; color: var(--grey-2); margin-top: 4px; font-style: italic; }

.measure-box { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.measure-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; background: var(--card-2); border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.measure-body { display: flex; gap: 14px; padding: 14px; align-items: flex-start; }
.measure-body .field.narrow { flex: 0 0 96px; }
.measure-body .field.grow { flex: 1; min-width: 0; }
.measure-body textarea.input { font-weight: 400; }

@media (max-width: 860px) {
  .measure-body { flex-wrap: wrap; }
  .measure-body .field.grow { flex: 1 1 100%; }
}

/* ---------- step 7: one card per risk ---------- */

.cards-head { padding: 0 2px 2px; }
.rcard-form { display: block; }
.rcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 12px;
}
/* A settled card is read at a glance while scrolling the step, so the
   confirmation has to show on the closed card, not only inside it. */
.rcard.confermato { border-color: var(--blue); background: var(--blue-bg); }
.rcard.confermato .rcard-head { background: transparent; }
.rcard.escluso .rcard-name, .rcard.escluso .rcard-code { opacity: .5; }

/* `display:flex` on the summary itself stops the browser from hiding the
   card body when the card is closed: the row layout goes on an inner box
   and the summary keeps a display the details element understands. */
.rcard details > summary {
  list-style: none; cursor: pointer; display: block;
}
.rcard details > summary::-webkit-details-marker { display: none; }
.rcard details > summary::marker { content: ""; }

.rcard-head {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 18px; font-size: 13.5px;
}
.rcard-head:hover { background: var(--card-2); }
.rcard-head::before { content: "▸"; color: var(--grey-3); font-size: 11px; }
.rcard details[open] .rcard-head::before { content: "▾"; }
.rcard-code { font-size: 11.5px; color: var(--grey-3); }
.rcard-name { font-weight: 700; }
.rcard-head .grow { flex: 1; }
.rcard-ok { color: var(--blue); font-weight: 800; }

.rcard-body { padding: 4px 18px 18px; border-top: 1px solid var(--line-2); }
.rcard-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2);
}

.scale-block { margin-top: 16px; }
.scale-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--grey-2); font-weight: 700; margin-bottom: 8px;
}
.scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stop {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
  cursor: pointer; background: var(--card); text-align: center;
}
.stop:hover { border-color: var(--blue-border); }
.stop.on { border-color: var(--blue); background: var(--blue-bg); }
/* The radio is hidden but must stay focusable: it is what the keyboard and
   the form itself act on. `:has` shows the selection with JavaScript off;
   the `.on` class mirrors it for browsers without `:has`. */
.stop input {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; margin: 0; pointer-events: none;
}
.stop:has(input:checked) { border-color: var(--blue); background: var(--blue-bg); }
.stop:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.stop-t { font-size: 13px; font-weight: 700; }

.metodo {
  background: var(--amber-bg); border: 1px solid #f2dcae; border-radius: 10px;
  padding: 13px 15px;
}
.metodo-n { font-size: 13px; font-weight: 700; color: var(--amber); margin-bottom: 4px; }

.escluso-box { background: var(--line-3); border-radius: 10px; padding: 15px; }

.piano { margin-top: 18px; }
.piano-row {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 13px; margin-bottom: 7px;
}
.piano-row .body { flex: 1; min-width: 0; }
.piano-row .t { font-size: 13px; font-weight: 600; }
.piano-head, .piano-line { display: grid; grid-template-columns: 1fr 160px 28px; gap: 8px; align-items: center; }
.piano-head { margin: 6px 0 4px; }
.piano-line { margin-bottom: 6px; }
.plan-add { padding: 6px 14px; font-size: 16px; line-height: 1; }
.risk-row-line { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 8px; align-items: start; margin: 8px 0; }
.risk-row-line textarea { grid-column: 1 / 3; }
.risk-row-line [data-plan-remove] { grid-column: 3; grid-row: 1; }

.rcard-err {
  background: var(--amber-bg); border: 1px solid #f2dcae; border-radius: 9px;
  padding: 10px 13px; margin-bottom: 14px;
  font-size: 12.5px; font-weight: 600; color: var(--amber);
}

.gate {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 18px; margin-top: 4px;
}
.gate-n { font-size: 13px; font-weight: 700; }
.gate-msg {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--grey-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gate-msg.blocco { color: var(--amber); font-weight: 600; }
/* Every blocker is in the markup so nothing is silently dropped; the bar
   shows what fits and the title attribute carries the rest. */
.gate-block + .gate-block::before { content: " · "; white-space: pre; }

@media (max-width: 860px) {
  .scale { grid-template-columns: repeat(2, 1fr); }
  .gate { flex-wrap: wrap; }
}

/* ---------- archive tables: selection, bulk bar, row menu, filters ---------- */


/* The row menu drops below the last rows; clipping would hide it. */
.table-card { overflow: visible; }

th.sel, td.sel { width: 36px; padding-right: 0; }
th.sel input, td.sel input { accent-color: var(--blue); width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
tbody tr.picked { background: var(--blue-bg); }

.bulkbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: var(--blue-bg);
  border-bottom: 1px solid var(--blue-border);
}
.bulkbar[hidden] { display: none; }
.bulkbar-n { font-size: 12.5px; font-weight: 700; color: var(--blue-dark); margin-right: auto; }
.bulkbar .btn { padding: 7px 12px; font-size: 12.5px; }

.btn.danger { background: var(--red-bg); color: var(--red); border-color: #f3c9c5; }
.btn.danger:hover { background: #fbdcd9; color: var(--red); }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--card-2); color: var(--ink); }
.icon-btn.on { background: var(--blue-bg); color: var(--blue-dark); border-color: var(--blue-border); }
.icon-btn-n {
  position: absolute; top: -6px; right: -6px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--blue); color: #fff; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

td.menu-cell { text-align: right; width: 56px; }
.menu { position: relative; display: inline-block; }
.menu summary {
  list-style: none; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: var(--grey);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--line-3); color: var(--ink); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  min-width: 170px; padding: 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(30, 40, 50, .14);
  text-align: left;
}
.menu-pop a, .menu-pop button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 7px; background: none;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--card-2); color: var(--ink); }
.menu-pop .danger { color: var(--red); }
.menu-pop .danger:hover { background: var(--red-bg); color: var(--red); }
.menu-pop form { margin: 0; }

.pg.off { opacity: .45; }
a.pg:hover { background: var(--card-2); }

.modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  box-shadow: 0 24px 60px rgba(30, 40, 50, .22);
}
.modal::backdrop { background: rgba(40, 48, 55, .35); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--line-2);
}
.modal-body { padding: 18px; }
.modal-body.form-grid { grid-template-columns: repeat(2, 1fr); }
.modal-body [hidden] { display: none; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 13px 18px; border-top: 1px solid var(--line-2);
}

/* Live archive tables: the whole row opens the record, sortable headers. */
.icon-btn-n[hidden] { display: none; }
tr[data-href] { cursor: pointer; }
.th-sort {
  all: unset; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.th-sort:hover { color: var(--ink); }
.th-sort::after { content: "↕"; opacity: .35; font-size: 11px; letter-spacing: 0; }
.th-sort[data-dir="asc"] { color: var(--blue-dark); }
.th-sort[data-dir="asc"]::after { content: "↑"; opacity: 1; }
.th-sort[data-dir="desc"] { color: var(--blue-dark); }
.th-sort[data-dir="desc"]::after { content: "↓"; opacity: 1; }
button.pg { cursor: pointer; font: inherit; font-size: 12px; }
button.pg:hover { background: var(--card-2); }
[data-live-table].loading tbody { opacity: .55; transition: opacity .15s; }
a.row-link { color: inherit; text-decoration: none; }
a.row-link:hover { background: var(--card-2); }

/* Document detail: facts on top, the PDF below at near full height. */
.doc-head { display: flex; flex-wrap: wrap; gap: 18px 40px; align-items: flex-start; justify-content: space-between; }
.doc-title { font-size: 15px; }
.doc-facts { margin: 0; }
a.link { color: var(--blue-dark); font-weight: 600; text-decoration: none; }
a.link:hover { text-decoration: underline; }
.pdf-card { overflow: hidden; padding: 0; }
.pdf-view { display: block; width: 100%; height: calc(100vh - 230px); min-height: 520px; border: 0; }

/* Form modals: create/edit without leaving the page. */
.modal.wide { width: min(900px, calc(100vw - 32px)); }
.modal form[data-modal-form] .modal-body { max-height: calc(100vh - 200px); overflow: auto; }

/* Account menu at the foot of the sidebar: opens upwards. */
.account-menu summary { color: rgba(255, 255, 255, .8); }
.account-menu summary:hover, .account-menu[open] summary { background: rgba(255, 255, 255, .14); color: #fff; }
.account-menu .menu-pop { top: auto; bottom: calc(100% + 6px); }

/* Wide tables scroll sideways inside their card: the toolbar above and the
   pager below stay put. Row menus inside are placed with position:fixed by
   script.js so the scroll box does not clip them. */
.table-scroll { overflow-x: auto; }
.table-scroll > table { min-width: 100%; }
.table-scroll th { white-space: nowrap; }
.table-scroll .menu-pop.floating { position: fixed; right: auto; top: auto; }

/* An option the wizard shows but cannot offer yet. */
.risk.off { opacity: .6; cursor: not-allowed; }
.tag-missing { color: var(--red); font-size: 11px; font-weight: 700; margin-left: 6px; }

/* Wizard pick lists (step 2): columns as wide as the screen allows, a search
   box on top and the picked entries pinned first, in picking order. */
.risk-grid.auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pick-search { max-width: 420px; margin-bottom: 14px; }
.risk[hidden] { display: none; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.live-messages { display: contents; }
.file-name { align-self: center; }

/* A risk card left incomplete when the consultant tried to move on. */
.rcard.incompleto { border-color: #e08a2a; box-shadow: 0 0 0 1px #e08a2a; background: #fff6ea; }
