:root {
  --bg: #f8fafb;
  --surface: #ffffff;
  --surface-muted: #f5f8f9;
  --surface-soft: #eef5f5;
  --surface-accent: #e7f2f2;
  --text: #102030;
  --muted: #647281;
  --line: #dbe5ea;
  --line-strong: #c8d5dd;
  --primary: #0f7c82;
  --primary-strong: #0a6166;
  --primary-soft: #dff1f1;
  --purple: #af76df;
  --blue: #4b95eb;
  --shadow-sm: 0 1px 2px rgba(8, 25, 33, 0.05);
  --shadow-md: 0 18px 44px rgba(12, 33, 40, 0.08);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at top left, rgba(15, 124, 130, 0.06), transparent 22%),
    linear-gradient(180deg, #fbfcfd 0%, var(--bg) 100%);
}

body.dark {
  --bg: #101718;
  --surface: #162022;
  --surface-muted: #1d282b;
  --surface-soft: #172729;
  --surface-accent: #123236;
  --text: #edf4f4;
  --muted: #9eb0b7;
  --line: #27353a;
  --line-strong: #31444a;
  --primary: #38b6be;
  --primary-strong: #67c6ce;
  --primary-soft: rgba(56, 182, 190, 0.16);
  --purple: #cb9ff0;
  --blue: #7ab4fb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.25);
  background:
    radial-gradient(circle at top left, rgba(56, 182, 190, 0.12), transparent 24%),
    linear-gradient(180deg, #101718 0%, #0c1213 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: 260px minmax(320px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 0 18px 0 26px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

body.dark .topbar {
  background: rgba(22, 32, 34, 0.92);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--primary);
}

.brand-mark svg {
  width: 38px;
  height: 38px;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.searchbar {
  position: relative;
  max-width: 548px;
  width: 100%;
  justify-self: center;
}

.searchbar input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 0 64px 0 48px;
  font-size: 15px;
  outline: none;
  box-shadow: var(--shadow-sm);
}

.searchbar input::placeholder {
  color: #7e8d98;
}

.searchbar svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.searchbar .kbd {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 34px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.theme-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.icon-inline {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.theme-toggle {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  padding: 3px;
  position: relative;
  cursor: pointer;
}

.theme-toggle::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  left: 3px;
  top: 3px;
  transition: transform 0.18s ease;
}

body.dark .theme-toggle::after {
  transform: translateX(20px);
}

.user-chip {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2c3f4e, #1f2e39);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) 308px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.sidebar,
.inspector {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
}

body.dark .sidebar,
body.dark .inspector {
  background: rgba(22, 32, 34, 0.88);
}

.sidebar {
  border-right: 1px solid var(--line);
  min-height: 0;
  height: 100%;
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.sidebar::-webkit-scrollbar,
.main-panel::-webkit-scrollbar,
.inspector::-webkit-scrollbar {
  width: 10px;
}

.sidebar::-webkit-scrollbar-thumb,
.main-panel::-webkit-scrollbar-thumb,
.inspector::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 34%, transparent);
  background-clip: padding-box;
}

.sidebar-section-title {
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-strong);
  margin: 2px 12px 2px;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-item:hover {
  background: var(--surface-muted);
}

.sidebar-item.active {
  background: linear-gradient(180deg, var(--primary-strong), var(--primary));
  border-color: rgba(8, 96, 102, 0.2);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 124, 130, 0.18);
}

.nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: inherit;
  flex: 0 0 auto;
}

.sidebar-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.12);
}

.nav-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.nav-desc {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.25;
  color: inherit;
  opacity: 0.78;
}

