/* PrintPricer — Conventional SaaS direction
   Indigo accent (configurable via --accent), soft shadows, rounded cards.
*/

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --subtle: #9ca3af;
  --shadow-sm: 0 1px 2px rgba(17,24,39,.04);
  --shadow-md: 0 4px 12px rgba(17,24,39,.06);
  --radius: 12px;
  --radius-sm: 7px;
}

html.dark {
  --bg: #0b0d12;
  --surface: #13161d;
  --surface-2: #1a1e27;
  --border: #262b36;
  --text: #e6e8ee;
  --muted: #8b94a7;
  --subtle: #5f6779;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ─── App shell ─────────────────────────────────────────────────────── */

.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: 56px; padding: 0 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 24px;
  background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center; color: #fff;
}
.brand-name { font-weight: 600; font-size: 15px; }

.tier-badge {
  font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted);
}
.tier-badge.is-pro { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 7px;
  color: var(--muted); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.tab.is-locked { opacity: .65; }

/* Hamburger + drawer backdrop — hidden on desktop, revealed in the mobile media query */
.nav-toggle {
  display: none; appearance: none; border: 0; background: transparent;
  color: var(--text); cursor: pointer; padding: 6px; margin-left: -6px;
  border-radius: 7px; align-items: center; justify-content: center;
}
.nav-toggle:hover { background: var(--surface-2); }
.nav-backdrop { display: none; }

.spacer { flex: 1; }

.btn-upgrade {
  background: var(--accent); color: #fff; border: 0;
  padding: 8px 14px; border-radius: 7px; cursor: pointer;
  font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-upgrade:hover { filter: brightness(1.06); }
.upgrade-form { display: contents; }

.main { flex: 1; padding: 24px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* ─── Icons ─────────────────────────────────────────────────────────── */

.icon { width: 16px; height: 16px; display: inline-block; vertical-align: middle; }
.icon-xs { width: 11px; height: 11px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 32px; height: 32px; }

/* ─── Cards & layout ────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .01em; }

.cards { display: flex; flex-direction: column; gap: 16px; }

.calc-page { display: grid; gap: 20px; }
.calc-page.is-split { grid-template-columns: 1.4fr 1fr; align-items: start; }
.calc-page.is-single { grid-template-columns: 1fr; max-width: 780px; margin: 0 auto; }
.calc-side { position: sticky; top: 80px; }

@media (max-width: 980px) {
  .calc-page.is-split { grid-template-columns: 1fr; }
  .calc-side { position: static; }
}

/* ─── Forms ─────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.field > span { color: var(--muted); font-weight: 500; }

.field input, .field select, .field textarea,
.input-suffix input, .input-suffix select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px; height: 34px; font-size: 13.5px;
  color: var(--text); outline: none; width: 100%;
  font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder {
  color: var(--subtle); opacity: 1;
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 60px; }
.field input:focus, .field select:focus, .field textarea:focus,
.input-suffix input:focus, .input-suffix select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.field input[type=color] { padding: 2px; height: 34px; cursor: pointer; }

.input-suffix {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 10px; height: 34px;
}
.input-suffix input {
  flex: 1; border: 0; background: transparent; padding: 0; height: auto;
  font-variant-numeric: tabular-nums;
}
.input-suffix input:focus { box-shadow: none; }
.input-suffix em { color: var(--subtle); font-style: normal; font-size: 12px; }

.field-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ─── Buttons ───────────────────────────────────────────────────────── */

.btn {
  appearance: none; border: 0; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary-sm { background: var(--accent); color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 12px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost-sm { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 4px 10px; font-size: 11.5px; border-radius: 5px; cursor: pointer; }
.btn-ghost-sm:hover { background: var(--surface-2); }
.icon-btn {
  appearance: none; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; padding: 4px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.pill {
  font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
  display: inline-flex; align-items: center; gap: 4px;
}
.pill.is-locked { background: var(--surface-2); color: var(--muted); }
.pill-default { background: color-mix(in srgb, #10b981 14%, transparent); color: #059669; margin-left: 8px; }
/* Kanban board */
.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
  align-items: start;
}
@media (max-width: 880px) { .kanban { grid-template-columns: 1fr; } }

.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  min-height: 200px;
  overflow: hidden;
}
.kanban-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.kanban-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.kanban-count {
  font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  padding: 2px 7px; border-radius: 999px;
}
.kanban-meta { margin-left: auto; }

.kanban-col.is-printing .kanban-head { box-shadow: inset 3px 0 0 var(--accent); }
.kanban-col.is-printing .kanban-count { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.kanban-col.is-done .kanban-head { box-shadow: inset 3px 0 0 #10b981; }
.kanban-col.is-done .kanban-count { background: color-mix(in srgb, #10b981 14%, transparent); color: #059669; }

.kanban-body { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.kanban-empty { text-align: center; padding: 24px 8px; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s;
}
.kanban-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.kanban-card.is-done { opacity: .72; }
.kanban-card.is-failed { opacity: .72; border-left: 3px solid #e11d48; }
.kanban-card.is-printing { border-left: 3px solid var(--accent); }

.kanban-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.kanban-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.badge-time { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.kanban-card-notes { line-height: 1.35; }
.kanban-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; padding-top: 6px; border-top: 1px dashed var(--border); }
.kanban-actions { display: flex; gap: 4px; align-items: center; }
.kanban-actions form { margin: 0; }
.kanban-actions .btn-primary-sm { padding: 5px 9px; font-size: 11.5px; }

.kanban-card-warn {
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 32%, transparent);
  color: #92400e;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 11.5px;
}
html.dark .kanban-card-warn { color: #fbbf24; }
.kanban-card-warn ul { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 2px; }
.kanban-card-warn strong { display: block; font-size: 12px; }

.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card-ghost { opacity: .4; background: var(--surface-2); border-style: dashed; }
.kanban-card-drag { box-shadow: 0 16px 32px rgba(17,24,39,.18); transform: rotate(2deg); }
.kanban-body { min-height: 80px; }

.kanban-printer-select {
  width: 100%; padding: 5px 8px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: inherit;
}
.kanban-printer-select:focus { outline: none; border-color: var(--accent); }

.reason-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.reason-list li strong { color: var(--accent); margin-right: 6px; }

/* ─── Drop zone ─────────────────────────────────────────────────────── */

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  padding: 24px 16px; text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.is-dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }
.dropzone.is-disabled { opacity: .55; }
.dz-label { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.dz-label strong { color: var(--text); font-size: 13px; }
.dz-label input[type=file] { display: none; }
.dz-foot {
  margin-top: 10px; display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: var(--muted);
}
.dz-foot form { margin: 0; }

/* ─── Breakdown / totals ────────────────────────────────────────────── */

.breakdown { display: flex; flex-direction: column; gap: 16px; }
.breakdown-card { padding: 18px; }

.bar {
  display: flex; height: 12px; border-radius: 999px;
  overflow: hidden; background: var(--surface-2);
}
.bar-seg { transition: width .25s; }

.legend { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 7px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend .dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }
.legend-label { color: var(--muted); flex: 1; }
.legend-val { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.totals dt, .totals dd { font-size: 13.5px; }
.totals-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; margin: 0; }
.totals-grid dt { color: var(--muted); }
.totals-grid dd { color: var(--text); margin: 0; font-variant-numeric: tabular-nums; }
.totals-grid .emph { font-weight: 600; color: var(--text); }

.gross-bar {
  margin-top: 14px; padding: 12px 16px; border-radius: var(--radius-sm);
  color: #fff; display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.gross-bar strong { font-size: 18px; font-variant-numeric: tabular-nums; }

.export-row { margin-top: 14px; }
.export-row .btn { width: 100%; justify-content: center; }

/* ─── Pages ─────────────────────────────────────────────────────────── */

.page { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; }
.page-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.page-head p { margin: 0; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ─── Tables ────────────────────────────────────────────────────────── */

.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data th, .data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
.data td.num, .data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data tr:last-child td { border-bottom: 0; }
.data .empty { text-align: center; color: var(--muted); padding: 24px; }
.data-sub { background: var(--surface-2); border-radius: var(--radius-sm); }
.data-sub th { background: transparent; }

.cell-name { display: flex; align-items: center; gap: 10px; }
.color-dot { width: 14px; height: 14px; border-radius: 999px; border: 1px solid var(--border); display: inline-block; }
.color-dot-xs { width: 8px; height: 8px; vertical-align: middle; }

/* Tooltip — hover any element with [data-tip] for a styled bubble */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 0;
  background: var(--text); color: var(--bg);
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.4; font-weight: 400;
  white-space: normal; width: 220px;
  opacity: 0; pointer-events: none; transform: translateY(2px);
  transition: opacity .12s ease, transform .12s ease;
  z-index: 100;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
[data-tip]:hover::after { opacity: 1; transform: translateY(0); }
.field [data-tip] {
  border-bottom: 1px dotted var(--subtle);
  display: inline-block; padding-bottom: 1px;
}

.loaded-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
  margin-bottom: 16px;
  grid-column: 1 / -1;  /* span all columns of the parent calc-page grid */
}
.loaded-banner .icon { color: var(--accent); }

.filament-lines { display: flex; flex-direction: column; gap: 8px; }
.filament-line { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: center; }
.filament-line select { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; height: 34px; font-size: 13.5px; color: var(--text); }

.failures-form { display: flex; flex-direction: column; gap: 6px; }
.failures-form input { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; width: 100%; font-family: inherit; }
.failures-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.failures-form button { align-self: flex-end; }

.timing-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: center; }
.timing-row select { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; height: 34px; font-size: 13.5px; color: var(--text); }

.timing-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.timing-badges form { margin: 0; }
.timing-badges button {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 3px 9px; font-size: 11px; cursor: pointer; color: var(--text);
  display: inline-flex; align-items: center; gap: 4px; font-family: inherit;
}
.timing-badges button:hover { border-color: var(--accent); color: var(--accent); }

.advanced-toggle { align-self: flex-start; gap: 6px; }
.advanced-section { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.advanced-section h4 { margin: 0; }
.row-actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }

.collapsible-row { cursor: pointer; transition: background .12s; }
.collapsible-row:hover { background: var(--surface-2); }
.chevron-cell { width: 28px; padding-right: 0 !important; }
.chevron { color: var(--muted); transition: transform .15s ease; }
.chevron.is-open { transform: rotate(90deg); color: var(--text); }
.data-collapse tbody { border: 0; }

.batches { padding: 14px; background: var(--surface-2); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 6px 10px; font-size: 12.5px; flex: 1; min-width: 0; }

/* ─── Models cards ──────────────────────────────────────────────────── */

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.model-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
}
.model-img {
  height: 140px; border-radius: 8px; background: var(--surface-2);
  display: grid; place-items: center; color: var(--subtle); overflow: hidden;
}
.model-img img { width: 100%; height: 100%; object-fit: cover; }
.model-card h4 { margin: 0; font-size: 15px; font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: 11px; padding: 2px 8px; background: var(--surface-2); border-radius: 999px; color: var(--muted); }
.model-notes { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.model-actions { display: flex; gap: 6px; align-items: center; margin-top: auto; }
.failures-toggle {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: center; gap: 6px; padding: 6px 0;
  font-size: 12.5px; color: var(--muted); font-family: inherit; text-align: left;
}
.failures-toggle strong { color: var(--text); }
.failures-panel { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.failures-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.failures-list li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.failures-list li > span:nth-child(2) { flex: 1; }

/* ─── Pro lock card ─────────────────────────────────────────────────── */

.pro-lock { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.pro-lock .lock-icon { color: var(--muted); }
.pro-lock h3 { margin: 8px 0 0; font-size: 16px; }
.pro-lock p { margin: 0; max-width: 380px; }

/* ─── Dialogs ───────────────────────────────────────────────────────── */

.dialog {
  border: 0; border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--text);
  width: 480px; max-width: 92vw;
  box-shadow: 0 24px 48px rgba(17,24,39,.18);
}
.dialog::backdrop { background: rgba(17,24,39,.4); backdrop-filter: blur(2px); }
.dialog-form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-form h3 { margin: 0; font-size: 16px; }
.dialog-form h4 { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.mat-row { align-items: center; }

/* ─── Settings form ─────────────────────────────────────────────────── */

.settings-form { display: flex; flex-direction: column; gap: 16px; max-width: 880px; }
.settings-form select, .settings-form input, .settings-form textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; color: var(--text); width: 100%; font-family: inherit; font-size: 13.5px;
}
.form-actions { display: flex; justify-content: flex-end; }

/* ─── Tweaks panel (floating) ───────────────────────────────────────── */

.tweaks { position: fixed; right: 18px; bottom: 18px; z-index: 60; }
.tweaks-toggle {
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--text); color: var(--bg); border: 0; cursor: pointer;
  box-shadow: var(--shadow-md);
  display: grid; place-items: center;
}
.tweaks-panel {
  position: absolute; right: 0; bottom: 56px;
  width: 280px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(17,24,39,.16);
  padding: 14px; display: flex; flex-direction: column; gap: 14px;
}
.tweaks-header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.tweak-section { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.tweak-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.seg { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 6px; }
.seg-btn {
  flex: 1; appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 6px 10px; border-radius: 4px; font-size: 12.5px; font-weight: 500; color: var(--muted);
}
.seg-btn.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 999px; border: 2px solid var(--surface); cursor: pointer; box-shadow: 0 0 0 1px var(--border); }
.swatch:hover { transform: scale(1.08); }

/* Color-swatch dropdown (filament cascade) */
[x-cloak] { display: none !important; }
.color-select { position: relative; }
.color-select-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 34px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 10px; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left;
}
.color-select-trigger:disabled { opacity: .5; cursor: not-allowed; }
.color-select-trigger:focus { outline: none; border-color: var(--accent); }
.color-select-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-select-name.is-placeholder { color: var(--muted); }
.color-select-trigger .chevron { width: 14px; height: 14px; color: var(--subtle); flex-shrink: 0; }
.color-menu {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 240px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(17,24,39,.22);
}
.color-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; padding: 6px 8px; border-radius: 6px;
  cursor: pointer; color: var(--text); font-size: 13px; text-align: left;
}
.color-menu-item:hover { background: var(--surface-2); }
.color-select-trigger .color-dot, .color-menu-item .color-dot { flex-shrink: 0; }

/* ─── Auth pages ────────────────────────────────────────────────────── */

.auth-shell { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px 24px 72px; background: var(--bg); }
.auth-shell .site-footer { position: absolute; left: 0; right: 0; bottom: 0; border-top: 0; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 32px; width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-card h1 { margin: 0 0 18px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form input { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 14px; color: var(--text); width: 100%; font-family: inherit; }
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.auth-form button { width: 100%; justify-content: center; padding: 10px; }
.auth-form small.muted { display: block; margin-top: 4px; font-size: 11px; line-height: 1.4; }
.auth-error { color: #e11d48; font-size: 13px; margin: 0; padding: 8px 10px; background: color-mix(in srgb, #e11d48 8%, transparent); border-radius: var(--radius-sm); }
.auth-foot { margin: 18px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.auth-foot a { color: var(--accent); text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* ─── User menu in header ───────────────────────────────────────────── */

.user-menu { position: relative; }
.user-menu-btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; padding: 6px 10px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500;
}
.user-menu-btn:hover { background: var(--surface-2); }
.user-avatar {
  width: 22px; height: 22px; border-radius: 999px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.user-menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(17,24,39,.14); padding: 6px; min-width: 180px; z-index: 60;
}
.user-menu-dropdown form { margin: 0; }
.user-menu-dropdown button, .user-menu-dropdown a {
  appearance: none; border: 0; background: transparent; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 5px; font-size: 13px; color: var(--text); cursor: pointer;
  display: block; text-decoration: none; font-family: inherit;
}
.user-menu-dropdown button:hover, .user-menu-dropdown a:hover { background: var(--surface-2); }
.user-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-menu-meta { padding: 7px 10px; font-size: 12px; color: var(--muted); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
html.dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); background-clip: content-box; }

/* upgrade CTA + teaser */
.pro-cta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.pro-cta-icon { color: var(--muted); flex-shrink: 0; }
.pro-cta-msg { margin: 0; flex: 1; color: var(--muted); font-size: 13px; }

/* Free/guest catalog browse (interactive teaser — explore, but no add/use) */
.catalog-browse .card-head { display: block; }
.catalog-browse .card-head .muted { margin: 4px 0 0; }
.teaser-detail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.teaser-price { margin: 0 0 10px; }
.teaser-price strong { font-size: 16px; }
.swatch-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch-grid .swatch {
  width: 26px; height: 26px; border-radius: 6px; padding: 0;
  border: 1px solid var(--border); cursor: pointer; transition: transform .08s ease;
}
.swatch-grid .swatch:hover { transform: scale(1.12); }
.swatch-grid .swatch.is-sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.spec-card .spec-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; border-bottom: 1px dashed var(--border);
}
.spec-note { margin-top: 10px; line-height: 1.5; }

/* ─── Site footer ───────────────────────────────────────────────────── */
.site-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 16px;
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 12.5px;
}
.site-footer-brand { color: var(--subtle); }
.site-footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer-links a { color: var(--muted); text-decoration: none; }
.site-footer-links a:hover { color: var(--text); text-decoration: underline; }

/* ─── Legal pages ───────────────────────────────────────────────────── */
.legal-shell { display: flex; flex-direction: column; min-height: 100vh; }
.legal-bar {
  height: 56px; padding: 0 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 24px; background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}
.legal-bar .brand { text-decoration: none; color: var(--text); }
.legal-back { margin-left: auto; color: var(--muted); text-decoration: none; font-size: 13px; }
.legal-back:hover { color: var(--text); }
.legal-page { flex: 1; padding: 40px 24px; width: 100%; }
.legal-doc {
  max-width: 760px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 40px;
}
.legal-eyebrow {
  margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
}
.legal-doc h1 { margin: 0 0 4px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.legal-stand { margin: 0 0 28px; font-size: 12.5px; color: var(--subtle); }
.legal-doc h2 { margin: 26px 0 8px; font-size: 16px; font-weight: 600; }
.legal-doc p { margin: 0 0 12px; color: var(--text); line-height: 1.6; }
.legal-doc a { color: var(--accent); }
.legal-doc code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.legal-form {
  margin: 8px 0 0; padding: 16px 18px; border-left: 3px solid var(--border);
  background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.7; color: var(--muted);
}

/* ─── Mobile / tablet ───────────────────────────────────────────────── */

@media (max-width: 860px) {
  /* Raise the topbar's stacking context above the floating tweaks gear (z 60)
     so the open drawer + backdrop sit over it */
  .topbar { gap: 12px; padding: 0 16px; z-index: 70; }

  /* Reveal hamburger, hide tier badge to save room */
  .nav-toggle { display: inline-flex; }
  .tier-badge { display: none; }

  /* Tabs become a slide-in drawer from the left */
  .tabs {
    position: fixed; top: 56px; left: 0; bottom: 0; z-index: 70;
    width: min(78vw, 280px); margin: 0; padding: 12px;
    flex-direction: column; gap: 2px; overflow-y: auto;
    background: var(--surface); border-right: 1px solid var(--border);
    box-shadow: 0 16px 40px rgba(17,24,39,.18);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .22s ease, visibility .22s ease;
  }
  .tabs.is-open { transform: translateX(0); visibility: visible; }
  .tab {
    width: 100%; padding: 11px 12px; font-size: 14.5px; border-radius: 8px;
  }

  /* Backdrop behind the open drawer */
  .nav-backdrop {
    display: block; position: fixed; inset: 56px 0 0 0; z-index: 65;
    background: rgba(17,24,39,.42);
    opacity: 0; pointer-events: none; transition: opacity .22s ease;
  }
  .nav-backdrop.is-open { opacity: 1; pointer-events: auto; }

  /* Compact the right-hand controls */
  .btn-upgrade { padding: 8px; font-size: 0; gap: 0; }
  .btn-upgrade .icon { font-size: 0; }
  .user-menu-btn > span:not(.user-avatar) { display: none; }
  .user-menu-btn { padding: 6px; }
  .user-menu-dropdown { min-width: 200px; }

  /* Looser breathing room for content + collapse dense form grids */
  .main { padding: 16px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .page-head { flex-direction: column; gap: 12px; }
  .page-head h2 { font-size: 19px; }
}

@media (max-width: 520px) {
  .brand-name { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .filament-line, .timing-row { grid-template-columns: 1fr 1fr; }
  .data th, .data td { padding: 8px; }
  .dialog-foot { flex-direction: column-reverse; }
  .dialog-foot .btn { width: 100%; justify-content: center; }
}
.guest-banner{display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:8px 16px;background:color-mix(in srgb,var(--accent) 12%,transparent);
  border-bottom:1px solid color-mix(in srgb,var(--accent) 30%,transparent);font-size:.9rem}
.guest-banner-actions{display:flex;gap:8px;flex:none}

/* ─── Pricing page ──────────────────────────────────────────────────── */
.pricing-page { display: flex; flex-direction: column; gap: 48px; max-width: 920px; margin: 0 auto; }

.pricing-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 12px; }
.pricing-hero h1 { margin: 0; font-size: 32px; font-weight: 680; letter-spacing: -.02em; }
.pricing-hero-sub { margin: 0; max-width: 560px; font-size: 15px; line-height: 1.55; }

.billing-toggle { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; }
.bt-opt { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent;
  color: var(--muted); padding: 8px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s, color .15s; }
.bt-opt.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.bt-save { font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 24px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 22px; }
.plan-card.is-pro { border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: var(--shadow-md); }
.plan-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 5px 12px; border-radius: 999px; box-shadow: var(--shadow-sm); }

.plan-card-head { display: flex; flex-direction: column; gap: 6px; }
.plan-card-head h2 { margin: 0; font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-amount { font-size: 38px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.plan-per { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan-note { margin: 0; font-size: 12px; }
.plan-tagline { margin: 2px 0 0; font-size: 13px; line-height: 1.45; }

.plan-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.plan-feat { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.4; }
.plan-feat .icon { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--accent); }
.plan-feat.is-off { color: var(--subtle); }
.plan-feat.is-off .icon { color: var(--subtle); }

.plan-cta { margin-top: auto; }
.plan-cta .btn { width: 100%; justify-content: center; }
.plan-current { display: inline-flex; align-items: center; gap: 7px; justify-content: center; width: 100%;
  padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.plan-current .icon { width: 16px; height: 16px; color: var(--accent); }

.pricing-compare h2, .pricing-faq h2 { font-size: 20px; font-weight: 650; letter-spacing: -.01em;
  margin: 0 0 18px; text-align: center; }
.compare-table { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.compare-table th, .compare-table td { padding: 13px 16px; text-align: center; font-size: 13.5px;
  border-bottom: 1px solid var(--border); }
.compare-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); }
.compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table .compare-feat { text-align: left; color: var(--text); }
.compare-table .col-pro { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cell-ok { width: 18px; height: 18px; color: var(--accent); }
.cell-off { width: 16px; height: 16px; color: var(--subtle); }
.cell-val { font-weight: 600; }

.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.faq-q { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: transparent; border: 0; cursor: pointer; padding: 15px 16px; text-align: left;
  font-size: 14px; font-weight: 600; color: var(--text); }
.faq-chev { width: 16px; height: 16px; color: var(--muted); transition: transform .18s; flex: none; }
.faq-item.is-open .faq-chev { transform: rotate(90deg); }
.faq-a { padding: 0 16px 15px; }
.faq-a p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

@media (max-width: 720px) {
  .plan-grid { grid-template-columns: 1fr; gap: 28px; }
  .pricing-hero h1 { font-size: 25px; }
  .pricing-page { gap: 36px; }
}

/* 7-day per-printer usage Gantt (below queue) */
.usage { margin-top: 16px; }
.usage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.usage-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.usage-key { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.usage-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.usage-dot.is-printing { background: var(--accent); }
.usage-dot.is-done { background: #10b981; }
.usage-dot.is-failed { background: #ef4444; }

.usage-grid { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.usage-axis, .usage-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; }
.usage-rowlabel { display: flex; flex-direction: column; gap: 1px; min-width: 0; overflow: hidden; }
.usage-rowlabel strong { font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.usage-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.usage-day { font-size: 10.5px; color: var(--muted); text-align: center; }

.usage-track {
  position: relative; height: 22px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); overflow: hidden;
}
.usage-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.usage-gridline:first-child { display: none; }
.usage-seg {
  position: absolute; top: 3px; bottom: 3px; border-radius: 3px; min-width: 2px;
}
.usage-seg.is-printing { background: var(--accent); }
.usage-seg.is-done { background: #10b981; }
.usage-seg.is-failed { background: #ef4444; }
.usage-empty { margin: 12px 0 0; }

@media (max-width: 880px) {
  .usage-axis { display: none; }
  .usage-row { grid-template-columns: 1fr; gap: 4px; }
  .usage-rowlabel { flex-direction: row; gap: 8px; align-items: baseline; }
}
