/*
 * Wireless-Tag tools workspace theme.
 * Loaded after tools.css so the functional component rules stay intact while
 * the page receives one coherent, homepage-aligned visual system.
 */

.tools-shell {
  --tool-brand: #00569d;
  --tool-brand-dark: #004778;
  --tool-sky: #3399ff;
  --tool-sky-soft: #eef7fc;
  --tool-teal: #39b9ac;
  --tool-teal-soft: #ebf8f5;
  --tool-ink: #142b3a;
  --tool-muted: #60717e;
  --tool-line: #dde8eb;
  --tool-panel: #ffffff;
  --tool-panel-strong: #ffffff;
  --tool-soft: #f7fbfd;
  --tool-soft-2: #edf5f8;
  --tool-red: #c9443c;
  --tool-blue: var(--tool-brand);
  --tool-shadow: 0 8px 24px rgba(20, 73, 107, 0.05);
  min-height: 100vh;
  overflow: clip;
  padding: 0 0 24px;
  color: var(--tool-ink);
  background: #f7fbfd;
}

.dark .tools-shell {
  --tool-brand: #55b9ff;
  --tool-brand-dark: #8ed0ff;
  --tool-sky: #4bb8ff;
  --tool-sky-soft: #102b3f;
  --tool-teal: #54cbbf;
  --tool-teal-soft: #12342f;
  --tool-ink: #edf6fb;
  --tool-muted: #a9beca;
  --tool-line: #294555;
  --tool-panel: #132532;
  --tool-panel-strong: #183140;
  --tool-soft: #0f202c;
  --tool-soft-2: #17303f;
  --tool-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  background: #0b1720;
}

.tools-hero {
  width: 100%;
  min-height: 258px;
  position: relative;
  overflow: hidden;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--tool-ink);
  background:
    radial-gradient(circle at 84% 12%, rgba(51, 153, 255, 0.24), transparent 28%),
    radial-gradient(circle at 64% 90%, rgba(57, 185, 172, 0.13), transparent 28%),
    linear-gradient(145deg, #edf8ff 0%, #f8fcff 50%, #eef9f7 100%);
  box-shadow: none;
}

.tools-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.46;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 86, 157, 0.052) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 86, 157, 0.052) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.76), transparent 96%);
}

.tools-hero::after {
  content: "";
  width: 280px;
  height: 280px;
  position: absolute;
  right: max(4vw, calc((100% - 1200px) / 2));
  top: -70px;
  border: 1px solid rgba(51, 153, 255, 0.13);
  border-radius: 50%;
  pointer-events: none;
  box-shadow:
    0 0 0 42px rgba(51, 153, 255, 0.035),
    0 0 0 84px rgba(57, 185, 172, 0.025);
}

.dark .tools-hero {
  background:
    radial-gradient(circle at 84% 12%, rgba(51, 153, 255, 0.18), transparent 28%),
    radial-gradient(circle at 64% 90%, rgba(57, 185, 172, 0.1), transparent 28%),
    linear-gradient(145deg, #0a1d2c 0%, #0c1923 58%, #10231f 100%);
}

.tools-hero__inner {
  width: min(1200px, calc(100% - 48px));
  max-width: none;
  min-height: 258px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding: 38px 0 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 410px);
  gap: clamp(42px, 6vw, 76px);
  align-items: center;
}

#tools .tools-hero__inner {
  max-width: none;
}

.tools-hero__copy {
  max-width: 710px;
  min-width: 0;
}

