/* ── LAYOUT ── */
.layout {
  display: flex;
  min-height: calc(100vh - 56px);
  max-width: var(--content-max-width, 1280px);
  margin: 0 auto;
  width: 100%;
}

/* ── SIDEBAR ── */
aside {
  width: 240px; flex-shrink: 0; border-right: 1px solid var(--border);
  background: var(--surface); padding: 20px 16px; overflow-y: auto;
  position: sticky; top: 56px; max-height: calc(100vh - 56px);
}
.filter-group { margin-bottom: 22px; }
.filter-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 10px; }
.filter-search { width: 100%; padding: 7px 10px; font-family: 'DM Sans', sans-serif; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--faint); color: var(--text); outline: none; }
.filter-search:focus { border-color: var(--brass); }
.check-list { display: flex; flex-direction: column; gap: 5px; }
.check-item { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 0; }
.check-item input[type=checkbox] { accent-color: var(--brass); width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.check-item label { font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; width: 100%; }
.check-count { font-size: 11px; color: var(--muted); background: var(--faint); padding: 1px 6px; border-radius: 10px; }
.range-vals { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }
.dual-range-scale-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted);
  margin-top: 4px; user-select: none;
}
.dual-range-track-wrap {
  position: relative; height: 32px; margin: 2px 0 4px; touch-action: none;
  --dual-track-h: 6px; --dual-thumb: 18px;
}
.dual-range-track-bg {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  height: var(--dual-track-h); background: var(--faint); border-radius: 4px; pointer-events: none;
}
.dual-range-track-active {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: var(--dual-track-h); background: var(--brass); border-radius: 4px; pointer-events: none;
  left: 0; width: 100%; opacity: .95;
}
.dual-inp {
  position: absolute; left: 0; width: 100%; top: 0; height: 32px; margin: 0; padding: 0;
  background: transparent; pointer-events: none;
  -webkit-appearance: none; appearance: none;
}
.dual-inp::-webkit-slider-runnable-track {
  height: var(--dual-track-h); background: transparent; border: none;
}
.dual-inp::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--dual-thumb); height: var(--dual-thumb); border-radius: 50%;
  background: var(--brass); border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.18);
  margin-top: calc((var(--dual-track-h) - var(--dual-thumb)) / 2);
  cursor: grab; pointer-events: auto;
}
.dual-inp:active::-webkit-slider-thumb { cursor: grabbing; }
.dual-inp::-moz-range-track { height: var(--dual-track-h); background: transparent; border: none; }
.dual-inp::-moz-range-thumb {
  width: var(--dual-thumb); height: var(--dual-thumb); border-radius: 50%;
  background: var(--brass); border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.18);
  cursor: grab; pointer-events: auto;
}
.dual-inp::-moz-focus-outer { border: 0; }
.dual-inp:active::-moz-range-thumb { cursor: grabbing; }
.dual-range-current { text-align: center; margin-top: 2px; }
.depth-check { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.depth-btn { font-size: 11px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 20px; background: transparent; cursor: pointer; color: var(--muted); transition: .15s; font-family: 'DM Sans', sans-serif; }
.depth-btn.on { background: var(--brass); border-color: var(--brass); color: #fff; font-weight: 500; }
.clear-btn { width: 100%; margin-top: 4px; padding: 7px; font-family: 'DM Sans', sans-serif; font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; background: transparent; cursor: pointer; transition: .15s; }
.clear-btn:hover { background: var(--faint); }

/* ── MAIN CONTENT ── */
.main { flex: 1; padding: 20px 24px; overflow-x: auto; }
.db-page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; margin: 0 0 16px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.result-count { font-size: 13px; color: var(--muted); }
.result-count strong { color: var(--text); }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.sort-select { font-family: 'DM Sans', sans-serif; font-size: 13px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; outline: none; }
.view-btns { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-btn { padding: 6px 10px; background: transparent; border: none; cursor: pointer; color: var(--muted); transition: .15s; display: flex; align-items: center; }
.view-btn.active { background: var(--brass); color: #fff; }

/* ── TABLE VIEW ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 9px 12px; text-align: left; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--surface2); white-space: nowrap; cursor: pointer; user-select: none; }
thead th:hover { color: var(--text); }
thead th .sort-arrow { margin-left: 4px; opacity: .4; }
thead th.sorted .sort-arrow { opacity: 1; color: var(--brass); }
tbody tr { border-bottom: 1px solid var(--border); transition: .1s; }
tbody tr:hover { background: var(--brass-l); }
tbody tr.table-row-link { cursor: pointer; }
tbody tr.table-row-link td.actions { cursor: default; }
tbody td { padding: 10px 12px; vertical-align: middle; }
td.brand { font-weight: 500; }
td.model { font-family: 'DM Mono', monospace; font-size: 12px; }
td.num { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text); }
td.bar-cell { min-width: 90px; }
.mini-bar { height: 4px; background: var(--faint); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.mini-bar-fill { height: 100%; border-radius: 2px; background: var(--brass); }
.depth-pips { display: flex; gap: 3px; }
.dpip { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); border: 1px solid var(--border); }
.dpip.on { background: var(--brass); border-color: var(--brass); }
td.actions { white-space: nowrap; }
.add-btn { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 500; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; transition: .15s; white-space: nowrap; }
.add-btn:hover { background: var(--brass); border-color: var(--brass); color: #fff; }
.add-btn.in-compare { background: var(--brass-l); border-color: var(--brass-b); color: var(--brass-d); font-weight: 600; }
.add-btn.in-compare:hover { background: var(--red-l); border-color: var(--red); color: var(--red); }
.add-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── CARD VIEW ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.mp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: .15s; }
.mp-card:hover { border-color: var(--border2); box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.mp-card[data-product-url] { cursor: pointer; }
.mp-card.comparing { border-color: var(--brass); box-shadow: 0 0 0 2px var(--brass-b); }
.card-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.card-brand { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 2px; }
.card-model { font-family: 'DM Mono', monospace; font-size: 18px; font-weight: 500; }
.card-body { padding: 12px 14px; }
.card-spec { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; }
.card-spec-label { color: var(--muted); }
.card-spec-val { font-family: 'DM Mono', monospace; font-weight: 500; }
.card-foot { padding: 0 14px 14px; display: flex; align-items: center; justify-content: space-between; }
.card-tag { font-size: 10px; font-weight: 500; padding: 3px 9px; border-radius: 10px; }
.card-add { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 500; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; transition: .15s; }
.card-add:hover { background: var(--brass); border-color: var(--brass); color: #fff; }
.card-add.in-compare { background: var(--brass-l); border-color: var(--brass-b); color: var(--brass-d); }
.card-add:disabled { opacity: .35; cursor: not-allowed; }

/* ── COMPARE TRAY ── */
#compareTray { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 2px solid var(--brass); padding: 12px 24px; display: flex; align-items: center; gap: 16px; transform: translateY(100%); transition: transform .3s cubic-bezier(.25,.46,.45,.94); z-index: 200; box-shadow: 0 -4px 24px rgba(0,0,0,.1); }
#compareTray.visible { transform: translateY(0); }
.tray-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--brass); white-space: nowrap; }
.tray-slots { display: flex; gap: 10px; flex: 1; }
.tray-slot { flex: 1; min-width: 160px; max-width: 240px; background: var(--surface2); border: 1px dashed var(--border2); border-radius: var(--radius); padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tray-slot.filled { background: var(--brass-l); border: 1px solid var(--brass-b); }
.tray-slot-name { font-size: 13px; font-weight: 500; }
.tray-slot-sub { font-size: 11px; color: var(--muted); }
.tray-slot-empty { font-size: 12px; color: var(--muted); font-style: italic; }
.tray-remove { font-size: 16px; color: var(--muted); cursor: pointer; line-height: 1; padding: 2px; transition: .15s; background: none; border: none; font-family: sans-serif; }
.tray-remove:hover { color: var(--red); }
.tray-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tray-btn { font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500; padding: 9px 18px; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--muted); transition: .15s; }
.tray-btn:hover { background: var(--faint); }
.tray-btn.go { background: var(--brass); border-color: var(--brass); color: #fff; }
.tray-btn.go:hover { background: var(--brass-d); }
.tray-btn.go:disabled { opacity: .4; cursor: not-allowed; }

/* ── MOBILE SIDEBAR ── */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  aside { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; z-index: 200; padding: 60px 20px 20px; overflow-y: auto; }
  aside.is-open { display: block; }
  .filter-toggle { display: flex; align-items: center; gap: 6px; margin: 12px 16px 0; font-size: 13px; font-weight: 500; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
  .filter-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); padding: 4px 8px; }
  .main { width: 100%; }
}
@media (min-width: 769px) {
  .filter-toggle, .filter-close { display: none; }
}

/* ── MOBILE COMPARE TRAY ── */
@media (max-width: 768px) {
  .compare-tray-inner { flex-direction: column; gap: 10px; align-items: stretch; }
  .compare-tray-slot { min-width: 0; }
  .compare-tray-actions { justify-content: center; }
}
