/* Marcum's Managed Services: styles for the Tools pages (loads after default.css and reuses its variables) */

/* ---------- Tools index ---------- */
.tool-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.tool-card .tool-open {
  display: inline-block;
  margin-top: 16px;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent-dark);
}

.tool-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Tool layout ---------- */
.tool-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.tool-layout > * { min-width: 0; }

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tool-panel h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

@media (max-width: 820px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Form controls ---------- */
.field { display: grid; gap: 6px; min-width: 0; }

.field-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-row {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.tool-panel input[type="text"],
.tool-panel select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  font: inherit;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
}

.tool-panel select { cursor: pointer; }

.tool-panel input:focus-visible,
.tool-panel select:focus-visible,
.tool-panel button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

@media (max-width: 420px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
}

/* Segmented toggle */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  align-self: flex-start;
}

.seg button {
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.seg button[aria-pressed="true"] { background: var(--dark); color: #fff; }

/* Preset chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips button {
  padding: 7px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-dark);
  background: #fff1e6;
  border: 1.5px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s;
}

.chips button:hover { border-color: var(--accent); }

/* ---------- Results ---------- */
.result {
  display: grid;
  gap: 6px;
  padding: 22px;
  color: #fff;
  background:
    radial-gradient(360px 160px at 100% 0%, rgba(255, 102, 0, .35), transparent 65%),
    var(--dark);
  border-radius: 20px;
  min-width: 0;
}

.result-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #c3c9d3;
}

.result-big {
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.result-big .unit { margin-left: 8px; font-size: .5em; font-weight: 600; color: var(--accent); }
.result-eq { font-size: 15px; color: #c3c9d3; overflow-wrap: anywhere; }

.result-pair {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

@media (max-width: 520px) {
  .result-pair { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; }

.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.tool-table th {
  padding: 0 0 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

.tool-table td { padding: 10px 0; border-top: 1px solid var(--line); }
.tool-table td:first-child { padding-right: 16px; white-space: nowrap; color: var(--muted); }
.tool-table th:not(:first-child), .tool-table td:not(:first-child) { text-align: right; }
.tool-table td:not(:first-child) { overflow-wrap: anywhere; }

.tool-table tr.group td {
  padding: 16px 0 6px;
  border-top: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

.tool-table tr.active td { color: var(--accent-dark); font-weight: 600; background: #fff1e6; }
.tool-table tr.active td:first-child { padding-left: 10px; border-radius: 8px 0 0 8px; }
.tool-table tr.active td:last-child { padding-right: 10px; border-radius: 0 8px 8px 0; }

.tool-note { margin: 0; font-size: 15px; color: var(--muted); max-width: 62ch; }
.tool-link { margin: 0; font-weight: 600; }

/* ---------- Subnet calculator ---------- */
.tool-full { margin-top: 24px; }
.tool-panel[hidden] { display: none; }

/* Tables with several text columns read better left-aligned than right-aligned */
.tool-table.cols th, .tool-table.cols td { text-align: left; }
.tool-table.cols td { padding-right: 16px; }
.tool-table.cols td:first-child { color: var(--muted); }

.tool-table td:not(:first-child) { color: var(--ink); }

.bin {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: .02em;
}

.bin-row { display: flex; align-items: baseline; gap: 0; white-space: nowrap; }
.bin-name { width: 70px; flex: none; font-family: inherit; color: var(--muted); letter-spacing: 0; }
.bin .net, .bin-key.net { color: var(--ink); font-weight: 700; }
.bin .host, .bin-key.host { color: var(--accent-dark); }
.bin-key { margin-right: 16px; font-size: 14px; }
/* ---------- UPS runtime calculator ---------- */
.tool-stack { display: grid; gap: 24px; min-width: 0; }

/* Keep the results in view while scrolling, but only on screens tall enough to show the whole panel */
@media (min-width: 821px) and (min-height: 1000px) {
  .tool-sticky { position: sticky; top: 96px; }
}

.dev-list { display: grid; gap: 8px; }

.dev-head,
.dev-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 88px 64px 42px;
  align-items: center;
}

.dev-head span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

#devs { display: grid; gap: 8px; }

.tool-panel .dev-row input[type="text"] {
  min-height: 42px;
  padding: 8px 10px;
  font-size: 16px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.icon-btn:hover { color: var(--accent-dark); border-color: var(--accent); }

.dev-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.dev-total strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.inline-pair { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) 96px; }

.status {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
}

.status[hidden] { display: none; }
.status-stack { display: grid; gap: 10px; }
.status-stack:empty { display: none; }
.status.ok { color: #14653a; background: #e6f6ec; }
.status.warn { color: #8a5a00; background: #fff4d6; }
.status.over { color: #a31616; background: #fde8e8; }

@media (max-width: 480px) {
  .dev-head { display: none; }
  .dev-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px; }
  .dev-row .dev-name { grid-column: 1 / -1; }
  #devs { gap: 14px; }
}

.bin-key::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; background: currentColor; }