.tools-hero .tools-kicker {
  width: fit-content;
  margin: 0 0 16px;
  padding: 7px 11px;
  border: 1px solid rgba(0, 86, 157, 0.16);
  border-radius: 999px;
  color: var(--tool-brand-dark);
  background: rgba(255, 255, 255, 0.74);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.dark .tools-hero .tools-kicker {
  background: rgba(18, 41, 56, 0.74);
}

.tools-hero h1 {
  margin: 0 0 13px;
  color: var(--tool-ink);
  font-size: clamp(40px, 4vw, 52px);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.045em;
  text-align: left;
}

.tools-hero p {
  max-width: 680px;
  margin: 0;
  color: var(--tool-muted);
  font-size: 15px;
  line-height: 1.7;
}

.tools-hero p a {
  color: var(--tool-brand);
  text-decoration-color: rgba(0, 86, 157, 0.34);
}

.tools-hero__visual {
  width: 100%;
  min-width: 0;
  position: relative;
}

.tools-hero__window {
  width: 100%;
  min-height: 168px;
  overflow: hidden;
  border: 1px solid rgba(0, 86, 157, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 36px rgba(20, 73, 107, 0.08);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-rows: 30px minmax(0, 1fr) auto;
}

.dark .tools-hero__window {
  background: rgba(19, 37, 50, 0.92);
}

.tools-hero__window-bar {
  padding: 0 14px;
  border-bottom: 1px solid rgba(0, 86, 157, 0.08);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tools-hero__window-bar span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 86, 157, 0.18);
}

.tools-hero__window-bar span:nth-child(2) {
  background: rgba(51, 153, 255, 0.46);
}

.tools-hero__window-bar span:nth-child(3) {
  background: rgba(57, 185, 172, 0.58);
}

.tools-hero__icon-grid {
  padding: 16px 18px 13px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
}

.tools-hero__tool {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 44px;
  position: relative;
  padding: 0;
  border: 1px solid rgba(0, 86, 157, 0.08);
  border-radius: 10px;
  color: var(--tool-brand);
  background: linear-gradient(145deg, #f5fbff, #edf7fc);
  display: grid;
  place-items: center;
  appearance: none;
  cursor: pointer;
  font: inherit;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.tools-hero__tool:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(51, 153, 255, 0.46);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(20, 73, 107, 0.1);
}

.tools-hero__tool.active,
.tools-hero__tool[aria-selected="true"] {
  border-color: var(--tool-sky);
  background: var(--tool-sky-soft);
  box-shadow:
    0 0 0 3px rgba(51, 153, 255, 0.14),
    0 8px 18px rgba(20, 73, 107, 0.09);
}

.tools-hero__tool::after {
  content: "";
  width: 6px;
  height: 6px;
  position: absolute;
  right: 5px;
  bottom: 5px;
  border-radius: 50%;
  background: var(--tool-sky);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.tools-hero__tool.active::after,
.tools-hero__tool[aria-selected="true"]::after {
  opacity: 1;
  transform: scale(1);
}

.tools-hero__tool:focus-visible {
  outline: 3px solid rgba(51, 153, 255, 0.42);
  outline-offset: 2px;
}

.tools-hero__tool:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.dark .tools-hero__tool {
  border-color: var(--tool-line);
  background: var(--tool-soft);
}

.dark .tools-hero__tool:hover:not(:disabled),
.dark .tools-hero__tool.active,
.dark .tools-hero__tool[aria-selected="true"] {
  border-color: var(--tool-sky);
  background: var(--tool-soft-2);
}

.tools-hero__icon-grid img {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.tools-hero__tool-label {
  width: 1px;
  height: 1px;
  overflow: hidden;
  position: absolute;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.tools-status {
  width: 100%;
  max-width: none;
  min-height: 48px;
  padding: 11px 16px 11px 42px;
  position: relative;
  border: 0;
  border-top: 1px solid rgba(0, 86, 157, 0.08);
  border-radius: 0;
  color: var(--tool-muted);
  background: rgba(238, 247, 252, 0.66);
  box-shadow: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.tools-status::before {
  content: "";
  width: 9px;
  height: 9px;
  position: absolute;
  left: 20px;
  top: 50%;
  border-radius: 50%;
  background: #9aabb6;
  box-shadow: 0 0 0 5px rgba(154, 171, 182, 0.14);
  transform: translateY(-50%);
}

.tools-status.is-supported::before {
  background: var(--tool-teal);
  box-shadow: 0 0 0 5px rgba(57, 185, 172, 0.14);
}

.tools-status.is-unsupported::before {
  background: var(--tool-red);
  box-shadow: 0 0 0 5px rgba(201, 68, 60, 0.12);
}

.dark .tools-status {
  background: rgba(15, 32, 44, 0.72);
}

.tools-main {
  width: min(1200px, calc(100% - 48px));
  margin: -34px auto 34px;
  position: relative;
  z-index: 3;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.tools-shared-panel {
  width: 100%;
  grid-column: 1;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid var(--tool-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 5px 16px rgba(20, 73, 107, 0.035);
  backdrop-filter: blur(14px);
}

.dark .tools-shared-panel {
  background: rgba(19, 37, 50, 0.97);
}

.shared-tool-actions {
  min-height: 50px;
  gap: 14px;
}

.shared-tool-summary {
  min-width: 0;
  position: relative;
  padding-left: 28px;
  gap: 3px;
}

.shared-tool-summary::before {
  content: "";
  width: 9px;
  height: 9px;
  position: absolute;
  left: 4px;
  top: 8px;
  border-radius: 50%;
  background: #9aabb6;
  box-shadow: 0 0 0 5px rgba(154, 171, 182, 0.12);
}

#shared-tool-actions[data-state="connected"] .shared-tool-summary::before {
  background: var(--tool-teal);
  box-shadow: 0 0 0 5px rgba(57, 185, 172, 0.14);
}

#shared-tool-actions[data-state="busy"] .shared-tool-summary::before {
  background: var(--tool-sky);
  box-shadow: 0 0 0 5px rgba(51, 153, 255, 0.14);
}

.shared-tool-summary strong {
  color: var(--tool-ink);
  font-size: 14px;
}

.shared-tool-summary span {
  color: var(--tool-muted);
  font-size: 11px;
}

.shared-tool-actions__buttons {
  flex: 0 0 auto;
  margin: 0;
  gap: 8px;
}

.shared-tool-actions__buttons .tool-btn {
  min-height: 38px;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 12px;
}

.shared-task-progress {
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid var(--tool-line);
}

.shared-task-progress .progress {
  margin-top: 0;
}

.tools-workbench {
  width: 100%;
  grid-column: 1;
  margin: 0;
  padding: 8px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tools-tabs-panel {
  width: 100%;
  grid-column: 1;
  margin: 0;
  position: static;
  padding: 0 0 14px;
  border: 0;
  border-bottom: 1px solid var(--tool-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.tool-list {
  width: 100%;
  padding: 0;
  overflow: visible;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  scroll-snap-type: none;
}

.tool-card,
.dark .tool-card {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--tool-muted);
  background: transparent;
  box-shadow: none;
  display: flex;
  justify-content: center;
  text-align: center;
  white-space: normal;
  transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.tool-card:hover {
  transform: none;
  border-color: transparent;
  color: var(--tool-brand);
  background: var(--tool-soft);
  box-shadow: none;
}

.tool-card img {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  padding: 5px;
  border-radius: 9px;
  background: var(--tool-sky-soft);
}

.tool-card__label {
  min-width: 0;
  color: inherit;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 800;
}

.tool-card.active,
.dark .tool-card.active {
  border-color: transparent;
  color: var(--tool-brand-dark);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--tool-brand);
}

.tool-card.active img,
.dark .tool-card.active img {
  background: var(--tool-sky-soft);
}

.dark .tool-card.active img {
  background: var(--tool-soft-2);
}

.workbench-head {
  grid-column: 1;
  margin: 0;
  padding: 0 4px 2px;
  display: block;
}

.workbench-head .tools-kicker {
  display: none;
}

.workbench-head h2 {
  margin: 0;
  color: var(--tool-ink);
  font-size: clamp(27px, 2.8vw, 32px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.workbench-head p {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--tool-muted);
  font-size: 13px;
  line-height: 1.65;
}

#tool-panel {
  min-width: 0;
  grid-column: 1;
}

.tool-grid {
  gap: 16px;
}

.flash-tool-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.tool-form,
.firmware-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--tool-line);
  border-radius: 14px;
  background: var(--tool-panel);
  box-shadow: 0 6px 20px rgba(20, 73, 107, 0.035);
}

.tool-form h3,
.firmware-card h3 {
  margin: 0 0 9px;
  color: var(--tool-ink);
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -0.012em;
}

.tool-form h4 {
  color: var(--tool-ink);
}

.tool-note,
.tool-form p,
.firmware-card p {
  color: var(--tool-muted);
}

#tool-panel[data-tool="erase"] .tool-form,
#tool-panel[data-tool="backup"] .tool-form,
#tool-panel[data-tool="chip-info"] .tool-form {
  width: min(860px, 100%);
  margin: 0 auto;
}

#tool-panel[data-tool="erase"] .tool-form {
  border-left: 4px solid var(--tool-red);
}

#tool-panel[data-tool="serial"] .tool-form {
  background: var(--tool-panel);
}

.tools-search input,
.field input,
.field select,
.official-firmware-search input,
.serial-input,
.device-state {
  min-height: 42px;
  border: 1px solid var(--tool-line);
  border-radius: 9px;
  color: var(--tool-ink);
  background: var(--tool-panel);
}

.dark .tools-search input,
.dark .field input,
.dark .field select,
.dark .official-firmware-search input,
.dark .serial-input,
.dark .device-state {
  background: var(--tool-soft-2);
}

.tools-search input:focus,
.field input:focus,
.field select:focus,
.official-firmware-search input:focus,
.serial-input:focus {
  border-color: var(--tool-sky);
  box-shadow: 0 0 0 3px rgba(51, 153, 255, 0.14);
}

.tool-btn,
.mini-btn {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--tool-line);
  border-radius: 9px;
  color: var(--tool-ink);
  background: var(--tool-panel);
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-btn:hover,
.mini-btn:hover {
  transform: none;
  border-color: rgba(0, 86, 157, 0.25);
  background: var(--tool-sky-soft);
  box-shadow: none;
}

.tool-btn.primary {
  border-color: var(--tool-brand);
  color: #ffffff;
  background: linear-gradient(135deg, var(--tool-brand), #0878c8);
  box-shadow: 0 7px 16px rgba(0, 86, 157, 0.15);
}

.tool-btn.danger {
  border-color: #b93630;
  color: #ffffff;
  background: linear-gradient(135deg, var(--tool-red), #b93630);
}

.tool-btn:disabled,
.mini-btn:disabled,
.shared-tool-actions .tool-btn:disabled {
  border-color: var(--tool-line);
  color: var(--tool-muted);
  background: var(--tool-soft-2);
  box-shadow: none;
  opacity: 0.62;
  transform: none;
}

.tool-btn.is-active,
.tool-btn.serial-timestamp-toggle.is-active,
.tool-btn.danger.serial-send-button {
  border-color: var(--tool-brand);
  color: #ffffff;
  background: linear-gradient(135deg, var(--tool-brand), #0878c8);
}

.tool-btn.is-active:disabled,
.tool-btn.danger.serial-send-button:disabled {
  border-color: var(--tool-line);
  color: var(--tool-muted);
  background: var(--tool-soft-2);
  box-shadow: none;
}

.mini-btn {
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 11px;
}

.official-firmware-form {
  border-color: rgba(0, 86, 157, 0.13);
  background: var(--tool-panel);
}

.official-firmware-controls {
  margin: 13px 0;
}

.official-firmware-count {
  color: var(--tool-brand);
}

.official-firmware-scroll {
  padding-right: 7px;
  scrollbar-color: rgba(0, 86, 157, 0.26) transparent;
}

.official-firmware-scroll::-webkit-scrollbar,
#tool-log::-webkit-scrollbar,
.serial-output::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.official-firmware-scroll::-webkit-scrollbar-thumb,
#tool-log::-webkit-scrollbar-thumb,
.serial-output::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(51, 153, 255, 0.32);
}

.firmware-list {
  gap: 9px;
}

.firmware-card {
  padding: 14px 2px;
  border: 0;
  border-top: 1px solid var(--tool-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.firmware-list .firmware-card:first-child {
  border-top: 0;
}

.firmware-card h3,
.firmware-card p,
.firmware-file-display strong,
.firmware-file-display small,
.firmware-picker__name {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.firmware-card h3,
.firmware-card > p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.firmware-card h3 {
  -webkit-line-clamp: 2;
}

.firmware-card > p {
  -webkit-line-clamp: 3;
}

.firmware-card .tool-actions {
  gap: 7px;
}

.badge {
  min-height: 22px;
  border: 1px solid rgba(0, 86, 157, 0.08);
  color: var(--tool-brand-dark);
  background: var(--tool-sky-soft);
  font-size: 10px;
}

.dark .badge {
  border-color: rgba(85, 185, 255, 0.14);
  color: var(--tool-brand);
  background: var(--tool-sky-soft);
}

.dark .tool-btn:not(.primary):not(.danger):not(.is-active):not(:disabled),
.dark .mini-btn:not(:disabled) {
  background: var(--tool-panel);
}

.firmware-empty,
.firmware-file-display,
.tool-diagnostics {
  border-color: var(--tool-line);
  border-radius: 11px;
  background: var(--tool-panel);
}

.firmware-picker__name {
  white-space: normal;
}

.flash-bin-section {
  border-top-color: var(--tool-line);
}

.progress {
  height: 7px;
  background: var(--tool-soft-2);
}

.progress span {
  background: linear-gradient(90deg, var(--tool-brand), var(--tool-sky), var(--tool-teal));
}

.info-table {
  border: 1px solid var(--tool-line);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.info-table tr:nth-child(even) {
  background: var(--tool-panel);
}

.info-table th,
.info-table td {
  border-bottom-color: var(--tool-line);
}

.tool-console {
  width: 100%;
  height: clamp(450px, 58vh, 600px);
  min-height: 0;
  max-height: none;
  grid-column: 1;
  margin: 2px 0 0;
  position: static;
  top: auto;
  padding: 14px;
  border: 1px solid var(--tool-line);
  border-radius: 14px;
  color: var(--tool-ink);
  background: var(--tool-panel);
  box-shadow: 0 6px 20px rgba(20, 73, 107, 0.035);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.console-head {
  min-height: 32px;
  margin-bottom: 9px;
  color: var(--tool-ink);
  font-size: 12px;
}

.console-actions {
  flex: 0 0 auto;
}

.tool-console .mini-btn {
  border-color: var(--tool-line);
  color: var(--tool-muted);
  background: var(--tool-soft);
}

#tool-log {
  min-height: 0;
  padding: 11px 12px;
  border: 1px solid #18394c;
  border-radius: 10px;
  color: #d8e8ef;
  background: #0c2230;
  font-size: 12px;
  line-height: 1.55;
}

#tool-log .tool-log-time {
  color: #7594a5;
}

.serial-output {
  height: clamp(300px, 36vh, 460px);
  border-color: #18394c;
  color: #d8e8ef;
  background: #0c2230;
  font-size: 12px;
  line-height: 1.55;
}

.serial-ansi-black {
  color: #b9cad3;
}

.serial-toolbar,
.serial-send-row {
  gap: 9px;
}

/* Keep the global navigation aligned with the homepage and docs palette. */
#tools #navbar {
  box-sizing: border-box;
  height: 64px;
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  align-items: center;
  border-bottom: 1px solid rgba(0, 86, 157, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 18px rgba(20, 43, 58, 0.055);
  backdrop-filter: blur(14px);
}

#tools #navbar ul {
  margin-top: 0;
  margin-bottom: 0;
}

#tools #navbar_menu,
#tools #navbar #navbar_items {
  height: 100%;
}

#tools #navbar_menu {
  margin-right: 16px;
  margin-left: 16px;
}

#tools #navbar #navbar_items {
  padding-right: 8px;
  align-items: center;
}

#tools #navbar .site_logo {
  height: 48px;
}

#tools #navbar a,
#tools #navbar a:visited,
#tools #navbar .sub_items > a {
  margin: 5px;
  padding: 8px;
  color: #60717e;
}

#tools #navbar a.site_title,
#tools #navbar a.site_title:visited {
  padding: 0;
}

#tools #navbar li > a:hover,
#tools #navbar .sub_items > a:hover {
  color: #00569d;
  background: #eef7fc;
}

