@import url('https://fonts.googleapis.com/css2?family=Hind:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --card: #1c202a;
  --text: #f5f6f9;
  --muted: #a1a8b3;
  --accent: #7cff4e;
  --accent-strong: #1c37ff;
  --btn: #d7a34a;
  --btn-strong: #9c6e20;
  --danger: #e7685d;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Hind', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.ambient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(124, 255, 78, 0.16), transparent 50%),
    radial-gradient(circle at 80% 10%, rgba(28, 55, 255, 0.18), transparent 45%),
    radial-gradient(circle at 20% 80%, rgba(124, 255, 78, 0.1), transparent 45%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.02), transparent 60%);
  z-index: -1;
}

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}


.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 18, 23, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-tools {
  display: none;
  align-items: center;
  gap: 10px;
}

.nav-mode-toggle {
  display: none;
}

.nav-toggle {
  display: none;
  padding: 6px 10px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
}

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

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.brand-title a {
  white-space: nowrap;
}

.beta {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.tag {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  font-weight: 600;
}

.nav a:hover {
  color: var(--text);
}

.user-trigger {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted);
  font-weight: 600;
}

.user-menu:hover .user-trigger,
.user-menu:focus-within .user-trigger {
  color: var(--text);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-link {
  color: var(--muted);
  font-weight: 600;
}

.nav-item:hover .nav-link,
.nav-item:focus-within .nav-link {
  color: var(--text);
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 8px 8px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 30;
}

.dropdown a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
}

.dropdown-action {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-weight: 600;
}

.dropdown a:hover {
  background: var(--surface-soft);
}

.dropdown-action:hover {
  background: var(--surface-soft);
}

.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  display: block;
}

.user {
  color: var(--muted);
  font-size: 0.9rem;
}

.search {
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

.search input {
  min-width: 200px;
}

.search-filter {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}

.search-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow);
  z-index: 20;
  display: none;
}

.search-suggest.is-open {
  display: block;
}

.suggest-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--text);
}

.suggest-item:hover {
  background: var(--surface-soft);
}

.suggest-type {
  font-size: 0.75rem;
  color: var(--muted);
}

.suggest-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  text-align: right;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filters input[type='search'] {
  min-width: 220px;
}

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

.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.5s ease both;
}

.card + .card {
  margin-top: 20px;
}

.card.compact {
  padding: 16px;
  box-shadow: none;
}

.card.narrow {
  max-width: 420px;
  margin: 40px auto;
}

.card.empty {
  text-align: center;
  padding: 40px;
}

.debug-box {
  margin: 16px 0 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: left;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: pre-wrap;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.stack-tight {
  gap: 8px;
  margin-bottom: 12px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.grid > .card {
  display: flex;
  flex-direction: column;
}

.grid > .card .actions {
  margin-top: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 6px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
  border-color: rgba(124, 255, 78, 0.4);
  transform: translateY(-1px);
}

.home-top {
  align-items: stretch;
}

.home-top[data-expanded="1"] {
  grid-template-columns: 1fr;
}

.home-top[data-expanded="1"] .home-stats {
  order: 2;
}

.flow-shell .flow-summary {
  display: none;
}

.flow-shell[data-expanded="0"] .flow-summary {
  display: block;
}

.flow-shell[data-expanded="0"] .flow-body {
  display: none;
}

.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
}

.stat-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.checkbox {
  gap: 4px;
}

.checkbox input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.checkbox small {
  color: var(--muted);
  font-weight: 400;
}

input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 255, 78, 0.25);
}

.btn {
  background: linear-gradient(120deg, var(--btn), var(--btn-strong));
  border: none;
  color: #241707;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-size: 0.9rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(215, 163, 74, 0.35);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.ghost.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(124, 255, 78, 0.25);
}

