/* =====================================================================
 *  configurator — visual identity
 *  monochrome dark, sharp typography, technical density,
 *  no gradients, no fluff, no AI tells.
 * ===================================================================== */

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

html, body {
  height: 100%;
}

:root {
  --bg:        #0a0a0a;
  --surface:   #111111;
  --surface-2: #1a1a1a;
  --line:      #232323;
  --line-soft: #1c1c1c;
  --text:      #e8e8e8;
  --text-soft: #a8a8a8;
  --text-faint:#6a6a6a;
  --accent:    #d4a356;          /* единственный «тёплый» оттенок */
  --accent-2:  #af813c;
  --ok:        #5fb86d;
  --warn:      #d4a356;
  --err:       #d44d3d;
  --info:      #6798d4;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow:    0 8px 32px rgba(0,0,0,.55);
}

body {
  font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--accent); color: #000; }

button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; background: transparent; border: 0; outline: 0; }

/* =================== TOPBAR =================== */

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,10,10,.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  user-select: none;
}
.brand-mark {
  color: var(--accent);
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
}
.brand-name {
  font-weight: 600;
  letter-spacing: -.01em;
  font-size: 17px;
}
.brand-host {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-faint);
}

.nav {
  display: flex;
  gap: 4px;
  justify-self: center;
}
.nav-tab {
  padding: 8px 14px;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-weight: 500;
  font-size: 14px;
  transition: color .15s, background .15s;
}
.nav-tab:hover { color: var(--text); background: var(--surface); }
.nav-tab.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* =================== BUTTONS =================== */

.btn {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: .01em;
  transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text-soft);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); background: var(--surface); }
.btn-danger { color: #b87b78; }
.btn-danger:hover { color: var(--err); border-color: var(--err); }
.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover { background: #ffffff; }

/* =================== LAYOUT =================== */

.view { display: none; flex: 1; min-height: 0; }
.view.is-active { display: grid; }

.layout {
  grid-template-columns: 320px 1fr 360px;
  gap: 0;
  height: calc(100vh - 60px);
  min-height: 600px;
}

.col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}
.col:last-child { border-right: 0; border-left: 1px solid var(--line); }

.col-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.col-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.col-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-faint);
}

/* =================== SLOTS =================== */

.slots {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
}
.slot {
  position: relative;
  margin-bottom: 4px;
}
.slot-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.slot-btn:hover { background: var(--surface); border-color: var(--line); }
.slot.is-current .slot-btn {
  background: var(--surface);
  border-color: var(--accent);
}
.slot.is-empty .slot-value { color: var(--text-faint); font-style: italic; }

/* Точка-статус слота вместо номера. Без чисел = без AI-следов */
.slot-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  opacity: .35;
  align-self: center;
  justify-self: center;
}
.slot.is-filled .slot-icon { background: var(--ok); opacity: 1; }
.slot.is-issue  .slot-icon { background: var(--err); opacity: 1; }

.slot-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.slot-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
}
.slot-value {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  margin-top: 2px;
}
.slot-price {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text-soft);
}
.slot-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 14px;
  color: var(--text-faint);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.slot:hover .slot-clear { opacity: 1; }
.slot-clear:hover { color: var(--err); }

/* =================== CATALOG =================== */

.col-catalog { background: var(--bg); }
.catalog-head {
  padding: 18px 26px 16px;
  border-bottom: 1px solid var(--line);
}
.catalog-head-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.catalog-head h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.01em;
}

/* Toggle "Только совместимые" */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  width: 32px;
  height: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  transition: background .15s, border-color .15s;
}
.toggle-thumb {
  width: 12px; height: 12px;
  background: var(--text-faint);
  border-radius: 50%;
  transition: transform .15s, background .15s;
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(14px); background: #000; }
.toggle-label {
  font-size: 13px;
  color: var(--text-soft);
}

/* Активные фильтры (бейджи под поиском) */
.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  min-height: 1px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-soft);
  background: var(--surface);
}
.filter-chip b { color: var(--accent); font-weight: 500; }
.filter-chip-clear {
  font-size: 14px;
  color: var(--text-faint);
  margin-left: 2px;
  line-height: 1;
}
.filter-chip-clear:hover { color: var(--err); }

/* Карточка кандидата выделяется когда уже выбрана */
.product.is-current {
  border-color: var(--accent);
  background: var(--surface-2);
  position: relative;
}
.product.is-current::before {
  content: "выбрано";
  position: absolute;
  top: 12px; right: 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  font-weight: 500;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}
.search input {
  flex: 1;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.search input:focus { border-color: var(--text-faint); background: var(--surface-2); }
.search-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}
.select-pill {
  padding: 8px 12px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-soft);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%),
                    linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}
