/* ==========================================================================
   PhoneBoard CAD — Atomic Precision Refinements & Engineering Micro-Widgets
   Altium / KiCad 8 / REFOX Pro Workstation Aesthetic
   Zero neon glow · Zero bubble bloat · Tabular engineering numerals
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Micro-Polished Typography & Tabular Numerals
   -------------------------------------------------------------------------- */
.coord-mono,
#coordReadout,
#zoomReadout,
.zoom-readout,
.status-pill,
.series-count,
.pane-hint,
.chip-mv,
.diode-mv,
.pill,
.kv-v,
.chip-canvas-meta,
.idx,
.pin-chip,
.b-tag,
.ai-prob,
.ai-step-num,
.pinboard-row,
.ruler-hud,
.diode-cmp-input,
.diode-short,
.diode-low,
.diode-ok,
.diode-ol,
.diode-delta-ok,
.diode-delta-bad,
.cad-table td,
.cad-table th {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

.coord-mono,
#coordReadout,
#zoomReadout,
.zoom-readout {
  letter-spacing: -0.01em;
}

.big-id,
.net-big,
.ht-title,
.ht-net {
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   2. Crisp Etched Keycap Badges (<kbd>)
   -------------------------------------------------------------------------- */
kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: var(--bg-canvas);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  box-shadow: inset 0 -1px 0 rgba(57, 68, 86, 0.85);
  padding: 1px 4px;
  min-width: 16px;
  white-space: nowrap;
  user-select: none;
}

.tool-btn kbd,
.mini-btn kbd,
.hud-hint kbd {
  margin-left: 3px;
  color: var(--text-muted);
  border-color: var(--border);
}

.tool-btn.active kbd,
.cmd-row.active kbd,
.cmd-row.active .kbd {
  color: var(--text);
  border-color: rgba(212, 146, 42, 0.55);
  background: rgba(13, 16, 21, 0.72);
}

/* --------------------------------------------------------------------------
   3. Semantic Diode Measurement Pills (mV / OL)
   -------------------------------------------------------------------------- */
.diode-short,
.diode-low,
.diode-ok,
.diode-ol {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  padding: 1px 5px;
  border-radius: 2px;
  white-space: nowrap;
}

/* < 20 mV — Dead short / low-impedance fault (muted crimson) */
.diode-short {
  color: #f0a8a8;
  background: var(--danger-soft);
  border: 1px solid rgba(217, 79, 79, 0.48);
}

/* 20 - 149 mV — Low / high-current rail or leakage suspect (amber) */
.diode-low {
  color: #f3cd8a;
  background: var(--accent-soft);
  border: 1px solid rgba(212, 146, 42, 0.5);
}

/* 150 - 850 mV — Nominal silicon junction drop (emerald) */
.diode-ok {
  color: #7ee2b1;
  background: var(--pcb-green-soft);
  border: 1px solid rgba(44, 155, 100, 0.48);
}

/* OL — Open line / disconnected pad (muted violet-slate) */
.diode-ol {
  color: #bfb5db;
  background: rgba(124, 111, 159, 0.14);
  border: 1px solid rgba(124, 111, 159, 0.45);
}

/* --------------------------------------------------------------------------
   4. Command Palette (Ctrl+K)
   -------------------------------------------------------------------------- */
.cmd-palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(8, 10, 14, 0.76);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(14vh, 112px) 16px 16px;
}

.cmd-palette-box {
  width: min(92vw, 560px);
  max-height: 70vh;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cmd-input {
  width: 100%;
  background: var(--bg-canvas);
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.4;
  outline: none;
}

.cmd-input::placeholder {
  color: var(--text-muted);
}

.cmd-input:focus {
  border-bottom-color: var(--accent);
}

.cmd-list {
  flex: 1;
  min-height: 0;
  max-height: 360px;
  overflow-y: auto;
  padding: 3px 0;
  background: var(--bg-panel);
}

.cmd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 12px;
  border-left: 2px solid transparent;
  border-bottom: 1px solid rgba(42, 50, 64, 0.35);
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.cmd-row:last-child {
  border-bottom: none;
}

.cmd-row:hover {
  background: var(--bg-panel-2);
  color: var(--text);
}

.cmd-row.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--text);
}

.cmd-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.25;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.cmd-row.active .cmd-tag {
  color: #f3cd8a;
  border-color: rgba(212, 146, 42, 0.45);
  background: rgba(212, 146, 42, 0.12);
}