#tools #navbar .active > a,
#tools #navbar .active_parent > a {
  color: #00569d;
  background: #eef7fc;
  font-weight: 700;
}

#tools #navbar .sub_items ul {
  border: 1px solid #dde8eb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(20, 43, 58, 0.08);
}

#tools #navbar #search {
  width: 260px;
  min-height: 40px;
  box-sizing: border-box;
  color: #142b3a;
  background: #f7fbfd;
  border: 1px solid #dde8eb;
  border-radius: 12px;
}

#tools #navbar #search:hover {
  color: #00569d;
  background: #eef7fc;
  border-color: #3399ff;
}

html#tools.dark #navbar {
  border-bottom-color: rgba(85, 185, 255, 0.1);
  background: rgba(11, 23, 32, 0.94);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

html#tools.dark #navbar a,
html#tools.dark #navbar a:visited,
html#tools.dark #navbar .sub_items > a {
  color: #a9beca;
}

html#tools.dark #navbar li > a:hover,
html#tools.dark #navbar .sub_items > a:hover,
html#tools.dark #navbar .active > a,
html#tools.dark #navbar .active_parent > a {
  color: #55b9ff;
  background: #102b3f;
}

html#tools.dark #navbar .active > a,
html#tools.dark #navbar .active_parent > a {
  font-weight: 700;
}

