/* American Logowear Shop Management — DecoNetwork-style UI
   Light-blue top bar with global search, a white left sidebar of always-open
   sections with count badges, flat white cards with thin borders, and a
   right-hand ACTIONS panel on detail pages. Material-blue accent. */

:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --ink: #33383d;
  --muted: #7a828a;
  --line: #e2e6ea;
  --line-strong: #cfd5db;

  --accent: #1683e2;          /* DecoNetwork primary blue — measured from screenshots */
  --accent-hover: #1276cf;
  --accent-tint: rgba(22,131,226,.10);

  --topbar: #1683e2;          /* DecoNetwork header band — measured from screenshots */
  --topbar-search: #51a1ea;   /* lighter inset search field on the header */
  --topbar-h: 56px;
  --gold: #ffcc00;            /* Business Hub button — measured DecoNetwork gold */
  --gold-ink: #3a2d00;

  --green: #2e9e5b;  --green-bg: #e7f7ee;
  --orange: #c2680a; --orange-bg: #fdf0df;
  --purple: #5e5ce6;
  --teal: #1592a6;
  --red: #d9333f;    --red-bg: #fdecea;

  --danger: #d9333f;
  --shadow: 0 1px 2px rgba(20,40,80,.05);
  --shadow-hover: 0 4px 16px rgba(20,40,80,.12);
  --radius: 6px;
  --radius-sm: 5px;
  --side-w: 214px;
}

