/* Node Studio — the one stylesheet every page shares.
   Colours are the React app's own tokens (src/index.css), converted from HSL,
   so a screen looks the same before and after it is rebuilt. */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #F5F6F9;            /* 220 20% 97% */
  --card: #FFFFFF;
  --fg: #121A26;            /* 220 30% 10% */
  --fg-2: #2F3747;
  --muted: #EEEFF3;         /* 220 15% 94% */
  --muted-fg: #666D7A;      /* 220 10% 45% */
  --border: #E1E4EA;        /* 220 15% 90% */
  --accent: #E9EBF0;        /* 220 15% 92% */
  --primary: #F97316;       /* 25 95% 53% */
  --primary-hover: #EA670C;
  --primary-wash: rgba(249,115,22,.10);
  --danger: #EF4444;
  --success: #2BAA6E;
  --warning: #F59E0B;
  --info: #3B8FE6;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.18);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
html, body { margin: 0; padding: 0; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.45; color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* An inline <svg> with no width attribute has no intrinsic size: in a flex row
   it stretches to fill its container, which is how the sign-out, quote and
   invoice icons once rendered at full-screen height. Every rule below (and
   every page <style>, which loads after this file) still wins, so an icon that
   asks for another size still gets it. */
svg:not([width]) { width: 16px; height: 16px; }

/* ── Chrome: top bar + tab bar ─────────────────────────────────────────── */
.ns-top { height: 56px; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.ns-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.ns-brand img { width: 36px; height: 36px; border-radius: 6px; background: #fff; object-fit: contain; padding: 2px; }
.ns-ws { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--border); min-width: 0; }
.ns-ws span:first-child { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-role { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted-fg); }
.ns-grow { flex: 1; }
.ns-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: var(--radius); color: var(--muted-fg); cursor: pointer; text-decoration: none; }
.ns-icon:hover { background: var(--muted); color: var(--fg); }
.ns-icon svg { width: 16px; height: 16px; }
.ns-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-wash); color: var(--primary); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.ns-tabs { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.ns-tabs nav { display: flex; align-items: center; gap: 4px; padding: 0 20px; overflow-x: auto; }
.ns-tab { position: relative; display: inline-flex; align-items: center; height: 44px; padding: 0 12px; font-size: 14px; font-weight: 500; color: var(--muted-fg); text-decoration: none; white-space: nowrap; background: none; border: 0; cursor: pointer; }
.ns-tab:hover { color: var(--fg); }
.ns-tab.on { color: var(--fg); }
.ns-tab.on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.ns-menu { position: relative; }
.ns-dropdown { position: absolute; top: calc(100% + 4px); min-width: 210px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 4px; z-index: 50; display: none; }
.ns-dropdown.right { right: 0; }
.ns-menu.open .ns-dropdown { display: block; }
.ns-dropdown a, .ns-dropdown button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; font-size: 14px; color: var(--fg); text-decoration: none; background: none; border: 0; border-radius: 4px; cursor: pointer; text-align: left; }
.ns-dropdown a:hover, .ns-dropdown button:hover { background: var(--muted); }
.ns-dropdown .lbl { padding: 8px 10px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-fg); }
.ns-dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.ns-burger { display: none; }
.ns-drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90; display: none; }
.ns-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 288px; background: var(--card); z-index: 91; transform: translateX(-100%); transition: transform .2s; overflow-y: auto; }
body.ns-drawer-open .ns-drawer { transform: none; }
body.ns-drawer-open .ns-drawer-bg { display: block; }
.ns-drawer .grp { padding: 8px; }
.ns-drawer .grp p { padding: 8px 12px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-fg); }
.ns-drawer a { display: block; padding: 8px 12px; border-radius: 6px; font-size: 14px; color: var(--muted-fg); text-decoration: none; }
.ns-drawer a.on { background: var(--accent); color: var(--fg); font-weight: 500; }
@media (max-width: 767px) {
  .ns-top { padding: 0 12px; }
  .ns-tabs, .ns-ws { display: none; }
  .ns-burger { display: inline-flex; }
  .ns-brand span { display: none; }
}

/* ── Page layout ───────────────────────────────────────────────────────── */
.ns-main { padding: 24px; max-width: 1200px; margin: 0 auto; }
.ns-main.wide { max-width: none; }
.ns-main.narrow { max-width: 760px; }
@media (max-width: 767px) { .ns-main { padding: 16px; } }
.ns-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { font-size: 14px; color: var(--muted-fg); margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-fg); text-decoration: none; margin-bottom: 12px; }
.back:hover { color: var(--fg); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } .grid4 { grid-template-columns: 1fr 1fr; } }
.span2 { grid-column: span 2; }
.muted { color: var(--muted-fg); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: #B45309; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; font-size: 14px; font-weight: 500; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); color: var(--fg); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.btn:hover { background: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--muted); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; }
.btn-icon { width: 30px; padding: 0; }
.btn-block { width: 100%; }
.seg { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.seg .btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
label.f, .f-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.f-err { font-size: 12px; color: var(--danger); margin-top: 4px; }
.f-hint { font-size: 12px; color: var(--muted-fg); margin-top: 4px; }
input:not([type]), input[type=text], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=email], input[type=tel], input[type=search], input[type=password], input[type=url], select, textarea {
  width: 100%; height: 36px; font: inherit; font-size: 14px; color: var(--fg); background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 72px; resize: vertical; line-height: 1.5; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-wash); }