html#tools.dark #navbar .sub_items ul {
  border-color: #294555;
  background: #132532;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

html#tools.dark #navbar #search {
  color: #edf6fb;
  background: #0b1720;
  border-color: #294555;
}

html#tools.dark #navbar #search:hover {
  color: #55b9ff;
  background: #102b3f;
  border-color: #4bb8ff;
}

html#tools.dark #navbar .site_logo {
  filter: brightness(1.75) saturate(0.9);
}

#tools #page_content .tools-shell a,
#tools #page_content .tools-shell a:visited {
  color: var(--tool-brand);
}

#tools #page_content .tools-shell a.tool-btn,
#tools #page_content .tools-shell a.tool-btn:visited {
  color: var(--tool-ink);
  text-decoration: none;
}

#tools #page_content .tools-shell .firmware-card .tool-actions a.tool-btn,
#tools #page_content .tools-shell .firmware-card .tool-actions a.tool-btn:visited {
  color: var(--tool-brand);
  background: var(--tool-sky-soft);
  border-color: rgba(0, 86, 157, 0.16);
}

#tools #page_content .tools-shell a.tool-btn.primary,
#tools #page_content .tools-shell a.tool-btn.primary:visited {
  color: #ffffff;
}

@media screen and (min-width: 901px) and (max-width: 1250px) {
  #tools #navbar_menu {
    margin-right: 12px;
    margin-left: 12px;
  }

  #tools #navbar .site_logo {
    height: 40px;
  }

  #tools #navbar a,
  #tools #navbar .sub_items > a {
    margin: 2px;
    padding: 6px;
  }

  #tools #navbar a.site_title {
    padding: 0;
  }

  #tools #navbar #navbar_items {
    padding-right: 10px;
  }

  #tools #nav_right > li:nth-child(1) #search,
  #tools #navbar #search {
    width: 200px;
  }
}

