/* ============================================================
   Fibre Inventory — thème sombre, UI d'administration réseau
   ============================================================ */
:root {
  --bg: #070b14;
  --bg-2: #0b1220;
  --panel: #0e1626;
  --panel-2: #121c2e;
  --panel-3: #17233a;
  --border: #1e2b42;
  --border-soft: #182437;
  --text: #e6edf7;
  --text-2: #a9b8cd;
  --muted: #6f8199;
  --accent: #22d3ee;
  --accent-2: #38bdf8;
  --accent-deep: #0e7490;
  --pink: #f472b6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --violet: #a78bfa;
  --radius: 10px;
  --shadow: 0 18px 45px rgba(0, 0, 0, .55);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ------------------------------ Layout ------------------------------ */
#app { display: grid; grid-template-rows: 58px minmax(0, 1fr) 28px; height: 100vh; }

/* ------------------------------ Topbar ------------------------------ */
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: linear-gradient(180deg, #0d1727, #0a1220);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 1200;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.logo { width: 34px; height: 34px; }
.brand-name { font-size: 17px; letter-spacing: -.2px; font-weight: 650; }
.brand-name em { font-style: normal; color: var(--accent); font-weight: 500; }

.search-wrap { position: relative; flex: 1; max-width: 620px; }
.search-wrap .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
#global-search {
  width: 100%; height: 38px; padding: 0 12px 0 38px; border-radius: 9px;
  border: 1px solid var(--border); background: #0a1322; color: var(--text); font-size: 13.5px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
#global-search:focus { border-color: var(--accent-deep); box-shadow: 0 0 0 3px rgba(34, 211, 238, .1); }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; max-height: 420px; overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 2000;
}
.search-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.search-item:hover, .search-item.sel { background: var(--panel-3); }
.search-item .kind { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); border: 1px solid #164e63; padding: 2px 6px; border-radius: 5px; background: #082f3d; }
.search-item .lbl { font-weight: 550; }
.search-item .sub { color: var(--muted); font-size: 12px; }
.search-empty { padding: 14px; color: var(--muted); text-align: center; font-size: 13px; }

.topbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ------------------------------ Buttons ------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  font-size: 13px; font-weight: 550; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #2a3b57; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #17b6cf, #0e8ea6); border-color: #22d3ee55; color: #04121a; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: #fecaca; border-color: #7f1d1d; background: #2a1114; }
.btn.danger:hover { background: #3b1519; }
.btn.small { height: 30px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn.icon-only { width: 34px; padding: 0; justify-content: center; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------ Main ------------------------------ */
.main { display: grid; grid-template-columns: 302px minmax(0, 1fr) auto; min-height: 0; }

/* ------------------------------ Sidebar ------------------------------ */
.sidebar {
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; z-index: 900;
}
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: 0; color: var(--muted); padding: 10px 4px 9px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; letter-spacing: .02em;
  border-bottom: 2px solid transparent; transition: color .15s, border-color .15s, background .15s;
}
.tab:hover { color: var(--text-2); background: #0c1525; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); background: linear-gradient(180deg, #0f1d2e, transparent); }
.tab .ic { width: 17px; height: 17px; }
.sidebar-body { flex: 1; overflow: auto; min-height: 0; }
.tab-panel { display: none; padding: 12px; }
.tab-panel.active { display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.panel-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-2); margin: 0; font-weight: 650; }
.seg { display: flex; background: #0a1322; border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.seg button { border: 0; background: none; color: var(--muted); font-size: 11px; padding: 3px 8px; border-radius: 5px; cursor: pointer; }
.seg button.on { background: var(--panel-3); color: var(--text); }

.list { display: flex; flex-direction: column; gap: 2px; }
.list-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; transition: background .12s, border-color .12s;
}
.list-item:hover { background: var(--panel-2); }
.list-item.active { background: var(--panel-3); border-color: #23395a; }
.list-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .04); }
.list-item .body { min-width: 0; flex: 1; }
.list-item .name { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .right { font-size: 11px; color: var(--text-2); font-family: var(--mono); }

.bar { height: 3px; border-radius: 2px; background: #1b2739; overflow: hidden; margin-top: 3px; }
.bar > i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--pink)); }

/* ------------------------------ Map ------------------------------ */
.map-wrap { position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: #0a0f18; }
.leaflet-container { background: #0a0f18; font-family: var(--sans); }
.leaflet-control-attribution { background: rgba(7, 11, 20, .78) !important; color: #7c8da6 !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: #9fb2cc !important; }
.leaflet-bar { border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; }
.leaflet-bar a { background: var(--panel-2) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--panel-3) !important; }

.map-tools {
  position: absolute; top: 14px; left: 14px; z-index: 800; display: flex; flex-direction: column; gap: 6px;
  background: rgba(11, 18, 32, .92); backdrop-filter: blur(10px); border: 1px solid var(--border);
  border-radius: 11px; padding: 6px; box-shadow: var(--shadow);
}
.tool {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--text-2); transition: all .13s;
}
.tool:hover { background: var(--panel-3); color: var(--text); }
.tool.active { background: #0c3a45; border-color: #1c7f91; color: var(--accent); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .18); }

.draw-hint {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 810;
  background: rgba(9, 16, 28, .95); border: 1px solid #1d4b5a; color: var(--text);
  padding: 8px 14px; border-radius: 9px; font-size: 12.5px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
}
.draw-hint b { color: var(--accent); font-family: var(--mono); }
.draw-hint .split { width: 1px; height: 16px; background: var(--border); }

.map-badge {
  position: absolute; right: 14px; bottom: 26px; z-index: 800; font-size: 11px; color: var(--text-2);
  background: rgba(9, 16, 28, .9); border: 1px solid var(--border); border-radius: 7px; padding: 5px 9px;
  backdrop-filter: blur(8px); font-family: var(--mono);
}

/* ------------------------------ Inspector ------------------------------ */
.inspector {
  width: 404px; background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; z-index: 950;
}
.inspector-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #101b2c, var(--panel)); position: relative;
}
.inspector-head .eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.inspector-head h2 { margin: 4px 0 0; font-size: 17px; line-height: 1.25; font-weight: 620; padding-right: 30px; }
.inspector-head .sub { margin-top: 3px; color: var(--muted); font-size: 12px; }
.inspector-head .close {
  position: absolute; top: 10px; right: 10px; background: none; border: 0; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 6px; display: grid; place-items: center;
}
.inspector-head .close:hover { background: var(--panel-3); color: var(--text); }
.inspector-body { flex: 1; overflow: auto; padding: 14px 16px 40px; }

.section { margin-bottom: 18px; }
.section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
  margin: 0 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.section-title span { display: flex; align-items: center; gap: 6px; }

.kv { display: grid; grid-template-columns: 108px 1fr; gap: 7px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.kv dd.mono { font-family: var(--mono); font-size: 12.5px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.stat {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 9px;
}
.stat .v { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat.used .v { color: var(--accent); }
.stat.free .v { color: var(--green); }
.stat.broken .v { color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text-2); display: inline-flex; align-items: center; gap: 5px;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.chip.on { border-color: var(--accent-deep); background: #0c2a33; color: var(--text); box-shadow: 0 0 0 1px rgba(34,211,238,.2); }
button.chip { cursor: pointer; font-family: inherit; }
.badge { font-size: 10.5px; padding: 2px 7px; border-radius: 5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.badge.green { background: #052e21; color: #6ee7b7; border: 1px solid #125c45; }
.badge.amber { background: #2c1f05; color: #fcd34d; border: 1px solid #6b4a09; }
.badge.red { background: #2b0f12; color: #fca5a5; border: 1px solid #6b1a20; }
.badge.blue { background: #082f49; color: #7dd3fc; border: 1px solid #0c4a6e; }
.badge.gray { background: #16202f; color: #9aa9bd; border: 1px solid #26344a; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* fibres */
.fiber-legend { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.fiber-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.fiber-cell {
  aspect-ratio: 1; border-radius: 3px; cursor: pointer; position: relative;
  border: 1px solid rgba(0, 0, 0, .35); transition: transform .1s, box-shadow .1s;
}
.fiber-cell:hover { transform: scale(1.18); z-index: 2; box-shadow: 0 0 0 2px var(--accent); }
.fiber-cell.used::after {
  content: ''; position: absolute; inset: 0; border-radius: 3px;
  background: repeating-linear-gradient(45deg, rgba(0, 0, 0, .55) 0 2px, transparent 2px 4px);
}
.fiber-cell.reserved { outline: 2px solid var(--amber); outline-offset: -2px; }
.fiber-cell.broken { outline: 2px solid var(--red); outline-offset: -2px; background-image: linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%); }
.fiber-cell.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); z-index: 3; }
.tube-row { display: grid; grid-template-columns: 34px 1fr; gap: 6px; align-items: center; margin-bottom: 4px; }
.tube-label { font-size: 10px; color: var(--muted); font-family: var(--mono); }

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { text-align: left; color: var(--muted); font-weight: 550; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.table td { padding: 5px 6px; border-bottom: 1px solid var(--border-soft); }
.table tr:hover td { background: #101a2a; }
.table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

.tree { font-size: 13px; }
.tree-node { margin-left: 2px; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.tree-row:hover { background: var(--panel-2); }
.tree-row .ic { width: 14px; height: 14px; color: var(--muted); transition: transform .12s; }
.tree-row.open .ic { transform: rotate(90deg); color: var(--accent); }
.tree-row .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-children { margin-left: 15px; border-left: 1px solid var(--border-soft); padding-left: 7px; }
.port-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 12px; border-radius: 5px; cursor: pointer; }
.port-row:hover { background: var(--panel-2); }
.port-dot { width: 8px; height: 8px; border-radius: 2px; background: #23344c; }
.port-dot.used { background: var(--accent); box-shadow: 0 0 6px rgba(34, 211, 238, .5); }

.empty { text-align: center; color: var(--muted); padding: 26px 12px; font-size: 13px; line-height: 1.6; }
.empty .ic { width: 30px; height: 30px; opacity: .5; margin-bottom: 8px; }

/* trace */
.trace-path { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; overflow: hidden; background: var(--panel-2); }
.trace-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: #101c2e; border-bottom: 1px solid var(--border); font-size: 12px; cursor: pointer; }
.trace-head .loss { margin-left: auto; font-family: var(--mono); color: var(--accent); font-weight: 650; }
.trace-steps { padding: 8px 10px; }
.tstep { display: flex; gap: 8px; padding: 4px 0; font-size: 12px; position: relative; }
.tstep .node { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-family: var(--mono); flex: none; border: 1px solid var(--border); background: var(--panel-3); color: var(--text-2); }
.tstep.fiber .node { border-color: #0e7490; background: #083344; color: #67e8f9; }
.tstep.sport .node { border-color: #7c3aed; background: #1e1b4b; color: #c4b5fd; }
.tstep.port .node { border-color: #0f766e; background: #042f2e; color: #5eead4; }
.tstep .txt { min-width: 0; }
.tstep .sub { color: var(--muted); font-size: 11px; }

/* ------------------------------ Status bar ------------------------------ */
.statusbar {
  display: flex; align-items: center; gap: 16px; padding: 0 14px; font-size: 11.5px;
  background: #0a1220; border-top: 1px solid var(--border); color: var(--text-2);
}
.statusbar .spacer { flex: 1; }

/* ------------------------------ Modal ------------------------------ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 7, 14, .72); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 5000; padding: 24px; animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99) } to { opacity: 1; transform: none } }
.modal {
  width: min(640px, 100%); max-height: 90vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid #24344e; border-radius: 14px; box-shadow: var(--shadow);
  animation: pop .16s cubic-bezier(.2, .9, .3, 1);
}
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 620; }
.modal-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.modal-head .close { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 5px; border-radius: 7px; display: grid; place-items: center; }
.modal-head .close:hover { background: var(--panel-3); color: var(--text); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); background: #0c1524; border-radius: 0 0 14px 14px; }

/* ------------------------------ Forms ------------------------------ */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 5px; font-weight: 550; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; background: #0a1322; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-deep); box-shadow: 0 0 0 3px rgba(34, 211, 238, .09); }
textarea { resize: vertical; min-height: 62px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }
.mini-select { width: auto; padding: 4px 7px; font-size: 11.5px; border-radius: 6px; }

/* ------------------------------ Lists / layers ------------------------------ */
.layers-box h3 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 12px 0 8px; font-weight: 600; }
.layer-row { display: flex; align-items: center; gap: 9px; padding: 6px 4px; font-size: 13px; color: var(--text-2); cursor: pointer; border-radius: 6px; }
.layer-row:hover { background: var(--panel-2); }
.layer-row input { width: 15px; height: 15px; accent-color: var(--accent); }
.layers-box hr { border: 0; border-top: 1px solid var(--border-soft); margin: 12px 0; }
.basemaps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bm {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 12px; cursor: pointer;
  background: var(--panel-2); color: var(--text-2); text-align: center;
}
.bm.on { border-color: var(--accent-deep); color: var(--text); background: #0c2a33; }
.legend { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-line { width: 22px; height: 4px; border-radius: 2px; }

/* ------------------------------ Stats ------------------------------ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi { background: linear-gradient(180deg, #111d30, #0d1727); border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; }
.kpi .v { font-size: 25px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.kpi .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; }
.kpi .d { color: var(--text-2); font-size: 11.5px; margin-top: 5px; }
.chart { display: flex; flex-direction: column; gap: 7px; }
.chart-row { display: grid; grid-template-columns: 128px 1fr 74px; align-items: center; gap: 10px; font-size: 12px; }
.chart-row .lab { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-row .track { background: #131f31; border-radius: 5px; height: 18px; overflow: hidden; }
.chart-row .fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #0ea5b7, #22d3ee); }
.chart-row .val { text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }

/* ------------------------------ Toast ------------------------------ */
.toast-root { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); z-index: 9000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #0d1a2b; border: 1px solid var(--border); color: var(--text); padding: 9px 16px;
  border-radius: 9px; box-shadow: var(--shadow); font-size: 13px; animation: pop .18s ease;
  display: flex; align-items: center; gap: 9px; max-width: 560px;
}
.toast.ok { border-color: #14532d; background: #0a1f16; color: #bbf7d0; }
.toast.err { border-color: #7f1d1d; background: #240f12; color: #fecaca; }
.toast .ic { width: 16px; height: 16px; }

/* ------------------------------ Leaflet markers ------------------------------ */
.node-marker { display: grid; place-items: center; }
.node-pin {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #06121e; background: #1f2937;
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .6); cursor: pointer;
  transition: transform .12s;
}
.node-pin:hover { transform: scale(1.12); }
.node-pin svg { width: 11px; height: 11px; stroke: #fff; fill: none; stroke-width: 2; }
.node-pin.sel { box-shadow: 0 0 0 3px rgba(34, 211, 238, .55), 0 2px 10px rgba(0, 0, 0, .6); transform: scale(1.12); }
.node-label {
  position: absolute; left: 25px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  font-size: 11px; color: #dbeafe; text-shadow: 0 1px 3px #000, 0 0 6px #000; pointer-events: none;
}
.vertex-dot {
  width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #22d3ee;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .5); cursor: move;
}
.cable-label {
  font-size: 10.5px; color: #cbd5e1; background: rgba(7, 11, 20, .82); border: 1px solid #1e3a52;
  padding: 1px 6px; border-radius: 5px; white-space: nowrap; font-family: var(--mono);
}

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1f2d44; border-radius: 6px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: #2b3d5a; }

/* responsive */
@media (max-width: 1180px) {
  .main { grid-template-columns: 262px minmax(0, 1fr) auto; }
  .inspector { width: 360px; }
}
@media (max-width: 900px) {
  .main { grid-template-columns: 0 minmax(0, 1fr) auto; }
  .sidebar { position: absolute; top: 58px; bottom: 28px; left: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; z-index: 1000; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .inspector { position: absolute; right: 0; top: 58px; bottom: 28px; width: min(380px, 92vw); }
  .topbar-actions span { display: none; }
}

/* ------------------------- Projet LHSM × Transdev ------------------------- */
.view-switch {
  display: flex; background: #0a1322; border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px;
}
.view-switch .vs {
  display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted);
  padding: 5px 11px; border-radius: 6px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.view-switch .vs:hover { color: var(--text); }
.view-switch .vs.on { background: var(--panel-3); color: var(--accent); box-shadow: inset 0 0 0 1px #1f4c58; }
.view-switch .vs .ic { width: 15px; height: 15px; }

/* ------------------------------- Schéma ------------------------------- */
.schema-view {
  position: absolute; inset: 0; z-index: 700; overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(34,211,238,.06), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(244,114,182,.05), transparent 45%),
    linear-gradient(#0a0f18, #070b14);
}
#schema-svg { width: 100%; height: 100%; display: block; cursor: grab; }
#schema-svg.dragging { cursor: grabbing; }

.schema-toolbar {
  position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(11,18,32,.92); backdrop-filter: blur(10px); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px; box-shadow: var(--shadow); z-index: 3;
}
.schema-legend {
  position: absolute; left: 14px; bottom: 14px; background: rgba(11,18,32,.92); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 12px; font-size: 11.5px; color: var(--text-2); display: flex; flex-direction: column;
  gap: 5px; backdrop-filter: blur(10px); z-index: 3;
}
.schema-legend .row { display: flex; align-items: center; gap: 8px; }
.schema-legend .sw { width: 18px; height: 4px; border-radius: 2px; }
.schema-hint {
  position: absolute; right: 14px; bottom: 14px; font-size: 11px; color: var(--muted);
  background: rgba(11,18,32,.85); border: 1px solid var(--border-soft); border-radius: 8px; padding: 5px 9px;
}

.snode { cursor: move; }
.snode rect.box { rx: 9; ry: 9; stroke-width: 1.5; }
.snode text { pointer-events: none; font-family: var(--sans); }
.snode .ncode { font-size: 13px; font-weight: 700; fill: #e6edf7; }
.snode .nname { font-size: 10px; fill: #93a4bd; }
.snode .ntype { font-size: 9px; fill: #64748b; text-transform: uppercase; letter-spacing: .06em; }
.snode.selected rect.box { stroke: #fff; stroke-width: 2.5; filter: drop-shadow(0 0 8px rgba(34,211,238,.6)); }

.slink { fill: none; stroke-linecap: round; cursor: pointer; }
.slink.sel { stroke: #ff2d55 !important; stroke-width: 4 !important; filter: drop-shadow(0 0 4px rgba(255,45,85,.55)); }
.slabel { font-family: var(--mono); font-size: 10px; fill: #b6c7db; pointer-events: none; }
.slabel-bg { fill: #0a1220; stroke: #1e2b42; stroke-width: 1; rx: 4; }

/* fiches besoins */
.needs-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.needs-table th { position: sticky; top: 0; background: #0e1626; z-index: 2; }
.needs-table td, .needs-table th { padding: 6px 7px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.needs-table tr:hover td { background: #101a2a; }
.needs-table input {
  width: 58px; padding: 3px 6px; font-size: 12px; text-align: right; border-radius: 6px;
}
.needs-table input.pending { border-color: #6b4a09; background: #1c1607; }
.need-ok { color: #6ee7b7; } .need-ko { color: #fca5a5; } .need-todo { color: #fcd34d; }
.lot-dvm { background: #2c2306; color: #fde68a; border: 1px solid #6b4a09; }
.lot-byg { background: #082f49; color: #bae6fd; border: 1px solid #0c4a6e; }
.lot-rms { background: #221a3a; color: #ddd6fe; border: 1px solid #4c1d95; }

.cap-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #16243a; margin: 4px 0 2px; }
.cap-bar i { display: block; height: 100%; }
.cap-it { background: linear-gradient(90deg,#0ea5b7,#22d3ee); }
.cap-ot { background: linear-gradient(90deg,#7c3aed,#a78bfa); }
.cap-need { background: repeating-linear-gradient(45deg,#f59e0b 0 3px,#b45309 3px 6px); }

/* ------------------------------ Connexion ------------------------------ */
.login-body {
  display: grid; place-items: center; min-height: 100vh; height: auto; overflow: auto; padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(34,211,238,.10), transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(244,114,182,.08), transparent 45%),
    var(--bg);
}
.login-card {
  width: min(390px, 100%); background: linear-gradient(180deg, #0e1626, #0a1220);
  border: 1px solid var(--border); border-radius: 16px; padding: 34px 30px 26px;
  box-shadow: var(--shadow); text-align: center;
}
.login-logo { width: 52px; height: 52px; display: block; margin: 0 auto 12px; }
.login-card h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.2px; }
.login-card h1 span { color: var(--accent); font-weight: 500; }
.login-sub { color: var(--muted); font-size: 12.5px; margin: 6px 0 26px; }
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 550; }
.login-card input {
  width: 100%; height: 46px; font-size: 16px; letter-spacing: .16em; text-align: center;
  font-family: var(--mono);
}
.login-card button {
  width: 100%; height: 42px; margin-top: 14px; border-radius: 9px; border: 1px solid #22d3ee55;
  background: linear-gradient(180deg, #17b6cf, #0e8ea6); color: #04121a; font-size: 14px;
  font-weight: 700; cursor: pointer; font-family: inherit;
}
.login-card button:hover { filter: brightness(1.07); }
.login-card button:disabled { opacity: .55; cursor: progress; }
.login-error { color: #fca5a5; font-size: 12.5px; min-height: 18px; margin: 10px 0 0; text-align: center; }
.login-foot { color: var(--muted); font-size: 11px; margin: 22px 0 0; letter-spacing: .02em; }