.select-pill:hover { color: var(--text); border-color: var(--text-faint); }
.select-pill:focus { outline: 0; border-color: var(--accent); color: var(--text); }

.catalog-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 26px;
  display: grid;
  gap: 10px;
}

.product {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.product:hover { border-color: var(--text-faint); background: var(--surface-2); }
.product-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 11px;
}
.product-brand {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
}
.product-price {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-weight: 500;
}
.product-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}
.product-meta {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.product-specs {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 4px 16px;
  font-size: 12px;
  margin-bottom: 12px;
}
.product-specs li { color: var(--text-soft); }
.product-specs li b { color: var(--text); font-weight: 500; }
.product-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.qty-control {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.qty-btn {
  padding: 6px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
}
.qty-btn:hover { background: var(--surface-2); color: var(--accent); }
.qty-val {
  min-width: 28px;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--text);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 6px 0;
}

.catalog-pager {
  padding: 12px 26px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =================== SUMMARY =================== */

.summary {
  padding: 22px 22px;
  overflow-y: auto;
  flex: 1;
}
.sum-block { margin-bottom: 22px; }
.sum-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.sum-value {
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -.01em;
}
.sum-value.with-status {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.sum-status {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-family: "Inter Tight";
  font-weight: 500;
}
.s-ok { color: var(--ok); }
.s-warn { color: var(--warn); }
.s-err { color: var(--err); }

.sum-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.sum-row:last-child { border-bottom: 0; }
.sum-row .l { color: var(--text-soft); }
.sum-row .v { color: var(--text); font-family: "JetBrains Mono", monospace; }

.compat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.compat-item {
  border-left: 2px solid var(--line);
  padding: 8px 12px;
  font-size: 13px;
  background: var(--surface);
}
.compat-item.kind-error   { border-color: var(--err);  }
.compat-item.kind-warning { border-color: var(--warn); }
.compat-item.kind-ok      { border-color: var(--ok);   }
.compat-title {
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.compat-title::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.kind-error .compat-title { color: var(--err); }
.kind-warning .compat-title { color: var(--warn); }
.kind-ok .compat-title { color: var(--ok); }
.compat-text { color: var(--text-soft); font-size: 12px; line-height: 1.45; }

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.summary-actions .btn { padding: 11px; }

/* =================== PRESETS / RECENT ============== */

.col-full {
  grid-column: 1 / -1;
  padding: 36px 56px;
  overflow-y: auto;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.page-lead {
  color: var(--text-soft);
  margin-bottom: 32px;
  font-size: 15px;
  max-width: 720px;
}
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.preset {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
  background: var(--surface);
}
.preset:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.preset-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.preset-name {
  font-size: 16px;
  font-weight: 600;
}
.preset-budget {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-weight: 500;
}
.preset-desc {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.45;
  margin-bottom: 14px;
}
.preset-stats {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.preset-stats b { color: var(--text-soft); font-family: "JetBrains Mono", monospace; }

.recent-list { display: grid; gap: 10px; }
.recent-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 18px;
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color .15s;
}
.recent-card:hover { border-color: var(--accent); }
.recent-name { font-weight: 500; }
.recent-meta { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--text-faint); }

/* =================== ABOUT =================== */
.about p { font-size: 15px; line-height: 1.6; max-width: 720px; margin-bottom: 16px; color: var(--text-soft); }
.about h3 { font-size: 16px; margin: 24px 0 12px; }
.checks, .muted-list { padding-left: 20px; }
.checks li, .muted-list li { font-size: 14px; margin-bottom: 6px; line-height: 1.5; }
.checks li { color: var(--text); }
.muted-list li, .muted { color: var(--text-faint); }
.checks li b { color: var(--accent); font-weight: 500; }

/* =================== MODAL =================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px 28px;
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h3 {
  font-size: 18px;
  margin-bottom: 14px;
  letter-spacing: -.01em;
}
.modal label {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
  margin-top: 14px;
}
.modal input, .modal select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.modal-detail-pairs {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 13px;
  margin: 12px 0 16px;
}
.modal-detail-pairs li {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line-soft);
}
.modal-detail-pairs li b { color: var(--text-soft); font-weight: 500; }
.modal-detail-pairs li span { color: var(--text); font-family: "JetBrains Mono", monospace; word-break: break-word; }

.share-link {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  word-break: break-all;
  color: var(--accent);
}

/* =================== UTIL =================== */
.muted { color: var(--text-faint); }

/* Scrollbars (subtle dark) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
::-webkit-scrollbar-track { background: transparent; }

/* Responsive */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 280px 1fr 320px; }
}
@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; }
  .col { border-right: 0; border-bottom: 1px solid var(--line); }
  .col:last-child { border-left: 0; }
  .nav { display: none; }
}
