:root{
  --bg:#F7F6F3; --surface:#FFFFFF; --surface-2:#F1EFE9;
  --border:#E4E1D9; --border-strong:#C9C5B8;
  --text:#1F1E1B; --text-2:#6B6960; --text-muted:#9B988D;
  --accent:#2F6FE4; --accent-bg:#E8F0FE; --accent-text:#1848A0;
  --danger:#C0392B; --danger-bg:#FBEAE8;
  --success:#2E7D46; --success-bg:#E7F3EA;
  --radius:8px; --radius-lg:12px;
}
*{ box-sizing:border-box; }
body{ margin:0; background:var(--bg); color:var(--text); font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif; font-size:14px; line-height:1.5; }
a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }
.topbar{ background:var(--surface); border-bottom:1px solid var(--border); padding:0 20px; display:flex; align-items:center; justify-content:space-between; height:54px; }
.topbar .brand{ font-weight:600; }
.topbar .user{ font-size:13px; color:var(--text-2); }
.nav{ display:flex; gap:2px; background:var(--surface); border-bottom:1px solid var(--border); padding:0 20px; overflow-x:auto; }
.nav a{ display:inline-block; padding:10px 14px; font-size:13px; font-weight:500; color:var(--text-2); border-bottom:2px solid transparent; white-space:nowrap; }
.nav a:hover{ text-decoration:none; color:var(--text); }
.nav a.active{ color:var(--text); border-bottom-color:var(--accent); }
.wrap{ max-width:1000px; margin:0 auto; padding:24px 20px 60px; }
h1{ font-size:20px; font-weight:600; margin:0 0 4px; }
h2{ font-size:16px; font-weight:600; margin:0 0 10px; }
.sub{ color:var(--text-2); font-size:13px; margin:0 0 20px; }
.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px 18px; margin-bottom:16px; }
.grid{ display:grid; gap:12px; }
.grid-2{ grid-template-columns:repeat(auto-fit, minmax(200px,1fr)); }
.grid-4{ grid-template-columns:repeat(auto-fit, minmax(150px,1fr)); }
label{ display:block; font-size:12px; color:var(--text-2); margin-bottom:4px; }
input[type=text], input[type=number], input[type=search], input[type=password], input[type=color], select{
  width:100%; height:34px; border:1px solid var(--border-strong); border-radius:var(--radius); padding:0 10px; font-size:14px; background:var(--surface); color:var(--text);
}
input:focus, select:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-bg); }
button, .btn{ height:34px; padding:0 14px; border-radius:var(--radius); border:1px solid var(--border-strong); background:var(--surface); color:var(--text); font-size:13px; font-weight:500; cursor:pointer; display:inline-flex; align-items:center; }
button:hover, .btn:hover{ background:var(--surface-2); text-decoration:none; }
button.primary, .btn.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
button.primary:hover, .btn.primary:hover{ background:var(--accent-text); }
button.danger-btn{ border-color:var(--danger); color:var(--danger); background:var(--surface); }
button.danger-btn:hover{ background:var(--danger-bg); }
button.ghost{ border-color:transparent; }
.error-box{ background:var(--danger-bg); color:var(--danger); border-radius:var(--radius); padding:10px 14px; margin-bottom:14px; font-size:13px; }
.ok-box{ background:var(--success-bg); color:var(--success); border-radius:var(--radius); padding:10px 14px; margin-bottom:14px; font-size:13px; }
.error{ font-size:12px; color:var(--danger); margin-top:4px; }
table{ width:100%; border-collapse:collapse; font-size:13px; }
th{ text-align:left; color:var(--text-2); font-weight:500; font-size:12px; padding:6px 8px; border-bottom:1px solid var(--border); }
td{ padding:7px 8px; border-bottom:1px solid var(--border); vertical-align:middle; }
tr:last-child td{ border-bottom:none; }
th.sortable{ cursor:pointer; user-select:none; }
th.sortable:hover{ color:var(--text); }
.swatch{ width:14px; height:14px; border-radius:50%; display:inline-block; border:1px solid var(--border-strong); vertical-align:-2px; margin-right:6px; }
.pill{ display:inline-block; font-size:11px; padding:2px 8px; border-radius:20px; background:var(--surface-2); color:var(--text-2); }
.metric{ background:var(--surface-2); border-radius:var(--radius); padding:12px 14px; }
.metric.accent{ background:var(--accent-bg); }
.metric .lbl{ font-size:12px; color:var(--text-2); margin:0 0 4px; }
.metric.accent .lbl{ color:var(--accent-text); }
.metric .val{ font-size:20px; font-weight:600; margin:0; }
.metric.accent .val{ color:var(--accent-text); }
.bom-row{ display:flex; justify-content:space-between; padding:5px 0; border-bottom:1px solid var(--border); font-size:13px; color:var(--text-2); }
.bom-row:last-child{ border-bottom:none; }
.preview{ background:var(--surface-2); border-radius:var(--radius-lg); padding:24px; display:flex; align-items:center; justify-content:center; min-height:90px; margin-bottom:14px; }
.conn-box{ display:flex; flex-direction:column; align-items:center; gap:6px; }
.conn-circle{ width:44px; height:44px; border-radius:50%; background:var(--surface); display:flex; align-items:center; justify-content:center; font-size:10px; color:var(--text-2); }
.conn-label{ font-size:11px; color:var(--text-2); }
.row-actions{ display:flex; gap:6px; }
.row-actions button, .row-actions a.btn{ height:28px; padding:0 10px; font-size:12px; }
.toolbar{ display:flex; gap:8px; align-items:center; margin-bottom:12px; flex-wrap:wrap; }
.toolbar input[type=search]{ max-width:240px; }
.chips{ display:flex; gap:6px; flex-wrap:wrap; }
button.chip{ height:28px; padding:0 12px; font-size:12px; border-radius:20px; }
button.chip.active{ background:var(--accent); border-color:var(--accent); color:#fff; }
.empty{ color:var(--text-muted); font-size:13px; padding:12px 0; }
.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.tab-btn{ background:none; border:none; padding:8px 14px; font-size:13px; font-weight:500; color:var(--text-2); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; }
.tab-btn:hover{ color:var(--text); text-decoration:none; }
.tab-btn.active{ color:var(--text); border-bottom-color:var(--accent); }
.login-wrap{ max-width:340px; margin:80px auto; }
.kv{ display:flex; justify-content:space-between; padding:4px 0; font-size:13px; }
.kv .k{ color:var(--text-2); }