* { box-sizing: border-box; }
.newcust { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--accent-tint); padding: 12px 14px 14px; margin: 4px 0 14px; }
.newcust legend { font-weight: 700; color: var(--accent); padding: 0 6px; font-size: 13px; }
.newcust textarea { width: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 13.5px/1.5 "Helvetica Neue", Helvetica, Arial, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top bar (fixed, full width) ─────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: stretch; background: var(--topbar); z-index: 60;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.topbar-brand {
  width: var(--side-w); min-width: var(--side-w); background: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0 14px;
  border-right: 1px solid var(--line);
}
.topbar-brand img { height: 30px; width: auto; }
.topbar-search { flex: 1; display: flex; align-items: center; padding: 0 18px; }
.topbar-search form { position: relative; width: 100%; max-width: 760px; }
.topbar-search .ts-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.9); }
.topbar-search input {
  width: 100%; height: 36px; border: 0; border-radius: 4px; background: var(--topbar-search);
  padding: 0 14px 0 40px; font: inherit; font-size: 14px; color: #fff;
}
.topbar-search input::placeholder { color: rgba(255,255,255,.85); }
.topbar-search input:focus { outline: none; background: #5aa8ec; }
.topbar-right { display: flex; align-items: center; gap: 4px; padding-right: 4px; }
.topbar-right .tb-ico {
  width: 40px; height: var(--topbar-h); display: flex; align-items: center; justify-content: center; color: #fff;
}
.topbar-right .tb-avatar { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; }
.topbar-link {
  display: flex; align-items: center; height: var(--topbar-h); padding: 0 16px;
  color: #fff; font-size: 13.5px; font-weight: 600; border-left: 1px solid rgba(255,255,255,.22);
}
.topbar-link:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.topbar-hub { background: var(--gold); color: var(--gold-ink); border-left: 0; }
.topbar-hub:hover { background: #f2be00; }
.side-menu-btn { display: none; }

/* ── Left sidebar (white, always-open sections) ──────────────────── */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--side-w);
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; z-index: 50;
}
.sidenav { flex: 1; padding: 6px 0 10px; }
.side-section {
  color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding: 14px 16px 5px; margin: 0;
}
.side-link {
  display: flex; align-items: center; gap: 10px; color: #4a5157; text-decoration: none;
  padding: 7px 16px; font-size: 13.5px; font-weight: 500; border-left: 3px solid transparent;
}
.side-link .ico { width: 17px; height: 17px; flex: 0 0 auto; color: #8a939b; display: inline-flex; }
.side-link .side-label { flex: 1; }
.side-link:hover { background: #f4f7fa; color: var(--ink); text-decoration: none; }
.side-link.active { background: var(--accent); color: #fff; font-weight: 600; border-left-color: #1670c4; }
.side-link.active .ico { color: #fff; }
.side-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.side-link.active .side-badge { background: rgba(255,255,255,.28); }
/* DecoNetwork hub — standalone link separated below the Company section. */
.side-hub { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 13px; font-weight: 600; }
.side-hub .ico { color: var(--accent); }
.side-hub.active .ico { color: #fff; }
.side-user { border-top: 1px solid var(--line); padding: 10px 16px; }
.side-who { color: var(--muted); font-size: 12.5px; padding-bottom: 5px; }
.side-signout { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
.side-signout:hover { text-decoration: underline; }
.side-foot { color: #9aa7b2; font-size: 11px; padding: 10px 16px 14px; line-height: 1.4; }

.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13.5px; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--danger); }

/* ── Layout (content sits right of the sidebar, below the top bar) ── */
body { padding-left: var(--side-w); padding-top: var(--topbar-h); }
.wrap { max-width: 1180px; margin: 22px auto; padding: 0 26px; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 18px; }
h2 { font-size: 19px; font-weight: 600; margin: 26px 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 20px 0 10px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}

/* ── Flash banners ───────────────────────────────────────────────── */
.flash { padding: 12px 22px; font-size: 14px; font-weight: 500; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }
.flash-info { background: var(--accent-tint); color: var(--accent); }

/* ── Dashboard tiles (with a touch of color) ─────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.tile {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 22px 20px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease; overflow: hidden;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.tile::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--tile-accent, var(--accent));
}
.tiles .tile:nth-child(5n+1) { --tile-accent: #0071e3; }
.tiles .tile:nth-child(5n+2) { --tile-accent: #1f9d55; }
.tiles .tile:nth-child(5n+3) { --tile-accent: #ff9f0a; }
.tiles .tile:nth-child(5n+4) { --tile-accent: #5e5ce6; }
.tiles .tile:nth-child(5n+5) { --tile-accent: #30b0c7; }
.tile-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tile-value { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin-top: 8px; }
.tile-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ── Tables ──────────────────────────────────────────────────────── */
.table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.table th, .table td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { background: #fbfbfd; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafafc; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.subtotal td { background: #f6f8fa; color: #5a6470; }
.table .total td { font-weight: 700; background: #dfe1e0; border-top: 1px solid var(--line); }
.muted { color: var(--muted); }
.pos { color: var(--green); }
.neg { color: var(--danger); }
.right { text-align: right; }

/* ── Forms ───────────────────────────────────────────────────────── */
label { display: block; margin: 14px 0; font-weight: 600; font-size: 14px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-weight: 400; margin-top: 6px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint);
}
.btn {
  display: inline-block; padding: 9px 20px; border-radius: 5px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); cursor: pointer; font: inherit; font-size: 14px; font-weight: 500;
  transition: background .15s, border-color .15s, transform .1s; text-decoration: none;
}
.btn:hover { background: #f5f5f7; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary, .btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover, .btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; }
.formerr { background: var(--red-bg); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; }
.actions { margin: 18px 0 2px; display: flex; gap: 10px; }

/* ── Auth / sign-in ──────────────────────────────────────────────── */
.auth { display: flex; min-height: 84vh; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 360px; padding: 32px; text-align: center; }
.auth-card .authlogo { height: 40px; margin: 0 auto 18px; display: block; }
.auth-card h1 { margin: 0; font-size: 24px; }
.auth-card .sub { color: var(--muted); margin: 6px 0 20px; }
.auth-card label { text-align: left; }
.auth-card .btn { width: 100%; margin-top: 14px; }

/* ── Status pills ────────────────────────────────────────────────── */
.pill { display: inline-block; padding: 3px 11px; border-radius: 5px; font-size: 12px; font-weight: 600; }
.pill-open { background: var(--orange-bg); color: var(--orange); }
.pill-paid { background: var(--green-bg); color: var(--green); }
.pill-partial { background: var(--accent-tint); color: var(--accent); }
.pill-void { background: #f0f0f2; color: var(--muted); }
/* Production / payment chips (P3) */
.pill-blue { background: var(--accent-tint); color: var(--accent); }
.pill-blue-dark { background: #dce7fb; color: #1d47b8; }
.pill-purple { background: #efeefd; color: var(--purple); }
.pill-violet { background: #f3ecfd; color: #7d3ce8; }
.pill-yellow { background: #fdf6df; color: #9a7b0a; }
.pill-teal { background: #e2f5f8; color: var(--teal); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-gray { background: #f0f0f2; color: var(--muted); }
.pill-orange { background: var(--orange-bg); color: var(--orange); }
.pill-red { background: var(--red-bg); color: var(--red); }

/* ── Production board (P3) ───────────────────────────────────────── */
.tabs { display: flex; gap: 6px; margin: 0 0 16px; }
.tab {
  padding: 6px 16px; border-radius: 5px; font-size: 13px; font-weight: 600;
  color: var(--muted); text-decoration: none;
}
.tab:hover { background: #fff; color: var(--ink); text-decoration: none; }
.tab.active { background: var(--accent); color: #fff; }
/* The 11-column board scrolls inside its own frame at every width —
   the page body never scrolls sideways. */
.table.board { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table.board th, .table.board td { white-space: nowrap; }
.filter-row td { background: #fbfbfd; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
.filter-row input, .filter-row select { width: 100%; margin: 0; padding: 6px 9px; font-size: 13px; }
.filter-row .btn { padding: 6px 12px; font-size: 13px; }
.inline-status { margin: 0; }
.status-select { width: auto; margin: 0; padding: 5px 26px 5px 9px; font-size: 12px; font-weight: 600; border-radius: 5px; }
.row-urgent td { background: #fff6f5; }
.row-urgent td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table tbody tr.row-urgent:hover td { background: #fdeeec; }

/* ── Searchable select (combobox) ────────────────────────────────── */
.ss { position: relative; }
.ss-panel {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; padding: 6px;
}
.ss-item { padding: 9px 11px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.ss-item:hover, .ss-item.hi { background: var(--accent-tint); color: var(--accent); }
.ss-item.sel { font-weight: 600; }
.ss-none { padding: 9px 11px; color: var(--muted); font-size: 14px; }
.ss.err .ss-input { border-color: var(--danger); box-shadow: 0 0 0 4px var(--red-bg); }

/* ── List search box ─────────────────────────────────────────────── */
.list-search { width: 280px; max-width: 100%; margin: 0; flex: 0 0 auto; }

/* ── Sales-order line editor ──────────────────────────────────────── */
.sotable td { padding: 6px 8px; vertical-align: middle; }
.sotable input { margin: 0; padding: 8px 9px; }
.sotable input.num { text-align: right; }
.so-typeahead .ss-item strong { font-weight: 600; }

/* ── Key/value detail table ──────────────────────────────────────── */
.kv { border-collapse: collapse; width: 100%; }
.kv td { padding: 4px 0; vertical-align: top; font-size: 14px; }
.kv td:first-child { color: var(--muted); width: 96px; white-space: nowrap; padding-right: 12px; }

/* ── Misc ────────────────────────────────────────────────────────── */
.tools { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.tools .grow { flex: 1; }
.balanced { color: var(--green); font-weight: 600; }
.appfoot { color: var(--muted); text-align: center; padding: 36px 0; font-size: 13px; }

/* ── Home / QuickBooks-style workflow flowchart ──────────────────── */
.home-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 20px; align-items: start; }
.home-col { display: flex; flex-direction: column; gap: 20px; }
.fc-panel {
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px 22px 22px; position: relative;
}
.fc-title {
  position: absolute; top: -12px; left: 22px; background: var(--accent-tint); color: var(--accent);
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 14px; border-radius: 5px;
}
.fc-flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.fc-flow.wrap-flow { gap: 12px; }
.fc-node {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
  width: 96px; min-height: 84px; padding: 12px 8px; border-radius: var(--radius-sm);
  border: 1px solid transparent; color: var(--ink); text-align: center; text-decoration: none;
  transition: background .14s, border-color .14s, transform .12s;
}
.fc-node:hover { background: #f5f5f7; border-color: var(--line-strong); text-decoration: none; transform: translateY(-1px); }
.fc-node .fc-ico { font-size: 30px; line-height: 1; }
.fc-node .fc-lbl { font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.fc-node.disabled { opacity: .42; cursor: default; }
.fc-node.disabled:hover { background: transparent; border-color: transparent; transform: none; }
.fc-arrow { color: var(--muted); font-size: 18px; flex: 0 0 auto; }
.fc-note { color: var(--muted); font-size: 13px; align-self: center; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } .home-col.side { order: -1; } }

/* ── Wide content (registers, wide tables) ───────────────────────── */
.wrap.wide { max-width: 1280px; }

/* ── Bank / check register ───────────────────────────────────────── */
.reg-pick { margin: 0 0 16px; max-width: 460px; }
.reg { width: 100%; border-collapse: collapse; background: var(--card);
       border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.reg thead th { background: #eef1f6; color: var(--muted); font-size: 11px; font-weight: 700;
                text-transform: uppercase; letter-spacing: .04em; padding: 8px 12px; border-bottom: 1px solid var(--line-strong); text-align: left; }
.reg th.num, .reg td.num { text-align: right; font-variant-numeric: tabular-nums; }
.reg th.c, .reg td.c { text-align: center; }
.reg td { padding: 6px 12px; font-size: 13px; }
.reg tr.reg-top td { border-top: 2px solid var(--line); }
.reg tbody tr.reg-top:first-child td { border-top: 0; }
.reg tr.reg-top:hover td, .reg tr.reg-top:hover + tr.reg-sub td { background: #f3faf4; }
.reg tr.reg-sub td { padding-top: 0; padding-bottom: 8px; color: var(--muted); }
.reg .reg-type { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.reg .reg-acct { color: var(--ink); }
.reg-ending { display: flex; justify-content: flex-end; align-items: baseline; gap: 16px; margin: 16px 4px 0; }
.reg-ending-lbl { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.reg-ending-val { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reg .neg, .reg-ending-val.neg { color: var(--danger); }

/* ── Write Check form: the check graphic (top third) ─────────────── */
.check { margin-top: 8px; border: 1px solid #b9c4d6; border-radius: 10px; overflow: hidden;
         background: repeating-linear-gradient(45deg, #f2f7f1, #f2f7f1 7px, #eaf3e9 7px, #eaf3e9 14px); }
.check-top { padding: 20px 22px; }
.check-num { display: flex; gap: 14px; justify-content: flex-end; }
.check-num label { margin: 0; font-size: 11px; color: #2c3e50; text-align: right; }
.check-num input { width: 130px; margin-top: 3px; background: #fff; }
.check-pay { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.ck-cap { font-size: 10px; text-transform: uppercase; color: #33475b; letter-spacing: .03em; font-weight: 700; line-height: 1.2; }
.ck-payee { flex: 1; margin: 0; font-size: 16px; font-weight: 600; background: #fff; }
.ck-dollar { font-size: 18px; font-weight: 700; }
.ck-amount { border: 1px solid #5b6b7e; background: #fff; border-radius: 6px; padding: 8px 16px; min-width: 130px;
             text-align: right; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.check-words { display: flex; align-items: baseline; gap: 10px; margin-top: 14px;
               border-bottom: 1px solid #33475b; padding-bottom: 4px; }
.check-words #ck-words { flex: 1; font-size: 14px; font-weight: 600; }
.ck-dollars-cap { font-size: 10px; text-transform: uppercase; font-weight: 700; color: #33475b; }
.check-addr { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; }
.ck-address { background: #fff; max-width: 360px; }
.check-memo { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.check-memo input { background: #fff; }
.chktable td { padding: 6px 8px; vertical-align: middle; }
.chktable input, .chktable select { margin: 0; padding: 8px 9px; }
.chktable input.num { text-align: right; }

/* ── Create Statements dialog ────────────────────────────────────── */
.stmt-cols { display: grid; grid-template-columns: 1fr 280px; gap: 28px; }
.stmt-fs { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; margin: 10px 0; }
label.rad { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 8px 0; }
label.rad input { width: auto; margin: 0; }
.period-range label, .scope-one, .scope-multiple { margin-top: 8px; }
.multi-box { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 8px; }
.multi-box .table { border: 0; box-shadow: none; border-radius: 0; }
.multi-box .table td { padding: 0; border-bottom: 1px solid var(--line); }
@media (max-width: 820px) { .stmt-cols { grid-template-columns: 1fr; } }

/* ── Line size-grid + decoration sub-rows (estimates / sales orders) ─ */
.line-tools { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.line-tools .linkbtn { font-size: 12px; }
.line-tools .deco-summary { font-size: 12px; }
.so-sub td { background: #f6f7f9; padding: 8px 10px; }
.sub-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.sub-box label.sz { display: inline-flex; align-items: center; gap: 4px; font-weight: normal; margin: 0; font-size: 12px; color: var(--muted); }
.sub-box .sz-qty { width: 52px; padding: 6px; }
.deco-box { flex-direction: column; align-items: stretch; }
.d-list { display: flex; flex-direction: column; gap: 6px; }
.d-entry { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.d-entry select { margin: 0; padding: 6px 8px; width: auto; }
.d-entry .d-f { display: inline-flex; align-items: center; gap: 4px; font-weight: normal; margin: 0; font-size: 12px; color: var(--muted); }
.d-entry .d-f input { width: 70px; padding: 6px; }
.d-entry .d-notes { width: 150px; padding: 6px 8px; margin: 0; }
.line-detail td { border-top: 0; }

/* ── Raise-PO screen: per-line pick label ────────────────────────── */
.po-pick { flex: 0; white-space: nowrap; display: flex; align-items: center; gap: 8px; padding-bottom: 8px; font-weight: 600; }
.po-pick-color { font-weight: 500; }

/* ── Garment color chip on order / PO lines ──────────────────────── */
.clr { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.clr-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid rgba(0,0,0,.28); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }

/* ── Detail page: content + right-hand ACTIONS panel (DecoNetwork) ── */
.detail-head { margin-bottom: 6px; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 240px; gap: 22px; align-items: start; }
.detail-main { min-width: 0; }
.actions-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); position: sticky; top: calc(var(--topbar-h) + 16px);
}
.actions-panel + .actions-panel { margin-top: 16px; }
.ap-head { background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; padding: 9px 14px; }
.ap-body { padding: 2px 0; }
.ap-body form { margin: 0; }
.ap-link {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); color: #3a5675;
  font: inherit; font-size: 13.5px; padding: 10px 14px; cursor: pointer;
}
.ap-link:last-child, .ap-body form:last-child .ap-link { border-bottom: 0; }
.ap-link:hover { background: #f4f7fa; color: var(--accent); text-decoration: none; }
.ap-link .ico { width: 16px; height: 16px; color: #8a939b; flex: 0 0 auto; }
.ap-link.ap-danger { color: var(--danger); }
.ap-link.ap-danger:hover { background: var(--red-bg); color: var(--danger); }
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .actions-panel { position: static; }
}

/* ── P4 payments: SO Payments card + deposit badge ─────────────────── */
.badge-deposit { display: inline-block; background: var(--red); color: #fff; font-size: 12.5px; font-weight: 700;
  letter-spacing: .02em; padding: 5px 12px; border-radius: 7px; vertical-align: middle; }
.pay-summary { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.pay-summary > div > .muted { display: block; font-size: 12px; margin-bottom: 2px; }
.pay-summary > div > strong { font-size: 17px; }
.pay-summary .grow { flex: 1; }
.pay-actions { display: flex; gap: 8px; align-items: center; }
.pay-findetails { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.pay-findetails td { padding: 2px 0; }

/* ── Mobile / small screens (production-floor phones & tablets) ────
   ≤820px: the fixed blue sidebar becomes a top bar with a ☰ menu,
   tables scroll sideways inside their rounded frame instead of
   crushing their columns, and touch targets get comfortable. */
@media (max-width: 820px) {
  /* Top bar stays; the sidebar slides in from the left behind a ☰ button. */
  body { padding-left: 0; }
  .topbar-brand { width: auto; min-width: 0; }
  .topbar-search { padding: 0 10px; }
  .topbar-search input::placeholder { color: transparent; }   /* keep the box, drop the long hint */
  .side-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; min-width: 48px; border: 0; background: rgba(255,255,255,.16);
    color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
  }
  .sidebar {
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 2px 0 14px rgba(0,0,0,.18);
  }
  .sidebar.open { transform: translateX(0); }
  .side-link { padding: 11px 16px; }                /* ≥44px touch targets */

  /* Content chrome */
  .wrap { margin: 16px auto; padding: 0 14px; }
  h1 { font-size: 24px; margin-bottom: 14px; }
  h2 { font-size: 19px; margin-top: 26px; }
  .card { padding: 16px; border-radius: var(--radius-sm); }
  .tools { row-gap: 10px; }
  .tabs { flex-wrap: wrap; }
  .tab { padding-top: 9px; padding-bottom: 9px; }
  .btn { padding-top: 11px; padding-bottom: 11px; } /* ~44px tall */
  .list-search { width: 100%; }

  /* Tables: scroll sideways rather than letter-wrap every column.
     Sub-rows (size grids / deco notes) keep wrapping so they don't
     drive the row width to absurd lengths. */
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; padding: 10px 12px; }
  .table .line-detail td, .table .so-sub td { white-space: normal; }
  .table .line-detail td[colspan] { min-width: 260px; max-width: 78vw; }

  /* 16px controls stop iOS Safari from zooming the page on focus */
  input, select, textarea { font-size: 16px; }
  .filter-row input, .filter-row select { font-size: 16px; min-width: 130px; }
  .status-select { font-size: 16px; padding-top: 8px; padding-bottom: 8px; }
  .sub-box .sz-qty { width: 64px; padding: 9px 6px; }
  .d-entry .d-f input { width: 84px; padding: 9px 6px; }
  .pay-summary { gap: 14px 24px; }
  .po-pick { white-space: normal; flex: 1 1 100%; }

  /* Line editor (new estimate / new SO): keep inputs usable — the
     table scrolls sideways instead of crushing them. */
  .sotable .qty, .sotable .price { min-width: 76px; }
  .sotable .so-item { min-width: 150px; }
  .sotable .desc { min-width: 220px; }
}

@media (max-width: 600px) {
  /* Phones: form rows stack one field per line */
  .row > * { flex-basis: 100%; }
  .actions { flex-wrap: wrap; }
  .pay-actions { flex-wrap: wrap; }
}

/* ── DecoNetwork-style document tab strip (jump-links to on-page sections) ── */
.doc-tabs { display:flex; gap:2px; border-bottom:1px solid var(--line,#e2e6ea); margin:2px 0 18px; overflow-x:auto; }
.doc-tab { padding:9px 14px; font-size:13px; font-weight:600; color:#6b7480; white-space:nowrap;
  border-bottom:2px solid transparent; text-decoration:none; }
.doc-tab:hover { color:var(--accent); }
.doc-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.doc-tab .cnt { display:inline-block; min-width:18px; padding:0 5px; margin-left:5px; font-size:11px;
  line-height:16px; text-align:center; background:#e8edf2; color:#5a6470; border-radius:9px; }

/* ── DecoNetwork-style dashboard ─────────────────────────────────────── */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dash-head h1 { margin: 0; }
.dash-actions { display: flex; gap: 8px; }
.dash-card { padding: 0; overflow: hidden; }
.dash-card-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 16px; border-radius: 999px; cursor: pointer; }
.seg button.seg-on { background: var(--accent); color: #fff; }
.stat-cols { display: grid; grid-template-columns: repeat(5, 1fr); }
.stat-col { text-align: center; padding: 18px 8px; border-right: 1px solid var(--line); }
.stat-col:last-child { border-right: 0; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat-pct { font-size: 12px; font-weight: 700; margin-top: 4px; min-height: 16px; }
.stat-pct.up { color: var(--green); }
.stat-pct.down { color: var(--red); }
.dash-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 18px 20px 6px; }
.barcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 34px; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; transition: height .25s ease; }
.barlbl { font-size: 11px; color: var(--muted); margin-top: 6px; }
.dash-chart-cap { text-align: center; padding: 0 0 14px; font-size: 12px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.card-hd { font-weight: 700; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.hbars { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 10px; }
.hbar-label { font-size: 13px; color: var(--ink); }
.hbar-track { background: var(--bg); border-radius: 4px; height: 16px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; transition: width .25s ease; }
.hbar-num { text-align: right; font-weight: 700; font-size: 13px; }
.hbars-foot { padding: 0 16px 14px; font-size: 13px; }
.dash-recent { margin: 0; }
.dash-recent .chip { text-transform: capitalize; }
@media (max-width: 820px) {
  .stat-cols { grid-template-columns: repeat(2, 1fr); }
  .stat-col:nth-child(odd) { border-right: 1px solid var(--line); }
  .dash-grid { grid-template-columns: 1fr; }
  .hbar-row { grid-template-columns: 110px 1fr 34px; }
}

/* ── Line editor: reorder grip, duplicate, and ALW-catalog type-ahead ── */
.line-actions { white-space: nowrap; text-align: center; }
.line-actions .linkbtn { padding: 2px 4px; font-size: 15px; line-height: 1; vertical-align: middle; }
.line-actions .grip { cursor: grab; color: #b3bcc4; }
.line-actions .grip:hover { color: var(--muted); text-decoration: none; }
.line-actions .dup { color: var(--accent); }
.so-row.dragging { opacity: .45; background: var(--accent-tint); }
.so-typeahead .ss-src { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; font-size: 10px;
  font-weight: 700; background: var(--accent-tint); color: var(--accent); vertical-align: middle; }
.so-typeahead .ss-note { padding: 6px 12px; font-size: 12px; border-top: 1px solid var(--line); }