.pro-tip {
  margin-top: auto;
  background: linear-gradient(160deg, #0e7379, #08595d);
  color: #eef8f8;
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.pro-tip-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 10px;
}

.pro-tip p {
  margin: 0;
  line-height: 1.5;
  font-size: 13px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 0;
}

.footer-icon-row {
  display: flex;
  gap: 12px;
}

.footer-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.collapse-chip {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
}

.main-panel {
  min-height: 0;
  height: 100%;
  padding: 28px clamp(20px, 3vw, 36px) 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-title {
  margin: 4px 0 6px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.055em;
}

.page-subtitle {
  margin: 0;
  max-width: 760px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--muted);
}

.protocol-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.segmented-pill {
  min-width: 64px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.segmented-pill.active {
  background: linear-gradient(180deg, var(--primary-strong), var(--primary));
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.surface-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.input-card {
  padding: 18px;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #3f5561;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 154px;
  gap: 14px;
}

.cidr-input-wrap {
  position: relative;
}

.cidr-input {
  width: 100%;
  height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 48px 0 16px;
  background: #ffffff;
  color: #111827;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  outline: none;
}

body.dark .cidr-input {
  background: var(--surface-muted);
  color: var(--text);
}

.cidr-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 124, 130, 0.12);
}

.field-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.primary-action {
  height: 56px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--primary-strong), var(--primary));
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(15, 124, 130, 0.18);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.kpi-card {
  padding: 18px 16px 16px;
  min-height: 120px;
}

.kpi-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-icon {
  width: 26px;
  height: 26px;
  color: var(--primary);
}

.kpi-icon.purple {
  color: var(--purple);
}

.kpi-icon.blue {
  color: var(--blue);
}

.kpi-label {
  font-size: 14px;
  color: #4c5e6a;
}

.kpi-value {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.kpi-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.content-card {
  padding: clamp(18px, 2.3vw, 28px);
  margin-top: 20px;
}

.section-heading {
  margin: 0 0 14px;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.stat-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 12px;
  color: #2c3f4d;
}

.stat-line span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.octet-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.octet-card {
  min-height: 92px;
  border-radius: 10px;
  border: 1px solid #cfe3e7;
  background: linear-gradient(180deg, #edf8f7, #e4f1f0);
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
}

.octet-card.host {
  background: linear-gradient(180deg, #edf5fd, #e0eefb);
  border-color: #d2e3f6;
}

.octet-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-strong);
}

.octet-card.host .octet-value {
  color: var(--blue);
}

.octet-role {
  margin-top: 4px;
  font-size: 14px;
  color: var(--primary-strong);
}

.octet-card.host .octet-role {
  color: var(--blue);
}

.octet-separator {
  position: absolute;
  right: -7px;
  top: 18px;
  color: #b4cbd0;
  font-size: 28px;
}

.range-rail {
  margin: 10px 0 6px;
  position: relative;
  height: 30px;
}

.range-line {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 13px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 99%, #1f3140 100%);
}

.range-dot {
  position: absolute;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}

.range-dot.end {
  right: 20px;
  background: #1c2c39;
}

.range-dot.start {
  left: 20px;
}

.range-labels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  margin-top: 8px;
  gap: 14px;
}

.range-point {
  font-size: 12px;
  color: var(--muted);
}

.range-point strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--text);
}

.range-point.center {
  text-align: center;
}

.range-point.end {
  text-align: right;
}

.details-table-wrap {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.details-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
}

.details-table tr:last-child td {
  border-bottom: none;
}

.details-table td:nth-child(odd) {
  width: 22%;
  background: var(--surface-muted);
  color: #3c4f5b;
}

.details-table td:nth-child(even) {
  width: 28%;
}

.inspector {
  border-left: 1px solid var(--line);
  min-height: 0;
  height: 100%;
  padding: 20px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.inspector-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.inspector-stack {
  display: grid;
  gap: 20px;
}

.stack-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary-strong);
  text-transform: uppercase;
}

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

.action-btn {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #415361;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.action-btn:hover,
.export-btn:hover {
  background: var(--surface-muted);
}

.notes-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
}

.notes-box textarea {
  width: 100%;
  min-height: 112px;
  border: none;
  resize: vertical;
  outline: none;
  background: transparent;
  color: var(--text);
}

