/* ---------- tokens ---------- */
:root {
  --bg:           #0e0f12;
  --bg-elev:      #16181d;
  --bg-elev-2:    #1d2026;
  --line:         #2a2e36;
  --line-strong:  #3a3f49;
  --text:         #e7e9ee;
  --text-dim:     #9aa0ac;
  --text-muted:   #6b7280;
  --accent:       #ff9b3d;          /* warm amber, like a glowing nozzle */
  --accent-soft:  #ffb872;
  --accent-deep:  #c46a14;
  --danger:       #e0526b;
  --good:         #4cc38a;

  --font-display: "JetBrains Mono", "IBM Plex Mono", ui-monospace,
                  SFMono-Regular, Menlo, monospace;
  --font-body:    "Söhne", "Inter", -apple-system, BlinkMacSystemFont,
                  "Helvetica Neue", system-ui, sans-serif;

  --radius: 6px;
  --radius-lg: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* subtle grid backdrop — blueprint vibe */
.grid-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 30% 20%, #000 30%, transparent 80%);
}

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--text-dim); }
.err { color: var(--danger); margin-top: 8px; font-size: 13px; }
.inline { display: inline; }
.link {
  background: none; border: 0; color: var(--accent);
  text-decoration: underline; padding: 0; font-size: inherit;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,155,61,0.04), transparent 60%);
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
}
.brand-tag {
  color: var(--text-muted); font-family: var(--font-display);
  font-size: 12px;
}
.logo-mark {
  width: 22px; height: 22px;
  background: conic-gradient(from 215deg, var(--accent), var(--accent-deep), var(--accent));
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg), 0 0 18px rgba(255,155,61,0.45);
  position: relative;
}
.logo-mark::after {
  content: ""; position: absolute; inset: 6px;
  background: var(--bg); border-radius: 50%;
}
.logo-mark.big { width: 44px; height: 44px; margin-bottom: 14px; }
.logo-mark.big::after { inset: 12px; }

nav { display: flex; align-items: center; gap: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn-primary {
  background: var(--accent); color: #1c1306;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-soft); }
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--line-strong); background: var(--bg-elev); }
.btn-danger {
  background: transparent; color: var(--danger);
  border-color: rgba(224,82,107,0.3);
}
.btn-danger:hover {
  background: rgba(224,82,107,0.08); border-color: var(--danger);
}

/* ---------- main / footer ---------- */
main { padding: 28px; max-width: 1400px; margin: 0 auto; }
footer {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 12px; color: var(--text-muted);
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }

/* ---------- toolbar ---------- */
.toolbar { margin-bottom: 22px; }
.filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.filters input[type="search"], .filters select {
  padding: 9px 12px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit;
}
.filters input[type="search"] { min-width: 280px; }
.filters input[type="search"]:focus, .filters select:focus {
  outline: 2px solid rgba(255,155,61,0.4); outline-offset: -1px;
  border-color: var(--accent);
}
.check {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-dim);
  user-select: none;
}

/* ---------- grid + card ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color 150ms, transform 150ms;
}
.card:hover { border-color: var(--line-strong); }
.card.archived { opacity: 0.55; }

.swatch {
  height: 96px;
  background: var(--c, #555);
  position: relative;
  border-bottom: 1px solid var(--line);
}
.swatch-stripe {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 6px;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(0,0,0,0.55) 0 6px,
      rgba(0,0,0,0.15) 6px 12px
    );
}
.count-badge {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(14, 15, 18, 0.78);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
}
.brand-line {
  font-family: var(--font-display); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}
.card-head h3 {
  margin: 2px 0 0; font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
}
.material-pill {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255,155,61,0.12);
  color: var(--accent-soft);
  border: 1px solid rgba(255,155,61,0.25);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.specs {
  margin: 0;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
.specs > div { display: flex; flex-direction: column; }
.specs dt {
  font-family: var(--font-display);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted);
}
.specs dd {
  margin: 1px 0 0;
  font-family: var(--font-display);
  font-size: 14px; color: var(--text);
}
.notes {
  margin: 0;
  padding: 8px 10px;
  background: var(--bg-elev-2); border-radius: var(--radius);
  font-size: 13px; color: var(--text-dim);
  border-left: 2px solid var(--line-strong);
}
.card-foot {
  display: flex; gap: 6px; align-items: center;
  padding-top: 4px; border-top: 1px dashed var(--line);
  margin-top: 2px;
}
.card-foot .btn { margin-left: auto; }
.card-foot .btn + form { margin-left: 0; }
.icon-btn {
  background: none; border: 1px solid var(--line);
  width: 30px; height: 30px; border-radius: 50%;
  color: var(--text-muted);
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 120ms, border-color 120ms;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); }
.icon-btn.is-on { color: var(--accent); border-color: rgba(255,155,61,0.4); }

/* ---------- empty state ---------- */
.empty {
  text-align: center; padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.empty h2 { margin: 0 0 6px; font-weight: 600; }
.empty p { margin: 0 0 18px; color: var(--text-dim); }

/* ---------- form ---------- */
.form-wrap {
  max-width: 760px; margin: 0 auto;
}
.form-head { margin-bottom: 22px; }
.form-head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; }

.spool-form {
  display: flex; flex-direction: column; gap: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row:has(>:nth-child(3)) { grid-template-columns: 1fr 1fr 1fr 1fr; }
@media (max-width: 720px) { .row, .row:has(>:nth-child(3)) { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  font-family: var(--font-display); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}
.field input, .field select, .field textarea {
  padding: 9px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit;
  font-family: var(--font-display);
}
.field textarea { font-family: var(--font-body); resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(255,155,61,0.35);
  outline-offset: -1px;
  border-color: var(--accent);
}
.check-field {
  flex-direction: row; align-items: center; gap: 8px;
  align-self: end; padding-bottom: 9px;
}

.color-input { display: flex; align-items: center; gap: 10px; }
.color-input input[type="color"] {
  width: 56px; height: 38px; padding: 2px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
}
.color-input code {
  font-family: var(--font-display); font-size: 13px;
  color: var(--text-dim); letter-spacing: 0.04em;
}

.autofill-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: rgba(255,155,61,0.06);
  border: 1px solid rgba(255,155,61,0.25);
  border-radius: var(--radius);
  font-size: 13px;
}
.dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255,155,61,0.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,155,61,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(255,155,61,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,155,61,0); }
}

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* ---------- login ---------- */
.login-wrap {
  display: flex; justify-content: center; align-items: center;
  min-height: calc(100vh - 200px);
}
.login-card {
  width: 100%; max-width: 360px;
  text-align: center;
  padding: 32px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.login-card h1 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  font-size: 22px;
}
.login-card form {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 18px; text-align: left;
}
.login-card label { display: flex; flex-direction: column; gap: 6px; }
.login-card label > span {
  font-family: var(--font-display); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}
.login-card input {
  padding: 9px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; font-family: var(--font-display);
}
.login-card input:focus {
  outline: 2px solid rgba(255,155,61,0.35); outline-offset: -1px;
  border-color: var(--accent);
}
