/*
 * Teme luminoasă / întunecată — Mondo Fibră Optică
 *
 * Tema se setează pe <html data-bs-theme="light|dark"> (Bootstrap 5.3 adaptează singur componentele).
 * Aici: variabilele aplicației + suprascrieri pentru stilurile proprii ale paginilor.
 * Suprascrierile dark sunt doar pentru ecran — la print pagina rămâne mereu pe alb.
 * Canvas-ul diagramelor rămâne alb (este „foaia” care se printează).
 * Fișierul se încarcă DUPĂ stilurile paginii, ca să le poată suprascrie.
 */
:root {
  --app-bg: #f8fafc;
  --app-surface: #ffffff;
  --app-surface-2: #fafafa;
  --app-hover: #f0f4ff;
  --app-border: #e5e7eb;
  --app-input-border: #ced4da;
  --app-text: #212529;
  --app-muted: #5f6872;
}

[data-bs-theme="dark"] {
  --app-bg: #0f141b;
  --app-surface: #171e27;
  --app-surface-2: #1d2631;
  --app-hover: #243244;
  --app-border: #2c3744;
  --app-input-border: #3a4756;
  --app-text: #e3e8ee;
  --app-muted: #9aa6b2;
  --bs-body-bg: #171e27;
  --bs-body-bg-rgb: 23, 30, 39;
  --bs-tertiary-bg: #1d2631;
  --bs-border-color: #2c3744;
}

/* Imagini diferite pe temă (ex. logo cu text negru / alb) */
.logo-dark-only { display: none; }
[data-bs-theme="dark"] .logo-light-only { display: none; }
[data-bs-theme="dark"] .logo-dark-only { display: inline-block; }

