:root {
  --brand-teal: #38A3A5;
  --brand-blue: #22577A;
  --bg: #F5F7FA;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.1);
  --border-strong: rgba(0,0,0,0.18);
  --text: #111111;
  --text-muted: #555555;
  --text-subtle: #888888;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

html { scroll-behavior: smooth; overflow-x: hidden; width: 100%; max-width: 100vw; }
body { overflow-x: hidden; width: 100%; max-width: 100vw; }
[id] { scroll-margin-top: 76px; }

.ip-row { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ip-row::-webkit-scrollbar { display: none; }

#unifiedNav.open { transform: translateX(0); }
.drawer-overlay { transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.drawer-overlay.hidden { opacity: 0; pointer-events: none; }

/* ---------- Shared tool design (reuse on every calculator / converter) ---------- */
.tool-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.tool-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.tool-input {
  width: 100%; height: 42px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: #111827; outline: none; transition: all .15s;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
}
@media (min-width: 640px) { .tool-input { padding: 0 14px; font-size: 14px; } }
.tool-input:focus { border-color: var(--brand-teal); box-shadow: 0 0 0 3px rgba(56,163,165,.18); }
.tool-input.invalid { border-color: #dc2626; background: #fef2f2; }
.tool-input.invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.field-error { display: none; margin-top: 4px; font-size: 11.5px; line-height: 1.35; color: #dc2626; font-weight: 500; }
.field-error.show { display: block; }

.info-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 16px; height: 16px; padding: 0; border: 0; background: transparent;
  color: var(--brand-blue); cursor: pointer; border-radius: 999px; transition: color .15s;
}
.info-btn:hover, .info-btn:focus-visible { color: var(--brand-teal); outline: none; }
.info-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#tipBox {
  position: fixed; z-index: 3000; max-width: calc(100vw - 16px); white-space: nowrap; padding: 6px 10px; border-radius: 6px;
  background: #143850; color: #fff; font-size: 12px; line-height: 1.3; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); pointer-events: none; display: none;
}

/* CIDR slider */
input[type=range].cidr-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--brand-blue) 0, var(--brand-blue) var(--pct, 75%), #e2e8f0 var(--pct, 75%), #e2e8f0 100%);
}
input[type=range].cidr-range::-webkit-slider-runnable-track { background: transparent; height: 8px; }
input[type=range].cidr-range::-moz-range-track { background: transparent; height: 8px; }
input[type=range].cidr-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%;
  background: var(--brand-teal); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--brand-blue), 0 2px 6px rgba(0,0,0,.25);
}
input[type=range].cidr-range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--brand-teal); border: 4px solid #fff;
  box-shadow: 0 0 0 2px var(--brand-blue), 0 2px 6px rgba(0,0,0,.25);
}
input[type=range].cidr-range:focus-visible { box-shadow: 0 0 0 4px rgba(56,163,165,.25); }

.action-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px; font-size: 12px; font-weight: 700; line-height: 1;
  color: var(--brand-blue); background: #E5EDF2; border: 1px solid #c3d4e0; border-radius: 6px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.action-btn:hover:not(:disabled) { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.action-btn:disabled { opacity: .45; cursor: not-allowed; }
.action-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.action-btn.done { background: var(--brand-teal); color: #fff; border-color: var(--brand-teal); }

/* Info section typography */
.article h2 { font-size: 22px; font-weight: 700; color: #22577A; margin: 32px 0 10px; line-height: 1.25; }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 16px; font-weight: 700; color: #111827; margin: 20px 0 6px; }
.article p { margin: 0 0 12px; color: #374151; font-size: 14.5px; line-height: 1.75; }
.article ul, .article ol { margin: 0 0 14px 20px; color: #374151; font-size: 14.5px; line-height: 1.75; }
.article ul { list-style: disc; } .article ol { list-style: decimal; }
.article li { margin-bottom: 6px; padding-left: 2px; }
.article code { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; background: #E8F5F5; color: #227274; padding: 2px 6px; border-radius: 4px; }
.article .formula { font-family: 'IBM Plex Mono', monospace; font-size: 13px; background: #E5EDF2; color: #143850; padding: 12px 14px; border-radius: 8px; border-left: 3px solid #38A3A5; margin: 0 0 14px; overflow-x: auto; white-space: pre; line-height: 1.7; }
.article .tip { background: #E8F5F5; border: 1px solid rgba(56,163,165,.3); color: #227274; padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; font-size: 14px; line-height: 1.65; }
.article .step-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: #111827; margin: 22px 0 6px; }
.article .step-no { flex-shrink: 0; width: 26px; height: 26px; border-radius: 999px; background: #22577A; color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.table-wrap { overflow: auto; border: 1px solid #d5dbe3; border-radius: 8px; margin-bottom: 14px; }
.table-wrap.tall { max-height: 480px; }
.ref-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.ref-table th { position: sticky; top: 0; z-index: 1; background: #E5EDF2; color: #22577A; text-align: left; padding: 8px 12px; font-weight: 700; white-space: nowrap; border-right: 1px solid #c3d4e0; border-bottom: 1px solid #c3d4e0; }
.ref-table td { padding: 8px 12px; border-right: 1px solid #e2e6ec; border-bottom: 1px solid #e2e6ec; font-family: 'IBM Plex Mono', monospace; color: #374151; white-space: nowrap; }
.ref-table th:last-child, .ref-table td:last-child { border-right: 0; }
.ref-table tbody tr:last-child td { border-bottom: 0; }
.ref-table tbody tr:nth-child(even) td { background: #f8fafc; }
.ref-table tbody tr:hover td { background: #E8F5F5; }
details.faq { border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; margin-bottom: 8px; }
details.faq summary { cursor: pointer; padding: 12px 14px; font-weight: 700; font-size: 14px; color: #111827; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: '+'; font-size: 20px; color: #38A3A5; font-weight: 600; line-height: 1; }
details.faq[open] summary::after { content: '–'; }
details.faq p { padding: 0 14px 12px; margin: 0; font-size: 14px; }