@media screen and (min-width: 901px) and (max-width: 1100px) {
  #tools #nav_right > li:nth-child(1) #search,
  #tools #navbar #search {
    width: 38px;
    min-width: 38px;
    box-sizing: border-box;
    justify-content: center;
  }

  #tools #search .placeholder {
    display: none;
  }
}

@media screen and (min-width: 901px) and (max-width: 1000px) {
  #tools #navbar {
    align-items: center;
  }

  #tools #navbar #navbar_items {
    flex-direction: row;
    align-items: center;
  }

  #tools #navbar #navbar_items > div:last-child {
    align-self: center;
  }

  #tools #navbar h2,
  #tools #navbar #navbar_items > div ul {
    margin-top: 0;
    margin-bottom: 0;
  }
}

@media screen and (max-width: 900px) {
  #tools #navbar {
    height: 64px;
    min-height: 64px;
    display: block;
    align-items: normal;
    overflow: visible;
  }

  #tools #navbar_menu {
    height: 64px;
    margin-right: 12px;
    margin-left: 12px;
  }

  #tools #navbar #navbar_items {
    position: absolute;
    top: 64px;
    right: 0;
    left: 0;
    height: auto;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0;
    background: #ffffff;
    border-bottom: 1px solid #d9e8f0;
    box-shadow: 0 18px 36px rgba(8, 47, 77, .14);
    overscroll-behavior: contain;
  }

  html#tools.dark #navbar #navbar_items {
    background: #0b1720;
    border-bottom-color: #294555;
    box-shadow: 0 18px 36px rgba(0, 0, 0, .34);
  }
}

