/* Lumina Orders. One family (Barlow), a steel-and-tape-measure palette, left-aligned working layout. */
:root {
  --paper: #F1F3F2;
  --surface: #FFFFFF;
  --ink: #1B2024;
  --steel: #5C6870;
  --line: #D3D9DC;
  --tape: #F5C518;
  --tape-ink: #7A5D00;
  --alert: #B3261E;
  --alert-wash: #FBEDEB;
  --ok: #24674A;
  --ok-wash: #E7F2EC;
  --radius: 6px;
  --font: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-tight: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

.shell { max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 22px 0 0; flex-wrap: wrap; }
.brand { font: 600 26px/1 var(--font-tight); letter-spacing: -0.01em; margin: 0; }
.mode { font-size: 14px; color: var(--steel); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.mode.demo { border-color: var(--tape); background: #FFF8DC; color: var(--tape-ink); }

.tabs { display: flex; gap: 4px; margin-top: 18px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px 9px; font-weight: 500; color: var(--steel); cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--tape); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }

.view { padding-top: 22px; }
h2 { font: 600 20px/1.2 var(--font-tight); margin: 0 0 4px; }
.help { color: var(--steel); margin: 0 0 16px; max-width: 70ch; font-size: 15px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* Stock list */
.stock-row { display: grid; grid-template-columns: minmax(220px, 1.3fr) minmax(240px, 1.6fr) 150px 110px; gap: 18px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.stock-row:last-child { border-bottom: 0; }
.stock-head { font-size: 14px; color: var(--steel); padding-top: 10px; padding-bottom: 10px; background: #FAFBFB; border-radius: var(--radius) var(--radius) 0 0; }
.p-name { font-weight: 600; line-height: 1.25; }
.p-meta { color: var(--steel); font-size: 14px; }
.count { font: 600 19px/1.2 var(--font-tight); }
.count small { font: 400 14px var(--font); color: var(--steel); margin-left: 6px; }
.low-flag { display: inline-block; margin-left: 8px; font: 500 13px var(--font); color: var(--alert); background: var(--alert-wash); padding: 1px 8px; border-radius: 999px; vertical-align: 2px; }

/* The tape: stock drawn as a measuring tape, one tick per box, a red notch at the reorder point. */
.tape { position: relative; height: 16px; margin-top: 8px; background: #E6EAEC; border-radius: 3px; overflow: hidden; }
.tape-fill { position: absolute; inset: 0 auto 0 0; background-color: var(--tape); background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--tick) - 1.5px), rgba(27,32,36,.55) calc(var(--tick) - 1.5px), rgba(27,32,36,.55) var(--tick)); }
.tape-fill.low { background-color: #E9A39C; }
.tape-notch { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--alert); }
.tape-wrap { position: relative; }
.tape-key { display: flex; justify-content: space-between; font-size: 13px; color: var(--steel); margin-top: 4px; }
.prices { font-size: 15px; line-height: 1.5; }
.prices span { color: var(--steel); }

.btn { border: 1px solid var(--ink); background: var(--surface); padding: 8px 14px; border-radius: var(--radius); font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #F4F6F6; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #2B3338; }
.btn.primary:disabled { background: #9AA4AA; border-color: #9AA4AA; cursor: not-allowed; }
.btn.quiet { border-color: var(--line); color: var(--steel); }
.btn.small { padding: 5px 10px; font-size: 14px; }

.adjust { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: #FAFBFB; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--steel); }
.field > input, .field > select, .field > textarea, .in { border: 1px solid #B9C2C7; border-radius: var(--radius); padding: 8px 10px; background: var(--surface); color: var(--ink); font-size: 16px; min-width: 0; }
.field > input:focus, .field > select:focus, .in:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid #B9C2C7; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--steel); font-size: 15px; }
.seg button + button { border-left: 1px solid #B9C2C7; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* Invoice */
.inv { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.block { padding: 16px 18px; }
.block + .block { border-top: 1px solid var(--line); }
.cust-pick { position: relative; max-width: 460px; }
.cust-pick input { width: 100%; }
.results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid #B9C2C7; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(27,32,36,.14); max-height: 260px; overflow: auto; }
.results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer; }
.results button:hover, .results button:focus { background: #F1F3F2; }
.results small { display: block; color: var(--steel); }
.chosen { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 460px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #FAFBFB; }
.chosen small { display: block; color: var(--steel); }

.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line:first-of-type { padding-top: 4px; }
.line-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.line-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.line-top select { width: 100%; }
.line-nums { display: grid; grid-template-columns: 104px 124px minmax(0, 1fr); gap: 10px; align-items: end; }
.line-nums .field > input { width: 100%; }
.seg button { white-space: nowrap; }
.line-top .seg, .adjust .seg { align-self: flex-start; }
.line-side { text-align: right; min-width: 104px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.line-net { font: 600 19px/1.2 var(--font-tight); }
.line-was { color: var(--steel); font-size: 14px; text-decoration: line-through; }
.disc { display: flex; gap: 6px; }
.disc input { width: 96px; flex: 0 1 96px; min-width: 64px; }
.line-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 14px; color: var(--steel); }
.line-foot .takes.bad { color: var(--alert); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.linkish { background: none; border: 0; padding: 0; color: var(--steel); text-decoration: underline; cursor: pointer; font-size: 14px; }
.linkish:hover { color: var(--alert); }

.sum { position: sticky; top: 16px; }
.sum dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 0; }
.sum dt { color: var(--steel); }
.sum dd { margin: 0; text-align: right; }
.sum .total { border-top: 2px solid var(--ink); padding-top: 10px; margin-top: 4px; font: 600 24px/1.1 var(--font-tight); color: var(--ink); }
.sum .saved { color: var(--ok); }
.problems { margin: 14px 0 0; padding: 10px 12px; background: var(--alert-wash); color: var(--alert); border-radius: var(--radius); font-size: 14px; }
.problems ul { margin: 0; padding-left: 18px; }
.done { margin: 0 0 18px; padding: 14px 16px; background: var(--ok-wash); border: 1px solid #BFDccb; border-radius: var(--radius); }
.done strong { color: var(--ok); }
.done ul { margin: 6px 0 0; padding-left: 18px; }

/* Tax report */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.figure { padding: 16px 18px; border-right: 1px solid var(--line); }
.figure:last-child { border-right: 0; }
.figure span { display: block; color: var(--steel); font-size: 14px; }
.figure b { font: 600 24px/1.2 var(--font-tight); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; font-size: 14px; color: var(--steel); background: #FAFBFB; }
td.r, th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }
.status { font-size: 13px; padding: 1px 8px; border-radius: 999px; background: #E9EDEF; color: var(--steel); }
.status.paid { background: var(--ok-wash); color: var(--ok); }
.empty { padding: 28px 18px; color: var(--steel); }
.note { font-size: 14px; color: var(--steel); margin: 14px 0 0; max-width: 78ch; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(27,32,36,.25); z-index: 20; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--alert); }

@media (max-width: 900px) {
  .inv { grid-template-columns: 1fr; }
  .sum { position: static; }
  .stock-row { grid-template-columns: 1fr 1fr; }
  .stock-head { display: none; }
  .figures { grid-template-columns: 1fr 1fr; }
  .figure:nth-child(2) { border-right: 0; }
  .figure:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .shell { padding: 0 16px 48px; }
  .stock-row { grid-template-columns: 1fr; gap: 10px; }
  .line { grid-template-columns: 1fr; }
  .line-top { grid-template-columns: 1fr; }
  .line-nums { grid-template-columns: 1fr 1fr; }
  .line-nums .f-disc { grid-column: 1 / -1; }
  .line-side { text-align: left; flex-direction: row; align-items: baseline; gap: 10px; }
  th, td { padding: 9px 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .tape-fill { transition: width .35s ease; }
}