.btn.danger {
  background: var(--danger);
  color: #2b0f0c;
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn.icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  padding: 0;
  background: var(--surface-soft);
  color: var(--text);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.actions form {
  margin: 0;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 12px 0 16px;
}

.chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(124, 255, 78, 0.18);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.chip-alt {
  background: rgba(74, 168, 255, 0.18);
  color: #87c3ff;
}

.chip-muted {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.knowledge-type {
  border: none;
  cursor: pointer;
  padding: 3px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.knowledge-type.is-active {
  background: rgba(74, 168, 255, 0.25);
  color: #cfe6ff;
}

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

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
}

.flash.success {
  background: rgba(124, 255, 78, 0.2);
  color: #b9ff9e;
}

.flash.error {
  background: rgba(231, 104, 93, 0.2);
  color: #f0b3ac;
}

.param-table {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.param-head,
.param-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 40px;
  gap: 10px;
  align-items: center;
}

.param-head {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.param-row input {
  width: 100%;
}

.param-list {
  display: grid;
  gap: 10px;
}

.param-list.compact .param-item {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.param-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
}

.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.list-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.catalog-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 56px;
  border: 1px solid var(--border);
  background: #f1f1f1;
}

.catalog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.catalog-hero {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f1f1f1;
}

.catalog-hero img {
  width: 100%;
  height: auto;
  display: block;
}

.list li.is-compatible {
  border-color: rgba(124, 255, 78, 0.35);
  box-shadow: 0 0 0 1px rgba(124, 255, 78, 0.15) inset;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 1fr 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.table-row.head {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toggle-panel {
  display: none;
  margin: 12px 0 16px;
}

.toggle-panel.is-open {
  display: block;
}

.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

.knowledge-grid {
  align-items: start;
  grid-template-columns: minmax(220px, 320px) 1fr;
}

.knowledge-compare-table {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.knowledge-compare-table .row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  align-items: center;
}

.knowledge-compare-table .row.head {
  background: rgba(10, 18, 30, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
  font-weight: 700;
}

.knowledge-compare-table .row .muted {
  color: var(--muted);
}

.knowledge-compare-table .row .value {
  font-weight: 700;
  color: #cfe6ff;
}

.knowledge-compare-table .row .desc {
  grid-column: 1 / -1;
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 4px;
}

.selected-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.selected-tags .chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 980px) {
  .knowledge-compare-table .row {
    grid-template-columns: 1fr 1fr;
  }

  .knowledge-compare-table .row.head {
    grid-template-columns: 1fr 1fr;
  }
}
.knowledge-grid .card.compact {
  grid-column: 1 / -1;
}


.knowledge-guide {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.knowledge-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.knowledge-guide-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(10, 18, 28, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.knowledge-guide-item .label,
.knowledge-guide-sheets .label,
.knowledge-guide-icons .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.knowledge-guide-item .value {
  font-weight: 700;
  color: #d8e9ff;
}

.knowledge-guide-sheets,
.knowledge-guide-icons {
  display: grid;
  gap: 6px;
}

.sheet-grid,
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.sheet,
.icon-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(14, 22, 34, 0.5);
  border: 1px dashed rgba(255, 255, 255, 0.06);
}

.sheet .title,
.icon-item .title {
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.sheet .value,
.icon-item .value {
  font-weight: 700;
  color: #cfe6ff;
}

.knowledge-table {
  display: grid;
  gap: 16px;
}

.knowledge-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.knowledge-title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
}

.knowledge-caret {
  font-size: 1rem;
  color: var(--muted);
}

.knowledge-section.is-collapsed .knowledge-caret {
  transform: rotate(-90deg);
}

.knowledge-list {
  display: grid;
  gap: 10px;
}

.knowledge-item {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1.9fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.knowledge-name {
  font-weight: 700;
}

.knowledge-meta {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
}

.knowledge-value {
  font-weight: 700;
  color: #cfe6ff;
}

.knowledge-desc {
  font-size: 0.86rem;
  grid-column: 1 / -1;
}

.knowledge-edit {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.7fr 0.7fr auto;
  gap: 8px;
  margin-top: 8px;
}

.input.small {
  padding: 6px 8px;
  font-size: 0.8rem;
}

@media (max-width: 980px) {
  .knowledge-item {
    grid-template-columns: 1fr 1fr;
  }

  .knowledge-edit {
    grid-template-columns: 1fr 1fr;
  }
}

.knowledge-tags {
  gap: 6px;
}

@media (max-width: 720px) {
  .knowledge-table .table-row {
    min-width: 520px;
  }
}

.stock-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stock-filter-grid.is-hidden {
  display: none;
}

.catalog-filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.filter-letter {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
}

.filter-letter.active,
.filter-item.active {
  background: var(--accent);
  color: #061200;
  border-color: transparent;
}

.filter-item.active .filter-count {
  color: #061200;
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.view-sort-row {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sort-form {
  gap: 8px;
  align-items: center;
}

.sort-icon {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .view-sort-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .sort-form {
    width: 100%;
    justify-content: flex-start;
  }
}

.filter-item {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.filter-color > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-count {
  color: var(--muted);
  font-size: 0.75rem;
}

.filter-card.is-hidden {
  display: none;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.toggle input {
  appearance: none;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.toggle input:checked {
  background: rgba(124, 255, 78, 0.25);
  border-color: rgba(124, 255, 78, 0.45);
}

.toggle input:checked::after {
  transform: translateX(20px);
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  vertical-align: middle;
}

.info-button {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  cursor: help;
  position: relative;
}

.info-button:hover {
  color: var(--text);
  border-color: rgba(124, 255, 78, 0.4);
}

.info-button::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 12, 18, 0.95);
  color: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 5;
}

.info-button:hover::after,
.info-button:focus::after {
  opacity: 1;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.open-spools {
  display: grid;
  gap: 12px;
}

.open-spool-template {
  display: none;
}

.open-spool-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 40px;
  gap: 12px;
  align-items: end;
}

.printer-name-template {
  display: none;
}

.printer-name-rows {
  display: grid;
  gap: 12px;
}

.printer-name-rows label {
  margin: 0;
}

.printer-name-rows .btn.icon {
  align-self: end;
}

.modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, 0.75);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(720px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  z-index: 1;
}

.details {
  display: grid;
  gap: 12px;
}

.details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
}

.printer-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.printer-image {
  width: 160px;
  min-width: 160px;
  height: 160px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.printer-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

@media (max-width: 720px) {
  .printer-header {
    flex-direction: column;
  }
  .printer-image {
    width: 100%;
    height: auto;
    min-width: 0;
  }
  .printer-image img {
    width: 100%;
    height: auto;
  }
}

.list > li {
  position: relative;
}

.corner-flag {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 24px solid #7cff4e;
  border-left: 24px solid transparent;
  border-top-right-radius: 8px;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

.link-row:hover {
  color: var(--text);
}

.btn.danger {
  background: #8b1d2c;
  border-color: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.btn.danger:hover {
  background: #a32639;
  border-color: rgba(255, 255, 255, 0.2);
}

.text-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.text-link:hover {
  color: var(--text);
}

.text-link.danger {
  color: #fca5a5;
}

.text-link.danger:hover {
  color: #fecaca;
}

.result-block {
  margin-top: 20px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
}

.admin-nav a:hover {
  color: var(--text);
  border-color: rgba(124, 255, 78, 0.45);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 32px 32px;
  color: var(--muted);
  text-align: center;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .header-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search input {
    min-width: 160px;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .param-head,
  .param-row {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
  }

  .param-row button {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-tools {
    display: flex;
    justify-content: flex-end;
  }

  .nav {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    display: none;
  }

  .site-header.nav-open .nav {
    display: flex;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    width: 100%;
  }

  .search {
    width: 100%;
  }

  .search input {
    flex: 1;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .nav-tools {
    display: flex;
    justify-content: flex-end;
  }

  .nav-mode-toggle {
    display: inline-flex;
  }
}

body.force-mobile .site-header {
  align-items: stretch;
}

body.force-mobile .header-right {
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

body.force-mobile .nav-tools {
  display: flex;
  justify-content: flex-end;
}

body.force-mobile .nav-mode-toggle {
  display: inline-flex;
}

body.force-mobile .nav {
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  display: none;
}

body.force-mobile .site-header.nav-open .nav {
  display: flex;
}

body.force-mobile .nav-toggle {
  display: inline-flex;
}

/* Form helpers */
.required {
  color: var(--accent);
  margin-left: 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.bed-temp-field {
  overflow: hidden;
  transition: opacity 200ms ease, max-height 200ms ease, transform 200ms ease;
  max-height: 140px;
  opacity: 1;
  transform: translateY(0);
}

.bed-temp-field.is-hidden {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

/* Filaments page */
.filament-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 24px 28px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(0, 118, 122, 0.18), rgba(0, 118, 122, 0.05));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.filament-hero h1 {
  margin: 6px 0 4px;
  font-size: 2rem;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filament-controls .segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
}

.filament-controls .segmented .btn {
  border-radius: 999px;
  padding: 6px 12px;
}

.filament-controls .segmented .btn.active {
  background: var(--accent);
  color: #061200;
  border-color: transparent;
}

.filament-stock-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.filament-stock-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px 18px 18px 26px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}

.stock-color-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: 16px 0 0 16px;
}

.filament-stock-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-content: flex-start;
}

.filament-stock-card .chip {
  position: absolute;
  right: 16px;
  top: 16px;
}

.filament-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.filament-profile-card .card-header {
  gap: 8px;
  flex-wrap: wrap;
}

.filament-profile-card .meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 10px;
}

@media (max-width: 840px) {
  .filament-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .filament-stock-card {
    grid-template-columns: 1fr;
  }

  .filament-stock-card .actions {
    justify-content: flex-start;
  }
}
