:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #d0d7de;
  --border-muted: #e6ebf1;
  --text: #1f2328;
  --muted: #59636e;
  --link: #0969da;
  --btn-bg: #1f6feb;
  --btn-hover: #1a5fd0;
  --green: #1a7f37;
  --green-bg: #dafbe1;
  --amber: #9a6700;
  --amber-bg: #fff8c5;
  --red: #cf222e;
  --red-bg: #ffebe9;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: #24292f;
  color: #e6edf3;
  font-size: 12px;
  padding: 6px 16px;
}
.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar span.muted { color: #9198a1; }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  text-decoration: none !important;
}
.logo-mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
}
.logo-sub {
  font-size: 12px;
  color: var(--muted);
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13.5px;
}
nav a { color: var(--text); font-weight: 500; }
nav a.active { color: var(--link); }

.basket-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.basket-btn:hover { background: #eef1f4; }

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.notice-box {
  background: #fff8c5;
  border: 1px solid #d4a72c;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #4d2d00;
  margin-bottom: 18px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--text); border-color: #8c959f; }
.tab.active {
  background: #1f2328;
  border-color: #1f2328;
  color: #ffffff;
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  width: 250px;
  color: var(--text);
}
.search-input:focus {
  outline: 2px solid #0969da;
  outline-offset: -1px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(335px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-top {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}
.pcb-thumb {
  width: 78px;
  height: 68px;
  flex-shrink: 0;
  background: #f6f8fa;
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sku-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 3px;
}
.card h3 {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}
.specs-line {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #424a53;
  background: #f6f8fa;
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 2px 6px;
  display: inline-block;
}

.desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.45;
}

.card-foot {
  border-top: 1px solid var(--border-muted);
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.price-block {
  display: flex;
  flex-direction: column;
}
.price {
  font-size: 15.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.vat {
  font-size: 11px;
  color: var(--muted);
}

.badge {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.badge-ok { background: var(--green-bg); color: var(--green); }
.badge-low { background: var(--amber-bg); color: var(--amber); }
.badge-out { background: var(--red-bg); color: var(--red); }

.actions {
  display: flex;
  gap: 6px;
}
.btn-sec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 9px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.btn-sec:hover { background: var(--bg); }
.btn-add {
  background: var(--btn-bg);
  border: 1px solid rgba(27,31,36,0.15);
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
}
.btn-add:hover { background: var(--btn-hover); }
.btn-add:disabled {
  background: #eaeef2;
  color: #8c959f;
  border-color: var(--border);
  cursor: not-allowed;
}

.prose-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 22px;
  margin-bottom: 16px;
}
.prose-card h1 { font-size: 19px; margin-bottom: 8px; }
.prose-card h2 { font-size: 15px; margin: 18px 0 8px; }
.prose-card p { color: var(--muted); margin-bottom: 10px; max-width: 760px; }
table.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}
table.ref-table th, table.ref-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}
table.ref-table th { background: var(--bg); font-weight: 600; }
code {
  font-family: var(--mono);
  font-size: 12px;
  background: #eff1f3;
  padding: 1px 5px;
  border-radius: 3px;
}
pre {
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  overflow-x: auto;
  margin-top: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27,31,36,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 560px;
  width: 100%;
  padding: 18px 20px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
}

footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
