/* Cable Containment Support Network Calculator — page-scoped styles.
   Uses the site's CSS custom properties so all three themes work. */

.nc-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- toolbar ---------- */
.nc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}
.nc-toolbar .nc-group {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.nc-toolbar .nc-sep { flex: 1; }
.nc-btn {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.nc-btn:hover { border-color: var(--accent); }
.nc-btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.nc-btn--primary:hover { background: var(--accent-hover); }
.nc-btn--danger { color: var(--danger); }
.nc-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.nc-seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.nc-seg button {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 0;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.nc-seg button + button { border-left: 1px solid var(--border); }
.nc-seg button.active { background: var(--accent); color: #fff; }

.nc-toolbar label.nc-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.nc-toolbar input[type='number'] {
  width: 4.2rem;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  font: inherit;
  font-size: 0.85rem;
}

/* ---------- banner ---------- */
.nc-banner {
  border-radius: 12px;
  padding: 0.7rem 1.1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}
.nc-banner--pass { border-color: var(--success); color: var(--success); }
.nc-banner--fail { border-color: var(--danger); color: var(--danger); }
.nc-banner--warn { border-color: var(--accent-warm); color: var(--accent-warm); }
.nc-banner small { display: block; font-weight: 400; color: var(--text-muted); margin-top: 0.25rem; }

/* ---------- main grid: canvas + side panel ---------- */
.nc-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}
.nc-canvas-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  max-height: 640px;
  position: relative;
}
.nc-canvas-card svg { display: block; touch-action: pan-x pan-y; }
.nc-canvas-hint {
  position: sticky;
  bottom: 0;
  left: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.3rem 0.8rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.nc-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  max-height: 640px;
  overflow-y: auto;
}
.nc-panel h3 { margin: 0 0 0.8rem; font-size: 1.05rem; }
.nc-panel .nc-field { margin-bottom: 0.7rem; }
.nc-panel label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.nc-panel input,
.nc-panel select {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.88rem;
}
.nc-panel .nc-row { display: flex; gap: 0.5rem; }
.nc-panel .nc-row > * { flex: 1; min-width: 0; }
.nc-support,
.nc-cms-slot {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem;
  margin-bottom: 0.55rem;
  background: var(--bg-elevated);
}
.nc-support .nc-row + .nc-row,
.nc-cms-slot .nc-row + .nc-row { margin-top: 0.4rem; }
.nc-mini { font-size: 0.78rem; color: var(--text-muted); }
.nc-sharesum { font-size: 0.82rem; margin: 0.3rem 0 0.6rem; color: var(--text-muted); }
.nc-sharesum.bad { color: var(--danger); font-weight: 600; }
.nc-check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--text-muted); }
.nc-check input { width: auto; }

/* ---------- element table ---------- */
.nc-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}
.nc-table-card h3 { margin: 0 0 0.7rem; font-size: 1.05rem; }
table.nc-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.84rem;
  min-width: 980px;
}
.nc-table th,
.nc-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.nc-table th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; }
.nc-table td.num, .nc-table th.num { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.nc-table tr.selected td { background: rgba(var(--accent-rgb), 0.12); }
.nc-table tr.fail td { background: rgba(224, 82, 82, 0.1); }
.nc-table input, .nc-table select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.2rem 0.3rem;
  font: inherit;
  font-size: 0.8rem;
}
.nc-table input.nc-id { width: 3.6rem; }
.nc-table input.nc-len { width: 4rem; }
.nc-table input.nc-share { width: 3.3rem; }
.nc-table input.nc-pos { width: 3.3rem; }
.nc-table .nc-supline { display: flex; gap: 0.25rem; align-items: center; margin-bottom: 0.2rem; }
.nc-table .nc-supline:last-child { margin-bottom: 0; }
.nc-cms-chip {
  display: inline-block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-primary);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nc-cms-chip:hover { border-color: var(--accent); }

.nc-status { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.03em; }
.nc-status--pass { color: var(--success); }
.nc-status--fail { color: var(--danger); }
.nc-status--nodata { color: var(--accent-warm); }

.nc-verify-chip {
  display: inline-block;
  background: rgba(240, 165, 0, 0.14);
  color: var(--accent-warm);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 0.3rem;
}

/* ---------- fixings + reference cards ---------- */
.nc-fixings {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}
.nc-fixings h3 { margin: 0 0 0.7rem; font-size: 1.05rem; }
.nc-ref {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.nc-ref summary { cursor: pointer; font-weight: 600; color: var(--text-primary); }
.nc-ref table { border-collapse: collapse; font-size: 0.82rem; margin: 0.8rem 1.2rem 0.8rem 0; display: inline-table; vertical-align: top; }
.nc-ref th, .nc-ref td { border: 1px solid var(--border); padding: 0.3rem 0.5rem; }
.nc-ref th { color: var(--text-muted); }
.nc-ref input { width: 4.5rem; background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; padding: 0.15rem 0.3rem; font: inherit; font-size: 0.8rem; }
.nc-ref .nc-sources { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; }

.nc-errors {
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: rgba(224, 82, 82, 0.07);
  padding: 0.8rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}
.nc-errors ul { margin: 0.3rem 0 0 1.1rem; padding: 0; }
.nc-errors li { color: var(--danger); margin-bottom: 0.15rem; }
.nc-warnings { border-color: var(--accent-warm); background: rgba(240, 165, 0, 0.06); }
.nc-warnings li { color: var(--accent-warm); }

.nc-mobile-note { display: none; }

@media (max-width: 900px) {
  .nc-main { grid-template-columns: 1fr; }
  .nc-panel { max-height: none; }
  .nc-mobile-note {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
  }
}
