/* cables.css — the cable catalogue page only.
 *
 * Loaded after style.css and, like power.css, adds nothing to it: the sidebar,
 * panels, rows, buttons and notes are the map tool's, unchanged. What is here
 * is the stage — a figure strip over one wide editable table — and the table's
 * own inline inputs, which have to look like text until you touch them or the
 * grid turns into a wall of boxes.
 */

#cat-stage {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  gap: 10px; padding: 10px; overflow: auto;
}

/* Same strip as the power visualiser, same class names, so the two pages read
 * as one tool. */
#figs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; flex: 0 0 auto; }
.fig {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 11px 9px; min-width: 0;
}
.fig .lbl {
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-dim);
}
.fig .val {
  font-size: 21px; font-weight: 700; line-height: 1.15; margin-top: 2px;
  font-variant-numeric: tabular-nums; color: var(--accent);
}
.fig .sub {
  font-size: 10.5px; color: var(--ink-dim); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- the table ---------- */

#cat { flex: 1 1 auto; min-height: 0; }

table.cat {
  width: 100%; border-collapse: collapse;
  font-size: 12px; font-variant-numeric: tabular-nums;
}
table.cat th {
  text-align: right; padding: 7px 8px; white-space: nowrap;
  font-size: 9.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-dim);
  border-bottom: 1px solid var(--line);
  background: var(--bg); position: sticky; top: 0; z-index: 2;
}
table.cat th.l, table.cat td.l { text-align: left; }
table.cat th.sortable { cursor: pointer; }
table.cat th.sortable:hover { color: var(--ink); }
table.cat th.on { color: var(--accent); }

table.cat td {
  padding: 3px 8px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid #21262f;
}
table.cat tr.sz:hover td { background: #171b23; }
table.cat td.calc-col { color: var(--ink-dim); }
table.cat td.none { color: #5b6478; }

/* Product header row. Wide, editable, and visually a band rather than a row so
 * the sizes underneath read as belonging to it. */
tr.fam td {
  background: var(--panel-2); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); padding: 7px 8px;
}
tr.fam .band { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
tr.fam .nm { font-size: 13px; font-weight: 600; color: var(--ink); }
tr.fam .tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .03em;
  border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px;
  color: var(--ink-dim); background: #141821;
}
tr.fam .tag.al { color: #cfd6e4; border-color: #49515f; }
tr.fam .tag.cu { color: #e0a06a; border-color: #6d4a2c; }
tr.fam .tag.custom { color: var(--accent); border-color: var(--accent); }
tr.fam .spacer { flex: 1 1 auto; }
tr.fam label {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--ink-dim);
}
tr.fam input[type=text] { width: auto; min-width: 110px; padding: 3px 6px; font-size: 11.5px; }
tr.fam input.url { min-width: 190px; }

/* Inline cell editors: flat until focused or hovered, so a dense grid of
 * numbers still reads as numbers. */
table.cat input.cell {
  width: 100%; min-width: 52px; background: transparent; border: 1px solid transparent;
  border-radius: 4px; padding: 3px 5px; color: var(--ink);
  font: inherit; font-variant-numeric: tabular-nums; text-align: right;
}
table.cat input.cell::placeholder { color: #4d5666; }
table.cat input.cell:hover { border-color: var(--line); background: #141821; }
table.cat input.cell:focus {
  outline: none; border-color: var(--accent); background: #141821;
  box-shadow: 0 0 0 2px rgba(77, 163, 255, .16);
}
table.cat input.cell.wide { text-align: left; min-width: 120px; }
/* The link column soaks up the slack so the numeric columns shrink to their
 * content instead of the browser spreading a dozen narrow figures across the
 * whole stage. */
table.cat th.grow, table.cat td.grow { width: 100%; }
/* Hide the spinners: they are useless at these magnitudes and they eat width. */
table.cat input.cell::-webkit-outer-spin-button,
table.cat input.cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
table.cat input.cell[type=number] { -moz-appearance: textfield; }

/* A figure the user has changed away from the built-in list. The dot is the
 * legend's marker too, so the two match. */
table.cat input.cell.mine { color: var(--accent); font-weight: 600; }
table.cat td.mine-cell { position: relative; }
table.cat td.mine-cell::after {
  content: ''; position: absolute; left: 2px; top: 50%; margin-top: -2px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.mine-dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); vertical-align: middle; margin: 0 2px;
}

table.cat a.ext { color: var(--accent); text-decoration: none; font-size: 11px; }
table.cat a.ext:hover { text-decoration: underline; }

table.cat button.mini {
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  color: var(--ink-dim); font: inherit; font-size: 12px; cursor: pointer;
  padding: 1px 5px; line-height: 1.3;
}
table.cat button.mini:hover { background: var(--panel-2); border-color: var(--line); color: var(--ink); }
table.cat button.mini.danger:hover { background: #3a2226; border-color: #6d3239; color: var(--danger); }

/* Marks a size the user added rather than one the built-in list ships. Scoped to
 * the first cell: the link cell is left-aligned too and would otherwise get its
 * own stray plus sign. */
table.cat tr.added td.l:first-child::before {
  content: '+'; color: var(--accent); font-weight: 700; margin-right: 4px;
}

.empty {
  padding: 26px 12px; text-align: center; color: var(--ink-dim); font-size: 12px;
}

/* ---------- sidebar extras ---------- */

#jsonBox {
  width: 100%; margin-top: 8px; resize: vertical;
  background: #141821; color: var(--ink); border: 1px solid var(--line);
  border-radius: 5px; padding: 6px 7px;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}
#jsonBox:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(77, 163, 255, .18);
}
#ioMsg:not(:empty) {
  margin-top: 8px; font-size: 11px; border-radius: 4px; padding: 6px 8px;
  border: 1px solid var(--line); background: #141821; color: var(--ink-dim);
}
#ioMsg.ok:not(:empty) { border-left: 2px solid #4be0a8; color: #9fe8cd; }
#ioMsg.bad:not(:empty) { border-left: 2px solid var(--danger); color: #ffb3b3; }

@media (max-width: 1100px) {
  #figs { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  #app { flex-direction: column; }
  #side { width: 100%; flex: 0 0 auto; height: 44%; border-right: none;
          border-bottom: 1px solid var(--line); }
  #cat-stage { flex: 1; }
  #figs { grid-template-columns: repeat(2, 1fr); }
}