/* ─── Buton comutare temă ─── */
.btn-theme {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 28px; padding: 0; border-radius: 6px; cursor: pointer;
  color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2);
}
.btn-theme:hover { color: #fff; background: rgba(255, 255, 255, .18); }
.btn-theme:focus-visible { outline: 2px solid #2E86AB; outline-offset: 2px; }
.btn-theme-float {
  position: fixed; top: 12px; right: 12px; z-index: 1100;
  color: var(--app-text); background: var(--app-surface); border-color: var(--app-border);
}
.btn-theme-float:hover { color: var(--app-text); background: var(--app-hover); }

@media screen {
  /* ─── Layout comun ─── */
  [data-bs-theme="dark"] body { background: var(--app-bg); color: var(--app-text); }
  [data-bs-theme="dark"] .stat-card,
  [data-bs-theme="dark"] .card,
  [data-bs-theme="dark"] .card-header { background: var(--app-surface); color: var(--app-text); }
  [data-bs-theme="dark"] .card-header { border-bottom-color: var(--app-border); }
  [data-bs-theme="dark"] .stat-card .stat-label,
  [data-bs-theme="dark"] .table th { color: var(--app-muted); }
  [data-bs-theme="dark"] .card,
  [data-bs-theme="dark"] .stat-card { box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
  [data-bs-theme="dark"] .bg-white,
  [data-bs-theme="dark"] .bg-light { background-color: var(--app-surface-2) !important; }
  [data-bs-theme="dark"] .text-dark { color: var(--app-text) !important; }
  [data-bs-theme="dark"] .modal-box,
  [data-bs-theme="dark"] .modal-content { background: var(--app-surface); color: var(--app-text); }

  /* Stiluri inline scrise direct în pagini / generate din JS (fundal alb sau gri deschis) */
  [data-bs-theme="dark"] :not(canvas)[style*="background:#fff"],
  [data-bs-theme="dark"] :not(canvas)[style*="background: #fff"],
  [data-bs-theme="dark"] :not(canvas)[style*="background:#fafafa"],
  [data-bs-theme="dark"] :not(canvas)[style*="background:#fafbfc"],
  [data-bs-theme="dark"] :not(canvas)[style*="background:#f8f9fa"],
  [data-bs-theme="dark"] :not(canvas)[style*="background: #f8f9fa"],
  [data-bs-theme="dark"] :not(canvas)[style*="background:white"],
  [data-bs-theme="dark"] :not(canvas)[style*="background:#f0f0f0"],
  [data-bs-theme="dark"] :not(canvas)[style*="background:#f5f5f5"],
  [data-bs-theme="dark"] :not(canvas)[style*="background:#eee"],
  [data-bs-theme="dark"] :not(canvas)[style*="background-color:#fff"] { background-color: var(--app-surface-2) !important; color: var(--app-text); }
  [data-bs-theme="dark"] [style*="color:#333"],
  [data-bs-theme="dark"] [style*="color: #333"],
  [data-bs-theme="dark"] [style*="color:#555"],
  [data-bs-theme="dark"] [style*="color:#444"] { color: var(--app-text) !important; }

  /* ─── Hartă ─── */
  [data-bs-theme="dark"] #sidebar { background: var(--app-surface); border-right-color: var(--app-border); color: var(--app-text); }
  [data-bs-theme="dark"] .sidebar-header,
  [data-bs-theme="dark"] .sidebar-tabs { background: var(--app-surface-2); border-bottom-color: var(--app-border); }
  [data-bs-theme="dark"] .tab-btn:hover,
  [data-bs-theme="dark"] .eq-item:hover,
  [data-bs-theme="dark"] .line-item:hover,
  [data-bs-theme="dark"] .eq-actions button:hover { background: var(--app-hover); }
  [data-bs-theme="dark"] .eq-item.no-gps { background: #2b2116; }
  [data-bs-theme="dark"] .draw-btn { background: var(--app-surface); border-color: var(--app-input-border); color: var(--app-text); }
  [data-bs-theme="dark"] .draw-btn:hover { background: var(--app-hover); }
  [data-bs-theme="dark"] .leaflet-popup-content-wrapper,
  [data-bs-theme="dark"] .leaflet-popup-tip,
  [data-bs-theme="dark"] .leaflet-control-layers,
  [data-bs-theme="dark"] .leaflet-bar a { background: var(--app-surface); color: var(--app-text); }
  [data-bs-theme="dark"] .leaflet-bar a { border-bottom-color: var(--app-border); }
  [data-bs-theme="dark"] .leaflet-container { background: #1a222c; }

  /* ─── Vizualizare diagramă ─── */
  [data-bs-theme="dark"] .canvas-wrapper { background: var(--app-surface-2); }
  [data-bs-theme="dark"] .loss-ok { background: #3a3215; }
  [data-bs-theme="dark"] .loss-bad { background: #3d1f24; }

  /* ─── Editor diagramă (pagină completă, fără layout) ─── */
  [data-bs-theme="dark"] .editor-sidebar { background: var(--app-surface); border-right-color: var(--app-border); color: var(--app-text); }
  [data-bs-theme="dark"] .sidebar-hdr,
  [data-bs-theme="dark"] .editor-top-toolbar,
  [data-bs-theme="dark"] .props-bar { background: var(--app-surface-2); border-color: var(--app-border); color: var(--app-text); }
  [data-bs-theme="dark"] .sidebar-tabs .stab-btn { color: var(--app-muted); }
  [data-bs-theme="dark"] .sidebar-hdr-title { color: var(--app-text); }
  [data-bs-theme="dark"] .sidebar-tabs .stab-btn:hover:not(.active) { background: var(--app-hover); color: var(--app-text); }
  [data-bs-theme="dark"] .form-control-sm,
[data-bs-theme="dark"] .form-select-sm,
[data-bs-theme="dark"] .buffer-row .br-mode,
[data-bs-theme="dark"] .splice-row .sr-type-sel,
[data-bs-theme="dark"] .splice-row .sr-loss input,
[data-bs-theme="dark"] .splice-batch-bar .sbb-btn { background-color: var(--app-surface-2); color: var(--app-text); border-color: var(--app-input-border); }
  [data-bs-theme="dark"] .buffer-select-cable,
[data-bs-theme="dark"] .color-editor-item,
[data-bs-theme="dark"] .splice-group-header,
[data-bs-theme="dark"] .splice-summary,
[data-bs-theme="dark"] .splice-table th { background: var(--app-surface-2); border-color: var(--app-border); color: var(--app-text); }
  [data-bs-theme="dark"] .splitter-item { background: #2a2236; border-color: #4a3d63; color: var(--app-text); }
  [data-bs-theme="dark"] .splice-edit-popup { background: var(--app-surface); border-color: var(--app-border); color: var(--app-text); }
  [data-bs-theme="dark"] .buffer-row:hover,
[data-bs-theme="dark"] .splice-row:hover,
[data-bs-theme="dark"] .splice-row .sr-fiber:hover,
[data-bs-theme="dark"] .splice-table tr:hover,
[data-bs-theme="dark"] .splice-batch-bar .sbb-btn:hover { background: var(--app-hover); }
  [data-bs-theme="dark"] .splice-row { border-bottom-color: var(--app-border); color: var(--app-text); }
  [data-bs-theme="dark"] .splice-summary .ss-total { background: #1c3550; color: #8cc4ff; }
  [data-bs-theme="dark"] .splice-summary .ss-good,
  [data-bs-theme="dark"] .loss-good-bg { background: #183323; color: #7fd49b; }
  [data-bs-theme="dark"] .splice-summary .ss-warn,
  [data-bs-theme="dark"] .loss-ok-bg { background: #3a2f14; color: #ffc46b; }
  [data-bs-theme="dark"] .splice-summary .ss-bad,
  [data-bs-theme="dark"] .loss-bad-bg { background: #3d1f26; color: #ff8a8a; }
  [data-bs-theme="dark"] .splice-summary .ss-notest { background: var(--app-surface-2); color: var(--app-muted); }
  [data-bs-theme="dark"] .btn-outline-light:hover { background: var(--app-hover); color: var(--app-text); }
  [data-bs-theme="dark"] #splice-canvas { background: #fff; }
  /* Texte cu culoare închisă scrisă fix în stilurile paginilor */
  [data-bs-theme="dark"] .sidebar-header-title,
  [data-bs-theme="dark"] .sidebar-toggle,
  [data-bs-theme="dark"] .sidebar-hdr .sidebar-toggle,
  [data-bs-theme="dark"] .enc-popup .popup-row,
  [data-bs-theme="dark"] .splice-edit-popup .sep-row label,
  [data-bs-theme="dark"] .splice-edit-popup .sep-title,
  [data-bs-theme="dark"] .splice-row .sr-connector .sc-x { color: var(--app-text); }
  [data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--app-surface-2); --bs-table-color: var(--app-muted);
    --bs-table-border-color: var(--app-border); color: var(--app-muted);
  }
  [data-bs-theme="dark"] .mondo-footer { border-top-color: var(--app-border); }
  /* Logo-ul din subsol e înnegrit (brightness 0) pentru tema deschisă; pe dark îl facem alb */
  [data-bs-theme="dark"] .mondo-footer .footer-logo { filter: brightness(0) invert(1); opacity: .6; }
  [data-bs-theme="dark"] .mondo-footer .footer-sep { color: var(--app-border); }
  [data-bs-theme="dark"] .mondo-footer .footer-version,
  [data-bs-theme="dark"] .mondo-footer .footer-copy { color: var(--app-muted); }
}

/* Butonul de temă ocupă loc în navbar: numele utilizatorului se ascunde mai devreme */
@media (max-width: 1600px) {
  .mondo-navbar .user-section .user-name { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
 * Tipar UI — aceleași dimensiuni pentru toate controalele, pe toate paginile
 * (inclusiv editorul de diagrame și harta). Trei trepte:
 *   standard (36px): formulare, bare de căutare/filtrare, acțiuni principale
 *   mic      (31px): .btn-sm / .form-control-sm / .form-select-sm — tabele, toolbar-uri secundare, panouri
 *   compact  (24px): .btn-xs / .btn.py-0 — micro-butoane în liste dense
 * Nu redefini înălțimi/fonturi/colțuri pe controale în paginile individuale; alege treapta potrivită.
 * ═══════════════════════════════════════════════════════════════════════ */
:root {
  --ctl-h: 36px;  --ctl-h-sm: 31px;  --ctl-h-xs: 24px;  --ctl-h-lg: 42px;
  --ctl-fs: .875rem;  --ctl-fs-sm: .8125rem;  --ctl-fs-xs: .75rem;  --ctl-fs-lg: 1rem;
  --ctl-r: 8px;  --ctl-r-sm: 6px;  --ctl-r-xs: 5px;
  --tab-h: 40px;
  --bs-border-radius: 8px;  --bs-border-radius-sm: 6px;  --bs-border-radius-lg: 10px;
}

/* Butoane */
.btn {
  min-height: var(--ctl-h); padding: .375rem .875rem; font-size: var(--ctl-fs); line-height: 1.25;
  border-radius: var(--ctl-r); display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
}
.btn.text-start { justify-content: flex-start; }
.btn-sm, .btn-group-sm > .btn {
  min-height: var(--ctl-h-sm); padding: .25rem .625rem; font-size: var(--ctl-fs-sm); border-radius: var(--ctl-r-sm);
}
.btn-lg, .btn-group-lg > .btn {
  min-height: var(--ctl-h-lg); padding: .5rem 1.25rem; font-size: var(--ctl-fs-lg); border-radius: var(--ctl-r);
}
.btn-xs, .btn.py-0 {
  min-height: var(--ctl-h-xs); padding-left: .375rem; padding-right: .375rem; font-size: var(--ctl-fs-xs); border-radius: var(--ctl-r-xs);
}

/* Câmpuri */
.form-control, .form-select {
  min-height: var(--ctl-h); padding-top: .375rem; padding-bottom: .375rem; font-size: var(--ctl-fs); border-radius: var(--ctl-r);
}
textarea.form-control { min-height: calc(var(--ctl-h) * 2); }
.form-control-sm, .form-select-sm {
  min-height: var(--ctl-h-sm); padding-top: .25rem; padding-bottom: .25rem; font-size: var(--ctl-fs-sm); border-radius: var(--ctl-r-sm);
}
.input-group-text { min-height: var(--ctl-h); font-size: var(--ctl-fs); }
.input-group-sm > .input-group-text, .input-group-sm > .form-control, .input-group-sm > .form-select, .input-group-sm > .btn {
  min-height: var(--ctl-h-sm); font-size: var(--ctl-fs-sm);
}
.form-control-color { padding: .25rem; }
.form-label { font-size: var(--ctl-fs-sm); font-weight: 600; margin-bottom: .3rem; }

/* Tab-uri de pagină și tab-uri de panou lateral */
.nav-tabs .nav-link {
  min-height: var(--tab-h); padding: .5rem 1rem; font-size: var(--ctl-fs); display: flex; align-items: center; gap: .375rem;
}
.sidebar-tabs .tab-btn, .sidebar-tabs .stab-btn {
  min-height: var(--ctl-h); font-size: var(--ctl-fs-sm); display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
}

/* Controale proprii ale paginilor, aduse pe aceleași trepte */
.draw-btn { min-height: var(--ctl-h); font-size: var(--ctl-fs-sm); border-radius: var(--ctl-r); }
.splice-batch-bar .sbb-btn, .buffer-row .br-mode, .splice-row .sr-type-sel { min-height: var(--ctl-h-xs); font-size: var(--ctl-fs-xs); border-radius: var(--ctl-r-xs); }

/* ═══ Contrast lizibil (minim 4.5:1 la text normal) — verificat automat pe toate paginile ═══ */
/* Temă deschisă: culorile Bootstrap deschise (galben, cyan) nu se citesc pe alb */
:root {
  --app-accent-text: #1d6f91;   /* brand #2E86AB, închis pentru text */
}
.text-warning { color: #9a6700 !important; }
.text-info { color: #0a6a80 !important; }
.text-success { color: #146c43 !important; }
/* Cap de tabel închis (table-dark): textul trebuie să fie deschis, nu gri */
.table-dark th, .table-dark td, thead.table-dark th { color: #f1f3f5 !important; }
.btn-outline-info { --bs-btn-color: #0a6a80; --bs-btn-border-color: #0a6a80; --bs-btn-hover-bg: #0a6a80; --bs-btn-hover-border-color: #0a6a80; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #0a6a80; --bs-btn-active-color: #fff; }
.btn-outline-danger { --bs-btn-color: #bb2d3b; --bs-btn-border-color: #bb2d3b; }
.btn-outline-secondary { --bs-btn-color: #5c636a; --bs-btn-border-color: #8a9096; }
.btn-outline-warning { --bs-btn-color: #9a6700; --bs-btn-border-color: #d39e00; --bs-btn-hover-bg: #ffc107; --bs-btn-hover-color: #1a1a1a; }
.mondo-footer .footer-version, .mondo-footer .footer-copy { color: var(--app-muted) !important; }
.tab-btn.active, .stab-btn.active { color: var(--app-accent-text) !important; }
.eq-item .eq-meta { color: var(--app-muted); }
.eq-actions button { border-radius: var(--ctl-r-xs); min-height: var(--ctl-h-xs); }
.btn-xs, .btn.py-0 { padding-top: 0; padding-bottom: 0; }
.cab-zoom-label { color: #d0d4d8 !important; }
.marker-cluster div { color: #1a1a1a; }

@media screen {
  /* Temă întunecată: variantele deschise ale culorilor, ca textul să se vadă pe fundal închis */
  [data-bs-theme="dark"] { --app-accent-text: #6cc3e6; }
  [data-bs-theme="dark"] .text-success { color: #75b798 !important; }
  [data-bs-theme="dark"] .text-info { color: #6edff6 !important; }
  [data-bs-theme="dark"] .text-warning { color: #ffda6a !important; }
  [data-bs-theme="dark"] .text-danger { color: #ea868f !important; }
  [data-bs-theme="dark"] .text-secondary { color: #a7acb1 !important; }
  [data-bs-theme="dark"] .btn-outline-success { --bs-btn-color: #75b798; --bs-btn-border-color: #3f8f64; }
  [data-bs-theme="dark"] .btn-outline-info { --bs-btn-color: #6edff6; --bs-btn-border-color: #3cbfd8; --bs-btn-hover-bg: #3cbfd8; --bs-btn-hover-color: #0f141b; }
  [data-bs-theme="dark"] .btn-outline-warning { --bs-btn-color: #ffda6a; --bs-btn-border-color: #d9a91a; }
  [data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color: #ea868f; --bs-btn-border-color: #c95561; }
  [data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #c9d1d9; --bs-btn-border-color: #6b7785; --bs-btn-hover-bg: #3a4756; --bs-btn-hover-border-color: #8693a2; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #3a4756; --bs-btn-active-border-color: #8693a2; --bs-btn-active-color: #fff; --bs-btn-disabled-color: #8a96a3; --bs-btn-disabled-border-color: #3a4756; }
  [data-bs-theme="dark"] .btn-outline-dark { --bs-btn-color: var(--app-text); --bs-btn-border-color: #5c6670; --bs-btn-hover-bg: #3a4756; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #3a4756; --bs-btn-active-color: #fff; }
  [data-bs-theme="dark"] .tab-btn { color: var(--app-muted); }
  [data-bs-theme="dark"] .leaflet-control-attribution { background: rgba(23, 30, 39, .85) !important; color: var(--app-muted); }
  [data-bs-theme="dark"] .leaflet-control-attribution a { color: #8cc4ff; }
}
/* ═══ Panoul din stânga al editorului de diagrame ═══ */
/* Tab-uri: 5 tab-uri egale, iconiță deasupra textului (panoul are 420px / 380px sub 1400px) */
.editor-sidebar .sidebar-tabs .stab-btn {
  flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; padding: 6px 2px;
  font-size: var(--ctl-fs-xs); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.editor-sidebar .sidebar-tabs .stab-btn i { font-size: 1rem; }
/* Rândurile din tab-ul Suduri: fibrele pe primul rând, tip / pierdere / acțiuni pe al doilea */
.editor-sidebar .splice-row { flex-wrap: wrap; row-gap: 3px; padding-left: 8px; padding-right: 6px; }
.editor-sidebar .splice-row::before { content: ''; order: 9; flex-basis: 100%; height: 0; }
.editor-sidebar .splice-row .sr-fiber { flex: 1 1 0; min-width: 0; overflow: hidden; white-space: nowrap; }
.editor-sidebar .splice-row .sr-type-sel { order: 10; margin-left: 24px; }
.editor-sidebar .splice-row .sr-loss { order: 11; }
.editor-sidebar .splice-row .sr-actions { order: 12; opacity: 1; }
.editor-sidebar .splice-row .sr-actions button { min-height: var(--ctl-h-xs); }
/* Poziții fibre: un bloc pe cablu, pe toată lățimea panoului */
.editor-sidebar .fiberpos-cable { display: block; min-width: 0; width: 100%; background: var(--app-surface-2); border-color: var(--app-border); }
.editor-sidebar .fiberpos-cable .splitter-header small { color: var(--app-text); }
.editor-sidebar .fiberpos-cable .d-flex { flex-wrap: wrap; row-gap: 2px; }
.editor-sidebar .fiberpos-cable .btn { min-width: 22px; padding-left: .2rem; padding-right: .2rem; }
.editor-sidebar .fiberpos-cable summary { flex-wrap: wrap; gap: 4px; }
.editor-sidebar .fiberpos-cable summary > span:first-child { flex: 1 1 auto; min-width: 0; }
/* Containerul tab-ului Poziții: blocurile cablurilor unul sub altul (editorul nu are .flex-column) */
.editor-sidebar #buffers-container { flex-direction: column; }
/* Mesaj la hover pe o fibră în editor */
.fiber-tip {
  position: fixed; z-index: 1500; pointer-events: none; max-width: 380px;
  background: var(--app-surface); color: var(--app-text); border: 1px solid var(--app-border);
  border-radius: var(--ctl-r); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 8px 10px;
  font: 12.5px/1.4 Inter, "Segoe UI", system-ui, sans-serif;
}
.fiber-tip .ft-end { display: grid; gap: 1px; }
.fiber-tip .ft-cable { font-weight: 700; }
.fiber-tip .ft-arrow { color: var(--app-muted); padding: 1px 0 1px 2px; line-height: 1; }
.fiber-tip .ft-meta { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--app-border); color: var(--app-muted); font-size: 11.5px; }
@media print { .fiber-tip { display: none !important; } }

/* ═══ Editor: sudare manuală, istoric, prezență ═══ */
.stp-popup {
  position: fixed; z-index: 9999; min-width: 300px; max-width: 420px; padding: 12px 14px; text-align: center;
  background: var(--app-surface); color: var(--app-text); border: 1px solid var(--app-border); border-top: 3px solid var(--app-brand);
  border-radius: var(--ctl-r); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font: 13px/1.4 Inter, "Segoe UI", system-ui, sans-serif;
}
.stp-popup .stp-route { font-size: 12px; color: var(--app-muted); margin-bottom: 6px; }
.stp-popup .stp-title { font-weight: 700; margin-bottom: 10px; }
.stp-popup .stp-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.stp-popup .stp-btn { min-height: var(--ctl-h-sm); padding: 0 14px; border-radius: var(--ctl-r-sm); font: 600 var(--ctl-fs-sm) Inter, "Segoe UI", sans-serif; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.stp-popup .stp-btn i { font-size: 8px; }
.stp-popup .stp-fusion { background: #198754; border-color: #198754; color: #fff; }
.stp-popup .stp-mechanical { background: var(--app-brand-fill); border-color: var(--app-brand-fill); color: #fff; }
.stp-popup .stp-cancel { background: var(--app-surface-2); border-color: var(--app-input-border); color: var(--app-text); }
.stp-popup .stp-btn:focus-visible { outline: 2px solid #2E86AB; outline-offset: 2px; }
.fiber-tip .ft-title { font-weight: 700; color: var(--app-accent-text); margin-bottom: 3px; }
.fiber-tip .ft-warn { margin-top: 5px; color: #b26a00; font-weight: 600; }
[data-bs-theme="dark"] .fiber-tip .ft-warn { color: #ffc46b; }
.canvas-action-bar .cab-btn:disabled { opacity: .35; cursor: default; }
.canvas-action-bar .cab-badge { width: auto; min-width: 32px; padding: 0 8px; gap: 4px; display: inline-flex; align-items: center; color: #ffb3b3; border-color: rgba(220, 53, 69, .55); }
.canvas-action-bar .cab-badge span { font-size: .8rem; font-weight: 700; }
.canvas-action-bar .cab-badge.cab-ok { color: #8fe0a8; border-color: rgba(40, 167, 69, .5); }
.presence-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 12px; font-size: .74rem; font-weight: 600; color: #1a1a1a !important; background: #ffc107; }
.presence-badge[hidden] { display: none; }

/* ═══════════════════════════════════════════════════════════════════════
 * Tipar de pagină — același aspect pe toate paginile, în ambele teme
 *   .app-head     antet: breadcrumb, titlu cu iconiță, descriere, acțiuni (generat în layout)
 *   .app-toolbar  bară de filtre / căutare + acțiunea principală
 *   .card         panou; .card-header = titlul panoului
 *   .table        tabel de date (cap discret, rânduri aerisite)
 *   .app-kv       listă de detalii „etichetă — valoare”
 *   .app-empty    stare goală (nu există încă date)
 *   .stat-card    indicator numeric (dashboard, rapoarte)
 * ═══════════════════════════════════════════════════════════════════════ */
:root {
  --app-bg: #f3f5f9;
  --app-radius: 12px;
  --app-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --app-shadow-lg: 0 10px 28px rgba(16, 24, 40, .10);
  --app-brand-soft: rgba(46, 134, 171, .12);
}
[data-bs-theme="dark"] {
  --app-bg: #0f141b;
  --app-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
  --app-shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
  --app-brand-soft: rgba(108, 195, 230, .14);
}
@media screen { body { background: var(--app-bg); color: var(--app-text); } }

/* Conținut: lățime maximă confortabilă; harta și diagramele folosesc tot ecranul */
.main-content { width: 100%; max-width: 1760px; margin: 0 auto; padding: 20px clamp(12px, 2vw, 28px) 28px; }
body.page-wide .main-content { max-width: none; }
body.sec-harta .main-content { max-width: none; padding: 10px; }
/* Hartă pe tot ecranul: fără derularea paginii și fără subsol (altfel bara hărții ajunge sub meniu) */
@media screen { body.sec-harta { height: 100vh; height: 100dvh; overflow: hidden; } body.sec-harta .mondo-footer { display: none; } }

/* Antet de pagină */
/* Grilă: breadcrumb pe tot rândul de sus, apoi [titlu | acțiuni] pe același rând, descrierea dedesubt */
.app-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; align-items: center; margin: 0 0 18px; }
.app-head-main { display: contents; }
.app-head-main > * { grid-column: 1 / -1; }   /* orice alt element din antet: pe tot rândul, sub titlu */
.app-head .app-crumbs { grid-column: 1 / -1; grid-row: 1; }
.app-head .app-title { grid-column: 1; grid-row: 2; min-width: 0; }
.app-head .app-head-actions { grid-column: 2; grid-row: 2; justify-content: flex-end; }
.app-head .app-sub { grid-column: 1 / -1; grid-row: 3; }
.app-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; font-size: .78rem; color: var(--app-muted); }
.app-crumbs a { color: var(--app-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.app-crumbs a:hover { color: var(--app-accent-text); }
.app-crumbs .bi-chevron-right { font-size: .65rem; opacity: .7; }
.app-title { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; color: var(--app-text); overflow-wrap: anywhere; }
.app-back { flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--app-border); background: var(--app-surface); color: var(--app-text); text-decoration: none; font-size: 1.05rem; }
.app-back:hover { background: var(--app-hover); color: var(--app-accent-text); }
.app-back:focus-visible { outline: 2px solid #2E86AB; outline-offset: 2px; }
.app-title-icon { flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--app-brand-soft); color: var(--app-accent-text); font-size: 1.05rem; }
.app-sub { margin: 4px 0 0; font-size: .85rem; color: var(--app-muted); }
.app-head-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
@media (max-width: 768px) {
  .app-title { font-size: 1.15rem; }
  .app-head .app-head-actions { grid-column: 1 / -1; grid-row: 4; justify-content: flex-start; margin-top: 10px; }
}
@media print { .app-head { display: none !important; } }

/* Bară de filtre: toate controalele pe aceeași treaptă (36px), acțiunea principală în dreapta */
.app-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; padding: 10px 12px;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.app-toolbar form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; }
.app-toolbar .form-select, .app-toolbar .form-control { width: auto; min-width: 170px; }
.app-toolbar .input-group { width: 280px; max-width: 100%; flex-wrap: nowrap; }
.app-toolbar .input-group .form-control { width: 1%; min-width: 0; flex: 1 1 auto; }
.app-toolbar .form-select-sm, .app-toolbar .form-control-sm, .app-toolbar .btn-sm { min-height: var(--ctl-h); font-size: var(--ctl-fs); border-radius: var(--ctl-r); }
.app-toolbar .app-toolbar-note { font-size: .8rem; color: var(--app-muted); }
@media (max-width: 576px) { .app-toolbar form, .app-toolbar .form-select, .app-toolbar .form-control { width: 100%; } }

/* Panouri */
.card { --bs-card-border-radius: var(--app-radius); --bs-card-inner-border-radius: calc(var(--app-radius) - 1px);
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--app-border); padding: .75rem 1rem; font-size: .9rem; font-weight: 600; color: var(--app-text); }
.card-header h6, .card-header .h6 { font-size: .9rem; font-weight: 600; }
.card-footer { background: transparent; border-top: 1px solid var(--app-border); }
.card.shadow-sm { box-shadow: var(--app-shadow) !important; }

/* Tabele de date */
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--app-border); font-size: .875rem; }
.table > thead:not(.table-dark) > tr > th, .table > thead:not(.table-dark) > tr > td {
  background: var(--app-surface-2); color: var(--app-muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: .6rem .75rem; border-bottom: 1px solid var(--app-border); white-space: nowrap; }
.table > tbody > tr > td, .table > tbody > tr > th { padding: .6rem .75rem; vertical-align: middle; }
.table-sm > tbody > tr > td, .table-sm > tbody > tr > th { padding: .35rem .6rem; }
.table-sm > thead:not(.table-dark) > tr > th { padding: .45rem .6rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--app-hover); }
.card .table:last-child > tbody > tr:last-child > * { border-bottom-width: 0; }
.table-borderless > tbody > tr > th { color: var(--app-muted); font-weight: 500; font-size: .82rem; text-transform: none; letter-spacing: 0; }

/* Detalii „etichetă — valoare” */
.app-kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; margin: 0; font-size: .875rem; }
.app-kv > dt, .app-kv > dd { margin: 0; padding: .45rem 0; border-bottom: 1px solid var(--app-border); }
.app-kv > dt { color: var(--app-muted); font-weight: 500; padding-right: 12px; }
.app-kv > dd { font-weight: 500; overflow-wrap: anywhere; }
.app-kv > dt:last-of-type, .app-kv > dd:last-of-type { border-bottom: 0; }

/* Stare goală */
/* <div class="app-empty"><i class="bi …"></i><strong>Titlu</strong><p>O frază.</p>[buton btn-outline-primary]</div> */
.app-empty { text-align: center; padding: 40px 16px; color: var(--app-muted); font-size: .9rem; }
.app-empty > .bi { display: block; font-size: 2.2rem; opacity: .55; margin-bottom: 8px; }
.app-empty > strong, .app-empty .app-empty-title { display: block; color: var(--app-text); font-size: .95rem; font-weight: 600; margin-bottom: 2px; }
.app-empty > p { max-width: 46ch; margin: 0 auto; }
.app-empty .btn { margin-top: 12px; }
.app-empty-sm { padding: 18px 12px; font-size: .85rem; }
.app-empty-sm > .bi { font-size: 1.5rem; margin-bottom: 4px; }
td > .app-empty { padding: 28px 12px; }

/* Indicatori */
.stat-card { height: 100%; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 14px; box-shadow: var(--app-shadow); padding: 1.1rem 1.25rem; transition: box-shadow .15s; }
.stat-card:hover { transform: none; box-shadow: var(--app-shadow-lg); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat-card .stat-label { font-size: .8rem; font-weight: 500; color: var(--app-muted); margin-top: 2px; }
.stat-card .stat-icon { width: 46px; height: 46px; border-radius: 12px; font-size: 1.3rem; flex-shrink: 0; }

/* Etichete, ferestre, câmpuri, alerte */
.badge { font-weight: 600; border-radius: 6px; padding: .38em .6em; letter-spacing: .01em; }
.badge.rounded-pill { border-radius: 50rem; }
.modal-content { border: 1px solid var(--app-border); border-radius: 14px; box-shadow: var(--app-shadow-lg); }
.modal-header { border-bottom-color: var(--app-border); }
.modal-footer { border-top-color: var(--app-border); }
.modal-title { font-size: 1.05rem; font-weight: 600; }
.form-control:focus, .form-select:focus { border-color: var(--app-brand); box-shadow: 0 0 0 3px var(--app-focus-ring); }
.alert { border-radius: 10px; }

/* Contrast: butoane / etichete pline cu text închis rămân închise și pe tema întunecată */
.btn-info { --bs-btn-color: #fff; --bs-btn-bg: #0a6a80; --bs-btn-border-color: #0a6a80; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #085566; --bs-btn-hover-border-color: #085566; --bs-btn-active-bg: #085566; --bs-btn-active-color: #fff; }
.btn-outline-success { --bs-btn-color: #146c43; --bs-btn-border-color: #198754; }
.btn-warning.text-dark, .bg-warning.text-dark:not([class*="bg-opacity"]), .bg-info.text-dark:not([class*="bg-opacity"]) { color: #1a1a1a !important; }
@media screen {
  [data-bs-theme="dark"] .btn-warning.text-dark, [data-bs-theme="dark"] .bg-warning.text-dark:not([class*="bg-opacity"]), [data-bs-theme="dark"] .bg-info.text-dark:not([class*="bg-opacity"]) { color: #1a1a1a !important; }
  [data-bs-theme="dark"] .btn-outline-success { --bs-btn-color: #75b798; --bs-btn-border-color: #3f8f64; }
  [data-bs-theme="dark"] .card-header { background: transparent; }
}

/* Setări → Localități: rânduri pe niveluri (județ / localitate / stradă) */

/* Pagina diagramei: diagrama pe toată lățimea, detaliile dedesubt */
.dv-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--app-muted); margin-top: 4px; }
.dv-meta span { display: inline-flex; align-items: center; gap: 5px; }
.dv-meta strong { color: var(--app-text); font-weight: 600; }
.dv-cables { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.dv-cable { border: 1px solid var(--app-border); border-left: 4px solid var(--dv-c, #2E86AB); border-radius: 10px; padding: 8px 12px; background: var(--app-surface); }
.dv-cable-name { font-weight: 600; font-size: .875rem; overflow-wrap: anywhere; }
.dv-cable-meta { font-size: .78rem; color: var(--app-muted); margin-top: 2px; }
.fiber-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); vertical-align: -1px; margin-right: 4px; }
.sp-end { white-space: nowrap; }
.sp-end .sp-cable { font-weight: 600; }
.sp-end .sp-sep { color: var(--app-muted); margin: 0 4px; }

/* ═══════════════════════════════════════════════════════════════════════
 * Sistem vizual (v1.9) — o singură culoare principală, culoarea doar pentru stări,
 * reguli fixe pentru butoane, insigne, formulare, stări goale. Regulile: docs/frontend-conventions.md.
 *
 * Culoarea Mondo #2E86AB înlocuiește albastrul Bootstrap peste tot (--bs-primary, linkuri, butoane, focus,
 * bife, paginare, progres). Nuanțe măsurate (contrast WCAG):
 *   --app-brand        #2E86AB  decor, contururi, bife, progres (alb pe el: 4.1:1 → nu pentru text mic)
 *   --app-brand-fill   #267596  butoane / insigne pline cu text alb (5.2:1); hover #1f6380 (6.7:1), apăsat #1b5872
 *   --app-accent-text  #1d6f91  text și linkuri pe fond deschis (5.6:1 pe alb, 5.2:1 pe #f3f5f9)
 *                      #6cc3e6  text și linkuri pe tema întunecată (8.5:1 pe #171e27)
 * ═══════════════════════════════════════════════════════════════════════ */
:root {
  --app-brand: #2E86AB;
  --app-brand-fill: #267596;
  --app-brand-fill-hover: #1f6380;
  --app-brand-fill-active: #1b5872;
  --app-brand-outline: #2E86AB;
  --app-accent-text-hover: #155a76;
  --app-focus-ring: rgba(46, 134, 171, .25);
  --app-border-strong: #c5ccd4;
  --app-stripe: rgba(16, 24, 40, .025);
  --app-sheet-desk: #e9edf2;
  --bs-primary: #2E86AB;
  --bs-primary-rgb: 46, 134, 171;
  --bs-primary-text-emphasis: #12475d;
  --bs-primary-bg-subtle: #d5e7ee;
  --bs-primary-border-subtle: #abcfdd;
  --bs-link-color: #1d6f91; --bs-link-color-rgb: 29, 111, 145;
  --bs-link-hover-color: #155a76; --bs-link-hover-color-rgb: 21, 90, 118;
  --bs-focus-ring-color: rgba(46, 134, 171, .25);
}
[data-bs-theme="dark"] {
  --app-brand-outline: #3f9cc4;
  --app-accent-text-hover: #95d5ef;
  --app-focus-ring: rgba(108, 195, 230, .3);
  --app-border-strong: #3e4a58;
  --app-stripe: rgba(255, 255, 255, .025);
  --app-sheet-desk: #0f141b;
  --bs-primary-text-emphasis: #8fd3ee;
  --bs-primary-bg-subtle: #0f2a36;
  --bs-primary-border-subtle: #1d5268;
  --bs-link-color: #6cc3e6; --bs-link-color-rgb: 108, 195, 230;
  --bs-link-hover-color: #95d5ef; --bs-link-hover-color-rgb: 149, 213, 239;
  --bs-focus-ring-color: rgba(108, 195, 230, .3);
}

/* Text în culoarea brandului: varianta lizibilă a temei (nu #2E86AB, care are doar 4.1:1) */
.text-primary, .link-primary { color: var(--app-accent-text) !important; }
.link-primary:hover { color: var(--app-accent-text-hover) !important; }
.bg-primary:not([class*="bg-opacity"]), .text-bg-primary { background-color: var(--app-brand-fill) !important; }
.text-bg-primary { color: #fff !important; }

/* Butoane */
.btn-primary {
  --bs-btn-color: #fff; --bs-btn-bg: var(--app-brand-fill); --bs-btn-border-color: var(--app-brand-fill);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--app-brand-fill-hover); --bs-btn-hover-border-color: var(--app-brand-fill-hover);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--app-brand-fill-active); --bs-btn-active-border-color: var(--app-brand-fill-active);
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--app-brand-fill); --bs-btn-disabled-border-color: var(--app-brand-fill);
  --bs-btn-focus-shadow-rgb: 46, 134, 171;
}
.btn-outline-primary {
  --bs-btn-color: var(--app-accent-text); --bs-btn-border-color: var(--app-brand-outline);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--app-brand-fill); --bs-btn-hover-border-color: var(--app-brand-fill);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--app-brand-fill-hover); --bs-btn-active-border-color: var(--app-brand-fill-hover);
  --bs-btn-disabled-color: var(--app-accent-text); --bs-btn-disabled-bg: transparent; --bs-btn-disabled-border-color: var(--app-brand-outline);
  --bs-btn-focus-shadow-rgb: 46, 134, 171;
}
.btn-outline-secondary { --bs-btn-hover-bg: #5c636a; --bs-btn-hover-border-color: #5c636a; --bs-btn-active-bg: #565e64; --bs-btn-active-border-color: #565e64; }

/* Bife, comutatoare, glisoare, tab-uri, paginare, progres, liste, meniuri */
.form-check-input:checked, .form-check-input[type="checkbox"]:indeterminate { background-color: var(--app-brand-fill); border-color: var(--app-brand-fill); }
.form-check-input:focus { border-color: var(--app-brand); box-shadow: 0 0 0 .25rem var(--app-focus-ring); }
.form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2393c3d7'/%3e%3c/svg%3e"); }
.form-range::-webkit-slider-thumb { background-color: var(--app-brand-fill); }
.form-range::-moz-range-thumb { background-color: var(--app-brand-fill); }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--bs-body-bg), 0 0 0 .25rem var(--app-focus-ring); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--app-brand-fill); }
.pagination { --bs-pagination-active-bg: var(--app-brand-fill); --bs-pagination-active-border-color: var(--app-brand-fill); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--app-focus-ring); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--app-brand-fill); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--app-brand-fill); }
.list-group { --bs-list-group-active-bg: var(--app-brand-fill); --bs-list-group-active-border-color: var(--app-brand-fill); }

/* ─── Insigne: exact trei tipuri, aceeași formă (pastilă) ───
 *   .app-badge-type    tip / categorie (ENCLOSURE, ODB, SPLICE) — neutră, contur
 *   .app-badge-status  stare — .is-ok verde, .is-warn galben, .is-bad roșu, .is-off gri (din statusBadge())
 *   .app-badge-count   număr — neutră, gri; cifrele nu primesc culoare */
.app-badge-type, .app-badge-status, .app-badge-count {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em; padding: .28em .7em;
  border: 1px solid transparent; border-radius: 50rem; font-size: .75rem; font-weight: 600; line-height: 1.25;
  white-space: nowrap; vertical-align: middle;
}
.app-badge-type { color: var(--app-muted); border-color: var(--app-border-strong); background: transparent; text-transform: uppercase; letter-spacing: .03em; }
.app-badge-count { min-width: 1.9em; color: var(--app-text); background: rgba(108, 117, 125, .12); font-variant-numeric: tabular-nums; }
.app-badge-status::before { content: ''; width: .5em; height: .5em; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.app-badge-status, .app-badge-status.is-off { color: #565e66; background: rgba(108, 117, 125, .12); }
.app-badge-status.is-ok   { color: #146c43; background: rgba(25, 135, 84, .12); }
.app-badge-status.is-warn { color: #7a5000; background: rgba(255, 193, 7, .22); }
.app-badge-status.is-bad  { color: #b02a37; background: rgba(220, 53, 69, .10); }
@media screen {
  [data-bs-theme="dark"] .app-badge-count { background: rgba(255, 255, 255, .08); }
  [data-bs-theme="dark"] .app-badge-status, [data-bs-theme="dark"] .app-badge-status.is-off { color: #a7acb1; background: rgba(255, 255, 255, .07); }
  [data-bs-theme="dark"] .app-badge-status.is-ok   { color: #75b798; background: rgba(25, 135, 84, .22); }
  [data-bs-theme="dark"] .app-badge-status.is-warn { color: #ffda6a; background: rgba(255, 193, 7, .16); }
  [data-bs-theme="dark"] .app-badge-status.is-bad  { color: #ea868f; background: rgba(220, 53, 69, .22); }
}

/* ─── Butoane din antetul paginii (.app-head-actions, pe rândul titlului) ───
 * Ordine fixă, aplicată automat: secundare (btn-outline-secondary) → Editează (btn-primary, singurul plin)
 * → Șterge (btn-outline-danger, doar coș), despărțit de restul. Toate la 36px. */
.app-head-actions > form { display: inline-flex; margin: 0; }
.app-head-actions > * { order: 1; }
.app-head-actions > .btn-primary, .app-head-actions > form:has(> .btn-primary) { order: 2; }
.app-head-actions > .btn-outline-danger, .app-head-actions > .btn-danger,
.app-head-actions > form:has(> .btn-outline-danger, > .btn-danger) { order: 3; margin-left: 10px !important; }   /* !important: învinge .m-0 / .ms-* puse pe formular */
.app-head-actions .btn-sm { min-height: var(--ctl-h); padding: .375rem .875rem; font-size: var(--ctl-fs); border-radius: var(--ctl-r); }
@media (max-width: 768px) {
  .app-head-actions > .btn-outline-danger, .app-head-actions > .btn-danger,
  .app-head-actions > form:has(> .btn-outline-danger, > .btn-danger) { margin-left: auto !important; }
}

/* ─── Acțiuni pe rând (liste / tabele): un singur rând, 31px, ordine [Hartă/Deschide] [Editează] [Șterge] ───
 * <td><div class="app-row-actions">…</div></td>; nu 24px — țintele trebuie să meargă pe tabletă / cu mănuși. */
.app-row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; flex-wrap: nowrap; white-space: nowrap; vertical-align: middle; }
.app-row-actions > * { order: 1; }
.app-row-actions > :has(> .bi-pencil) { order: 2; }
.app-row-actions > .btn-outline-danger, .app-row-actions > form:has(> .btn-outline-danger) { order: 3; }
.app-row-actions > form { display: inline-flex; margin: 0; }
.app-row-actions .btn { min-height: var(--ctl-h-sm); min-width: var(--ctl-h-sm); padding: .25rem .5rem; font-size: var(--ctl-fs-sm); border-radius: var(--ctl-r-sm); }
td:has(> .app-row-actions), .table th.app-col-actions { width: 1%; white-space: nowrap; text-align: end; }

/* ─── Formulare ───
 * Aliniate la stânga, sub titlu, cu lățime maximă; butoanele [Anulează] [Salvează] la dreapta, dedesubt. */
.app-form { max-width: 760px; }
.app-form-wide { max-width: 1040px; }
.app-form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--app-border); }
/* Subtitlu de secțiune în formular / card: mai puternic decât etichetele câmpurilor de sub el */
.app-section-title {
  display: flex; align-items: center; gap: .5rem; margin: 1.5rem 0 .85rem; padding-bottom: .4rem; border-bottom: 1px solid var(--app-border);
  font-size: .8rem; font-weight: 700; line-height: 1.3; letter-spacing: .06em; text-transform: uppercase; color: var(--app-accent-text);
}
.app-section-title:first-child { margin-top: 0; }
.app-section-title .app-opt { margin-left: auto; font-size: .72rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--app-muted); }
/* Text tehnic (utilizator, cale, cod, iconiță): monospațiat, discret — nu <code> (roz) */
.app-mono { font-family: var(--bs-font-monospace); font-size: .8rem; color: var(--app-muted); overflow-wrap: anywhere; }
/* Câmp obligatoriu: <label class="form-label app-req"> — steluța nu intră în textul etichetei */
.app-req::after { content: " *"; color: var(--bs-form-invalid-color); font-weight: 700; }

/* Stări ale câmpurilor (ambele teme): readonly = fond discret; disabled = fond gri, text estompat */
.form-control[readonly]:not(.form-control-plaintext) { background-color: var(--bs-tertiary-bg); }
.form-control:disabled, .form-select:disabled { color: var(--app-muted); }
@media screen {
  [data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-select:disabled { background-color: #232c37; border-color: var(--app-border); }
  [data-bs-theme="dark"] .form-control[readonly]:not(.form-control-plaintext) { background-color: var(--app-surface-2); }
}

/* ─── input[type=file] în română (construit automat de confirm.js) ─── */
.app-file { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.app-file > .app-file-input {
  position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important;
  border: 0 !important; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none;
}
.app-file-name { flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--ctl-fs); color: var(--app-text); }
.app-file-name.is-empty { color: var(--app-muted); }
.app-file.is-drag { outline: 2px dashed var(--app-brand); outline-offset: 4px; border-radius: var(--ctl-r); }
.app-file:has(> .app-file-input.is-invalid) > .btn { border-color: var(--bs-form-invalid-border-color); }
.app-file:has(> .app-file-input.is-invalid) > .app-file-name { color: var(--bs-form-invalid-color); }

/* ─── Tabele: dungi și borduri discrete în ambele teme; cifre aliniate ─── */
.table { --bs-table-striped-bg: var(--app-stripe); --bs-table-color: var(--app-text); --bs-table-striped-color: var(--app-text); --bs-table-hover-color: var(--app-text); }
.table-bordered > :not(caption) > * > * { border-color: var(--app-border); }
.app-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-num.is-zero { color: var(--app-muted); }

/* ─── Foaie de hârtie: desenul alb (canvas / imagine) stă pe o „masă”, nu orbește pe tema întunecată ───
 * <div class="app-sheet"><canvas>…</canvas></div> — la print rămâne doar foaia. */
.app-sheet { padding: 14px; background: var(--app-sheet-desk); border-radius: var(--ctl-r); overflow: auto; }
.app-sheet > canvas, .app-sheet > img, .app-sheet > svg, .app-sheet > .app-sheet-paper {
  display: block; background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(16, 24, 40, .12), 0 6px 18px rgba(16, 24, 40, .08);
}
@media screen {
  [data-bs-theme="dark"] .app-sheet > canvas, [data-bs-theme="dark"] .app-sheet > img,
  [data-bs-theme="dark"] .app-sheet > svg, [data-bs-theme="dark"] .app-sheet > .app-sheet-paper {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 10px 30px rgba(0, 0, 0, .55);
  }
}
@media print {
  .app-sheet { padding: 0; background: none; overflow: visible; }
  .app-sheet > canvas, .app-sheet > img, .app-sheet > svg, .app-sheet > .app-sheet-paper { box-shadow: none; border-radius: 0; }
}

/* === suduri === Registrul sudurilor (/suduri) și pagina OTDR (/masuratori) */
.sud-table td { vertical-align: middle; }
.sud-table tr.sud-group > td { background: var(--app-surface-2); padding-top: .55rem; padding-bottom: .55rem; font-size: .82rem; }
.sud-table tr.sud-group:hover > td { --bs-table-bg-state: transparent; }
.sud-enc { font-weight: 600; color: var(--app-text); text-decoration: none; white-space: nowrap; }
a.sud-enc:hover { color: var(--app-accent-text); text-decoration: underline; }
.sud-cas { font-weight: 600; white-space: nowrap; }
.sud-sep { color: var(--app-muted); margin: 0 6px; }
.sud-diag { float: right; color: var(--app-muted); white-space: nowrap; }
.sud-diag a { text-decoration: none; }
.sud-sub, .sud-meta { font-size: .78rem; color: var(--app-muted); }
.sud-ends { font-size: .82rem; line-height: 1.45; min-width: 300px; }
.sud-end { display: inline-block; }
.sud-cable { font-weight: 600; }
.sud-fiber { white-space: nowrap; }
.sud-arrow { color: var(--app-muted); margin: 0 6px; font-size: .75rem; }
.sud-loss-input { width: 6.2rem; margin-left: auto; text-align: end; }
.sud-flag-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.sud-flag-label .form-check-input { margin: 0; float: none; }
.sud-flag-text { display: none; font-size: .82rem; }
.sud-notes { max-width: 260px; font-size: .82rem; overflow-wrap: anywhere; }
.sud-table tr.is-saving .sud-loss-input { opacity: .6; }
.sud-table tr.is-saved .sud-loss-input { border-color: var(--bs-form-valid-border-color); }
.sud-table tr.is-error .sud-loss-input { border-color: var(--bs-form-invalid-border-color); }
@media (max-width: 576px) { #sudFilters .input-group, #otdrFilters .input-group { width: 100%; } }
@media (max-width: 767.98px) {
  /* telefon: fiecare sudură e un card — capetele, apoi tip / pierdere / „de refăcut” / acțiuni pe un rând, apoi observațiile */
  .sud-table thead { display: none; }
  .sud-table, .sud-table tbody { display: block; }
  .sud-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-bottom: 1px solid var(--app-border); }
  .table.sud-table > tbody > tr > td { display: block; padding: 0; border: 0; min-width: 0; max-width: none; width: auto; text-align: start; background: transparent; }
  .sud-table tr.sud-group { background: var(--app-surface-2); padding: 8px 12px; }
  .table.sud-table > tbody > tr.sud-group > td { flex: 1 1 100%; }
  .sud-diag { float: none; display: block; margin-top: 2px; }
  .sud-table .sud-ends { flex: 1 1 100%; order: 1; }
  .sud-table .sud-type { order: 2; }
  .sud-table .sud-loss { order: 3; }
  .sud-table .sud-flag { order: 4; }
  .sud-table .sud-actions { order: 5; margin-left: auto; }
  .sud-table .sud-notes { order: 6; flex: 1 1 100%; }
  .sud-table .sud-notes:not(:has(.sud-notes-text:not(:empty), .sud-meta:not(:empty))) { display: none; }
  .sud-table .sud-type.is-fusion { display: none; }   /* fuziunea e implicită; pe telefon se arată doar „Mecanică” */
  .sud-flag-text { display: inline; }
  .sud-loss-input { width: 5.6rem; margin-left: 0; }
}
/* OTDR */
.otdr-thumb { height: 200px; overflow: hidden; background: var(--app-sheet-desk); border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; display: flex; align-items: center; justify-content: center; }
.otdr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.otdr-thumb .bi { font-size: 3rem; color: var(--app-muted); }
.otdr-photo { display: block; text-align: center; }
.otdr-photo img { max-width: 100%; max-height: 520px; margin: 0 auto; }
.otdr-map { height: 200px; }

/* === dview === Pagina diagramei (views/diagrame/view.ejs), urmărirea fibrei (fiber-trace.js), fișa A4 */
.dv-canvas-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.dv-card-title { font-weight: 600; }
.dv-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dv-tools .btn.active { background: var(--app-brand-soft); color: var(--app-accent-text); border-color: var(--app-brand-outline); }
.dv-zoom-label { min-width: 3.6em; pointer-events: none; font-variant-numeric: tabular-nums; }
.dv-canvas-card .app-sheet { border-radius: 0; }
[data-bs-theme="dark"] .dv-canvas-card .app-sheet { background: var(--app-sheet-desk); }
.dv-legend, .dv-hint { padding: 8px 14px; font-size: .8rem; color: var(--app-muted); border-top: 1px solid var(--app-border); }
.dv-legend-orphan { display: inline-block; width: 28px; vertical-align: middle; border-top: 2.5px dashed #D32F2F; margin-right: 6px; }
.dv-orphan-row > td { background: rgba(220, 53, 69, .06) !important; }
.dv-cable-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dv-workdate { display: flex; align-items: center; gap: 8px; }
.dv-version-here > td { background: var(--app-brand-soft) !important; }
.dv-history-scroll { max-height: 420px; overflow-y: auto; }
.dv-history-scroll thead th { position: sticky; top: 0; z-index: 1; }
.dv-chg-add { color: #146c43; font-weight: 600; }
.dv-chg-del { color: #b02a37; font-weight: 600; }
@media screen {
  [data-bs-theme="dark"] .dv-chg-add { color: #75b798; }
  [data-bs-theme="dark"] .dv-chg-del { color: #ea868f; }
}
/* insigna de stare pe rândul evidențiat: fond opac (altfel fondul transparent al insignei + al rândului scade contrastul pe tema întunecată);
   :is() o face mai specifică decât regula [data-bs-theme="dark"] .app-badge-status.is-* */
.dv-version-here > td .app-badge-status:is(.is-ok, .is-warn, .is-bad, .is-off) { background-color: var(--app-surface); }
.trace-btn.active { box-shadow: 0 0 0 2px var(--app-brand); }
.sp-end { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 4px; }
.sp-cable { font-weight: 600; }
.sp-sep { color: var(--app-muted); }
/* Urmărirea fibrei */
.ft-start { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; font-size: .9rem; }
.ft-side + .ft-side { margin-top: 14px; }
.ft-steps { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--app-border); }
.ft-step { position: relative; padding: 6px 0 8px 10px; }
.ft-step::before { content: ""; position: absolute; left: -21px; top: 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--app-surface); border: 2px solid var(--app-brand); }
.ft-where { font-size: .82rem; color: var(--app-muted); }
.ft-where a { font-weight: 600; }
.ft-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: .85rem; margin-top: 2px; }
.ft-fiber { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 4px; }
.ft-cable { font-weight: 600; }
.ft-sep { color: var(--app-muted); margin: 0 2px; }
.ft-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); margin-right: 3px; }
.ft-dest { font-size: .75rem; font-weight: 600; padding: 0 6px; border-radius: 999px; border: 1px solid var(--app-border-strong); color: var(--app-muted); }
.ft-arrow { color: var(--app-muted); font-size: .8rem; }
.ft-muted { color: var(--app-muted); }
.ft-warn { font-size: .78rem; color: var(--app-muted); }
.ft-end { margin: 4px 0 0 14px; font-size: .82rem; color: var(--app-muted); }
.ft-end-error { margin-left: 0; color: #b02a37; }
[data-bs-theme="dark"] .ft-end-error { color: #ea868f; }
.ft-branches { margin: 4px 0 0 14px; display: grid; gap: 8px; }
.ft-branch { border: 1px solid var(--app-border); border-radius: var(--ctl-r); padding: 8px 10px; }
.ft-branch-label { font-size: .82rem; font-weight: 600; margin-bottom: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ft-loading { color: var(--app-muted); font-size: .875rem; }
.ft-cable-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: .9rem; }
.ft-result:not(:empty) { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--app-border); }
.ft-table td { vertical-align: middle; font-size: .82rem; }
/* Fișa A4: ascunsă pe ecran; la print rămâne doar ea (pagina 1 culcată: antet + desen; pagina 2 în picioare: suduri) */
#dv-print { display: none; }
@media print {
  @page dvsheet { size: A4 landscape; margin: 10mm; }
  @page dvtable { size: A4 portrait; margin: 12mm; }
  body:has(#dv-print) .mondo-navbar, body:has(#dv-print) .mondo-footer, body:has(#dv-print) .app-head,
  body:has(#dv-print) .main-content > :not(#dv-print) { display: none !important; }
  body:has(#dv-print) { padding: 0 !important; background: #fff !important; }
  body:has(#dv-print) .main-content { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  #dv-print { display: block; color: #000; font-family: Arial, sans-serif; }
  .dvp-p1 { page: dvsheet; }
  .dvp-p2 { page: dvtable; break-before: page; }
  .dvp-head { display: flex; justify-content: space-between; gap: 8mm; border-bottom: .4mm solid #000; padding-bottom: 3mm; margin-bottom: 3mm; }
  .dvp-kicker { font-size: 8pt; text-transform: uppercase; letter-spacing: .08em; color: #444; }
  .dvp-title { font-size: 14pt; font-weight: 700; margin: .5mm 0 2mm; }
  .dvp-kv { border-collapse: collapse; font-size: 8.5pt; }
  .dvp-kv th { text-align: left; font-weight: 400; color: #555; padding: .4mm 3mm .4mm 0; white-space: nowrap; }
  .dvp-kv td { font-weight: 700; padding: .4mm 6mm .4mm 0; }
  .dvp-qr { width: 30mm; text-align: center; flex-shrink: 0; }
  .dvp-qr svg { width: 28mm; height: 28mm; }
  .dvp-qr-url { font-size: 6pt; word-break: break-all; color: #444; }
  #dvp-img { display: block; max-width: 100%; max-height: 140mm; width: auto; height: auto; margin: 0 auto; object-fit: contain; }
  .dvp-title2 { font-size: 12pt; font-weight: 700; margin-bottom: 3mm; }
  .dvp-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  .dvp-table th, .dvp-table td { border: .25mm solid #000; padding: 1.2mm 1.5mm; vertical-align: middle; }
  .dvp-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; text-align: left; }
  .dvp-table tr { break-inside: avoid; }
  .dvp-nr { width: 9mm; text-align: right !important; }
  .dvp-check { width: 18mm; text-align: center !important; }
  .dvp-box { display: inline-block; width: 4.5mm; height: 4.5mm; border: .3mm solid #000; }
  .dvp-none { text-align: center; color: #555; }
  .dvp-table .sp-sep { color: #555; margin: 0 1mm; }
  .dvp-sign { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4mm 8mm; margin-top: 8mm; font-size: 9pt; }
}

/* === infra === Lista Infrastructură, pagina echipamentului și ferestrele echipament / casetă / cablu (views/diagrame/index, echipament, _infra_modals) */
/* Iconița tipului în titlu (layout.ejs → pageIcon / pageIconColor) */
.app-title-icon.is-colored { background: var(--app-title-icon-bg, var(--app-brand)); color: #fff; }
/* Liste compacte: un rând pe linie, numele tăiat cu „…” (numele întreg în title) */
.infra-list td, .infra-list th { white-space: nowrap; }
.infra-list .infra-cell-name { max-width: 0; width: 46%; }
.infra-list .infra-cell-place { max-width: 0; width: 30%; }
.infra-ell { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.infra-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--app-text); font-weight: 600; text-decoration: none; }
a.infra-name:hover .infra-ell { text-decoration: underline; }
.infra-list .enc-row { cursor: pointer; }
.infra-type-dot { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: .7rem; vertical-align: middle; }
.eq-line-dot { flex-shrink: 0; display: inline-block; width: 12px; height: 4px; border-radius: 2px; vertical-align: middle; }
/* Pagina echipamentului: casete și diagrame */
.eq-caseta + .eq-caseta { border-top: 1px solid var(--app-border); }
.eq-caseta { padding: 10px 16px; }
.eq-caseta-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-width: 0; }
.eq-caseta-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-diag { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); cursor: pointer; }
.eq-diag:hover { background: var(--app-hover, rgba(46, 134, 171, .06)); }
.eq-diag + .eq-diag { margin-top: 6px; }
.eq-diag-old { background: var(--app-surface-2); }
.eq-diag-main { min-width: 0; flex: 1 1 auto; display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; color: var(--app-text); text-decoration: none; }
.eq-diag-main:hover .eq-diag-title { text-decoration: underline; }
.eq-diag-title { font-weight: 600; white-space: nowrap; }
.eq-diag-meta { display: inline-flex; flex-wrap: wrap; gap: 2px 12px; font-size: .78rem; color: var(--app-muted); }
.eq-history summary { font-size: .8rem; color: var(--app-muted); cursor: pointer; margin: 6px 0 4px; }
#eq-map { height: 240px; border-radius: 0 0 var(--app-radius) var(--app-radius); }
.eq-qr { display: flex; gap: 14px; align-items: center; }
.eq-qr svg { width: 120px; height: 120px; flex-shrink: 0; background: #fff; border-radius: 8px; padding: 4px; border: 1px solid var(--app-border); }
.eq-qr-url { font-size: .75rem; color: var(--app-muted); word-break: break-all; }
.infra-orphans .card-header { border-left: 3px solid #dc3545; }
.infra-path-row > td { background: var(--app-surface-2); white-space: normal; padding: 10px 12px; }
/* Ferestre */
.infra-code { padding: 8px 10px; border: 1px solid var(--app-border); border-radius: 8px; background: var(--app-surface-2); font-size: .875rem; }
.infra-gps { display: flex; gap: 6px; flex-wrap: wrap; }
.infra-gps .form-control { flex: 1 1 120px; min-width: 0; }
.infra-num { max-width: 120px; }
.infra-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.infra-quick .btn { min-width: 56px; font-variant-numeric: tabular-nums; }
.infra-quick .btn.active { background: var(--app-brand-soft); border-color: var(--app-brand-outline); color: var(--app-accent-text); }
.infra-pair, .infra-express { margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--app-border-strong, var(--app-border)); border-radius: 8px; font-size: .85rem; }
.infra-adv > summary { cursor: pointer; font-size: .85rem; color: var(--app-accent-text); margin-bottom: 4px; }
.infra-swatches { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.infra-swatch { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--app-muted); margin: 0; }
.infra-swatch input { width: 24px; height: 24px; padding: 0; border: 1px solid var(--app-border-strong, var(--app-border)); border-radius: 4px; background: none; cursor: pointer; }
.infra-list .app-row-actions { min-height: var(--ctl-h-sm); }   /* rânduri egale: cu sau fără buton */
.table.infra-list > tbody > tr > td { padding-top: .4rem; padding-bottom: .4rem; }   /* ~45px pe rând: ~12 echipamente pe 1440×900 */
/* === /infra === */

/* === linii === Linii de fibră (/linii), Dashboard (/) și Rapoarte (/rapoarte…), foaia A4 a rapoartelor */
/* Linii de fibră: pătratul de culoare al liniei, capetele ca nume de echipamente */
.line-swatch { flex-shrink: 0; width: 14px; height: 14px; margin-top: 3px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .25); }
.linii-meta, .rpt-meta { font-size: .78rem; color: var(--app-muted); }
.linii-ends { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: .85rem; }
.linii-arrow { color: var(--app-muted); font-size: .8rem; }
.linii-name .app-badge-status { margin-left: 4px; }
/* „Scos din funcțiune” (lib/decommission.js): rândurile gri, în liste și pe pagina echipamentului */
tr.is-off > td { opacity: .6; }
tr.is-off > td:last-child { opacity: 1; }
.line-item.is-off { opacity: .6; }

/* Infrastructură: echipamentele grupate pe localitate (views/diagrame/index.ejs), ca grupurile din panoul hărții */
.infra-grp.is-closed .enc-row { display: none; }
.infra-grp-head > th { padding: 0 !important; background: var(--app-surface-2) !important; border-bottom: 1px solid var(--app-border); }
.infra-grp-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 6px 12px; border: 0; background: transparent;
  color: var(--app-text); font-weight: 600; font-size: .9rem; text-align: left; cursor: pointer; text-transform: none; letter-spacing: normal; }
.infra-grp-toggle:hover { background: var(--app-hover); }
.infra-grp-toggle:focus-visible { outline: 2px solid var(--app-focus-ring, #2E86AB); outline-offset: -2px; }
.infra-grp-arrow { transition: transform .15s; color: var(--app-muted); font-size: .8rem; }
.infra-grp:not(.is-closed) .infra-grp-arrow { transform: rotate(90deg); }
.infra-grp-meta { margin-left: auto; font-weight: 400; font-size: .8rem; color: var(--app-muted); }

/* Arhivă (views/arhiva) */
.arhiva-meta { font-size: .78rem; color: var(--app-muted); }
.arhiva-note { font-size: .82rem; color: var(--app-muted); }
.arhiva-table .app-badge-type { margin-right: 4px; }
.arhiva-table a { text-decoration: none; }
.arhiva-table a:hover { text-decoration: underline; }
.arhiva-group { height: 100%; padding: 10px 12px; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface-2); }
.arhiva-group-title { font-weight: 600; margin-bottom: 4px; }
.arhiva-group ul { padding-left: 1.1rem; font-size: .86rem; }
.linii-end { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.linii-linked { color: var(--app-accent-text); font-size: .8rem; }
.linii-cable { font-size: .74rem; color: var(--app-muted); }
.linii-cable.is-missing, .ll-warn { color: #7a5000; }
.linii-end-btn { margin-top: 2px; }

/* Capetele liniei / „Leagă automat” (public/js/line-link.js) */
.ll-line { margin-bottom: 10px; }
.ll-tabs { margin-bottom: 12px; }
.ll-tabs .btn { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 4px; line-height: 1.3; min-width: 0; }
.ll-tab-name { flex-basis: 100%; font-size: .74rem; font-weight: 400; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ll-ok { color: #198754; }
.ll-tabs .btn-primary .ll-ok, .ll-tabs .btn-primary .ll-warn, .ll-tabs .btn-primary .ll-muted { color: inherit; }
.ll-muted { color: var(--app-muted); }
.ll-where { font-size: .88rem; }
.ll-linked { padding: 8px 10px; margin-bottom: 12px; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface-2); }
.ll-cands { display: flex; flex-direction: column; border: 1px solid var(--app-border); border-radius: var(--app-radius); overflow: hidden; }
.ll-cand { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 0; cursor: pointer; border-top: 1px solid var(--app-border); }
.ll-cand:first-child { border-top: 0; }
.ll-cand:hover { background: var(--app-hover); }
.ll-cand .form-check-input { margin: 0; flex-shrink: 0; }
.ll-cand-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ll-cand-dist { color: var(--app-muted); font-size: .85rem; }
.ll-note { margin-top: 8px; padding: 7px 10px; border-radius: var(--app-radius); background: var(--app-surface-2); }
.ll-note ul { padding-left: 1.2rem; margin-top: 2px; }
.ll-cable { margin-top: 14px; }
.ll-table { font-size: .86rem; }
.ll-table .ll-chk { width: 34px; }
.ll-table select { min-width: 170px; }
.ll-summary { margin-top: 6px; }
.ll-loading { padding: 18px 0; }
@media screen {
  [data-bs-theme="dark"] .linii-cable.is-missing, [data-bs-theme="dark"] .ll-warn { color: #ffda6a; }
  [data-bs-theme="dark"] .ll-ok { color: #75b798; }
}
.rpt-grow { min-width: 0; flex: 1 1 auto; }
.app-toolbar .form-switch { display: flex; align-items: center; gap: 8px; min-height: var(--ctl-h); margin: 0; padding-left: 0; }
.app-toolbar .form-switch .form-check-input { float: none; flex-shrink: 0; margin: 0; }
.app-toolbar .form-switch .form-check-label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: var(--ctl-fs); }
/* Numele din liste: legături fără subliniere (doar la hover), ca titlurile de rând */
.linii-table a, body.sec-rapoarte .table a, body.sec-rapoarte .list-group a, .dash-item-main a, body.sec-rapoarte .app-kv a { text-decoration: none; }
.linii-table a:hover, body.sec-rapoarte .table a:hover, body.sec-rapoarte .list-group a:hover, .dash-item-main a:hover, body.sec-rapoarte .app-kv a:hover { text-decoration: underline; }
/* Comutator de vedere (Pe echipament / Pe cablu): starea activă în culoarea brandului, nu gri plin */
.rpt-view > .btn.active { background: var(--app-brand-soft); color: var(--app-accent-text); border-color: var(--app-brand-outline); }

/* Dashboard: indicatori neutri (culoarea doar pe stări), liste scurte */
.dash-stat { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; color: var(--app-text); text-decoration: none; }
.dash-stat:hover { color: var(--app-text); }
.dash-stat:focus-visible { outline: 2px solid var(--app-brand); outline-offset: 2px; }
.dash-stat-main { min-width: 0; }
.dash-stat .stat-value { color: var(--app-text); }
.dash-stat .stat-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; font-size: 1.15rem; background: var(--app-brand-soft); color: var(--app-accent-text); }
.dash-stat-meta { margin-top: 4px; font-size: .75rem; color: var(--app-muted); overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
  .dash-stat { padding: .9rem 1rem; }
  .dash-stat .stat-icon { width: 30px; height: 30px; font-size: .95rem; border-radius: 9px; }
}
.stat-unit { margin-left: 2px; font-size: .8rem; font-weight: 500; letter-spacing: 0; color: var(--app-muted); }
.dash-item { display: flex; align-items: center; gap: 10px; }
.dash-item-main { min-width: 0; flex: 1 1 auto; }
.dash-item-meta { font-size: .78rem; color: var(--app-muted); }
.dash-item-icon { flex-shrink: 0; width: 20px; text-align: center; color: var(--app-muted); }
.dash-head-sub { display: block; font-size: .75rem; font-weight: 400; color: var(--app-muted); }
.dash-quick { display: flex; flex-direction: column; gap: 10px; }
.dash-quick-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dash-quick-btns .btn { display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.dash-quick-btns .btn-primary { grid-column: 1 / -1; }
@media (max-width: 1199.98px) { .dash-quick-btns { grid-template-columns: repeat(3, 1fr); } .dash-quick-btns .btn-primary { grid-column: auto; } }
@media (max-width: 575.98px) { .dash-quick-btns { grid-template-columns: 1fr 1fr; } .dash-quick-btns .btn-primary { grid-column: 1 / -1; } }
/* Cifrele pe un singur rând lângă acțiunile rapide: aceeași înălțime (fără spațiul vertical dintre rânduri);
   între 1200 și 1600 px cardurile sunt înguste → fără iconiță, ca eticheta să încapă pe un rând */
@media (min-width: 1200px) { .dash-stats > [class*="col-"] > .row { --bs-gutter-y: 0; } }
@media (min-width: 1200px) and (max-width: 1599.98px) { .dash-stat .stat-icon { display: none; } }
/* Dashboard pe monitor: încape în fereastră fără derularea paginii; listele din carduri derulează în interior */
@media screen and (min-width: 1200px) and (min-height: 640px) {
  body.sec-home { height: 100vh; height: 100dvh; overflow: hidden; }
  body.sec-home .main-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-bottom: 16px; }
  body.sec-home .dash-stats { flex: 0 0 auto; margin-bottom: 1rem !important; }
  /* rândul ia înălțimea celui mai înalt card (toate patru egale), dar cel mult cât a rămas din fereastră (flex-shrink) */
  body.sec-home .dash-row { flex: 0 1 auto; min-height: 0; }
  body.sec-home .dash-row > [class*="col-"] { height: 100%; min-height: 0; }
  body.sec-home .dash-row .card { display: flex; flex-direction: column; min-height: 0; }
  body.sec-home .dash-row .card > .list-group, body.sec-home .dash-row .card > .app-empty { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
}
.dash-warn, .rpt-warn-icon { color: #7a5000; }
.dash-ok > .bi, .rpt-all-ok > .bi { color: #198754; opacity: 1; }
.dash-ok > strong, .rpt-all-ok > strong { color: #146c43; }
@media screen {
  [data-bs-theme="dark"] .line-swatch { border-color: rgba(255, 255, 255, .35); }
  [data-bs-theme="dark"] .dash-warn, [data-bs-theme="dark"] .rpt-warn-icon { color: #ffda6a; }
  [data-bs-theme="dark"] .dash-ok > .bi, [data-bs-theme="dark"] .rpt-all-ok > .bi,
  [data-bs-theme="dark"] .dash-ok > strong, [data-bs-theme="dark"] .rpt-all-ok > strong { color: #75b798; }
}

/* Istoric versiuni: versiunea curentă grupată pe zone, cele vechi restrânse */
.ver-list { max-width: 980px; }
.ver-current { border-left: 3px solid var(--app-brand); }
.ver-num { font-size: 1.1rem; }
.ver-title { font-size: .95rem; font-weight: 600; margin-bottom: .75rem; }
.ver-changes { font-size: .875rem; line-height: 1.5; padding-left: 1.2rem; margin-bottom: .5rem; }
.ver-old > summary { cursor: pointer; list-style: none; border-bottom: 0; }
.ver-old > summary::-webkit-details-marker { display: none; }
.ver-old[open] > summary { border-bottom: 1px solid var(--app-border); }
.ver-sum-title { font-size: .82rem; font-weight: 500; color: var(--app-muted); }

/* Rapoarte */
.rpt-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.rpt-tabs .nav-link { white-space: nowrap; }
.rpt-print-head { display: none; }
.rpt-stats .stat-card { padding: .85rem 1rem; }
.rpt-stats .stat-value { font-size: 1.4rem; }
/* Capacitate: nota „ce înseamnă cifrele” și contextul (linie / echipament) */
.rpt-cap-note { font-size: .82rem; color: var(--app-muted); }
.rpt-cap-note ul { padding-left: 1.2rem; margin-top: 2px; }
.rpt-ctx { display: inline-flex; align-items: center; gap: 8px; min-height: var(--ctl-h); }
.rpt-feed .list-group-item { display: flex; align-items: flex-start; gap: 10px; }
.rpt-feed-icon { flex-shrink: 0; width: 20px; margin-top: 2px; text-align: center; color: var(--app-muted); }
.rpt-feed-main { min-width: 0; flex: 1 1 auto; }
#capTable tr.cap-full > td:first-child a { color: var(--app-muted); }

/* Foaia A4: fără meniu, filtre și butoane; toate coloanele vizibile; antet cu titlul și data generării */
@media print {
  @page { size: A4; margin: 12mm; }
  body.sec-rapoarte .main-content { max-width: none; padding: 0; }
  body.sec-rapoarte .rpt-tabs, body.sec-rapoarte .app-toolbar, body.sec-rapoarte .alert, body.sec-rapoarte .pagination,
  body.sec-rapoarte .app-col-actions, body.sec-rapoarte td:has(> .app-row-actions), body.sec-rapoarte .rpt-meta.d-sm-none,
  body.sec-rapoarte .rpt-meta.d-md-none, body.sec-rapoarte .rpt-meta.d-lg-none { display: none !important; }
  body.sec-rapoarte th.d-none, body.sec-rapoarte td.d-none { display: table-cell !important; }
  body.sec-rapoarte .rpt-print-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding-bottom: 4px; border-bottom: 1px solid #000; font-size: 10pt; }
  body.sec-rapoarte .card, body.sec-rapoarte .stat-card { box-shadow: none; border-color: #bbb; }
  body.sec-rapoarte .table { font-size: 9pt; }
  body.sec-rapoarte .table tr { break-inside: avoid; }
  body.sec-rapoarte thead { display: table-header-group; }
  body.sec-rapoarte a { color: #000; text-decoration: none; }
  body.sec-rapoarte .rpt-stats > * { flex: 1 1 0; width: auto; max-width: none; }
  body.sec-rapoarte .rpt-stats .stat-value { font-size: 14pt; }
}

/* === setari === Setări: același tipar ca restul aplicației (tab-uri, bară, tabel standard); aici doar piesele proprii */
.setari-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.setari-tabs .nav-link { white-space: nowrap; }
.setari-intro { max-width: 110ch; margin: 0 0 .75rem; font-size: .85rem; color: var(--app-muted); }
.setari-desc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setari-type-name { display: inline-flex; align-items: center; gap: 10px; }
/* iconița de pe hartă: cerc în culoarea tipului (alb pe culoare, ca markerul) */
.setari-marker { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  color: #fff; font-size: .85rem; border: 2px solid var(--app-surface); box-shadow: 0 0 0 1px var(--app-border-strong); }
.setari-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; border: 1px solid var(--app-border-strong); }
.setari-dots { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.setari-dots .app-badge-count { margin-right: 4px; }
.setari-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--app-border-strong); flex-shrink: 0; }
.setari-row-off > td { opacity: .6; }
/* Localități: arbore județ › localitate › stradă în tabelul standard */
.setari-tree tr[data-act] { cursor: pointer; }
.setari-tree-name { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.setari-tree-l1 > td:first-child { padding-left: 2.25rem; }
.setari-tree-l2 > td:first-child { padding-left: 4.25rem; }
.setari-tree-toggle, .setari-tree-gap { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; }
.setari-tree-toggle { padding: 0; border: 0; border-radius: var(--ctl-r-xs); background: transparent; color: var(--app-muted); }
.setari-tree-toggle:hover { background: var(--app-hover); color: var(--app-text); }
/* Fereastra „Tip nou”: alegerea iconiței */
.setari-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; max-height: 190px; overflow-y: auto; padding: 6px;
  background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: var(--ctl-r); }
.setari-icon-pick { display: flex; align-items: center; justify-content: center; height: 36px; padding: 0; font-size: 1rem; cursor: pointer;
  color: var(--app-text); background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--ctl-r-sm); }
.setari-icon-pick:hover { background: var(--app-hover); }
.setari-icon-pick.selected { border: 2px solid var(--app-brand); background: var(--app-brand-soft); color: var(--app-accent-text); }
/* Fereastra „Tip fibră”: lista ordonată a culorilor (se reordonează trăgând) */
.setari-color-list { display: flex; flex-wrap: wrap; gap: 4px; min-height: 42px; padding: 6px; border: 1px solid var(--app-border); border-radius: var(--ctl-r); background: var(--app-surface-2); }
.setari-color-item { display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 8px; font-size: .8rem; cursor: grab;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--ctl-r-sm); }
.setari-color-item:hover { background: var(--app-hover); }
.setari-color-remove { display: inline-flex; padding: 2px 4px; border: 0; background: transparent; color: var(--app-muted); border-radius: var(--ctl-r-xs); }
.setari-color-remove:hover { color: var(--bs-danger-text-emphasis); background: var(--app-hover); }
.setari-color-select { width: auto; min-width: 170px; }

/* Mesaje plutitoare — window.mondoToast (confirm.js): confirmarea unei acțiuni, în dreapta sus, dispar singure.
   Culoarea = tipul mesajului (verde reușit, roșu eroare, galben atenție, turcoaz informare); bara de jos = timpul rămas
   (stă pe loc cât mouse-ul / focusul e pe mesaj). Text alb pe fundal ≥ 4.5:1 în ambele capete ale degradeului. */
/* colțul din dreapta sus, sub bara de meniu; cel mai nou mesaj deasupra */
#mondo-toasts { position: fixed; right: 18px; top: calc(var(--navbar-height, 52px) + 14px); z-index: 3000; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 10px;
  width: min(400px, calc(100vw - 24px)); pointer-events: none; }
.mondo-toast { --t-a: #187c4e; --t-b: #146c43; position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px; width: 100%;
  padding: 12px 40px 15px 14px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--t-a), var(--t-b));
  box-shadow: 0 10px 28px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .12); pointer-events: auto;
  animation: mondoToastIn .28s cubic-bezier(.2, .9, .3, 1.2); transition: opacity .25s, transform .25s; }
.mondo-toast.is-ok   { --t-a: #187c4e; --t-b: #146c43; }
.mondo-toast.is-bad  { --t-a: #c8323f; --t-b: #a12531; }
.mondo-toast.is-warn { --t-a: #9a6700; --t-b: #7a5000; }
.mondo-toast.is-info { --t-a: #267596; --t-b: #1b5872; }
.mondo-toast-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-top: 1px;
  border-radius: 50%; background: rgba(255, 255, 255, .18); font-size: 1rem; }
.mondo-toast-body { min-width: 0; flex: 1 1 auto; }
.mondo-toast-title { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; opacity: .9; }
.mondo-toast-text { font-size: .9rem; line-height: 1.35; overflow-wrap: anywhere; }
.mondo-toast-close { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  padding: 0; border: 0; border-radius: 50%; color: #fff; background: transparent; opacity: .85; }
.mondo-toast-close:hover, .mondo-toast-close:focus-visible { opacity: 1; background: rgba(255, 255, 255, .2); outline: none; }
.mondo-toast-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .65); transform-origin: left center;
  animation-name: mondoToastTimer; animation-timing-function: linear; animation-fill-mode: forwards; }
.mondo-toast:hover .mondo-toast-timer, .mondo-toast:focus-within .mondo-toast-timer { animation-play-state: paused; }
.mondo-toast.is-hiding { opacity: 0; transform: translateX(24px); }
@keyframes mondoToastIn { from { opacity: 0; transform: translateX(28px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes mondoToastTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 575.98px) { #mondo-toasts { right: 12px; left: 12px; top: calc(var(--navbar-height, 48px) + 10px); width: auto; } }
@media (prefers-reduced-motion: reduce) { .mondo-toast { animation: none; } }
@media print { #mondo-toasts { display: none; } }
