:root {
  --erg-navy: #0b2a4a;
  --erg-navy-2: #123b63;
  --erg-menu-bg: #0a3d73;      /* more saturated blue for the left menu */
  --erg-accent: #e8590c;
  --erg-bg: #f3f5f8;
  --sidebar-w: 230px;
  --topbar-h: 56px;
}
body { background: var(--erg-bg); font-size: .925rem; }

/* ── top bar & sidebar ─────────────────────────────── */
.topbar { background: var(--erg-navy); height: var(--topbar-h); position: fixed; top: 0; left: 0; right: 0; z-index: 1030; }
/* Bootstrap makes .offcanvas-lg transparent on desktop – force the menu colour */
.sidebar, .sidebar.offcanvas-lg { background-color: var(--erg-menu-bg) !important; }
@media (min-width: 992px) {
  .sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); overflow-y: auto; }
  .has-menu .content { margin-left: var(--sidebar-w); }
}
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--erg-menu-bg); }
.sidebar .nav-link { color: #ffffff; font-size: .97rem; font-weight: 500; letter-spacing: .01em;
  padding: .6rem 1.1rem; border-left: 4px solid transparent; }
.sidebar .nav-link i { width: 1.5rem; display: inline-block; color: #7fd0ff; font-size: 1.05rem; }
.sidebar .nav-link:hover { color: #ffffff; background: rgba(127, 208, 255, .16); }
.sidebar .nav-link:hover i { color: #ffffff; }
.sidebar .nav-link.active { color: #ffffff; font-weight: 700; background: rgba(232, 89, 12, .28); border-left-color: var(--erg-accent); }
.sidebar .nav-link.active i { color: #ffb38a; }
.sidebar .nav-group { color: #9fd8ff; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 1rem 1.1rem .35rem; margin-top: .4rem; border-top: 1px solid rgba(255,255,255,.15); }
.sidebar .nav-link.sub { padding-left: 1.6rem; }
.content { padding: calc(var(--topbar-h) + 1.25rem) 1.25rem 2rem; }
.content-plain { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(160deg, var(--erg-navy) 0%, #1d5a8c 100%); }

/* ── login ─────────────────────────────────────────── */
.login-card { width: 100%; max-width: 420px; border: 0; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card .brand { color: var(--erg-navy); }
.otp-boxes { display: flex; gap: .5rem; justify-content: center; }
.otp-boxes input { width: 3rem; height: 3.4rem; text-align: center; font-size: 1.5rem; font-weight: 600; }

/* ── home cards ────────────────────────────────────── */
.quick-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.quick-card { display: block; background: #fff; border-radius: 12px; padding: 1.25rem; text-decoration: none; color: inherit;
  border: 1px solid #e3e8ef; transition: transform .12s, box-shadow .12s; }
.quick-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(11,42,74,.12); color: inherit; }
.quick-card .qc-icon { font-size: 1.8rem; color: var(--erg-accent); }
.quick-card .qc-title { font-weight: 600; margin-top: .4rem; color: var(--erg-navy); }
.quick-card .qc-count { font-size: 1.6rem; font-weight: 700; color: var(--erg-navy); }

/* ── module pages ──────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.35rem; margin: 0; color: var(--erg-navy); }
.card-table { background: #fff; border-radius: 12px; border: 1px solid #e3e8ef; overflow: hidden; }
.card-table .table { margin: 0; }
.card-table thead th { background: #eef2f7; color: var(--erg-navy); font-weight: 600; white-space: nowrap; border-bottom: 0; }
.card-table thead th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.card-table thead th a:hover { color: var(--erg-accent); }
.card-table tbody tr { cursor: pointer; }
.card-table tbody tr:hover { background: #f7f9fc; }
.sort-ind { font-size: .72rem; opacity: .35; }
.sort-ind.active { opacity: 1; color: var(--erg-accent); }
.card-table thead th a:hover .sort-ind { opacity: .8; }
.pager .page-link { color: var(--erg-navy); }
.pager .active .page-link { background: var(--erg-navy); border-color: var(--erg-navy); color: #fff; }

.modal-header { background: var(--erg-navy); color: #fff; }
.modal-header .btn-close { filter: invert(1); }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem 1.2rem; }
.dl-grid .lbl { font-size: .75rem; color: #6c7a8a; text-transform: uppercase; letter-spacing: .02em; }
.dl-grid .val { font-weight: 500; min-height: 1.2rem; word-break: break-word; }
.section-title { font-size: .8rem; font-weight: 700; color: var(--erg-accent); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid #e3e8ef; padding-bottom: .3rem; margin: 1.2rem 0 .7rem; }
.btn-accent { background: var(--erg-accent); border-color: var(--erg-accent); color: #fff; }
.btn-accent:hover { background: #c94d0a; border-color: #c94d0a; color: #fff; }
.child-table td, .child-table th { font-size: .85rem; }
a.par-link { color: var(--erg-navy); font-weight: 600; text-decoration: none; border-bottom: 1px dotted currentColor; }
a.par-link:hover { color: var(--erg-accent); }

/* Descriptions in view mode: alone in their row, 90% of the modal width, at least 4 lines high */
.dl-grid .dl-desc { grid-column: 1 / -1; }
.dl-grid .dl-desc .val { width: 90%; min-height: calc(4 * 1.5em + 1rem); line-height: 1.5; white-space: pre-wrap;
  font-weight: 400; background: #f7f9fc; border: 1px solid #e3e8ef; border-radius: .375rem; padding: .5rem .75rem; }

/* Scenario composer (scenario_building.php) */
/* section headers: stronger background – closed = blue-grey, open = navy like the top bar */
.composer .accordion-button { font-weight: 600; color: var(--erg-navy); background: #d3deea; }
.composer .accordion-button:hover { background: #c3d2e3; }
.composer .accordion-button:focus { box-shadow: none; }
.composer .accordion-button:not(.collapsed) { background: var(--erg-navy); color: #fff; box-shadow: none; }
.composer .accordion-button:not(.collapsed) .text-muted { color: rgba(255, 255, 255, .75) !important; }
.composer .accordion-button:not(.collapsed)::after { filter: brightness(0) invert(1); }
.composer .accordion-button:disabled { opacity: .6; background: #e3e9f0; }
.composer .accordion-item + .accordion-item .accordion-button { border-top: 1px solid #b8c7d9; }
.composer .sec-letter { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem;
  border-radius: 50%; background: var(--erg-accent); color: #fff; font-size: .85rem; margin-right: .6rem; }
.composer-block { border-top: 1px solid #e3e8ef; padding-top: .9rem; margin-top: .4rem; }
.composer-table thead th { background: #f7f9fc; color: var(--erg-navy); font-weight: 600; white-space: nowrap; }
.composer-table .group-row td { background: #fff4ec; font-weight: 600; color: var(--erg-navy); }
.composer-sub { background: #f7f9fc; border: 1px solid #e3e8ef; border-radius: .5rem; padding: .9rem; margin: .6rem 0 .9rem; }

/* Tables with double-height rows (Κριτήρια, Ενέργειες, Σενάρια) */
.table.rows-tall > tbody > tr:not(.group-row) > td { height: 3.8rem; }
.table td.text-wrap-full { white-space: pre-line; word-break: break-word; min-width: 220px; }
.table.sortable th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.table.sortable th.th-sort:hover { color: var(--erg-accent); }
/* Καταχώρηση Αποτελεσμάτων: save bar always visible at the bottom */
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  background: #fff; border: 1px solid #d3deea; border-radius: .5rem; padding: .6rem .9rem; margin-top: .8rem;
  box-shadow: 0 -4px 14px rgba(11, 42, 74, .08); }
/* rows with a problem (Καταχώρηση Αποτελεσμάτων): red text, also inside the fields */
.table tr.row-error > td, .table tr.row-error > td .form-control, .table tr.row-error > td .form-select { color: #c1121f; }
.table tr.row-error > td:first-child { box-shadow: inset 3px 0 0 #c1121f; }
.history-table tr.hist-first > td { border-top: 2px solid #b8c7d9; }

/* drag & drop of composer rows */
.drag-handle{cursor:grab;color:#8a94a6;font-size:1.1rem;line-height:1;padding:0 .1rem}
.drag-handle:hover{color:#0b2545}
tr.dragging{opacity:.45;background:#e8eef6}

/* Προγραμματισμός Υλοποίησης */
.plan-wrap{max-height:70vh;overflow:auto}
.plan-table th,.plan-table td{min-width:110px}
.plan-table thead th{position:sticky;top:0;background:#0b2545;color:#fff;z-index:2;white-space:nowrap}
.plan-table tfoot th{position:sticky;bottom:0;background:#eef2f7;z-index:2}
.plan-table .plan-def{position:sticky;left:0;background:#fff;z-index:1;min-width:220px;font-weight:500}
.plan-table thead .plan-def{background:#0b2545;z-index:3}
.plan-table tfoot .plan-def{background:#eef2f7;z-index:3}
.plan-cell{height:2.6rem;text-align:center;vertical-align:middle}
.plan-cell.editable{cursor:pointer}
.plan-cell.editable:hover,.plan-cell.editable:focus{background:#fff4ec;outline:2px solid #e85d04;outline-offset:-2px}
.plan-code{background:#1d4e89;color:#fff;font-weight:600;margin:1px;font-size:.78rem}
.plan-cell.plan-saved{background:#e3f6e8;transition:background .3s}
/* «Συνοπτικά» of the Προγραμματισμός */
.sum-table th,.sum-table td{min-width:80px}
.sum-table .sum-row th{position:sticky;top:2.05rem;background:#e7edf5;color:#0b2545;z-index:2;font-weight:700}
.sum-table .sum-row th.plan-def{z-index:3}
.sum-table .sum-col{background:#e7edf5;font-weight:700}
.sum-table thead tr:first-child th.sum-col{background:#0b2545;color:#fff}
.sum-table .sum-all{background:#d3deea}
.sum-table td.sum-hit{background:#eef5ff;font-weight:600;color:#1d4e89}
/* «Συνοπτικά»: first column half as wide; scenario codes show their title on hover */
.sum-table{table-layout:fixed}
.sum-table .plan-def{width:230px;min-width:230px;max-width:230px;white-space:normal}
.sum-table .sum-sc{cursor:help}
.sum-table thead tr:first-child th.sum-col{width:75px}   /* 2nd column (Σύνολο) one third; the rest share the width */
.plan-def .plan-hw{font-size:.72rem;font-weight:400;color:#6c7a91}   /* Αυτοκινητόδρομος under the Προσδιορισμός */

/* ── Αναφορά «Εμφάνιση Σεναρίου»: A4 pages (screen preview + print) ── */
@page { size: A4; margin: 0; }
.rep-toolbar{position:sticky;top:0;z-index:10;display:flex;align-items:center;gap:.5rem;padding:.6rem 1rem;background:#0b2545;color:#fff}
.rep-toolbar .btn-outline-secondary{color:#fff;border-color:#8aa0bf}
.rep-source{position:absolute;left:-10000px;top:0;width:186mm;visibility:hidden}
.rep-pages{padding:1rem 0;background:#e9edf2}
.rep-page{width:210mm;height:297mm;margin:0 auto 1rem;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,.18);
          padding:10mm 12mm 8mm;display:flex;flex-direction:column;font-size:9pt;color:#111;overflow:hidden}
.rep-phead{display:flex;justify-content:space-between;border-bottom:1.5px solid #0b2545;padding-bottom:1.5mm;margin-bottom:3mm;
           font-size:8pt;color:#0b2545;font-weight:600}
.rep-ptitle{max-width:70%;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rep-pbody{flex:1 1 auto;overflow:hidden}
.rep-pfoot{border-top:1px solid #9aa7b8;padding-top:1.5mm;margin-top:2mm;text-align:right;font-size:9pt;font-weight:700;color:#0b2545}
.rep-h{background:#0b2545;color:#fff;font-weight:600;font-size:10.5pt;padding:1.4mm 2.5mm;margin:3mm 0 2mm;border-radius:1mm}
.rep-pbody > .rep-h:first-child{margin-top:0}
.rep-letter{display:inline-block;width:5.5mm;height:5.5mm;line-height:5.5mm;text-align:center;border-radius:50%;background:#e85d04;color:#fff;font-size:8.5pt;margin-right:1.5mm}
.rep-sub{font-weight:700;color:#0b2545;margin:2.5mm 0 1.5mm;font-size:9.5pt}
.rep-empty,.rep-note{color:#5b6677;font-size:8.5pt;margin-bottom:2mm}
.rep-info,.rep-visit{display:grid;grid-template-columns:1fr 1fr;gap:1.5mm 6mm;margin-bottom:2.5mm}
.rep-info .wide,.rep-visit .wide{grid-column:1 / -1}
.rep-info .lbl,.rep-visit .lbl{display:block;font-size:7pt;text-transform:uppercase;color:#5b6677;letter-spacing:.03em}
.rep-visit .fill{display:block;border-bottom:1px solid #777;height:6mm}
.fill.inline{display:inline-block;width:60mm;border-bottom:1px solid #777;height:5mm;vertical-align:bottom}
.lbl-in{font-size:8pt;color:#5b6677;margin-right:1mm}
.ptable{width:100%;border-collapse:collapse;margin-bottom:2mm;table-layout:fixed}
.ptable th{background:#e7edf5;color:#0b2545;font-size:8pt;font-weight:700;padding:1.2mm 1.5mm;border:1px solid #b8c4d4;text-align:left}
.ptable td{padding:1.2mm 1.5mm;border:1px solid #c9d2de;vertical-align:top;word-wrap:break-word}
.ptable .c-srt{width:11mm;text-align:center}
.ptable td.c-cmt{height:9mm}
.ptable td.c-val{height:7mm}
.ptable .rep-total td{background:#f3f6fa}
.ptable .small{font-size:7.5pt}
.pbox-item{display:inline-flex;align-items:center;gap:1mm;margin:0 2.5mm .6mm 0;white-space:nowrap}
.pbox{display:inline-block;width:3.2mm;height:3.2mm;border:1px solid #333;border-radius:.4mm;flex:none}
@media print {
  body{background:#fff !important}
  .no-print{display:none !important}
  .rep-pages{padding:0;background:#fff}
  .rep-page{margin:0;box-shadow:none;page-break-after:always;break-after:page}
  .rep-page:last-child{page-break-after:auto;break-after:auto}
  .rep-h,.rep-letter,.ptable th,.rep-total td{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
.report-card:hover{box-shadow:0 4px 14px rgba(11,37,69,.15);border-color:#e85d04}
/* the report uses the plain page (no menu): normal block layout, light background */
body:has(.rep-doc){background:#e9edf2 !important}
main.content-plain:has(.rep-doc){display:block;min-height:0;padding:0;background:none}
@media print { body:has(.rep-doc){background:#fff !important} }
/* report page header: code at the left · title (bold) 70% of the row · report name at the right */
.rep-phead{align-items:flex-end;gap:3mm}
.rep-phead .rep-pcode{flex:0 0 auto;font-size:10pt;font-weight:700}
.rep-phead .rep-ptitle{flex:0 0 70%;max-width:70%;text-align:left;font-size:10pt;font-weight:700;color:#111;white-space:normal}
.rep-phead .rep-pname{flex:1 1 auto;text-align:right;font-weight:400;color:#5b6677}
/* report footer: note (left) · page number (right) */
.rep-pfoot{display:flex;justify-content:space-between;align-items:baseline;gap:4mm}
.rep-pfoot .rep-pnote{font-size:7.5pt;font-weight:400;color:#5b6677}
/* «Αποτελέσματα Επισκέψεων»: ticked boxes, rows with errors */
.pbox.checked{background:#0b2545;border-color:#0b2545;position:relative;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.pbox.checked::after{content:"";position:absolute;left:.95mm;top:.25mm;width:.9mm;height:1.9mm;border:solid #fff;border-width:0 .45mm .45mm 0;transform:rotate(45deg)}
.pbox-item.on{font-weight:700}
.ptable tr.rep-err td{color:#c1121f}
.rep-errmsg{font-size:7.5pt;color:#c1121f;font-weight:600;margin-top:.5mm}
.rep-errcount{float:right;background:#c1121f;color:#fff;border-radius:1mm;padding:0 2mm;font-size:8pt;margin-top:.5mm;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.rep-visit-filled{background:#f3f6fa;border:1px solid #d3deea;border-radius:1mm;padding:2mm 3mm;-webkit-print-color-adjust:exact;print-color-adjust:exact}
/* composer: the row you return to after editing */
.composer-table tr[id^="row-"]{scroll-margin-top:calc(var(--topbar-h, 56px) + 1rem)}
.composer-table tr.row-back > td{background:#fff1c2 !important;transition:background .6s}
/* «Κατάλογος Προσδιορισμών»: number of items next to a heading */
.rep-hcount{float:right;background:#e85d04;color:#fff;border-radius:1mm;padding:0 2mm;font-size:8.5pt;margin-top:.4mm;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.rep-sub .bi{color:#e85d04}

/* ── Phones: tables with class «stack-sm» become stacked rows ───────────────────────────────
   (phones and small tablets, below 992px – the same limit as the side menu)
   first line: the short items (Σειρά, Ομάδα, Κωδικός…) · then the description on its own full line ·
   then answers / values · then the comment. sk-w = full line, sk-o1…sk-o4 = order, data-label = small label. */
@media (max-width: 991.98px) {
  table.stack-sm { display: block; width: 100%; }
  table.stack-sm > thead { display: none; }
  table.stack-sm > tbody { display: block; width: 100%; }
  table.stack-sm > tbody > tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: .75rem; row-gap: .4rem;
    padding: .7rem .35rem; border-bottom: 1px solid var(--bs-border-color); }
  table.stack-sm > tbody > tr > td { display: block; border: 0 !important; padding: 0 !important; height: auto !important;
    min-width: 0 !important; max-width: 100%; white-space: normal; box-shadow: none !important; }
  table.stack-sm .sk-w { flex: 1 1 100%; width: 100%; }
  table.stack-sm .sk-o1 { order: 1; } table.stack-sm .sk-o2 { order: 2; }
  table.stack-sm .sk-o3 { order: 3; } table.stack-sm .sk-o4 { order: 4; }
  table.stack-sm .sk-end { margin-left: auto; }
  table.stack-sm td[data-label]::before { content: attr(data-label) " "; color: var(--bs-secondary-color); font-size: .78em; font-weight: 500; }
  table.stack-sm td.sk-w[data-label]::before { display: block; margin-bottom: .1rem; }
  table.stack-sm td.sk-title { font-size: 1rem; }
}
@media (max-width: 991.98px) {
  table.stack-sm input[name^="order["] { width: 4.5rem; }        /* composer: Σειρά box stays small */
}

/* ── Πίνακας Ελέγχου ─────────────────────────────────────────── */
.dash-head { flex-wrap: wrap; gap: .5rem; }
.dash-card { background: #fff; border: 1px solid #e3e8ef; border-radius: 12px; padding: 1rem 1.1rem; box-shadow: 0 1px 2px rgba(11,37,69,.04); }
.dash-title { font-weight: 700; color: #0b2545; margin-bottom: .6rem; }
.dash-donut { position: relative; height: 260px; }
.dash-legend { width: 100%; margin-top: .6rem; font-size: .85rem; }
.dash-legend td { padding: .18rem .25rem; border-bottom: 1px solid #f0f2f5; color: #1f2733; }
.dash-legend .dash-legend-total td { font-weight: 700; border-bottom: 0; }
.dash-swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; margin-right: .45rem; vertical-align: -1px; flex: none; }
.dash-swatch-solid { background: linear-gradient(90deg, #2a78d6 0 33%, #eb6834 33% 66%, #1baf7a 66%); }
.dash-swatch-rest { background: #d9dee6; }
.dash-legend-inline { display: flex; gap: 1.2rem; font-size: .82rem; color: #5b6677; margin-bottom: .4rem; }
.dash-big { font-size: 1.6rem; font-weight: 700; color: #0b2545; line-height: 1; }
.dash-empty { color: #5b6677; padding: 2rem .5rem; text-align: center; }
/* Χρήστες & Ομάδες */
.ur-tabs .nav-link { padding: .4rem .8rem; }
.ur-list { border-top-left-radius: 0; }
tr.ur-own > td { background: #fff8e6; }
/* Επαναλήψεις Σεναρίων */
.rep-table .plan-def{min-width:260px;white-space:normal}
.rep-table td.rep-tot,.rep-table th.rep-tot{background:#eef2f7;font-weight:700;min-width:80px}
.rep-table thead th.rep-tot{background:#0b2545}
.rep-table td.rep-cell{padding:2px 4px;min-width:90px}
.rep-in{text-align:center;font-variant-numeric:tabular-nums}
.rep-table td.sum-hit{font-weight:600}
.rep-busy{opacity:.6}
.rep-table td.rep-multi{padding:3px 4px;min-width:120px}
.rep-line{display:flex;align-items:center;gap:4px;margin:0 0 2px;cursor:text}
.rep-line:last-child{margin-bottom:0}
.rep-lbl{flex:0 0 2.8em;font-size:.72rem;font-weight:700;color:#1d4e89;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rep-line .rep-in{padding:1px 4px;height:auto;min-height:0}
.rep-line.plan-saved{background:#e3f6e8;transition:background .3s}
.rep-legend{display:flex;flex-wrap:wrap;gap:4px 12px}
/* a window opened from another window (e.g. «Που χρησιμοποιείται») stays above it */
.modal.modal-stacked{z-index:1070}
.modal-backdrop.backdrop-stacked{z-index:1065}
