:root {
  --bg: #eef2f6; --surface: #ffffff; --surface-2: #f4f7fa; --text: #1c2733; --muted: #5c6874;
  --line: #d6dee6; --line-strong: #b9c6d3;
  --accent: #1a3a5c; --accent-hover: #12293f; --on-accent: #ffffff; --accent-soft: #e3eaf2; --accent-text: #1a3a5c;
  --topbar: #1a3a5c; --focus: #96c83d;
  --brand-green: #96c83d; --brand-green-hover: #7bae28; --on-green: #15300a; --brand-navy: #1a3a5c; --brand-navy-dark: #12293f;
  --blue: #1f5fbf; --blue-soft: #e6eefb; --green: #237a3b; --green-soft: #e4f4e8;
  --red: #b3261e; --red-soft: #fbe9e7; --gray-soft: #eceff3; --gray-hover: #dde2e8;
  --ok-line: #b9dfc4; --ok-text: #17552a; --err-line: #f1c2bd; --err-text: #7d1a14;
  --row-hover: #e6eef7;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0f1a26; --surface: #172535; --surface-2: #1b2b3d; --text: #e3e9ef; --muted: #9fb1c1;
  --line: #2a3b4e; --line-strong: #3a4f66;
  --accent: #9cc0e6; --accent-hover: #bcd6f0; --on-accent: #0f1a26; --accent-soft: #22374d; --accent-text: #bcd6f0;
  --topbar: #12293f; --focus: #96c83d;
  --brand-green: #96c83d; --brand-green-hover: #a9d75a; --on-green: #15300a; --brand-navy: #1a3a5c; --brand-navy-dark: #12293f;
  --blue: #8db8f7; --blue-soft: #1b2a44; --green: #86d69a; --green-soft: #16301f;
  --red: #f39189; --red-soft: #3a1a17; --gray-soft: #262e37; --gray-hover: #313b46;
  --ok-line: #24523a; --ok-text: #a6e3b6; --err-line: #6a2a25; --err-text: #f6b8b2;
  --row-hover: #22364d;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a26; --surface: #172535; --surface-2: #1b2b3d; --text: #e3e9ef; --muted: #9fb1c1;
  --line: #2a3b4e; --line-strong: #3a4f66;
  --accent: #9cc0e6; --accent-hover: #bcd6f0; --on-accent: #0f1a26; --accent-soft: #22374d; --accent-text: #bcd6f0;
  --topbar: #12293f; --focus: #96c83d;
  --brand-green: #96c83d; --brand-green-hover: #a9d75a; --on-green: #15300a; --brand-navy: #1a3a5c; --brand-navy-dark: #12293f;
  --blue: #8db8f7; --blue-soft: #1b2a44; --green: #86d69a; --green-soft: #16301f;
  --red: #f39189; --red-soft: #3a1a17; --gray-soft: #262e37; --gray-hover: #313b46;
  --ok-line: #24523a; --ok-text: #a6e3b6; --err-line: #6a2a25; --err-text: #f6b8b2;
  --row-hover: #22364d;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); }
/* The title bar and menu stay at the top while the page scrolls. */
.stickytop { position: sticky; top: 0; z-index: 50; }
html { scroll-padding-top: 7rem; }     /* links to #sections land below the bar */
/* Title bar: white with the NxtWall logo, like www.nxtwall.com (white in dark mode too, so the logo reads) */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: #ffffff; color: #1c2733; padding: .45rem 1.25rem; border-bottom: 3px solid var(--brand-green); }
.topbar .brand { display: flex; align-items: center; gap: .8rem; color: #1a3a5c; font-weight: 800;
  font-size: 1.1rem; text-decoration: none; letter-spacing: .01em; }
.topbar .brand img { height: 34px; width: auto; display: block; }
.topbar .brand .appname { border-left: 1px solid #c6d3df; padding-left: .8rem; }
.who { display: flex; align-items: center; gap: 1rem; font-size: .88rem; }
.who a { color: #1a3a5c; }
.signout { display: inline; margin: 0; }
button.linklike { background: none; color: #1a3a5c; padding: 0; font-weight: 400; text-decoration: underline; font-size: .88rem; }
button.linklike:hover { background: none; opacity: .85; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; background: var(--brand-navy); padding: .35rem 1.25rem;
  border-bottom: 1px solid var(--brand-navy-dark); }
.tabgroup { display: flex; flex-wrap: wrap; gap: .1rem; }
.tabs a { padding: .4rem .8rem; border-radius: 999px; text-decoration: none; color: #ffffff; font-size: .95rem; }
.tabs a:hover { background: rgba(255, 255, 255, .14); }
.tabs a.on { background: var(--brand-green); color: var(--on-green); font-weight: 700; }
/* The Admin menu: a drop-down in the menu bar */
.navmenu { position: relative; }
.navmenu > summary { list-style: none; cursor: pointer; padding: .4rem .8rem; border-radius: 999px; color: #ffffff;
  font-size: .95rem; white-space: nowrap; }
.navmenu > summary::-webkit-details-marker { display: none; }
.navmenu > summary:hover, .navmenu[open] > summary { background: rgba(255, 255, 255, .14); }
.navmenu > summary.on { background: var(--brand-green); color: var(--on-green); font-weight: 700; }
.navmenu .caret { margin-left: .35rem; font-size: .75em; }
.navmenu .navcount { display: inline-block; min-width: 1.1rem; margin-left: .3rem; padding: 0 .3rem; border-radius: .6rem;
  background: #f0a400; color: #1a1a1a; font-size: .7rem; font-weight: 700; text-align: center; line-height: 1.1rem;
  vertical-align: middle; }
.navmenu .dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #ff6b5e;
  box-shadow: 0 0 0 2px #fff; margin-left: .3rem; vertical-align: middle; }
.navpanel { position: absolute; top: calc(100% + .35rem); left: 0; z-index: 50; min-width: 15rem; padding: .4rem;
  background: var(--brand-navy); border: 1px solid var(--brand-navy-dark); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); display: flex; flex-direction: column; gap: .1rem; }
.navpanel a { white-space: nowrap; }
.navpanel .navhead { color: rgba(255, 255, 255, .6); font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: .55rem .8rem .15rem; }
.navpanel .navhead:first-child { padding-top: .25rem; }
main { max-width: 1320px; margin: 0 auto; padding: 1.25rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 .3rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .6rem; }
h3 { font-size: .9rem; font-weight: 600; color: var(--muted); margin: 1rem 0 .3rem; }
.count { font-size: .85rem; font-weight: 500; color: var(--muted); background: var(--gray-soft);
  border-radius: 999px; padding: .05rem .55rem; margin-left: .3rem; vertical-align: middle; }
.intro { color: var(--muted); margin: 0 0 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.hint { display: block; font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.empty { color: var(--muted); padding: 1rem 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; margin: 1rem 0; }
.card h2:first-child { margin-top: .2rem; }
.titlebar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.titlebar.cardhead { align-items: center; margin-bottom: .45rem; }
.card .titlebar.cardhead h2 { margin: 0; }
.headbuttons { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .5rem; }

.flash { padding: .65rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--green-soft); border-color: var(--ok-line); color: var(--ok-text); }
.flash.error { background: var(--red-soft); border-color: var(--err-line); color: var(--err-text); }

table.grid { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.card table.grid { border: 0; border-radius: 0; }
.grid th { text-align: left; font-size: .85rem; font-weight: 600; color: var(--muted);
  background: var(--surface-2); padding: .55rem .75rem; border-bottom: 1px solid var(--line); }
/* Sortable list columns (static/sortable.js): the title is a button. */
.grid th button.colsort { all: unset; cursor: pointer; font: inherit; color: inherit; }
.grid th button.colsort:hover { color: var(--text); text-decoration: underline; }
.grid th button.colsort:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 2px; border-radius: 3px; }
.grid th[aria-sort="ascending"], .grid th[aria-sort="descending"] { color: var(--text); }
.grid th.num button.colsort { text-align: right; }
.grid td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
/* The row under the mouse is shaded, on every list, so it is easy to follow across. */
.grid tbody tr:hover > td { background: var(--row-hover); }
.grid tr.more td { padding-top: 0; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.grid tr.completed td, .grid tr.canceled td { color: var(--muted); }
.grid tr.completed strong, .grid tr.canceled strong { font-weight: 500; }
.grid tr.waiting td:first-child { color: var(--muted); }
.overdue { color: var(--red); font-weight: 600; }
.actions form { display: inline; margin-right: .3rem; }
.nowrap { white-space: nowrap; }
.grid td.notes { min-width: 12rem; max-width: 22rem; font-size: .9rem; }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: .1rem .55rem; }
.badge.open { background: var(--blue-soft); color: var(--blue); }
.badge.waiting, .badge.canceled { background: var(--gray-soft); color: var(--muted); }
.badge.completed { background: var(--green-soft); color: var(--green); }
.badge.late { background: var(--red-soft); color: var(--red); }
.badge.stage { background: var(--accent-soft); color: var(--accent-text); }
/* Quote statuses */
.badge.status-open { background: none; color: var(--muted); font-weight: 500; padding-left: 0; padding-right: 0; }
.badge.status-sold { background: var(--brand-green); color: var(--on-green); font-weight: 700; }
.statusfacts dd.soldline { font-size: 1.2rem; font-weight: 700; }
.badge.status-revised { background: var(--accent-soft); color: var(--accent-text); }
.badge.status-closed { background: var(--gray-soft); color: var(--muted); }
/* Quotes from the quoting program */
ul.quotefiles { list-style: none; margin: .2rem 0 0; padding: 0; display: grid; gap: .35rem; }
ul.quotefiles li { display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
ul.quotefiles li > .small.muted:first-child { min-width: 6.5rem; }
p.proposaltext { white-space: pre-wrap; font-size: .9rem; }
table.quotelines tr.pricinghead td { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); }
table.quotelines tr.pricingline td { background: var(--surface-2); }
.othersform { display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; margin-top: .3rem; }
/* Quoting program screen */
.newkey { border-color: var(--brand-green); }
.diskline.warn { background: var(--red-soft); border-color: var(--err-line); color: var(--err-text); }
code.thekey { display: inline-block; font-size: 1rem; padding: .5rem .75rem; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; user-select: all; overflow-wrap: anywhere; }
code.apiurl { user-select: all; }
.linkform { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.linkform input { width: 18rem; max-width: 100%; }
.revisionedit { margin-top: .6rem; }
.revisionedit summary { cursor: pointer; font-size: .88rem; color: var(--accent-text); }
.revisionform { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; margin: .6rem 0 .3rem; }
.revisionform select { max-width: 100%; }
.closeform { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; margin: .6rem 0 .3rem; }
.closeform select, .closenote { max-width: 100%; }
.closenote { flex: 1 1 14rem; }
.reopenform { margin-top: .6rem; }
.closedline { line-height: 1.4; }
.daysbox { width: 4.5rem; padding: .15rem .3rem; }
.tabs a .navcount { display: inline-block; min-width: 1.1rem; margin-left: .3rem; padding: 0 .3rem; border-radius: .6rem;
  background: #f0a400; color: #1a1a1a; font-size: .7rem; font-weight: 700; line-height: 1.1rem; text-align: center;
  vertical-align: middle; }
.quotetop { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rowwarn td { background: var(--warn-bg, #fff4d6); }
.palletweights { max-width: 22rem; }
.openquotes { border-left: 4px solid var(--warn, #c98a00); }
.openquotes select { max-width: 100%; }
.openquotes input[type=text] { width: 100%; min-width: 8rem; }
.revisionbuttons { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.revisionswitch p { margin: 0 0 .6rem; }
h3.chainhead { font-size: .95rem; margin: 1rem 0 .35rem; }
table.chain { margin-bottom: .4rem; }
details.samename summary { cursor: pointer; font-weight: 600; margin-top: 1rem; }
/* Revisions tab: each section folds */
details.revsection > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline;
  gap: .2rem .8rem; }
details.revsection > summary::-webkit-details-marker { display: none; }
details.revsection > summary h2 { margin: 0; font-size: 1.1rem; }
details.revsection > summary h2::before { content: "▸ "; color: var(--accent-text); }
details.revsection[open] > summary h2::before { content: "▾ "; }
details.revsection[open] > summary { margin-bottom: .6rem; }
.badge.big { font-size: .85rem; padding: .25rem .8rem; white-space: nowrap; }

.bar { display: inline-block; width: 130px; height: 8px; border-radius: 999px; background: var(--gray-soft);
  vertical-align: middle; overflow: hidden; }
.bar.wide { width: 220px; }
.bar > span { display: block; height: 100%; background: var(--brand-green-hover); }

button { font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; border: 0; border-radius: 999px;
  background: var(--brand-green); color: var(--on-green); padding: .4rem 1rem; }
button:hover { background: var(--brand-green-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--gray-soft); color: var(--text); }
button.secondary:hover { background: var(--gray-hover); }
input, textarea { font: inherit; width: 100%; padding: .45rem .6rem; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--surface); color: var(--text); }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.search { display: flex; gap: .5rem; align-items: center; margin: 0 0 1rem; max-width: 640px; }
.search input { flex: 1; }
.form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.25rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.field.wide, .form button { grid-column: 1 / -1; }
.form button { justify-self: start; }
.sr { position: absolute; left: -9999px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem 1.5rem; }
.facts dl { margin: 0; }
.facts dt { font-size: .82rem; color: var(--muted); margin-top: .4rem; }
.facts dd { margin: 0; font-weight: 500; }
.description { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem;
  font-size: .9rem; margin: 0; }
details summary { cursor: pointer; color: var(--accent); font-size: .88rem; font-weight: 600; }
details ol { margin: .4rem 0 .2rem; padding-left: 1.3rem; font-size: .9rem; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 4fr); gap: 0 1.25rem; align-items: start; }
.detail-grid .card:first-child { margin-top: 0; }
.col-tasks .grid th, .col-tasks .grid td { padding: .5rem .55rem; }
.col-tasks .grid td { font-size: .92rem; }
.col-tasks .actions form { display: block; margin: 0 0 .3rem; }
.auth-card { max-width: 26rem; margin: 2rem auto; }
.pwbox { display: flex; gap: .4rem; align-items: center; }
.pwbox input { flex: 1; }
.pwbox button { flex: 0 0 4.2rem; padding: .45rem .5rem; }
.auth-card.wide { max-width: 34rem; }
.stack { display: grid; gap: 1rem; }
.qr { background: #fff; display: inline-block; padding: .25rem; border: 1px solid var(--line); border-radius: 8px; }
.qr svg { display: block; width: 200px; height: 200px; }
.keybox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.1rem; letter-spacing: .04em;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; word-break: break-all; }
ol.steps { padding-left: 1.3rem; margin: .3rem 0 .8rem; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
label.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; }
label.check input { width: auto; }
.actionrow { display: flex; align-items: center; gap: .75rem; margin: 0 0 .75rem; flex-wrap: wrap; }
.actionrow .hint { margin: 0; flex: 1 1 14rem; }
@media (max-width: 1320px) { .detail-grid { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  main { padding: .75rem; }
  .form { grid-template-columns: 1fr; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; gap: 1rem; }
  .tabgroup { flex-wrap: nowrap; }
  .tabs a { white-space: nowrap; }
  .navpanel { position: fixed; left: .75rem; right: .75rem; top: auto; }     /* not cut off by the scrolling bar */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  table.responsive td { border: 0; padding: .15rem .75rem; display: flex; gap: .6rem; }
  table.responsive td::before { content: attr(data-label); flex: 0 0 5.5rem; color: var(--muted); font-size: .82rem;
    padding-top: .1rem; }
  table.responsive td[data-label=""]::before { display: none; }
  table.grid tr.more td { display: block; }
}

form.inline { display: inline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em;
  background: rgba(127,127,127,.12); padding: 0 .25em; border-radius: 3px; }
.qbwarn { border-left: 4px solid var(--red); }
.tabs a .dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #ff6b5e; box-shadow: 0 0 0 2px #fff;
  margin-left: .3rem; vertical-align: middle; }
table.grid + .actionrow { margin-top: .75rem; }
/* Keep the task table inside its box when the page is split 60/40. */
.col-tasks table.grid { width: 100%; table-layout: fixed; }
.col-tasks table.grid th:nth-child(1) { width: 30%; }
.col-tasks table.grid th:nth-child(2) { width: 23%; }
.col-tasks table.grid th:nth-child(3) { width: 23%; }
.col-tasks table.grid th:nth-child(4) { width: 24%; }
.col-tasks .grid td { overflow-wrap: break-word; }
.col-tasks .badge { white-space: nowrap; }
.col-tasks .actions button { padding: .4rem .45rem; width: 100%; font-size: .85rem; white-space: nowrap; }

/* Order Details: slightly smaller text in the boxes people type in */
input.compact, textarea.compact, .rt-editor.compact { font-size: .9rem; }

/* Project Status editor */
.rt-toolbar { display: flex; gap: .3rem; align-items: center; margin: 0 0 .3rem; flex-wrap: wrap; }
.rt-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong);
  padding: .2rem .55rem; font-size: .85rem; min-width: 2rem; line-height: 1.4; }
.rt-btn:hover { background: var(--gray-hover); }
.rt-swatch span { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; vertical-align: middle; }
.rt-editor { width: 100%; padding: .45rem .6rem; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--text); line-height: 1.45;
  min-height: calc(11 * 1.45em + .9rem); max-height: 32rem; overflow-y: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.rt-editor:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
/* Outlook lines up its "columns" with spaces in Calibri; the same font keeps them lined up here. */
.rt-editor, .project-page .rt-editor { font-family: Calibri, Carlito, "Segoe UI", system-ui, sans-serif; font-size: .95rem; }
.rt-editor ul, .rt-editor ol { margin: 0; padding-left: 1.6em; white-space: normal; }
.rt-editor li { white-space: pre-wrap; }
.rt-editor ul ul { list-style-type: circle; }
.rt-editor ul ul ul { list-style-type: square; }
.rt-editor blockquote { margin: 0 0 0 2em; padding: 0; border: 0; }
.rt-editor span[style*="background-color"] { color: #1c2733; border-radius: 2px; }
.rt-sep { display: inline-block; width: 1px; align-self: stretch; background: var(--line-strong); margin: 0 .15rem; }
.rt-highlight span { border: 1px solid var(--line-strong); }
select.inline-select { font: inherit; padding: .45rem .5rem; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--surface); color: var(--text); width: auto; }

/* Lists (Orders to Ship, All Open, Closed, team screens): full width and compact rows */
/* Lists and the order page use the screen's width, up to 1920 pixels; wider screens get margins. */
main.wide { max-width: 1920px; padding: .75rem 1.25rem; }
.listhead { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.25rem; margin: 0 0 .6rem; }
.listhead h1 { margin: 0; font-size: 1.35rem; }
.listhead .intro { margin: 0; font-size: .85rem; }
.listhead .search { margin: 0 0 0 auto; flex: 0 1 28rem; }
.totals { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .9rem; }
.totals .label { color: var(--muted); }
.totals strong { font-variant-numeric: tabular-nums; }
table.grid.dense { font-size: .875rem; line-height: 1.3; }
table.grid.dense th { padding: .4rem .55rem; font-size: .8rem; }
table.grid.dense td { padding: .3rem .55rem; }
table.grid.dense td.notes { font-size: .875rem; min-width: 10rem; }
table.grid.dense .badge { white-space: nowrap; font-size: .72rem; padding: .05rem .45rem; }
table.grid.dense .bar { width: 70px; height: 7px; vertical-align: middle; }
table.grid.dense button { padding: .25rem .7rem; font-size: .85rem; }
.dense td[data-label="Project"], .dense td[data-label="Customer"] { min-width: 19rem; }
.grid th.num, .grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Orders to Ship: the short columns fit their contents (no gaps on wide screens), Project
   and Customer have a set width, and Tasks now open takes whatever room is left. */
.dense.with-total td[data-label="S.O."], .dense.with-total td[data-label="Total"],
.dense.with-total td[data-label="Expected Ship"], .dense.with-total td[data-label="Stage"],
.dense.with-total td[data-label="Progress"] { width: 1%; white-space: nowrap; }
.dense.with-total th { white-space: nowrap; }
.dense.with-total td[data-label="Project"], .dense.with-total td[data-label="Customer"] { width: 21rem; min-width: 15rem; }
.dense.with-total td.notes { width: 14rem; min-width: 8rem; }
/* Smaller screens (up to about 1400 pixels): narrower, so the list never scrolls sideways. */
@media (max-width: 1400px) {
  .dense.with-total td[data-label="Project"], .dense.with-total td[data-label="Customer"] { width: 13rem; min-width: 11rem; }
  .dense.with-total td.notes { width: 10rem; }
}
@media (max-width: 760px) { table.responsive td.num { text-align: left; } }
.nowrap { white-space: nowrap; }
main.wide h2 { margin: 1rem 0 .4rem; font-size: 1.1rem; }

/* Shipping custom text choices */
.choicebar { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .35rem; }
.choicebar button { padding: .3rem .7rem; font-size: .85rem; }
.auth-card form + form { margin-top: .6rem; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.card .field.wide + .field.wide, .card .field + .field.wide { margin-top: .75rem; }

/* Project page: full width and tighter, like the lists */
/* Project name line: stays at the top under the menu, stage and progress on the right */
.projecthead { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.25rem;
  background: var(--bg); padding: .5rem max(1.25rem, calc((100% - 1920px) / 2 + 1.25rem)); border-bottom: 1px solid var(--line); }
.projecthead h1 { margin: 0; font-size: 1.35rem; }
.projecthead .so-customer { font-size: 1.05rem; color: var(--muted); font-weight: 500; }
.projecthead .headright { margin-left: auto; display: inline-flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.projecthead .badge.big { font-size: .78rem; padding: .15rem .65rem; }
.headsearch { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
.headsearch input[type=search] { width: 13rem; max-width: 100%; padding: .25rem .5rem; }
@media (max-width: 640px) { .headsearch { flex: 1 1 100%; } .headsearch input[type=search] { flex: 1; width: auto; } }
html:has(.projecthead) { scroll-padding-top: 10rem; }
.progressline { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; }
.progressline .bar.wide { width: 160px; }
.project-page .card { padding: .7rem 1rem; margin: .6rem 0; }
.project-page .card h2 { font-size: 1.02rem; margin: .1rem 0 .45rem; }
.project-page .form { gap: .45rem 1rem; }
.project-page .field label { font-size: .84rem; margin-bottom: .1rem; }
.project-page .hint { font-size: .76rem; margin-top: .05rem; }
.project-page input, .project-page textarea { padding: .3rem .5rem; font-size: .88rem; }
.project-page .rt-editor { padding: .3rem .5rem; font-size: .88rem; }
.project-page .rt-toolbar { margin-bottom: .2rem; }
.project-page .facts { gap: .1rem 1.25rem; }
.project-page .facts dt { font-size: .76rem; margin-top: .25rem; }
.project-page .facts dd { font-size: .9rem; }
.project-page .facts h3 { font-size: .9rem; margin: .2rem 0 0; }
.project-page .detail-grid { gap: 0 1rem; }
.project-page .col-tasks .grid th, .project-page .col-tasks .grid td { padding: .3rem .5rem; }
.project-page .col-tasks .grid td { font-size: .85rem; }
.project-page .col-tasks .actions form { margin: 0 0 .2rem; }
.project-page .col-tasks .actions button { padding: .25rem .45rem; font-size: .8rem; }
.project-page .col-tasks .grid tr.more td { padding-top: 0; padding-bottom: .2rem; }
.project-page .actionrow { margin: 0 0 .4rem; }
.project-page .card table.grid td, .project-page .card table.grid th { padding-top: .3rem; padding-bottom: .3rem; }
.project-page main > .card, .project-page details { font-size: .9rem; }
.project-page .card .field.wide + .field.wide, .project-page .card .field + .field.wide { margin-top: .2rem; }
.project-page .col-tasks table.grid th:nth-child(1) { width: 27%; }
.project-page .col-tasks table.grid th:nth-child(2) { width: 36%; }
.project-page .col-tasks table.grid th:nth-child(3) { width: 17%; }
.project-page .col-tasks table.grid th:nth-child(4) { width: 20%; }

/* Order lists: the title row and the column headings stay in view under the menu
   (stickyhead.js measures --sticky-h and --listhead-h). Not on phones, where the
   column headings are hidden and the title row wraps. */
@media (min-width: 761px) {
  .listpage .listhead { position: sticky; top: var(--sticky-h, 7rem); z-index: 40;
    background: var(--bg); margin: -.75rem -1.25rem 0; padding: .6rem 1.25rem; }
  .listpage table.grid { overflow: visible; }
  .listpage table.grid thead th { position: sticky; z-index: 30;
    top: calc(var(--sticky-h, 7rem) + var(--listhead-h, 3.5rem));
    box-shadow: inset 0 -1px 0 var(--line); }
  .listpage h2.elsewhere { margin-top: 1rem; }
}

/* Documents on the project page */
.doclist { list-style: none; margin: 0 0 .5rem; padding: 0; }
.doclist li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.doclist li:last-child { border-bottom: 0; }
.docline { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.docname { font-weight: 600; overflow-wrap: anywhere; flex: 1 1 12rem; }
.docactions { display: inline-flex; align-items: baseline; gap: .75rem; }
button.linkbtn { background: none; color: var(--red); padding: 0; font-weight: 400; text-decoration: underline; }
button.linkbtn:hover { background: none; opacity: .85; }
.docreplace summary { font-size: .8rem; font-weight: 400; margin-top: .1rem; }
.docreplace form { margin: .35rem 0 .1rem; }
.doclist input[type=file], .docadd input[type=file] { flex: 1 1 12rem; width: auto; padding: .25rem; font-size: .85rem; }
.docadd { margin: .4rem 0 0; }

/* The Email screen: settings on the left (2/3), the log on the right (1/3) */
.email-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0 1.25rem; align-items: start; }
.email-grid.single { grid-template-columns: minmax(0, 1fr); max-width: 60rem; }
.email-main > .card:first-child { margin-top: 0; }
.email-log { position: sticky; top: var(--sticky-h, 7rem); }
.email-log .card { margin-top: 0; max-height: calc(100vh - 9rem); overflow-y: auto; }
.loglist { list-style: none; margin: 0; padding: 0; }
.loglist li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.loglist li:last-child { border-bottom: 0; }
.loglist .small { overflow-wrap: anywhere; }
.logtop { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; font-size: .9rem; }
.loglist form { margin-top: .3rem; }
details.fold { margin: 1rem 0; }
details.fold > summary { list-style: none; display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: .7rem 1rem; color: var(--text); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--accent); font-size: .9rem; }
details.fold[open] > summary::before { content: "▾"; }
details.fold > summary:hover { background: var(--surface-2); }
.foldtitle { font-weight: 700; font-size: 1.02rem; }
.foldhint { color: var(--muted); font-size: .85rem; font-weight: 400; }
details.fold[open] > summary { border-color: var(--accent); }
details.fold > .intro { margin: .75rem 0 0; }
@media (max-width: 1100px) { .email-grid { grid-template-columns: minmax(0, 1fr); } .email-log { position: static; }
  .email-log .card { max-height: none; } }

/* Close early: moving information to the replacement order */
fieldset.transfer { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem .7rem; margin: 0;
  display: grid; gap: .35rem; }
fieldset.transfer legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
fieldset.transfer .actionrow { margin: .2rem 0 0; }
fieldset.transfer input.so-input { width: 9rem; flex: 0 0 auto; }

/* Quotes */
.quotesearch { flex-wrap: wrap; }
.quotesearch input[type=date] { width: auto; flex: 0 0 auto; }
.listhead .crumbs { flex-basis: 100%; order: -1; margin: 0; color: var(--muted); }
.listhead .search.browsesearch { flex: 0 1 34rem; }
/* Customers tab: jobs and quotes open under their row */
a.opener { text-decoration: none; }
a.opener:hover { text-decoration: underline; }
a.opener .twisty { display: inline-block; width: 1em; color: var(--accent-text); }
tr.subrow > td { background: var(--surface-2); padding: .4rem .6rem .7rem 1.6rem; }
table.subtable { width: 100%; margin: 0; background: var(--surface); }
table.subtable tr.subrow > td { padding-left: 1.4rem; }
.listpage table.subtable thead th { position: static; }   /* only the main list's headings stay in view */
@media (max-width: 760px) {
  /* On a phone the opened jobs and quotes stack as cards inside their customer's card, like the main list */
  table.responsive tr.subrow > td { display: block; padding: .3rem .4rem .5rem .9rem; }
  table.responsive tr.subrow > td::before { display: none; }
  table.subtable { border: 1px solid var(--line); border-radius: 8px; }
}
/* Quote list: title, totals and description on one row; every search field across the next */
.listhead .search.quotesearch { flex: 1 1 100%; max-width: none; margin-left: 0; align-items: center; }
.quotesearch .f-main { flex: 3 1 18rem; min-width: 0; }
.quotesearch .f-city { flex: 1 1 8rem; min-width: 0; }
.quotesearch .f-state { flex: 0 0 4.5rem; }
.quotesearch .f-zip { flex: 0 0 6rem; }
.tabs .backtab { opacity: .85; }
.reporthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.reportlinks { display: inline-flex; gap: 1rem; font-size: .9rem; }
.narrowlabel { font-weight: 600; font-size: .9rem; }
.controlrow { display: inline-flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; flex-basis: 100%; }
.controlrow button[type=submit] { margin-left: .3rem; }
/* Build pallets' Freight cost: the ship-to address on one line */
.shipto input { width: auto; padding: .15rem .3rem; }
.shipto input.street { width: 14rem; max-width: 100%; }
.shipto input.city { width: 9rem; }
.shipto input.daysbox { width: 4.5rem; }
.sortrow label { display: inline-flex; gap: .3rem; align-items: center; }
button.foldbtn { background: none; color: var(--accent); padding: 0 .3rem 0 0; font-size: .9rem; line-height: 1; }
button.foldbtn:hover { background: none; color: var(--accent-hover); }
.foldspace { display: inline-block; width: 1.05rem; }
@media print { button.foldbtn { display: none; } .foldspace { display: none; } }
a.buttonlike.primary { background: var(--brand-green); color: var(--on-green); }
a.buttonlike.primary:hover { background: var(--brand-green-hover); }
a.buttonlike.small { font-size: .8rem; padding: .25rem .7rem; }
.reportform .card input[name=name] { max-width: 32rem; }
select:disabled { opacity: .45; cursor: not-allowed; }
.levelrow, .filterrow { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; margin: .3rem 0; }
.filterrow .filtervalue { width: 24rem; max-width: 100%; }
.colpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .3rem 1rem; }
.colpick .posbox { width: 3.2rem; padding: .15rem .3rem; }
@media print { .reportlinks { display: none !important; } }
.reporthead h1 { margin: 0; font-size: 1.35rem; }
.reportscope { margin: .1rem 0 .6rem; color: var(--muted); font-size: .9rem; }
.reportcontrols { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; margin: 0 0 .9rem; }
.reportcontrols input[type=date] { width: auto; }
.reportactions { margin-left: auto; display: inline-flex; gap: .5rem; align-items: center; }
a.buttonlike { display: inline-block; font-size: .9rem; font-weight: 700; border-radius: 999px; padding: .4rem 1rem;
  background: var(--gray-soft); color: var(--text); text-decoration: none; }
a.buttonlike:hover { background: var(--gray-hover); }
table.report { max-width: 90rem; }
table.report .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.report tr.grouprow td { font-weight: 600; background: var(--surface-2); }
table.report tr.grouprow.level0 td { background: var(--accent-soft); font-weight: 700; }
table.report:not(.detailed) tr.grouprow.level0 td { background: var(--surface-2); }
table.report:not(.detailed) tr.grouprow:not(.level0) td { font-weight: 400; background: none; }
table.report tr.quoterow td { font-size: .88rem; }
table.report tfoot th { border-top: 2px solid var(--line-strong); }
@media print {
  .stickytop, .reportcontrols, .flash { display: none !important; }
  body, main, .card { background: #fff !important; color: #000; }
  main.wide { max-width: none; padding: 0; }
  table.report { font-size: 10pt; border: 0; }
  table.report tr.grouprow td { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.report a { color: #000; text-decoration: none; }
  table.report tr { break-inside: avoid; }
  table.report thead { display: table-header-group; }
}
.facts.quotefacts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts.addresses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts dd.address { line-height: 1.45; }
@media (max-width: 760px) { .facts.addresses { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .facts.quotefacts { grid-template-columns: 1fr; } }
table.subtotals { border-collapse: collapse; min-width: 22rem; font-size: .9rem; }
table.subtotals td, table.subtotals th { padding: .2rem .6rem .2rem 0; text-align: left; }
table.subtotals .num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
table.subtotals tbody.extras tr:first-child td { border-top: 1px solid var(--line); padding-top: .35rem; }
table.subtotals tfoot th { border-top: 1px solid var(--line-strong); padding-top: .35rem; }

/* Deposit invoices */
table.depositlines { width: 100%; }
table.depositlines td { vertical-align: top; }
table.depositlines textarea { width: 100%; min-width: 16rem; font-size: .85rem; }
table.depositlines .itembox { width: 8rem; }
.moneybox { width: 7.5rem; padding: .15rem .3rem; text-align: right; }
table.depositlines input.pct { text-align: right; }
table.depositoptions td { vertical-align: top; }
table.depositoptions textarea { display: block; margin-top: .3rem; font-size: .85rem; }

/* Dashboard */
.tabs .tabend { margin-left: auto; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 12rem)); gap: .75rem; margin: 0 0 .75rem; }
.kpis.gsakpis { grid-template-columns: repeat(6, minmax(0, 12rem)); }
@media (max-width: 760px) { .kpis.gsakpis { grid-template-columns: 1fr 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem 1rem; }
.kpi .label { display: block; font-size: .82rem; color: var(--muted); }
.kpi strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.dashpage .card { max-width: 60rem; }
/* Orders by stage, then Total sales and Orders sold beside it (side by side under it on narrower screens) */
.dashrow { display: grid; grid-template-columns: minmax(0, 52rem) repeat(2, minmax(15rem, 19rem)); gap: .75rem; align-items: start; }
.dashrow > .card { margin: 0; }
.salescard h2 { margin: 0 0 .45rem; }
table.salestable { border: 0; }
.salestable td, .salestable th { padding: .4rem .5rem; }
.salestable td:first-child { white-space: nowrap; }
.salestable tr.lastof td { border-bottom: 1px solid var(--line-strong); }
.salestable tbody tr:last-child td { border-bottom: 0; }
.salescard .hint { margin: .5rem 0 0; }
.salescard h2 a { color: inherit; text-decoration: none; }
.salescard h2 a:hover { text-decoration: underline; }
.salestable tr.picked td { background: var(--accent-soft); }
.salestable tr.picked td a { font-weight: 700; }
.dashrow.salesrow { grid-template-columns: repeat(2, minmax(15rem, 22rem)); }
@media (max-width: 760px) { .dashrow.salesrow { grid-template-columns: 1fr; } }
@media (max-width: 1400px) { .dashrow { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashrow > .card:first-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .dashrow { grid-template-columns: 1fr; } }
table.stagebars { border: 0; }
.stagebars td, .stagebars th { padding: .45rem .6rem; }
.stagebars .barcol { width: 45%; }
.stagebars tfoot th { color: var(--text); border-top: 1px solid var(--line-strong); background: none; }
.stagebars tr.picked td { background: var(--accent-soft); }
.stagebars tr.picked td a { font-weight: 700; }
.hbar { display: block; height: 16px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--blue); }
.hbar.dim { background: var(--line-strong); }
.dashlisthead { align-items: baseline; margin: 1rem 0 .4rem; }
.dashtest { margin: 0 0 0 auto; }
.dashlisthead h2 { margin: 0; }
@media (max-width: 760px) { .kpis { grid-template-columns: 1fr 1fr; } .stagebars .barcol { width: 30%; } }

/* A row of buttons where one is chosen (the Accounting screen's "put on top" toggle). */
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden;
  background: var(--surface); }
.segmented a { padding: .3rem .9rem; font-size: .85rem; text-decoration: none; color: var(--text);
  border-left: 1px solid var(--line-strong); white-space: nowrap; }
.segmented a:first-child { border-left: 0; }
.segmented a:hover { background: var(--gray-hover); }
.segmented a.on { background: var(--brand-green); color: var(--on-green); font-weight: 700; }

/* Team task screens: one line per task, like the order lists. */
.teampage h2 { margin: .7rem 0 .35rem; font-size: 1.05rem; }
.teampage .listhead + h2 { margin-top: .5rem; }
.teampage table.grid.dense td.action { text-align: right; white-space: nowrap; width: 1%; }
.teampage table.grid.dense td.action button { padding: .12rem .7rem; font-size: .8rem; }
.teampage table.grid.dense td.action .small { white-space: normal; display: inline-block; max-width: 22rem; text-align: left; }
.teampage .dense td[data-label="Project"], .teampage .dense td[data-label="Customer"] { min-width: 12rem; }
.teampage .empty { padding: .4rem 0; }

/* Box list (boxes.html) */
.boxhead { align-items: center; gap: .6rem 1rem; }
.boxhead .daysbox { width: 5rem; font-size: 1.1rem; font-weight: 700; }
table.boxparts td { vertical-align: middle; }
table.boxparts input.pick { width: 1.15rem; height: 1.15rem; }
table.boxparts td.left { font-weight: 700; }
table.packedlist td.boxname { white-space: nowrap; }
table.packedlist .boxmeta { font-size: .78rem; margin-top: .35rem; }
table.packedlist td.boxactions { width: 1%; text-align: center; vertical-align: top; }
table.packedlist td.boxactions .printlabel { white-space: nowrap; }
table.packedlist .boxlinks { display: flex; justify-content: center; gap: .9rem; margin-top: .35rem; }
table.packedlist .boxlinks form { margin: 0; }
form.partnote { display: flex; gap: .4rem; align-items: center; margin: 0; }
form.partnote input[name="note"] { flex: 1; min-width: 8rem; }
/* The order page for someone who can only look (the Warehouse team) */
fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; display: contents; }
form.readonly .rt-toolbar, form.readonly .choicebar { display: none; }