:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-muted: #eef1f3;
  --surface-strong: #182028;
  --text: #182028;
  --text-muted: #68737d;
  --border: #d8dee3;
  --border-strong: #aeb8c0;
  --accent: #087f5b;
  --accent-strong: #056247;
  --accent-soft: #dff5ec;
  --signal: #f4b942;
  --danger: #c53d3d;
  --shadow: 0 12px 32px rgba(20, 32, 43, 0.1);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10161b;
  --surface: #182028;
  --surface-muted: #222c34;
  --surface-strong: #f4f7f8;
  --text: #edf2f4;
  --text-muted: #aab4bc;
  --border: #34414b;
  --border-strong: #596873;
  --accent: #45c79b;
  --accent-strong: #76dfba;
  --accent-soft: #163d32;
  --signal: #f4b942;
  --danger: #ff8585;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1500px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-left: 4px solid var(--signal);
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 800;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 16px;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

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

.icon-button,
.page-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.icon-button:hover,
.page-button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-muted);
}

main {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
}

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.8fr);
  gap: 48px;
  align-items: end;
  padding: 46px 0 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.overview h1 {
  max-width: 720px;
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
}

.overview-copy > p:last-child {
  max-width: 700px;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border);
}

.stat-strip div {
  min-width: 0;
  padding: 16px 18px;
  border-left: 1px solid var(--border);
}

.stat-strip div:first-child {
  border-left: 0;
}

.stat-strip dt {
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.stat-strip dd {
  margin: 0;
  font-size: 24px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.workspace {
  padding-bottom: 32px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  height: 50px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 0 rgba(20, 32, 43, 0.03);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-symbol {
  width: 48px;
  color: var(--text-muted);
  font-size: 25px;
  text-align: center;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 44px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.clear-button {
  position: absolute;
  right: 8px;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 18px;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.text-button {
  align-self: end;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.text-button:hover {
  background: var(--accent-soft);
}

.type-filter {
  display: flex;
  gap: 6px;
  margin: 18px 0 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.type-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  white-space: nowrap;
}

.type-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.type-chip[aria-pressed="true"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.type-chip .count {
  margin-left: 7px;
  opacity: 0.68;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(3, minmax(150px, 0.7fr)) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.filter-bar label {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

select {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  gap: 20px;
}

.result-bar p {
  margin: 0;
  color: var(--text-muted);
}

.result-bar strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.page-size-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.page-size-label select {
  width: 86px;
  height: 34px;
}

.table-shell {
  position: relative;
  min-height: 420px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-muted);
}

th {
  height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

th:nth-child(1) { width: 23%; }
th:nth-child(2) { width: 16%; }
th:nth-child(3) { width: 13%; }
th:nth-child(4) { width: 15%; }
th:nth-child(5) { width: 13%; }
th:nth-child(6) { width: 15%; }
th:nth-child(7) { width: 48px; }

td {
  height: 58px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

tbody tr {
  cursor: pointer;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover,
tbody tr:focus-visible {
  outline: 0;
  background: var(--accent-soft);
}

.device-name {
  color: var(--text);
  font-weight: 700;
}

.model-code,
.code-value {
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.brand-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-color);
}

.type-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 11px;
}

.badge-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.form-factor-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.row-action {
  color: var(--accent);
  font-size: 20px;
  text-align: center;
}

.empty-state {
  position: absolute;
  inset: 44px 0 0;
  align-content: center;
  padding: 40px;
  text-align: center;
}

.empty-state:not([hidden]) {
  display: grid;
}

.empty-state strong {
  font-size: 18px;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px 0 0;
}

.pagination span {
  min-width: 120px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.page-button {
  font-size: 22px;
}

.page-button:disabled {
  cursor: default;
  opacity: 0.38;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1500px, calc(100% - 40px));
  min-height: 80px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

footer p {
  margin: 0;
}

footer a:hover {
  color: var(--accent);
}

.detail-dialog {
  width: min(620px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.3);
}

.detail-dialog::backdrop {
  background: rgba(10, 15, 20, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.detail-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}

.detail-item {
  min-width: 0;
  padding: 18px 24px;
  background: var(--surface);
}

.detail-item.full {
  grid-column: 1 / -1;
}

.detail-item dt {
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.detail-item dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.5;
}

.detail-item dd.empty-value {
  color: var(--text-muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
}

.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;
}

noscript {
  display: block;
  padding: 20px;
  background: #fff2cf;
  color: #583b00;
  text-align: center;
}

@media (max-width: 920px) {
  .overview {
    grid-template-columns: 1fr;
    gap: 26px;
  }

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

  .text-button {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .header-inner,
  main,
  footer {
    width: min(100% - 24px, 1500px);
  }

  .overview {
    padding: 30px 0 24px;
  }

  .overview h1 {
    font-size: 25px;
  }

  .stat-strip div {
    padding: 13px 10px;
  }

  .stat-strip dd {
    font-size: 19px;
  }

  .search-row,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .primary-button {
    min-height: 44px;
  }

  .result-bar {
    align-items: flex-start;
    padding: 12px 0;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }

  .detail-content {
    grid-template-columns: 1fr;
  }

  .detail-item.full {
    grid-column: auto;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .icon-button,
  .page-button,
  .type-chip,
  .primary-button,
  .secondary-button,
  tbody tr {
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  }
}