@media screen and (max-width: 1100px) {
  .tools-hero__inner {
    grid-template-columns: minmax(0, 1fr) minmax(310px, 360px);
    gap: 34px;
  }

  .tools-hero__icon-grid {
    gap: 6px;
  }
}

@media screen and (max-width: 1024px) and (min-width: 761px) {
  .flash-tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .official-firmware-form {
    height: auto !important;
    overflow: visible;
  }

  .official-firmware-scroll {
    max-height: 520px;
  }
}

@media screen and (max-width: 900px) {
  .tools-hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 52px;
  }

  .tools-hero__visual {
    width: auto;
    max-width: 100%;
    margin: 0;
  }

  .tools-hero__window {
    min-height: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    display: block;
  }

  .tools-hero__window-bar {
    display: none;
  }

  .tools-hero__icon-grid {
    width: 100%;
    padding: 10px 0 12px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
  }

  .tools-hero__tool {
    min-height: 54px;
    aspect-ratio: auto;
    gap: 4px;
    padding: 7px 4px;
    background: rgba(255, 255, 255, 0.74);
  }

  .dark .tools-hero__tool {
    background: rgba(19, 37, 50, 0.78);
  }

  .tools-hero__tool-label {
    width: auto;
    height: auto;
    overflow: visible;
    position: static;
    clip: auto;
    clip-path: none;
    color: var(--tool-muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  .tools-hero__tool.active .tools-hero__tool-label,
  .tools-hero__tool[aria-selected="true"] .tools-hero__tool-label {
    color: var(--tool-brand-dark);
  }

  .tools-status {
    width: fit-content;
    min-height: 34px;
    padding: 6px 11px 6px 32px;
    border-top: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    font-size: 10px;
  }

  .dark .tools-status {
    background: rgba(19, 37, 50, 0.72);
  }

  .tools-status::before {
    left: 13px;
  }

  .tool-list {
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    gap: 7px;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .tool-list::-webkit-scrollbar {
    display: none;
  }

  .tool-card,
  .dark .tool-card {
    width: auto;
    min-width: 132px;
    min-height: 50px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .tool-card img {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }
}

@media screen and (max-width: 760px) {
  .tools-shell {
    padding-bottom: 22px;
  }

  .tools-hero {
    min-height: 0;
  }

  .tools-hero::before {
    background-size: 34px 34px;
  }

  .tools-hero__inner {
    width: calc(100% - 28px);
    min-height: 0;
    padding: 28px 0 46px;
  }

  .tools-hero .tools-kicker {
    margin-bottom: 13px;
    padding: 6px 9px;
    font-size: 8px;
  }

  .tools-hero h1 {
    margin-bottom: 11px;
    font-size: 32px;
    line-height: 1.1;
  }

  .tools-hero p {
    font-size: 13px;
    line-height: 1.65;
  }

  .tools-hero__visual {
    max-width: none;
  }

  .tools-status {
    min-height: 32px;
    padding: 5px 10px 5px 30px;
    font-size: 10px;
  }

  .tools-status::before {
    left: 12px;
  }

  .tools-main {
    width: calc(100% - 24px);
    max-width: none;
    margin: -24px auto 28px;
    gap: 12px;
  }

  .tools-shared-panel {
    padding: 10px;
    border-radius: 13px;
  }

  .shared-tool-actions {
    align-items: stretch;
  }

  .shared-tool-actions__buttons {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shared-tool-actions__buttons .tool-btn:last-child {
    grid-column: auto;
  }

  .shared-tool-actions__buttons .tool-btn {
    min-width: 0;
    padding-right: 6px;
    padding-left: 6px;
    font-size: 11px;
    line-height: 1.2;
  }

  .tools-workbench {
    padding: 6px 0 0;
    border-radius: 0;
    gap: 14px;
  }

  .tools-tabs-panel {
    padding-bottom: 13px;
  }

  .tool-card,
  .dark .tool-card {
    min-width: 114px;
    min-height: 48px;
    padding: 7px 9px;
  }

  .workbench-head {
    padding: 0 2px;
  }

  .workbench-head h2 {
    font-size: 24px;
  }

  .workbench-head p {
    font-size: 12px;
  }

  .tool-form {
    padding: 14px;
    border-radius: 12px;
  }

  .firmware-card {
    padding: 13px 2px;
    border-radius: 0;
  }

  .flash-tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .official-firmware-form {
    height: auto !important;
    overflow: visible;
  }

  .official-firmware-scroll {
    max-height: 460px;
  }

  .console-actions .mini-btn {
    width: auto;
    min-width: 56px;
    min-height: 32px;
    flex: 0 0 auto;
  }

  .tool-console {
    height: 185px;
    padding: 12px;
    border-radius: 12px;
  }

  .serial-output {
    height: clamp(230px, 30vh, 310px);
  }

  .serial-toolbar__group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .serial-send-row {
    grid-template-columns: 44px minmax(92px, 1fr) auto;
  }

  .serial-send-text {
    grid-column: 1 / -1;
  }

  .firmware-card .tool-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .firmware-card .tool-actions .tool-btn {
    width: 100%;
    min-width: 0;
  }
}

@media screen and (max-width: 520px) {
  .tools-hero__icon-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tools-hero__tool {
    min-height: 66px;
  }

  .tools-main {
    width: calc(100% - 20px);
    margin-bottom: 34px;
  }

  .tools-hero h1 {
    font-size: 30px;
  }

  .shared-tool-actions__buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shared-tool-actions__buttons .tool-btn:last-child {
    grid-column: auto;
  }

  .tool-card,
  .dark .tool-card {
    min-width: 110px;
  }

  .tool-console {
    height: 175px;
  }

  .console-head {
    align-items: flex-start;
    gap: 8px;
  }

  .console-actions {
    gap: 5px;
  }

  .console-actions .mini-btn {
    min-width: 50px;
    padding-left: 7px;
    padding-right: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tools-hero__tool,
  .tools-hero__tool::after,
  .tool-card,
  .tool-btn,
  .mini-btn,
  .progress span {
    transition: none;
  }
}
