/* ============================================================
   Approved Materials Registry
   Palette: charcoal ground, signal-amber accent (approval stamp),
   slate-blue secondary. Body: IBM Plex Sans. Data: IBM Plex Mono.
   ============================================================ */

:root{
  --ink:        #14181f;
  --panel:      #1b212b;
  --panel-2:    #212834;
  --line:       #2c3341;
  --line-soft:  #262d38;
  --text:       #e8e9ec;
  --text-dim:   #9aa3b2;
  --text-faint: #616a79;
  --amber:      #e8a33d;
  --amber-dim:  #6b551f;
  --slate-blue: #6f93c9;
  --radius:     3px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*{ box-sizing: border-box; }
html{ color-scheme: dark; }
body{
  margin:0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}
::selection{ background: var(--amber-dim); color: #fff; }

a{ color: inherit; }

/* ---------- Topbar ---------- */
.topbar{
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top:0; z-index: 20;
}
.topbar-inner{
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand-mark{ color: var(--amber); flex: none; }
.brand-text{ display:flex; flex-direction:column; line-height:1.25; }
.brand-title{ font-weight:600; font-size:16px; letter-spacing:.2px; }
.brand-sub{ font-size:11.5px; color: var(--text-dim); letter-spacing:.3px; text-transform: uppercase; }
.topbar-stat{ text-align:right; font-family: var(--mono); flex: none; }
.stat-num{ display:block; font-size:20px; font-weight:600; color: var(--amber); }
.stat-label{ display:block; font-size:10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing:.5px; }

/* ---------- Layout ---------- */
.layout{
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

/* ---------- Filters (sidebar) ---------- */
.filters{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.filters-block + .filters-block{ margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.filters-heading{
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-faint);
  font-weight: 600;
  display:flex; align-items:center; gap:8px;
}
.count-pill{
  background: var(--amber-dim); color: var(--amber);
  font-family: var(--mono); font-size: 10px; padding: 1px 6px; border-radius: 10px;
}

.search-box{ position:relative; }
.search-icon{ position:absolute; left:10px; top:50%; transform:translateY(-50%); color: var(--text-faint); }
#qInput{
  width:100%;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 10px 9px 32px;
  font-size: 13.5px;
  font-family: var(--sans);
}
#qInput:focus{ outline: none; border-color: var(--amber); }

.cat-list{ display:flex; flex-direction:column; gap:2px; max-height: 380px; overflow-y:auto; }
.cat-item{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  background: none; border: none; color: var(--text-dim);
  text-align:left; padding: 6px 8px; border-radius: var(--radius);
  font-size: 12.5px; cursor:pointer; font-family: var(--sans);
}
.cat-item:hover{ background: var(--panel-2); color: var(--text); }
.cat-item.is-active{ background: var(--amber-dim); color: var(--amber); font-weight:600; }
.cat-name{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cat-count{ font-family: var(--mono); font-size: 11px; color: inherit; opacity:.8; flex:none; }

#mfrSelect{
  width:100%;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--sans);
}

.btn-reset{
  margin-top: 20px;
  width:100%;
  background: none;
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--sans);
}
.btn-reset:hover{ border-color: var(--amber); color: var(--amber); }

/* ---------- Results ---------- */
.results-toolbar{
  display:flex; align-items:center; gap:14px; margin-bottom: 12px; flex-wrap: wrap;
}
.results-summary{ color: var(--text-dim); font-size: 12.5px; flex: 1; }
.results-summary strong{ color: var(--text); font-weight:600; }
.toolbar-actions{ display:flex; gap:8px; align-items:center; }
#perPageSelect{
  background: var(--panel); border:1px solid var(--line); color: var(--text-dim);
  padding: 7px 9px; border-radius: var(--radius); font-size: 12px; font-family: var(--sans);
}
.btn-export{
  background: var(--panel); border:1px solid var(--line); color: var(--slate-blue);
  padding: 7px 12px; border-radius: var(--radius); font-size: 12px; text-decoration:none;
  font-weight: 600; white-space: nowrap;
}
.btn-export:hover{ border-color: var(--slate-blue); }

.btn-filters-toggle{
  display:none;
  background: var(--panel); border:1px solid var(--line); color: var(--text);
  padding: 7px 12px; border-radius: var(--radius); font-size: 12px; cursor:pointer; font-family: var(--sans);
}

.active-chips{ display:flex; gap:6px; flex-wrap:wrap; margin-bottom: 10px; }
.chip{
  display:flex; align-items:center; gap:6px;
  background: var(--panel-2); border:1px solid var(--line);
  color: var(--text-dim); font-size:11.5px; padding: 4px 8px; border-radius: 12px;
}
.chip button{ background:none; border:none; color: var(--text-faint); cursor:pointer; font-size: 13px; line-height:1; padding:0; }
.chip button:hover{ color: var(--amber); }

.table-wrap{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.reg-table{ width:100%; border-collapse: collapse; }
.reg-table thead th{
  text-align:left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-faint);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  position: sticky; top: 0;
}
.reg-table tbody td{
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  font-size: 13px;
}
.reg-table tbody tr:hover{ background: var(--panel-2); }
.reg-table tbody tr:last-child td{ border-bottom: none; }
.col-model{ font-family: var(--mono); font-size: 12px; color: var(--slate-blue); white-space: nowrap; }
.col-mfr{ color: var(--text-dim); white-space: nowrap; }
.col-cat{ white-space: nowrap; }
.cat-badge{
  font-size: 10.5px; font-family: var(--mono);
  color: var(--amber); background: var(--amber-dim);
  padding: 2px 7px; border-radius: 10px;
}
mark{ background: var(--amber-dim); color: var(--amber); padding: 0 1px; border-radius: 2px; }

.empty-state{ padding: 60px 20px; text-align:center; }
.empty-title{ font-weight:600; font-size:15px; margin: 0 0 6px; }
.empty-body{ color: var(--text-dim); font-size: 13px; margin:0; }

.pagination{
  display:flex; align-items:center; justify-content:center; gap:6px;
  margin-top: 18px; flex-wrap: wrap;
}
.pagination button{
  background: var(--panel); border:1px solid var(--line); color: var(--text-dim);
  min-width: 32px; height: 32px; border-radius: var(--radius);
  cursor:pointer; font-size: 12.5px; font-family: var(--mono);
}
.pagination button:hover:not(:disabled){ border-color: var(--amber); color: var(--amber); }
.pagination button.is-active{ background: var(--amber-dim); border-color: var(--amber); color: var(--amber); font-weight:600; }
.pagination button:disabled{ opacity:.35; cursor:default; }
.pagination .ellipsis{ color: var(--text-faint); padding: 0 4px; font-family: var(--mono); }

.footer{
  max-width: 1400px; margin: 8px auto 40px; padding: 0 24px;
  display:flex; justify-content:space-between;
  color: var(--text-faint); font-size: 11px;
}

/* ---------- Responsive ---------- */
@media (max-width: 880px){
  .layout{ grid-template-columns: 1fr; }
  .filters{
    position: fixed; inset: 0 0 0 auto; width: min(320px, 86vw);
    max-height: none; height: 100vh; z-index: 40;
    transform: translateX(100%); transition: transform .2s ease;
    border-radius: 0; border-left: 1px solid var(--line);
  }
  .filters.is-open{ transform: translateX(0); }
  .btn-filters-toggle{ display:inline-block; }
  .col-cat{ display:none; }
  .table-wrap{ overflow-x:auto; }
}
