:root {
  --tb-bg: #ffffff;
  --tb-fg: #1f2933;
  --tb-muted: #6b7280;
  --tb-border: #e5e7eb;
  --tb-accent: #0d6efd;
  --tb-code-bg: #f6f8fa;
  --app-gradient: linear-gradient(135deg, #eff6ff 0%, #ffffff 40%, #f5f3ff 100%);
  --tb-hero-metric-bg: rgba(255, 255, 255, 0.75);
}

[data-bs-theme="dark"] {
  --tb-bg: #111418;
  --tb-fg: #e6edf3;
  --tb-muted: #9aa4b2;
  --tb-border: #2a3138;
  --tb-code-bg: #161b22;
  --app-gradient: linear-gradient(135deg, #161b22 0%, #111418 40%, #1a1626 100%);
  --tb-hero-metric-bg: rgba(255, 255, 255, 0.04);
}

body {
  color: var(--tb-fg);
  background-color: var(--tb-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

.site-footer {
  flex-shrink: 0;
  color: var(--tb-muted);
}

.font-monospace {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

pre, code {
  white-space: pre-wrap;
  word-break: break-word;
}

.card {
  border-color: var(--tb-border);
}

.hero-panel {
  background: var(--app-gradient);
  border: 1px solid var(--tb-border);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.06);
}

.hero-metric {
  background: var(--tb-hero-metric-bg);
  border: 1px solid var(--tb-border);
}

.hero-ip-box {
  max-width: 100%;
}

.hero-ip-value {
  font-size: clamp(1.75rem, 2.5vw + 1rem, 3.25rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-ip-value a {
  color: inherit;
}

.link-unstyled,
.link-unstyled:visited,
.link-unstyled:hover,
.link-unstyled:active {
  color: inherit;
  text-decoration: none;
}

.link-unstyled:hover {
  text-decoration: underline;
}

.small-detail-grid dt {
  font-weight: 600;
}

.raw-block {
  max-height: 24rem;
  overflow: auto;
  padding: 1rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 0.75rem;
}

.footer-attribution-list {
  display: grid;
  gap: 0.35rem;
  max-width: 42rem;
}

.footer-attribution-list a {
  color: inherit;
}

.site-footer {
  border-color: var(--tb-border) !important;
}

.result-table th {
  width: 28%;
  color: var(--tb-muted);
  font-weight: 600;
  vertical-align: top;
}

.result-table td {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
}

.copyable {
  cursor: pointer;
}

.badge-open { background-color: #198754; }
.badge-closed { background-color: #dc3545; }
.badge-filtered { background-color: #fd7e14; }
.badge-unknown { background-color: #6c757d; }

.tool-card-grid > .col {
  margin-bottom: 1rem;
}

/* Finance calculator stat cards: keep large numbers from breaking layout */
.finance-calc .display-5,
.finance-calc .display-6 {
  font-size: clamp(1rem, 1.4vw + 0.5rem, 2rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Target only the colored result stat cards (not plain input/chart cards) */
.finance-calc .card.bg-primary,
.finance-calc .card.bg-success,
.finance-calc .card.bg-warning,
.finance-calc .card.bg-info,
.finance-calc .card.bg-secondary,
.finance-calc .card.bg-danger,
.finance-calc .card.bg-dark,
.finance-calc .card.bg-light {
  height: 100%;
}

.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

.json-valid { color: #198754; }
.json-invalid { color: #dc3545; }

.oui-result,
.subnet-result {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.binary-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  line-height: 1.6;
}

.navbar .dropdown-menu {
  max-height: 80vh;
  overflow-y: auto;
}

.map-shell {
  min-height: 22rem;
  width: 100%;
  background-color: var(--tb-code-bg);
}

.map-shell .leaflet-control-attribution {
  font-size: 0.7rem;
}

.qr-image {
  image-rendering: pixelated;
  background: #fff;
  padding: .5rem;
  border-radius: .375rem;
  max-width: 100%;
}

.progress-log {
  max-height: 320px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem;
}

.chip {
  display: inline-block;
  padding: .15rem .5rem;
  margin: .1rem .15rem .1rem 0;
  border: 1px solid var(--tb-border);
  border-radius: 999px;
  font-size: .8rem;
}