.notes-counter {
  display: block;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}

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

.export-btn {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #415361;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.saved-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #cbe2e7;
  background: linear-gradient(180deg, #f3fbfc, #edf7f8);
}

.saved-box-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #0a7480;
  margin-bottom: 8px;
}

.saved-box p {
  margin: 0 0 8px;
  color: #62828d;
  font-size: 14px;
}

.saved-box a {
  color: #0a7480;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.is-hidden {
  display: none;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: clamp(26px, 4vw, 44px);
  margin-bottom: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(15, 124, 130, 0.14), transparent 34%),
    linear-gradient(135deg, var(--surface), var(--surface-muted));
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-title {
  max-width: 780px;
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.07em;
}

.hero-copy {
  max-width: 700px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-action {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.tool-directory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.tool-card {
  min-height: 116px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.tool-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  flex: 0 0 auto;
}

.tool-card strong,
.tool-card small {
  display: block;
}

.tool-card strong {
  margin-bottom: 6px;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.tool-card small {
  color: var(--muted);
  line-height: 1.45;
}

.tool-content {
  max-width: 1080px;
  font-size: 15px;
}

.tool-content h2,
.tool-content h3 {
  margin: 28px 0 12px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.tool-content p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.tool-form,
.form-group,
.input-group,
.form-row {
  margin-bottom: 16px;
}

.tool-content label,
.tool-form label,
.form-group label,
.input-group label,
.form-row label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tool-content input,
.tool-content select,
.tool-content textarea,
.tool-form input,
.tool-form select,
.tool-form textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 13px;
  outline: none;
}

.tool-content textarea {
  min-height: 120px;
}

.tool-content input:focus,
.tool-content select:focus,
.tool-content textarea:focus,
.tool-form input:focus,
.tool-form select:focus,
.tool-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 124, 130, 0.12);
}

.tool-content button,
.btn,
.btn-primary,
.btn-secondary,
.tool-form button {
  min-height: 46px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--primary-strong), var(--primary));
  color: #ffffff;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.tool-content .btn-icon,
.btn-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--primary-strong);
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  box-shadow: none;
}

.tool-content .btn-icon:hover,
.btn-icon:hover {
  background: var(--primary-soft);
}

.btn-secondary {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--line);
}

.result-cards,
.card-grid,
#bw-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.results-area {
  display: block;
  max-width: 100%;
  margin-top: 20px;
  overflow-x: auto;
}

.result-item,
.result-card,
.card,
.output-area {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  padding: 14px;
  overflow-wrap: anywhere;
}

.output-area {
  min-height: 80px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.strength-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 10px;
}

.strength-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.label,
.result-card .label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-wrap,
.details-table-wrap {
  overflow-x: auto;
}

.tool-content table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 14px;
}