/* --------------------------------------------------------------------------
   5. Floating CAD Drag-Drop Overlay
   -------------------------------------------------------------------------- */
.cad-drop-overlay {
  position: fixed;
  inset: 10px;
  z-index: 95;
  pointer-events: none;
  background: rgba(13, 16, 21, 0.86);
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  outline: 1px solid rgba(212, 146, 42, 0.22);
  outline-offset: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   6. Net Pinboard & Diode Compare Widgets
   -------------------------------------------------------------------------- */
.pinboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border-left: 2px solid transparent;
  border-bottom: 1px solid rgba(42, 50, 64, 0.5);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.3;
  color: var(--text);
  cursor: pointer;
}

.pinboard-row:last-child {
  border-bottom: none;
}

.pinboard-row:hover {
  background: var(--bg-elev);
  border-left-color: var(--accent);
}

.diode-cmp-input {
  width: 74px;
  height: 22px;
  padding: 2px 6px;
  background: var(--bg-canvas);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  outline: none;
}

.diode-cmp-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.diode-cmp-input:focus {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.diode-delta-ok,
.diode-delta-bad {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  padding: 1px 5px;
  border-radius: 2px;
  white-space: nowrap;
}

.diode-delta-ok {
  color: #7ee2b1;
  background: var(--pcb-green-soft);
  border: 1px solid rgba(44, 155, 100, 0.45);
}

.diode-delta-bad {
  color: #f0a8a8;
  background: var(--danger-soft);
  border: 1px solid rgba(217, 79, 79, 0.48);
}

/* --------------------------------------------------------------------------
   7. Ruler Measurement HUD Pill
   -------------------------------------------------------------------------- */
.ruler-hud {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  background: rgba(21, 25, 32, 0.96);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.viewport-wrap > .ruler-hud {
  position: absolute;
  left: 10px;
  bottom: 34px;
  z-index: 6;
}

/* --------------------------------------------------------------------------
   8. Precision Focus Rings, Button Press Feedback, Hairlines & Dense Rows
   -------------------------------------------------------------------------- */
button:focus-visible,
.tool-btn:focus-visible,
.mini-btn:focus-visible,
.tab-btn:focus-visible,
.right-tab-btn:focus-visible,
.layer-pill:focus-visible,
.block-tab:focus-visible,
.brand-chip:focus-visible,
.pin-chip:focus-visible,
.quick-btn:focus-visible,
.ai-mdl-btn:focus-visible,
.ai-preset-btn:focus-visible,
.ai-jump-chip:focus-visible,
.ai-send-btn:focus-visible,
.fav-top-btn:focus-visible,
.board-star:focus-visible,
.search-box input:focus-visible,
.ai-cfg-row input:focus-visible,
.ai-input-bar input:focus-visible,
.cmd-input:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.tool-btn:active:not(:disabled),
.mini-btn:active:not(:disabled),
.layer-pill:active:not(:disabled),
.block-tab:active:not(:disabled),
.brand-chip:active:not(:disabled),
.pin-chip:active:not(:disabled),
.quick-btn:active:not(:disabled),
.ai-preset-btn:active:not(:disabled),
.ai-jump-chip:active:not(:disabled),
.ai-send-btn:active:not(:disabled),
.fav-top-btn:active:not(:disabled),
.board-star:active:not(:disabled) {
  transform: translateY(0.5px);
}

/* Crisp 1px Hairline Dividers & Compact Engineering Density */
.sep,
.hud-sep {
  background: var(--border);
  opacity: 0.9;
}

.cad-hairline {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
  border: none;
}

.kv-row {
  padding: 2.5px 0;
  font-size: 11px;
  border-bottom-color: rgba(42, 50, 64, 0.55);
}

.card {
  padding: 7px 9px;
  margin-bottom: 6px;
}

.card-title {
  margin-bottom: 5px;
  padding-bottom: 4px;
}

.board-item {
  padding: 4px 8px 4px 10px;
  font-size: 11.5px;
}

.search-row {
  padding: 5px 10px;
}

.conn-group {
  padding: 5px 7px;
  margin-bottom: 4px;
}

.cad-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.3;
}

.cad-table th,
.cad-table td {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(42, 50, 64, 0.55);
  text-align: left;
  vertical-align: middle;
}

.cad-table th {
  background: var(--bg-panel-2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom-color: var(--border);
}

.cad-table tbody tr:hover {
  background: var(--bg-elev);
}

.cad-table tbody tr:last-child td {
  border-bottom: none;
}