input:disabled, select:disabled, textarea:disabled { background: var(--muted); color: var(--muted-fg); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-fg); pointer-events: none; }
.input-icon input { padding-left: 34px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-size: 14px; font-weight: 600; margin-bottom: 10px; padding: 0; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filters > .grow { flex: 1; min-width: 220px; }
.filters select { width: auto; min-width: 180px; }
@media (max-width: 640px) { .filters select { width: 100%; } }

/* Switch */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 20px; cursor: pointer; transition: .15s; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ── Cards, tables ─────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { font-size: 13px; color: var(--muted-fg); }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted-fg); height: 42px; padding: 0 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td, table.t tbody tr:hover td { background: rgba(238,239,243,.5); }
table.t th.num, table.t td.num { text-align: right; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.stat .k { font-size: 13px; color: var(--muted-fg); }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted-fg); margin-top: 2px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.dl dt { color: var(--muted-fg); }
.dl dd { margin: 0; }

/* ── Tabs inside a page ────────────────────────────────────────────────── */
.ptabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.ptab { position: relative; height: 40px; padding: 0 12px; background: none; border: 0; font-size: 14px; font-weight: 500; color: var(--muted-fg); cursor: pointer; white-space: nowrap; }
.ptab:hover { color: var(--fg); }
.ptab.on { color: var(--fg); }
.ptab.on::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; background: var(--primary); border-radius: 2px; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--muted); color: var(--fg-2); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.outline { background: transparent; border: 1px solid var(--border); }
.badge.s-lead { background: rgba(100,116,139,.15); color: #475569; }
.badge.s-waiting-arrival { background: rgba(6,182,212,.15); color: #0891B2; }
.badge.s-inspecting { background: rgba(59,130,246,.15); color: #2563EB; }
.badge.s-waiting-approval { background: rgba(234,179,8,.15); color: #A16207; }
.badge.s-repairing { background: rgba(249,115,22,.15); color: #EA580C; }
.badge.s-ready-for-collection { background: rgba(16,185,129,.15); color: #059669; }
.badge.s-completed { background: rgba(22,163,74,.15); color: #15803D; }
.badge.s-cancelled, .badge.s-lost, .badge.danger { background: rgba(239,68,68,.15); color: #DC2626; }
.badge.s-new, .badge.info { background: rgba(59,143,230,.15); color: #2474C8; }
.badge.s-follow-up, .badge.warning { background: rgba(245,158,11,.15); color: #B45309; }
.badge.s-converted, .badge.success { background: rgba(43,170,110,.15); color: #1F8455; }
.plate { display: inline-flex; align-items: center; font-family: var(--mono); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--border); background: var(--card); color: var(--fg); border-radius: 6px; white-space: nowrap; line-height: 1; font-size: 14px; padding: 3px 8px; text-decoration: none; }
.plate.sm { font-size: 11px; padding: 3px 6px; }
.plate.lg { font-size: 16px; padding: 5px 10px; }
a.plate:hover { border-color: var(--primary); }

/* ── Empty, loading, notes ─────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 16px; color: var(--muted-fg); }
.empty strong { display: block; color: var(--fg); margin-bottom: 4px; }
.loading { text-align: center; padding: 48px 16px; color: var(--muted-fg); }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; border-bottom-color: var(--primary); animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { font-size: 13px; line-height: 1.55; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--muted); }
.note.warn { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.08); color: #92400E; }
.note.good { border-color: rgba(43,170,110,.4); background: rgba(43,170,110,.08); color: #1F6F48; }
.note.bad { border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.06); color: #B91C1C; }
.lockwrap { max-width: 460px; margin: 48px auto; text-align: center; }
.lockwrap h2 { font-size: 20px; margin-bottom: 10px; }
.lockwrap p { color: var(--muted-fg); margin-bottom: 18px; line-height: 1.6; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.ns-toasts { position: fixed; bottom: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 380px); }
.ns-toast { background: var(--card); color: var(--fg); border: 1px solid var(--border); border-left: 4px solid var(--success); box-shadow: var(--shadow-lg); padding: 12px 14px; border-radius: 8px; font-size: 14px; animation: tin .18s ease-out; }
.ns-toast.err { border-left-color: var(--danger); }
.ns-toast.warn { border-left-color: var(--warning); }
.ns-toast.info { border-left-color: var(--info); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.ns-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.ns-modal { background: var(--card); border-radius: 8px; width: 100%; max-width: 512px; box-shadow: var(--shadow-lg); animation: tin .15s ease-out; }
.ns-modal.wide { max-width: 760px; }
.ns-modal.xwide { max-width: 1000px; }
.ns-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 8px; }
.ns-modal-title { font-size: 18px; font-weight: 600; }
.ns-modal-desc { font-size: 14px; color: var(--muted-fg); margin-top: 4px; }
.ns-modal-x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted-fg); cursor: pointer; padding: 0 2px; }
.ns-modal-body { padding: 12px 24px; }
.ns-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; flex-wrap: wrap; }

/* ── Combobox (ns.combo) ───────────────────────────────────────────────── */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 60; padding: 4px; }
.combo-item { padding: 8px 10px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.combo-item:hover, .combo-item.on { background: var(--muted); }
.combo-empty { padding: 10px; font-size: 13px; color: var(--muted-fg); }

@media print {
  .ns-top, .ns-tabs, .no-print, .ns-toasts { display: none !important; }
  body { background: #fff; }
  .ns-main { padding: 0; max-width: none; }
}
