:root {
  font-family: "Instrument Sans Variable", system-ui, sans-serif;
  font-size: 15px;
  color-scheme: light;
  --canvas: #f3f6f7;
  --paper: #fff;
  --ink: #192b39;
  --muted: #4d616e;
  --navy: #132837;
  --nav-text: #d9e5eb;
  --line: #d4dfe4;
  --line-strong: #a9bbc3;
  --teal: #075d50;
  --teal-hover: #074b41;
  --teal-soft: #e0f0eb;
  --danger: #9a2928;
  --notice: #fff4db;
  --notice-ink: #674900;
  --scrim: #13283780;
  background: var(--canvas);
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p { margin: 0; }
.sign-in { max-width: 26rem; margin: 8vh auto; padding: 1rem; }
.sign-in form { display: grid; gap: 1rem; padding: 1.5rem; background: var(--paper); border: 1px solid var(--line); border-radius: .6rem; }
.top #sign-out { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.top #sign-out a { color: inherit; }
.employees { display: grid; gap: 1rem; }
.employees ul { margin: 0; padding-inline-start: 1.25rem; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.85rem, 3.5vw, 2.55rem); letter-spacing: -.035em; line-height: 1.1; }
h2 { font-size: 1.3rem; letter-spacing: -.02em; }
p, label { overflow-wrap: anywhere; }
a { color: var(--teal); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; color: inherit; }
button, input, select, textarea, [data-slot="button"] {
  border: 1px solid var(--line-strong);
  border-radius: .45rem;
  background: var(--paper);
  padding: .55rem .75rem;
  min-width: 0;
}
button, [data-slot="button"] { cursor: pointer; font-weight: 650; }
button:hover:not(:disabled), [data-slot="button"]:hover { border-color: var(--teal); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.primary, [data-slot="button"][data-variant="default"] {
  color: var(--paper); background: var(--teal); border-color: var(--teal);
}
.primary:hover:not(:disabled), [data-slot="button"][data-variant="default"]:hover:not(:disabled) { background: var(--teal-hover); }
[data-slot="button"] { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none; }
[data-slot="button"][data-variant="ghost"] { background: transparent; border-color: transparent; color: var(--teal); }
[data-slot="button"][data-variant="ghost"]:hover { background: var(--teal-soft); }
[data-slot="button"] svg { width: 1rem; height: 1rem; flex: none; }
.top {
  min-height: 3.75rem; padding: .75rem max(1rem, calc((100% - 1320px) / 2));
  display: flex; align-items: center; gap: .85rem; background: var(--navy); color: var(--nav-text);
}
.top strong { color: var(--paper); font-size: 1.1rem; font-weight: 800; }
.top span { padding-left: .85rem; border-left: 1px solid var(--line-strong); }
main { max-width: 1352px; margin: auto; padding: clamp(1.5rem, 4vw, 3.25rem) 1rem; }
.title, .actions, .company-bar, .toolbar, .dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
}
.title p, .toolbar p, #empty, .wizard p { color: var(--muted); }
.title p, .wizard-title p { margin-top: .5rem; }
.company-bar { margin-top: 1.8rem; }
nav { display: flex; gap: .35rem; flex-wrap: wrap; min-width: 0; }
nav button { border-color: transparent; background: transparent; overflow-wrap: anywhere; max-width: 100%; }
nav [aria-pressed="true"] { background: var(--teal-soft); color: var(--teal); }
.worklist { margin-top: .8rem; background: var(--paper); border: 1px solid var(--line); border-radius: .75rem; }
.toolbar { padding: .9rem; }
.search { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th, td { border-top: 1px solid var(--line); padding: .6rem .75rem; overflow-wrap: anywhere; vertical-align: top; }
th { background: var(--canvas); color: var(--muted); white-space: nowrap; font-size: .85rem; }
th button, td button { padding: 0; border: 0; background: none; text-align: left; }
td button { color: var(--teal); text-decoration: underline; text-underline-offset: .2em; overflow-wrap: anywhere; }
td small { display: block; color: var(--muted); margin-top: .2rem; }
#empty { padding: 2rem 1rem; text-align: center; border-top: 1px solid var(--line); }
#status:not(:empty) { padding-top: 1rem; }
dialog {
  width: min(42rem, calc(100% - 1.5rem)); max-height: calc(100% - 1.5rem); border: 1px solid var(--line);
  border-radius: .75rem; padding: 1.25rem; color: var(--ink); background: var(--paper);
}
dialog::backdrop { background: var(--scrim); }
dialog.drawer { height: 100%; max-height: 100%; margin: 0 0 0 auto; border-radius: 0; }
dialog p, dialog form > button, dialog label { margin-top: .8rem; }
label:not(.search) { display: grid; gap: .35rem; min-width: 0; }
input, select, textarea { max-width: 100%; }
textarea { resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.error { color: var(--danger); }
#invoices { max-height: 15rem; overflow: auto; overflow-wrap: anywhere; }
#invoice-section { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }

.wizard { max-width: 1050px; }
.wizard-title { margin: 1rem 0 1.65rem; }
.wizard-title h1:focus { outline: none; }
.steps {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0;
  margin: 0 0 1rem; gap: .4rem; list-style: none;
}
.steps li {
  display: flex; gap: .45rem; align-items: center; min-width: 0; padding: .55rem .35rem;
  border-bottom: 2px solid var(--line); color: var(--muted); font-weight: 650;
}
.steps li[aria-current="step"] { color: var(--teal); border-color: var(--teal); }
.steps li[data-complete="true"] { color: var(--teal); }
.steps li > span {
  display: grid; place-items: center; width: 1.4rem; height: 1.4rem; flex: none;
  border-radius: 50%; background: var(--line); font-size: .8rem;
}
.steps li[aria-current="step"] > span, .steps li[data-complete="true"] > span { background: var(--teal-soft); }
.steps svg { width: .9rem; height: .9rem; }
.wizard-body { padding: clamp(1rem, 3vw, 1.75rem); background: var(--paper); border: 1px solid var(--line); border-radius: .75rem .75rem 0 0; }
.wizard-body h2 + p { margin-top: .4rem; }
.wizard-body .fields, .reference-field { margin-top: 1rem; }
.reference-field { max-width: 26rem; }
.file-name { font-weight: 650; }
.file-name + p { margin-top: .65rem; }
.file-box {
  display: grid; justify-items: center; gap: .55rem; margin: 1.2rem 0 .75rem; padding: 1.5rem 1rem;
  background: var(--canvas); border: 1px dashed var(--line-strong); border-radius: .6rem; text-align: center;
}
.file-box svg { color: var(--teal); }
.file-box label { font-weight: 650; }
.file-box input { width: min(100%, 28rem); }
.file-box small { color: var(--muted); overflow-wrap: anywhere; max-width: 100%; }
.notice { padding: .65rem .85rem; margin-top: .85rem; border-radius: .45rem; }
.wizard .notice { background: var(--notice); color: var(--notice-ink); }
.wizard .error { color: var(--danger); }
[data-slot="tabs-list"] {
  display: flex; flex-wrap: wrap; gap: .25rem; margin: 1rem 0 .6rem; padding: .25rem;
  border: 1px solid var(--line); border-radius: .55rem; background: var(--canvas);
}
[data-slot="tabs-trigger"] { display: flex; align-items: center; gap: .4rem; background: transparent; border-color: transparent; color: var(--muted); }
[data-slot="tabs-trigger"][data-state="active"] { color: var(--teal); background: var(--paper); border-color: var(--line-strong); }
[data-slot="tabs-trigger"] span { font-variant-numeric: tabular-nums; }
.review-table { min-width: 39rem; }
.review-table td:nth-child(5) { width: 38%; }
.review-empty { padding: 1rem 0; }
.wizard-footer {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .6rem; padding: .8rem clamp(.8rem, 3vw, 1.75rem);
  color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 .75rem .75rem;
}
.result { display: grid; justify-items: start; gap: .5rem; padding: .75rem 0; }
.result > svg { color: var(--teal); background: var(--teal-soft); border-radius: 50%; width: 2.75rem; height: 2.75rem; padding: .55rem; }
@media (max-width: 580px) {
  .fields { grid-template-columns: 1fr; }
  .steps li { flex-direction: column; align-items: start; font-size: .82rem; }
  .wizard-footer .actions { margin-left: auto; }
  .toolbar { align-items: start; }
}

.fabrication-details summary { cursor: pointer; color: var(--teal); }
.fabrication-details dl { margin: .5rem 0 0; }
.fabrication-details dl div { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .25rem; }
.fabrication-details dt { color: var(--muted); }
.fabrication-details dd { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#job-table { table-layout: fixed; }
#job-table th, #job-table td { position: relative; }
#job-table th { padding-right: 1.1rem; white-space: normal; }
#job-table .resize-handle {
  position: absolute; padding: 0; border: 0; border-radius: 0; background: transparent;
  touch-action: none; z-index: 1;
}
#job-table .resize-width { inset: 0 0 0 auto; width: 12px; cursor: col-resize; }
#job-table .resize-height { inset: auto 0 0; height: 12px; cursor: row-resize; }
#job-table .resize-handle::after { content: ""; position: absolute; background: var(--line-strong); }
#job-table .resize-width::after { inset: 25% 4px; }
#job-table .resize-height::after { inset: 4px 35%; }
#job-table .resize-handle:hover::after, #job-table .resize-handle:focus-visible::after { background: var(--teal); }
#job-table .editing-row { background: var(--teal-soft); }
.editing-row label { font-size: .85rem; }
.editing-row label + label { margin-top: .45rem; }
.editing-row input, .editing-row select { width: 100%; padding-inline: .4rem; }
.editing-row .inline-details label { margin-top: 0; }
.inline-details { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#inline-job-form { display: flex; gap: .35rem; flex-wrap: wrap; }
#inline-job-form button { padding: .4rem .55rem; border: 1px solid var(--line-strong); border-radius: .4rem; text-decoration: none; }
#inline-job-form button.primary { border-color: var(--teal); }
#inline-job-form .error { width: 100%; }
.pagination { display: flex; gap: .75rem; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: .75rem; border-top: 1px solid var(--line); }
.pagination label { display: flex; align-items: center; gap: .5rem; }

.table-scroll { position: relative; }

#tracker { max-width: none; padding-inline: clamp(1rem, 2vw, 2.5rem); }
.top { padding-inline: clamp(1rem, 2vw, 2.5rem); }
.column-picker { position: relative; }
.column-picker summary {
  cursor: pointer; font-weight: 650; border: 1px solid var(--line-strong);
  border-radius: .45rem; padding: .55rem .75rem; background: var(--paper);
}
.column-picker #column-options {
  position: absolute; z-index: 3; right: 0; top: calc(100% + .35rem); width: min(19rem, 80vw);
  padding: .45rem; max-height: min(25rem, 60vh); overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: .55rem;
  box-shadow: 0 8px 22px var(--scrim);
}
#column-options label { display: flex; align-items: center; gap: .5rem; padding: .35rem; cursor: pointer; }
#column-options input { accent-color: var(--teal); }
.column-option { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .25rem; align-items: center; }
.column-option label { overflow-wrap: anywhere; }
.column-option button { padding: .3rem .55rem; min-width: 2rem; }

.editing-row label {
  align-content: start;
  grid-template-rows: minmax(1.25rem, auto) auto;
  line-height: 1.25;
}
.editing-row input, .editing-row select { min-height: 2.25rem; }
.inline-details, .inline-notes { gap: .7rem 1rem; }
.inline-notes { margin-top: .85rem; }
.inline-notes label { margin-top: 0; }
.inline-notes textarea { width: 100%; min-height: 4.75rem; line-height: 1.4; overflow-wrap: anywhere; }

#selection-count { color: var(--muted); }
#selection-count:empty { display: none; }
#delete-all { margin-left: auto; }
.danger-button { color: var(--danger); }
#delete-form .danger-button { color: var(--paper); background: var(--danger); border-color: var(--danger); }
.delete-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
#job-table .selection-cell { padding: .6rem .25rem; text-align: center; }
.selection-cell input { accent-color: var(--teal); }
.import-match-note { margin-top: .4rem; }
nav [data-company-id][data-drop-target="true"] { border-color: var(--teal); background: var(--teal-soft); }

#history-section { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
#quantity-history { max-height: 15rem; overflow: auto; padding: 0; list-style: none; }
#quantity-history li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
#quantity-history span { display: block; color: var(--muted); }
.quantity-diff { padding: 0; margin: .35rem 0 0; list-style: none; color: var(--teal); font-size: .85rem; }

#tracker { padding-block: 1rem 2rem; }
.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.folders {
  position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: .75rem; padding: .6rem;
}
.folders-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .2rem .25rem .5rem; }
.folders-head h2 { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.folders-head button { padding: .3rem .55rem; font-size: .85rem; }
#folder-list { display: grid; gap: .15rem; }
.folder {
  display: grid; gap: .1rem; width: 100%; text-align: left; border-color: transparent; background: transparent;
  padding: .45rem .6rem; font-weight: 400;
}
.folder strong { font-weight: 650; overflow-wrap: anywhere; }
.folder small { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.folder[aria-current="true"] { background: var(--teal-soft); color: var(--teal); }
.folder-special strong { font-weight: 600; }
.folder-special:last-child { margin-top: .25rem; border-top: 1px solid var(--line); border-radius: 0 0 .45rem .45rem; }
.title h1 { font-size: 1.35rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.folder-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.folder-title button { padding: .3rem .6rem; font-size: .85rem; }
.content .company-bar { margin-top: .6rem; }
.mapping-group { border: 0; padding: 0; margin: 1.25rem 0 0; min-width: 0; }
.mapping-group legend { font-weight: 650; padding: 0; }
.mapping-group .fields { margin-top: .6rem; }
.review-table td small { display: block; color: var(--muted); }
#move-new { margin-top: .8rem; }
.reference-field + p { margin-top: 1rem; }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .folders { position: static; max-height: none; }
  #folder-list { display: flex; overflow-x: auto; gap: .35rem; padding-bottom: .2rem; }
  .folder { width: auto; flex: none; max-width: 14rem; }
  .folder-special:last-child { margin-top: 0; border-top: 0; border-radius: .45rem; }
}

.toolbar { padding: .7rem .9rem; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; min-width: 0; }
#search { width: min(24rem, 100%); }
.selection-bar {
  position: fixed; z-index: 5; bottom: 1rem; left: 50%; translate: -50% 0; width: max-content; max-width: calc(100% - 2rem);
  display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; padding: .55rem .7rem .55rem 1rem;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: .7rem; box-shadow: 0 10px 30px var(--scrim);
}
.worklist { margin-bottom: 4.5rem; }
.selection-bar button { padding: .35rem .7rem; }
#selection-count { color: var(--teal); margin-right: .2rem; }
.bar-divider { width: 1px; align-self: stretch; margin: .2rem .15rem; background: var(--line-strong); }
.bar-hint { color: var(--muted); font-size: .85rem; padding-left: .25rem; }
#job-table .selection-cell { white-space: nowrap; }
.drag-handle {
  display: inline-block; width: .6rem; height: 1.05rem; margin-right: .45rem; vertical-align: middle;
  cursor: grab; opacity: .45; background: radial-gradient(circle, var(--muted) 1.3px, transparent 1.6px) 0 0 / .3rem .35rem;
}
tr:hover .drag-handle, .drag-handle:hover { opacity: 1; }
.drag-handle[draggable="false"] { visibility: hidden; }
#drag-ghost {
  position: fixed; top: -200px; left: 0; padding: .4rem .75rem; border-radius: .45rem;
  background: var(--teal); color: var(--paper); font-weight: 650; pointer-events: none;
}
body.dragging-jobs .folder:not(:first-child) { outline: 1px dashed var(--line-strong); outline-offset: -1px; }
body.dragging-jobs .folder[data-drop-target="true"] { background: var(--teal-soft); color: var(--teal); outline: 2px solid var(--teal); }
@media (max-width: 860px) { .bar-hint, .drag-handle { display: none; } }
#undo-toast { left: 1rem; translate: none; }
#undo-message { margin-right: .3rem; }
#job-table tr[data-drop="before"] td { box-shadow: inset 0 2px 0 var(--teal); }
#job-table tr[data-drop="after"] td { box-shadow: inset 0 -2px 0 var(--teal); }
