  :root{
    --bg: #0f1216;
    --sidebar: #12151a;
    --panel: #171b21;
    --panel-2: #1d222a;
    --border: #2a3038;
    --text: #e7eaee;
    --muted: #8a93a1;
    --accent: #3fd9c7;
    --accent-dim: #1f4d47;
    --danger: #d5545a;
    --warn: #e8813a;
    --radius: 7px;
    --radius-sm: 4px;
  }
  body.light-theme{
    --bg: #f4f6f8;
    --sidebar: #ffffff;
    --panel: #ffffff;
    --panel-2: #eef1f4;
    --border: #d7dce2;
    --text: #1a1f26;
    --muted: #6b7684;
    --accent: #0d9488;
    --accent-dim: #d6f3f0;
    --danger: #c62839;
    --warn: #b5590a;
  }
  body.light-theme .device{ color:#0b0e12; }
  body.light-theme #cableSvg rect{ fill:#dbe2e8 !important; }
  body.light-theme .rack-frame{ background:#e7ebef; }
  body.light-theme .u-row{ border-top-color:#c7ced6; }
  body.light-theme .u-row .u-top{ color:#8a93a1; }
  body.light-theme .u-row .u-bottom{ color:#c2c9d1; }
  body.light-theme .swatch-btn{ border-color:rgba(0,0,0,0.15); }
  *{box-sizing:border-box;}
  html,body{ height:100%; }
  body{
    margin:0; background:var(--bg); color:var(--text);
    font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; font-size:14px;
  }
  .mono{ font-family:'SF Mono',Consolas,monospace; }
  svg.ic{ display:block; flex:0 0 auto; }

  /* ---- Shell / sidebar ---- */
  .shell{ display:flex; min-height:100vh; }
  .sidebar{
    width:260px; flex:0 0 auto; background:var(--sidebar); border-right:1px solid var(--border);
    display:flex; flex-direction:column; gap:12px; position:sticky; top:0; height:100vh; overflow-y:auto;
    padding:20px 16px;
  }
  .brand{ display:flex; align-items:center; gap:8px; font-weight:700; font-size:14px; padding-bottom:12px; border-bottom:1px solid var(--border); }
  .brand .sub{ display:block; font-weight:400; color:var(--muted); font-size:10.5px; margin-top:2px; }
  .project-switcher{ display:flex; flex-direction:column; gap:6px; padding-bottom:10px; border-bottom:1px solid var(--border); }
  .project-switcher select{ font-weight:600; }
  .project-switcher .row2{ display:flex; gap:4px; }
  .project-switcher .row2 button{ flex:1; padding:4px 2px; font-size:10.8px; }
  nav.navlist{ display:flex; flex-direction:column; gap:2px; }
  .nav-btn{
    display:flex; align-items:center; gap:9px; text-align:left; background:transparent; border:1px solid transparent;
    color:var(--muted); font-weight:600; padding:7px 8px; border-radius:var(--radius); font-size:12.8px; cursor:pointer;
    transition:background 0.12s ease, color 0.12s ease;
  }
  .nav-btn:hover{ background:var(--panel-2); color:var(--text); }
  .nav-btn.active{ background:var(--accent-dim); color:var(--accent); border-color:var(--accent); }
  .nav-btn .count{ margin-left:auto; font-size:10.5px; font-weight:600; color:var(--muted); }
  .nav-btn.active .count{ color:var(--accent); }

  details.side-add{ border-top:1px solid var(--border); padding-top:10px; }
  details.side-add summary{ cursor:pointer; font-weight:600; font-size:12.3px; color:var(--muted); list-style:none; display:flex; align-items:center; gap:6px; }
  details.side-add summary::-webkit-details-marker{ display:none; }
  details.side-add summary .plus{ font-weight:700; color:var(--accent); }
  details.side-add[open] summary{ color:var(--text); margin-bottom:8px; }
  .side-form{ display:flex; flex-direction:column; gap:6px; }
  .side-form input, .side-form select{ width:100%; }
  .side-form .row2{ display:flex; gap:6px; }
  .side-form .row2 > *{ flex:1 1 0; min-width:0; }
  .side-form button{ margin-top:2px; }
  .side-form .lbl{ font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:0.4px; margin:2px 0 -2px 0; }
  .swatch-row{ display:flex; flex-wrap:wrap; gap:4px; margin-top:-2px; }
  .swatch-btn{ width:16px; height:16px; border-radius:3px; border:1px solid rgba(255,255,255,0.15); cursor:pointer; padding:0; }
  .swatch-btn:hover{ outline:1px solid var(--accent); outline-offset:1px; }

  .sidebar-stats{ margin-top:auto; border-top:1px solid var(--border); padding-top:10px; display:flex; flex-direction:column; gap:4px; font-size:11.2px; color:var(--muted); }
  .sidebar-stats b{ color:var(--text); }
  .sidebar-actions{ display:flex; gap:6px; }
  .sidebar-actions button{ flex:1; display:flex; align-items:center; justify-content:center; gap:6px; }
  .dirty-dot{ width:6px; height:6px; border-radius:50%; background:var(--warn); flex:0 0 auto; }
  .persist-row{ display:flex; align-items:center; gap:6px; font-size:11px; color:var(--muted); margin-top:2px; }

  .content{ flex:1 1 auto; padding:24px 30px; min-width:0; }
  .view{ animation:viewFadeIn 0.16s ease; }
  @keyframes viewFadeIn{ from{ opacity:0; transform:translateY(3px); } to{ opacity:1; transform:none; } }
  .view-header{ margin-bottom:18px; display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap; }
  .view-header h1{ font-size:19px; margin:0 0 3px 0; font-weight:700; }
  .view-header .sub{ color:var(--muted); font-size:12.5px; margin:0; }
  .view-header .actions{ display:flex; gap:8px; }

  /* ---- generic ---- */
  select, input[type=text], input[type=number], input[type=search]{
    background:var(--panel-2); border:1px solid var(--border); color:var(--text);
    border-radius:var(--radius); padding:6px 8px; font-size:13px; font-family:inherit;
  }
  input[type=color]{
    -webkit-appearance:none; appearance:none; width:26px; height:26px; padding:0;
    border:1px solid var(--border); border-radius:var(--radius); background:none; cursor:pointer;
  }
  input[type=color]::-webkit-color-swatch-wrapper{ padding:2px; }
  input[type=color]::-webkit-color-swatch{ border:none; }
  select:focus, input:focus{ outline:1px solid var(--accent); }
  button{
    background:var(--accent-dim); border:1px solid var(--accent); color:var(--accent);
    border-radius:var(--radius); padding:6px 12px; font-size:12.8px; cursor:pointer; font-weight:600; font-family:inherit;
    transition:background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
  }
  button:active{ transform:scale(0.97); }
  button:hover{ background:var(--accent); color:#08211d; }
  button.ghost{ background:transparent; border:1px solid var(--border); color:var(--muted); font-weight:400; }
  button.ghost:hover{ background:var(--panel-2); color:var(--text); }
  button.small{ padding:3px 8px; font-size:11.5px; }
  button.danger{ border-color:var(--danger); color:var(--danger); background:transparent; }
  button.danger:hover{ background:var(--danger); color:#1a0708; }
  button.seg{ background:transparent; border:1px solid var(--border); color:var(--muted); font-weight:600; }
  button.seg.active{ background:var(--accent-dim); color:var(--accent); border-color:var(--accent); }
  button:disabled{ opacity:0.35; cursor:not-allowed; pointer-events:none; }
  .hint-block{ font-size:11.3px; color:var(--warn); margin-top:2px; }

  .panel{
    background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); padding:20px; margin-bottom:24px;
  }
  .panel h2{ font-size:12px; text-transform:uppercase; letter-spacing:0.7px; color:var(--muted); margin:0 0 12px 0; font-weight:600; }
  .grid2{ display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; }
  @media (max-width: 980px){ .grid2{ grid-template-columns:1fr; } }
  .dash-grid{ display:grid; grid-template-columns:1fr 1fr; gap:18px; }
  @media (max-width: 900px){ .dash-grid{ grid-template-columns:1fr; } }

  .form-row{ display:flex; gap:8px; margin-bottom:8px; flex-wrap:wrap; align-items:center; }
  .form-row input, .form-row select{ flex:1 1 auto; min-width:70px; }
  .form-row .fixed{ flex:0 0 auto; }
  .note{ color:var(--muted); font-size:11.3px; margin-top:10px; line-height:1.55; }
  .table-scroll{ overflow-x:auto; }

  /* ---- Racks ---- */
  #racksScroll{ overflow-x:auto; padding-bottom:6px; }
  #racksInner{ position:relative; display:flex; gap:18px; align-items:flex-start; width:max-content; }
  #cableSvg{ position:absolute; left:0; top:0; pointer-events:none; overflow:visible; }
  .rack-block{ display:flex; flex-direction:column; align-items:center; flex:0 0 auto; position:relative; z-index:1; }
  .rack-name{ font-size:12.2px; margin-bottom:6px; color:var(--text); font-weight:600; text-align:center; }
  .over-badge{ display:inline-flex; align-items:center; gap:3px; background:var(--danger); color:#fff; font-size:9.5px; font-weight:700; padding:1px 6px; border-radius:8px; vertical-align:middle; }
  .health-row{ display:flex; align-items:flex-start; gap:8px; padding:7px 0; border-bottom:1px solid #20252c; font-size:12.5px; cursor:pointer; }
  .health-row:last-child{ border-bottom:none; }
  .health-row:hover{ background:var(--panel-2); }
  .health-row .hc-dot{ width:7px; height:7px; border-radius:50%; background:var(--danger); flex:0 0 auto; margin-top:4px; }
  .health-ok{ display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12.5px; padding:6px 0; }
  .rack-name .rack-sub{ color:var(--muted); font-weight:400; display:block; font-size:10.3px; }
  .rack-frame{ border:2px solid #3a414c; border-radius:var(--radius); background:#0b0e12; position:relative; width:196px; }
  .u-row{ position:absolute; left:0; right:0; border-top:1px dashed #22262d; font-size:8.5px; color:#4b525d; display:flex; justify-content:space-between; padding:0 3px; box-sizing:border-box; pointer-events:none; }
  .u-row .u-top{ color:#5a6270; }
  .u-row .u-bottom{ color:#3a414c; }
  .drop-preview{ position:absolute; left:2px; right:2px; border:2px dashed var(--accent); background:rgba(63,217,199,0.16); border-radius:var(--radius-sm); pointer-events:none; z-index:3; display:none; transition:top 0.08s ease; }
  .drop-preview.blocked{ border-color:var(--danger); background:rgba(213,84,90,0.16); }
  .rack-frame.drag-active{ border-color:var(--accent); }
  .device{
    position:absolute; left:3px; right:3px; border-radius:var(--radius-sm);
    display:flex; align-items:center; justify-content:space-between; gap:5px;
    padding:0 6px; font-size:11.3px; cursor:grab; color:#0b0e12; font-weight:600;
    border:1px solid rgba(0,0,0,0.35); overflow:hidden; white-space:nowrap;
    transition:opacity 0.15s ease, outline-color 0.15s ease, box-shadow 0.15s ease;
  }
  .device:hover{ box-shadow:0 0 0 1px rgba(255,255,255,0.25) inset; }
  #racksInner.connect-armed .device{ cursor:crosshair; }
  .device.connect-pending{ outline:2px dashed var(--accent); outline-offset:1px; animation:pulseOutline 1s ease-in-out infinite; }
  @keyframes pulseOutline{ 0%,100%{ outline-color:var(--accent); } 50%{ outline-color:transparent; } }
  button.active-pick{ background:var(--accent); color:#08211d; border-color:var(--accent); }
  .device.device-added{ animation:devicePop 0.28s ease; }
  @keyframes devicePop{ from{ opacity:0; transform:scale(0.88); } to{ opacity:1; transform:none; } }
  .device .grip{ flex:0 0 auto; opacity:0.5; }
  .device .cat-ic{ flex:0 0 auto; opacity:0.75; }
  .device .name-txt{ overflow:hidden; text-overflow:ellipsis; }
  .device:active{ cursor:grabbing; }
  .device .portdot{ width:5px; height:5px; border-radius:50%; background:#0b0e12; flex:0 0 auto; opacity:0.55; }
  .device .tray-count{ flex:0 0 auto; background:#0b0e12; color:#fff; font-size:8.5px; font-weight:700; border-radius:6px; padding:0 4px; line-height:12px; }
  .device .cable-count{ flex:0 0 auto; background:rgba(0,0,0,0.3); color:#fff; font-size:8.5px; font-weight:700; border-radius:6px; padding:0 4px; line-height:12px; min-width:11px; text-align:center; }
  .device .cable-count.zero{ background:rgba(213,84,90,0.55); }
  .device .tray-count.tray-warm{ background:var(--warn); }
  .device .tray-count.tray-hot{ background:var(--danger); }
  .device .del{
    background:rgba(0,0,0,0.25); border:none; color:#0b0e12; border-radius:2px;
    width:15px; height:15px; line-height:15px; text-align:center; font-size:11px;
    padding:0; font-weight:700; cursor:pointer; flex:0 0 auto;
  }
  .device.ghost-device{
    background:transparent !important; border-style:dashed; opacity:0.55; cursor:default; font-weight:400;
  }
  .rack-gap{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; padding-top:30px; color:var(--muted); font-size:11px; z-index:1; }
  .rack-gap input{ width:56px; text-align:center; }
  .rack-gap-line{ width:26px; height:1px; background:var(--border); }
  .face-toggle{ display:flex; align-items:center; gap:10px; margin-bottom:6px; }
  .device.search-dim{ opacity:0.2; }
  .device.search-match{ outline:2px solid var(--accent); outline-offset:1px; z-index:2; }
  .face-legend{ color:var(--muted); font-size:11px; margin-bottom:14px; display:flex; align-items:center; gap:6px; }
  .face-legend .swatch-ghost{ display:inline-block; width:10px; height:10px; border:1px dashed var(--muted); vertical-align:-1px; }

  fieldset{ border:1px solid var(--border); border-radius:var(--radius); padding:12px; margin:0 0 16px 0; }
  legend{ padding:0 6px; color:var(--muted); font-size:11.5px; text-transform:uppercase; letter-spacing:0.5px; }

  /* ---- Tables ---- */
  table{ width:100%; border-collapse:collapse; font-size:12.3px; }
  th{ text-align:left; color:var(--muted); font-weight:600; font-size:10.6px; text-transform:uppercase; letter-spacing:0.4px; padding:6px 8px; border-bottom:1px solid var(--border); white-space:nowrap; }
  td{ padding:6px 8px; border-bottom:1px solid #20252c; vertical-align:middle; }
  tr:last-child td{ border-bottom:none; }
  .swatch{ display:inline-block; width:10px; height:10px; border-radius:1px; margin-right:6px; vertical-align:-1px; }
  .dot{ display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; vertical-align:-1px; }
  .dot.free{ background:#4a525e; } .dot.used{ background:#7ac74f; } .dot.shared{ background:var(--warn); } .dot.patched{ background:#8a5cf6; }
  .pill{ display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; color:#0b0e12; white-space:nowrap; }
  .len{ font-weight:600; } .len-raw{ color:var(--muted); font-size:11px; }
  .cable-label{ color:var(--muted); font-size:10.6px; font-family:'SF Mono',Consolas,monospace; }
  .cable-edit-run{ min-width:230px; }
  .cable-edit-row{ display:flex; align-items:center; gap:5px; margin-bottom:3px; }
  .cable-edit-row:last-of-type{ margin-bottom:0; }
  .cable-edit-row .ce-lbl{ flex:0 0 26px; color:var(--muted); font-size:10.3px; }
  .cable-edit-row select{ flex:1 1 0; min-width:0; font-size:11.3px; padding:4px 5px; }
  .cable-edit-via{ color:var(--muted); font-size:10.6px; margin-top:3px; }
  .empty-note{ color:var(--muted); font-size:12.3px; padding:10px 2px; }
  table input[type=text]{ width:100%; } table input[type=number]{ width:76px; }

  .summary{ margin-top:14px; border-top:1px solid var(--border); padding-top:12px; }
  .summary-row{ display:flex; justify-content:space-between; padding:4px 0; font-size:12.3px; }
  .summary-row.total{ font-weight:700; border-top:1px solid var(--border); margin-top:6px; padding-top:8px; }

  /* ---- Dashboard ---- */
  .kpi-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
  @media (max-width: 900px){ .kpi-row{ grid-template-columns:repeat(2,1fr); } }
  .kpi{ background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; }
  .kpi .num{ font-size:21px; font-weight:700; }
  .kpi .lbl{ color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:0.5px; margin-top:2px; }
  .budget-row{ margin-bottom:12px; }
  .budget-row .top{ display:flex; justify-content:space-between; font-size:12px; margin-bottom:4px; }
  .budget-row .top .name{ font-weight:600; }
  .budget-row .top .val{ color:var(--muted); }
  .bar{ height:7px; border-radius:3px; background:var(--panel-2); overflow:hidden; }
  .bar > div{ height:100%; background:var(--accent); }
  .bar > div.over{ background:var(--danger); }

  /* ---- Ports view ---- */
  details.device-card{ background:var(--panel-2); border:1px solid var(--border); border-radius:var(--radius); padding:10px 12px; margin-bottom:10px; }
  details.device-card > summary{ list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px; }
  details.device-card > summary::-webkit-details-marker{ display:none; }
  details.device-card > summary::marker{ display:none; content:""; }
  details.device-card[open] > summary{ margin-bottom:10px; }
  .device-card .chevron{ flex:0 0 auto; opacity:0.6; transition:transform 0.12s ease; }
  details.device-card[open] .chevron{ transform:rotate(90deg); }
  .device-card .head{ display:flex; align-items:center; gap:8px; flex:1 1 auto; min-width:0; }
  .device-card .head .name{ font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .device-card .head .loc{ color:var(--muted); font-size:11.3px; }
  .device-card .usage-mini{ display:flex; align-items:center; gap:6px; margin-left:auto; flex:0 0 auto; }
  .device-card .usage-mini .bar{ width:56px; height:5px; }
  .device-card .usage-mini .txt{ font-size:10.6px; color:var(--muted); white-space:nowrap; }
  .device-card .body-inner{ padding-top:2px; }
  .bulk-box{ border:1px dashed var(--border); border-radius:var(--radius-sm); padding:10px; margin-top:10px; }
  .bulk-box .bulk-title{ font-size:11px; font-weight:700; color:var(--accent); margin-bottom:6px; display:flex; align-items:center; gap:6px; }
  .filter-chips{ display:flex; gap:6px; margin:10px 0 2px 0; }
  button.chip{ background:transparent; border:1px solid var(--border); color:var(--muted); font-weight:600; padding:4px 11px; border-radius:12px; font-size:11.5px; }
  button.chip:hover{ background:var(--panel-2); color:var(--text); }
  button.chip.active{ background:var(--accent-dim); color:var(--accent); border-color:var(--accent); }
  .status-pill{ display:inline-block; padding:1px 7px; border-radius:8px; font-size:10.3px; font-weight:600; }
  .status-pill.free{ background:#2a3038; color:var(--muted); }
  .status-pill.used{ background:#193a22; color:#7ac74f; }
  .status-pill.shared{ background:#3a2c14; color:var(--warn); }
  .status-pill.patched{ background:#2c2140; color:#a78bf5; }
  .continue-hint{ margin-top:10px; padding:9px 11px; border:1px solid #4a3a7a; background:#211a3a; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
  .continue-hint span{ font-size:12px; color:#c3b6f0; }

  /* ---- Modal ---- */
  .modal-overlay{ position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:100; display:flex; align-items:center; justify-content:center; padding:20px; animation:fadeIn 0.12s ease; }
  .modal-box{ background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); padding:20px; width:340px; max-width:100%; box-shadow:0 10px 30px rgba(0,0,0,0.5); animation:popIn 0.14s ease; }
  @keyframes fadeIn{ from{ opacity:0; } to{ opacity:1; } }
  @keyframes popIn{ from{ opacity:0; transform:translateY(4px) scale(0.98); } to{ opacity:1; transform:none; } }
  .modal-title{ font-weight:700; font-size:14.5px; margin-bottom:8px; }
  .modal-body{ color:var(--muted); font-size:12.8px; line-height:1.5; white-space:pre-line; }
  .modal-box input[type=text]{ width:100%; margin-top:12px; }
  .modal-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
  .info-box{ width:400px; max-height:82vh; display:flex; flex-direction:column; }
  .info-modal-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
  .info-modal-head .modal-title{ margin-bottom:0; }
  .info-modal-body{ overflow-y:auto; white-space:normal; font-size:12.8px; }
  .cmdk-overlay{ align-items:flex-start; padding-top:12vh; }
  .cmdk-box{ background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); width:480px; max-width:100%; box-shadow:0 14px 40px rgba(0,0,0,0.5); overflow:hidden; animation:popIn 0.12s ease; }
  .cmdk-box input{ width:100%; border:none; border-bottom:1px solid var(--border); border-radius:0; padding:14px 16px; font-size:14px; background:transparent; }
  .cmdk-box input:focus{ outline:none; }
  .cmdk-list{ position:static; border:none; border-radius:0; box-shadow:none; max-height:320px; }
  .cmdk-list .search-result.cmdk-active{ background:var(--panel-2); }

  /* ---- Floor plan (blueprint) view ---- */
  .floorplan-controls{ display:flex; align-items:center; gap:10px; margin-bottom:8px; }
  .floorplan{
    position:relative; width:100%; min-height:420px; overflow:auto; border:1px solid var(--border); border-radius:var(--radius-sm);
    background-color:#0c1720;
    background-image: linear-gradient(rgba(63,217,199,0.09) 1px, transparent 1px), linear-gradient(90deg, rgba(63,217,199,0.09) 1px, transparent 1px);
    background-size:24px 24px;
  }
  .floor-rack{
    position:absolute; width:84px; height:84px; background:rgba(23,27,33,0.95);
    border-width:2px; border-style:solid; border-color:var(--accent-dim);
    border-radius:6px; cursor:grab; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
    padding:6px; user-select:none; box-shadow:0 4px 10px rgba(0,0,0,0.35);
    transition:box-shadow 0.12s ease, transform 0.12s ease;
  }
  .floor-rack.dragging{ box-shadow:0 12px 26px rgba(0,0,0,0.55); transform:scale(1.04); z-index:5; cursor:grabbing; }
  .floor-rack:active{ cursor:grabbing; }
  .floor-rack .fr-name{ font-size:11px; font-weight:700; text-align:center; overflow:hidden; text-overflow:ellipsis; max-width:100%; white-space:nowrap; }
  .floor-rack .fr-aisle{ font-size:9px; color:var(--muted); text-align:center; overflow:hidden; text-overflow:ellipsis; max-width:100%; white-space:nowrap; margin-top:-3px; }
  .floor-rack .fr-bar{ width:70%; height:5px; background:var(--panel-2); border-radius:3px; overflow:hidden; }
  .floor-rack .fr-bar > div{ height:100%; background:var(--accent); }
  .floor-rack .fr-bar > div.over{ background:var(--danger); }
  .floor-rack .fr-pct{ font-size:9px; color:var(--muted); }
  .floor-rack .fr-rotate{
    position:absolute; top:-8px; right:-8px; width:18px; height:18px; border-radius:50%; padding:0;
    background:var(--panel-2); border:1px solid var(--border); color:var(--muted); display:flex; align-items:center; justify-content:center;
  }
  .floor-rack .fr-rotate:hover{ background:var(--accent-dim); color:var(--accent); }
  .floor-legend{ position:absolute; bottom:8px; right:10px; font-size:10.5px; color:var(--muted); display:flex; align-items:center; gap:10px; }
  .floor-legend .fl-swatch{ display:inline-block; width:12px; height:3px; border-radius:2px; margin-right:3px; vertical-align:2px; }
  #cableSvg .cable-vis{ transition:opacity 0.15s ease, stroke-width 0.15s ease; }
  #cableSvg .cable-dot{ transition:opacity 0.15s ease; }

  /* ---- Sidebar search ---- */
  .sidebar-search{ position:relative; }
  .sidebar-search input{ width:100%; }
  .search-results{ position:absolute; left:0; right:0; top:calc(100% + 4px); background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); max-height:320px; overflow-y:auto; z-index:40; box-shadow:0 8px 20px rgba(0,0,0,0.4); animation:fadeIn 0.1s ease; }
  .search-result{ display:flex; flex-direction:column; gap:1px; padding:7px 10px; cursor:pointer; border-bottom:1px solid #20252c; }
  .search-result:last-child{ border-bottom:none; }
  .search-result:hover{ background:var(--panel-2); }
  .search-result .sr-label{ font-size:12.2px; font-weight:600; }
  .search-result .sr-sub{ font-size:10.6px; color:var(--muted); }
  .search-empty{ padding:10px; color:var(--muted); font-size:11.8px; }
  .flash-highlight{ outline:2px solid var(--accent) !important; outline-offset:2px; }

  /* ---- Hover tooltip ---- */
  .hover-tooltip{
    position:fixed; z-index:50; display:none; background:var(--panel); border:1px solid var(--border);
    border-radius:var(--radius); padding:10px 12px; font-size:12px; max-width:260px; box-shadow:0 6px 18px rgba(0,0,0,0.4);
    pointer-events:none; animation:fadeIn 0.1s ease;
  }
  .hover-tooltip .ht-head{ display:flex; align-items:center; gap:6px; font-weight:700; font-size:12.5px; margin-bottom:5px; }
  .hover-tooltip .ht-row{ color:var(--muted); font-size:11.3px; margin-bottom:3px; }
  .hover-tooltip .ht-desc{ color:var(--text); font-style:italic; margin-top:4px; }
  .hover-tooltip .ht-sub{ margin-top:7px; margin-bottom:2px; font-size:10px; text-transform:uppercase; letter-spacing:0.4px; color:var(--muted); border-top:1px solid var(--border); padding-top:6px; }
  .hover-tooltip .ht-list{ font-size:11.2px; line-height:1.65; }
  .hover-tooltip .ht-more{ color:var(--muted); font-size:10.5px; margin-top:2px; }

  /* ---- Settings ---- */
  .type-row{ display:flex; align-items:center; gap:10px; padding:6px 0; border-bottom:1px solid #20252c; font-size:12.3px; }
  .type-row .grp{ color:var(--muted); font-size:10.3px; text-transform:uppercase; margin-left:auto; }

  /* ---- Checklist ---- */
  .progress-wrap{ display:flex; align-items:center; gap:14px; }
  .progress-wrap .bar{ flex:1 1 auto; height:10px; }
  .progress-wrap .pct{ font-weight:700; font-size:15px; width:52px; text-align:right; }

  /* ---- Loading Screen ---- */
  .loading-overlay{
    position:fixed; inset:0; background:var(--bg); z-index:1000;
    display:flex; align-items:center; justify-content:center;
    transition:opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
    backdrop-filter: blur(10px);
  }
  .loading-overlay.hidden{ opacity:0; visibility:hidden; pointer-events:none; }
  .loading-box{ display:flex; flex-direction:column; align-items:center; gap:24px; text-align:center; max-width:300px; width:100%; }
  .loading-brand{ display:flex; align-items:center; gap:14px; font-weight:800; font-size:24px; color:var(--text); letter-spacing:-0.5px; }
  .loading-brand svg{ color:var(--accent); filter: drop-shadow(0 0 8px var(--accent-dim)); }
  .loading-bar{ width:100%; height:4px; background:var(--panel-2); border-radius:4px; overflow:hidden; position:relative; box-shadow: inset 0 1px 2px rgba(0,0,0,0.2); }
  .loading-progress{
    width:0%; height:100%; background: linear-gradient(90deg, var(--accent), #54f2df); border-radius:4px;
    position:absolute; left:0;
    box-shadow: 0 0 10px var(--accent-dim);
  }
  .loading-text{ font-size:11px; color:var(--muted); letter-spacing:1px; text-transform:uppercase; font-weight:600; min-height: 1.2em; transition: all 0.2s ease; }
  .loading-logs{
    width: 100%; max-height: 150px; overflow-y: auto;
    font-family: var(--font-mono); font-size: 10px; color: var(--muted);
    text-align: left; padding: 10px; background: rgba(0,0,0,0.2);
    border-radius: 4px; display: flex; flex-direction: column; gap: 4px;
    margin-top: 10px;
  }
  .log-entry{ opacity: 0.8; }
  .log-entry.error{ color: #ff6b6b; font-weight: bold; }
  .log-entry.success{ color: #51cf66; }

  /* Premium Polish */
  :root {
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  }

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  .panel {
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
  }

  .panel:hover {
    box-shadow: var(--shadow);
  }

  button {
    transition: var(--transition);
  }

  .nav-btn {
    transition: var(--transition);
  }

  .device {
    transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
  }

  .device:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.1) inset;
  }

  input, select {
    transition: var(--transition);
  }

  input:focus, select:focus {
    box-shadow: 0 0 0 2px var(--accent-dim);
  }