.tool-content th,
.tool-content td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.tool-content th {
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.row-flex,
.department-row,
.entry-row,
.record-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.row-flex > *,
.department-row > *,
.entry-row > *,
.record-row > * {
  flex: 1 1 140px;
}

.entry-row .small-input,
.record-row .small-input,
.department-row input[type="number"] {
  flex: 0 1 130px;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

pre,
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

pre {
  border-radius: 14px;
  background: #102030;
  color: #eef8f8;
  padding: 14px;
  overflow-x: auto;
}

@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .inspector {
    display: none;
  }

  .sidebar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .sidebar-section-title,
  .nav-copy,
  .pro-tip,
  .sidebar-footer {
    display: none;
  }

  .sidebar-item {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-width: 940px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark,
  .brand-mark svg {
    width: 32px;
    height: 32px;
  }

  .brand-name {
    font-size: 17px;
  }

  .searchbar {
    grid-column: 1 / -1;
    order: 3;
    max-width: none;
    justify-self: stretch;
  }

  .searchbar input {
    height: 40px;
    padding-left: 42px;
    font-size: 14px;
  }

  .searchbar .kbd {
    display: none;
  }

  .topbar-actions {
    justify-content: flex-end;
    gap: 8px;
  }

  .theme-cluster span,
  .icon-inline,
  .user-chip {
    display: none;
  }

  .theme-toggle {
    width: 44px;
    height: 26px;
  }

  .workspace {
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: block;
    height: auto;
    max-height: 118px;
    min-height: 0;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: auto;
  }

  .sidebar-section-title,
  .pro-tip,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    min-width: max-content;
  }

  .sidebar-item {
    flex: 0 0 178px;
    min-height: 66px;
    justify-content: flex-start;
    padding: 10px;
  }

  .nav-copy {
    display: block;
  }

  .nav-icon {
    width: 30px;
    height: 30px;
  }

  .main-panel {
    padding: 18px 14px 30px;
  }

  .page-header,
  .hero-panel,
  .input-row,
  .kpi-grid,
  .stat-line,
  .octet-grid,
  .range-labels {
    grid-template-columns: 1fr;
  }

  .page-header {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
  }

  .page-title {
    font-size: clamp(26px, 9vw, 34px);
    letter-spacing: -0.055em;
  }

  .page-subtitle,
  .hero-copy,
  .tool-content p {
    font-size: 14px;
    line-height: 1.6;
  }

  .content-card,
  .input-card {
    padding: 16px;
    border-radius: 14px;
  }

  .surface-card {
    box-shadow: var(--shadow-sm);
  }

  .protocol-switch {
    justify-self: start;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-panel {
    padding: 22px 18px;
  }

  .hero-title {
    font-size: clamp(32px, 11vw, 44px);
    letter-spacing: -0.065em;
  }

  .tool-directory {
    grid-template-columns: 1fr;
  }

  .tool-card {
    min-height: 92px;
    padding: 15px;
  }

  .kpi-card {
    min-height: auto;
  }

  .tool-content input,
  .tool-content select,
  .tool-content textarea,
  .tool-form input,
  .tool-form select,
  .tool-form textarea {
    min-height: 46px;
    font-size: 16px;
  }

  .tool-content button,
  .btn,
  .btn-primary,
  .btn-secondary,
  .tool-form button,
  .primary-action,
  .ghost-action {
    width: 100%;
    min-height: 46px;
  }

  .tool-content .btn-icon,
  .btn-icon {
    width: 42px;
    min-width: 42px;
    flex-basis: 42px;
  }

  .btn-group {
    display: grid;
    grid-template-columns: 1fr;
  }

  .entry-row,
  .record-row,
  .department-row,
  .row-flex {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .entry-row input,
  .record-row input,
  .department-row input,
  .row-flex input,
  .entry-row select,
  .record-row select,
  .department-row select,
  .row-flex select {
    min-width: 0;
  }

  .entry-row .small-input,
  .record-row .small-input,
  .department-row input[type="number"] {
    flex: 1 1 auto;
  }

  .tool-content table {
    min-width: 620px;
    font-size: 13px;
  }

  .details-table td {
    display: block;
    width: 100%;
  }

  .details-table td:nth-child(odd) {
    padding-bottom: 6px;
  }

  .details-table td:nth-child(even) {
    padding-top: 0;
  }
}

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

  .main-panel {
    padding: 14px 10px 24px;
  }

  .sidebar {
    max-height: 104px;
    padding: 8px 10px;
  }

  .sidebar-item {
    flex-basis: 154px;
    min-height: 58px;
  }

  .nav-icon {
    display: none;
  }

  .nav-label {
    font-size: 12.5px;
  }

  .nav-desc {
    font-size: 11.5px;
  }

  .content-card,
  .input-card,
  .hero-panel {
    padding: 14px;
  }

  .entry-row,
  .record-row,
  .department-row,
  .row-flex {
    grid-template-columns: 1fr 42px;
  }

  .tool-content table {
    min-width: 560px;
  }
}
