/* The customer dashboard (dashboard.js): every rule is scoped to its box (.dash), so any page can host it (OEP-46).
   The page decides the box's size; inside it the tabs stay, the PO list and the PO each scroll on their own. */
.dash { --bg:#f7f6f2; --card:#ffffff; --soft:#f1efe9; --line:#e7e5e0; --line-strong:#d6d3cd; --ink:#1c1917; --ink-2:#44403c;
  --muted:#57534e; --faint:#78716c; --accent:#0f766e; --accent-ink:#0f5f58; --accent-soft:#e3f0ee; --ok:#166534; --ok-soft:#dcfce7;
  --warn:#92400e; --warn-soft:#fff7e6; --err:#9f1239;
  display: flex; flex-direction: column; gap: 10px; min-height: 0; color: var(--ink); font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.dash, .dash * { box-sizing: border-box; }
.dash a { color: var(--accent-ink); } .dash a:hover { color: var(--accent); }
.dash .mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.dash .muted { color: var(--muted); }
/* folder tabs: the current one is raised and joined to what's under it, the others sit behind */
.dash nav.tabs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--line-strong); padding-left: 2px; }
.dash nav.tabs button { font: inherit; cursor: pointer; margin-bottom: -1px; padding: 6px 16px 7px; font-size: 13px; font-weight: 500; color: var(--muted);
  background: #ebe7df; border: 1px solid var(--line); border-bottom: none; border-radius: 6px 6px 0 0; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s; }
.dash nav.tabs button:hover { background: #e4e0d7; color: var(--ink); }
.dash nav.tabs button[aria-current="page"] { position: relative; z-index: 1; padding: 8px 18px 9px; font-weight: 700; color: var(--accent); background: var(--bg);
  border-color: var(--line-strong); box-shadow: 0 -4px 10px rgba(28,25,23,.07); }
.dash .count { min-width: 22px; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--ink-2); font-size: 11px; text-align: center; }
.dash nav.tabs button[aria-current="page"] .count { background: var(--accent); color: #fff; }
.dash .tabnote { margin-left: auto; padding-bottom: 8px; font-size: 12px; color: var(--muted); }
.dash .split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.dash ul.list { list-style: none; margin: 0; padding: 0; flex: 1 1 280px; max-width: 100%; display: flex; flex-direction: column; gap: 6px; }
.dash ul.list button { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 15px 17px; border-radius: 8px; border: 1px solid transparent; background: transparent; }
.dash ul.list button:hover { background: var(--card); }
.dash ul.list button[aria-current="true"] { background: var(--card); border: 2px solid var(--accent); padding: 14px 16px; }
.dash .li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dash .li-title { font-size: 14px; font-weight: 600; }
.dash .li-sub { font-size: 12px; color: var(--ink-2); }
.dash .li-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dash .n { padding: 1px 9px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 11px; font-weight: 600; }
.dash .time { font-size: 11px; color: var(--muted); }
.dash .hist button { flex-direction: column; align-items: stretch !important; gap: 6px !important; }
.dash .hist .row { display: flex; justify-content: space-between; gap: 8px; }
.dash .label { align-self: flex-start; padding: 2px 10px; border-radius: 99px; font-size: 11px; background: var(--soft); color: var(--ink-2); }
.dash .label.reviewed { background: #edf5ef; color: #3f6b4c; font-weight: 500; }   /* a quiet green, softer than --ok-soft */
.dash .label.automatic { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.dash .label.failed { background: transparent; border: 1px solid var(--err); color: var(--err); }
.dash .label.working { background: var(--warn-soft); color: var(--warn); }
.dash section.panel { flex: 999 1 520px; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.dash section.panel.lifted { box-shadow: 0 12px 32px rgba(28,25,23,.08); }
.dash h2 { margin: 0; font-size: 20px; font-weight: 600; } .dash h3 { margin: 0; font-size: 15px; font-weight: 600; }
.dash .chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dash .pill { padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); font-size: 12px; }
.dash .q { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); }
.dash .q.open { border: 2px solid var(--accent); }
.dash .q-head { font: inherit; color: inherit; width: 100%; text-align: left; cursor: pointer; background: none; border: none; padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dash .q.open .q-head { padding: 15px 17px; }
.dash .q-title { flex: 1 1 240px; min-width: 0; font-size: 14px; font-weight: 600; }
.dash .state { padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--warn-soft); color: var(--warn); }
.dash .state.done { background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.dash .q-body { padding: 0 17px 18px; display: flex; flex-direction: column; gap: 12px; }
.dash .q-done { margin-top: -6px; padding: 0 18px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.dash .says { background: var(--soft); border-radius: 8px; padding: 12px 16px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; }
.dash .ask { font-size: 14px; font-weight: 600; }
.dash .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.dash .choice { position: relative; font: inherit; color: inherit; text-align: left; cursor: pointer; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; min-height: 68px; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.dash .choice[aria-pressed="true"] { border: 2px solid var(--accent); padding: 11px 15px; }
.dash .choice .tick { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 99px; background: var(--accent); display: none; align-items: center; justify-content: center; }
.dash .choice[aria-pressed="true"] .tick { display: inline-flex; }
.dash .big { font-size: 17px; font-weight: 600; } .dash .big small { font-size: 13px; font-weight: 400; color: var(--ink-2); }
.dash input[type=text], .dash input[type=search] { font: inherit; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); color: var(--ink); }
.dash .btn { font: inherit; cursor: pointer; align-self: flex-start; min-height: 48px; padding: 0 22px; border-radius: 8px; border: none; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; }
.dash .btn:disabled { cursor: not-allowed; background: var(--line-strong); color: var(--muted); }
.dash .quiet { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 5px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.dash .quiet:hover { color: var(--accent-ink); border-color: var(--accent-ink); }
.dash .link { font: inherit; cursor: pointer; background: none; border: none; padding: 0; color: var(--accent-ink); font-size: 12px; text-decoration: underline; }
.dash .err { color: var(--err); font-size: 12px; }
.dash .foot { margin: 0; border-top: 1px solid var(--line); padding-top: 16px; font-size: 12px; color: var(--muted); }
.dash .tablebox { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.dash table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 500; padding: 10px 14px; }
.dash td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.dash td.r, .dash th.r { text-align: right; }
.dash .byyou { display: inline-flex; align-items: center; gap: 6px; }
.dash .you { flex: none; width: 18px; height: 18px; border-radius: 99px; background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; cursor: help; }
.dash .you:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the tooltip is drawn above the whole page (it hangs off <body>, outside the box) */
.dash-tip { position: fixed; z-index: 40; max-width: 240px; padding: 7px 10px; border-radius: 5px; background: #1c1917; color: #fff; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12px; line-height: 1.35; box-shadow: 0 6px 16px rgba(28,25,23,.18); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.dash-tip.on { opacity: 1; transform: none; }
/* the Email tab: the PO's email, laid out like an email */
.dash .mail { display: flex; flex-direction: column; gap: 14px; }
.dash .mail-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; }
.dash .mail-subject { font-size: 17px; line-height: 1.3; }
.dash .mail-head { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; }
.dash .avatar { flex: none; width: 36px; height: 36px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; text-transform: uppercase; }
.dash .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.dash .who .muted { font-size: 12px; }
.dash .when { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.dash .when span { color: var(--muted); font-size: 11px; }
.dash .mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dash .mail-files { display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.dash .files { display: flex; flex-wrap: wrap; gap: 10px; }
.dash .file { display: flex; gap: 10px; align-items: center; padding: 10px 14px 10px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); color: var(--ink); text-decoration: none; min-width: 0; max-width: 100%; }
.dash .file:hover { border-color: var(--accent); color: var(--ink); }
.dash .ftype { flex: none; width: 36px; height: 40px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; letter-spacing: .03em; color: #fff; background: var(--faint); }
.dash .ftype.pdf { background: #b42318; } .dash .ftype.xls { background: #1f7a4d; } .dash .ftype.img { background: #6941c6; }
.dash .fname { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash .fname b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash .fname span { font-size: 11px; color: var(--muted); }
.dash .mail-wait { display: flex; justify-content: center; padding: 30px 0; }
.dash .mail-wait .spin { border-color: color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); }
.dash .po-details { flex: none; display: flex; flex-direction: column; gap: 14px; }   /* a PO's tabs and what's under them, together */
.dash .subtabs { display: flex; align-items: flex-end; gap: 4px; flex: none; position: relative; z-index: 1; margin-bottom: -14px; padding-left: 2px; }
.dash .subtabs button { font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; margin-bottom: -1px; padding: 6px 14px 7px; color: var(--muted);
  background: var(--soft); border: 1px solid var(--line); border-bottom: none; border-radius: 6px 6px 0 0; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s; }
.dash .subtabs button:hover { background: #e9e6df; color: var(--ink); }
.dash .subtabs button[aria-selected="true"] { position: relative; z-index: 2; padding: 8px 16px 9px; font-weight: 700; color: var(--accent); background: var(--card);
  border-color: var(--line-strong); box-shadow: 0 -4px 10px rgba(28,25,23,.07); }
.dash .subpanel { flex: none; background: var(--card); border: 1px solid var(--line-strong); border-radius: 0 8px 8px 8px; padding: 16px;
  box-shadow: 0 6px 18px rgba(28,25,23,.06); }
.dash .subpanel > .tablebox { border: none; border-radius: 0; margin: -16px; }
.dash .did { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; }
.dash .tickc { flex: none; width: 20px; height: 20px; border-radius: 99px; background: var(--ok-soft); display: inline-flex; align-items: center; justify-content: center; }
.dash .ring { flex: none; width: 20px; height: 20px; border-radius: 99px; border: 2px solid var(--line-strong); }
.dash .did .at { margin-left: auto; padding-left: 12px; flex: none; font-size: 11px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.dash .did.answer .tickc { background: var(--accent-soft); }
.dash .did.fail .tickc { background: transparent; border: 1px solid var(--err); color: var(--err); font-size: 12px; font-weight: 700; }
.dash .did.fail { color: var(--err); }
.dash a.erp { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dash a.erp:hover { color: var(--accent-ink); }
.dash .filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.dash .filters [role=group] { display: flex; flex-wrap: wrap; gap: 6px; }
.dash .filters button { font: inherit; cursor: pointer; padding: 3px 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2); font-size: 12px; }
.dash .filters button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.dash .filters label { margin-left: auto; flex: 0 1 300px; min-width: 0; }
.dash .filters input { width: 100%; font-size: 13px; padding: 6px 12px; }
.dash .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dash .empty { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 40px 24px; text-align: center; font-size: 14px; color: var(--ink-2); }
.dash .notice { background: var(--warn-soft); border-radius: 10px; padding: 16px 20px; font-size: 13px; }
/* nothing to review: a dashed placeholder in the list, "All done" centred in the panel */
.dash .li-placeholder { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 8px; background: var(--card); border: 2px dashed #a8a29e; }
.dash .li-placeholder .tick { flex: none; width: 28px; height: 28px; border-radius: 99px; background: var(--ok-soft); display: inline-flex; align-items: center; justify-content: center; }
.dash section.panel.caught-up { align-items: center; justify-content: center; text-align: center; gap: 12px; min-height: 320px; padding: 40px 24px; }
.dash .caught-up p { margin: 0; max-width: 420px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
/* motion: only what just changed moves; none at all for people who turned animations off */
@keyframes dash-enter { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes dash-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dash-leave { 0% { opacity: 1; transform: none; max-height: 140px; }
  45% { opacity: 0; transform: translateX(48px); max-height: 140px; }
  100% { opacity: 0; transform: translateX(48px); max-height: 0; margin: 0; padding: 0; } }
@keyframes dash-pop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
@keyframes dash-spin { to { transform: rotate(360deg); } }
.dash .enter { animation: dash-enter .28s ease-out; }
.dash .ro .btn { display: none; }
.dash .ro .choice, .dash .ro input { pointer-events: none; }
.dash .ro .choice[aria-pressed="false"] { opacity: .55; }
.dash .fade-in { animation: dash-fade .22s ease-out; }
.dash ul.list li { overflow: hidden; }
.dash ul.list li.leaving { animation: dash-leave .7s ease-in forwards; }
.dash .all-done { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); }
.dash .all-done .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.dash .all-done .slot { flex: none; display: inline-flex; align-items: center; font-size: 13px; }
.dash .spin { width: 18px; height: 18px; border-radius: 99px; border: 2px solid color-mix(in srgb, var(--ok) 25%, transparent); border-top-color: var(--ok); animation: dash-spin .8s linear infinite; }
.dash .all-done b { font-size: 15px; }
.dash .all-done .muted { color: var(--ink-2); }
.dash .all-done .pop { flex: none; width: 36px; height: 36px; border-radius: 99px; background: #fff; display: inline-flex; align-items: center; justify-content: center; animation: dash-pop .45s ease-out; }
.dash .li-done { display: inline-flex; width: 20px; height: 20px; border-radius: 99px; background: var(--ok-soft); align-items: center; justify-content: center; animation: dash-pop .45s ease-out; }
@media (prefers-reduced-motion: reduce) { .dash *, .dash *::before, .dash *::after, .dash-tip { animation: none !important; transition: none !important; } .dash .spin { animation: dash-spin 1.6s linear infinite !important; } }
/* slim scrollbars in a quiet, soft version of the button green (stronger on hover), set in from the edges */
.dash { --scroll: color-mix(in srgb, var(--accent) 30%, var(--bg)); --scroll-hover: color-mix(in srgb, var(--accent) 55%, var(--bg)); }
@supports not selector(::-webkit-scrollbar) { .dash * { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; } }
.dash ::-webkit-scrollbar { width: 10px; height: 10px; }
.dash ::-webkit-scrollbar-track { background: transparent; margin: 10px 0; }
.dash ::-webkit-scrollbar-thumb { background: var(--scroll); background-clip: padding-box; border: 3px solid transparent; border-radius: 99px; }
.dash ::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); background-clip: padding-box; }
.dash ::-webkit-scrollbar-button { display: none; height: 0; }
.dash ul.list { padding-right: 6px; }
/* one screen: the tabs stay, the PO list and the PO each scroll on their own */
.dash .dash-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.dash .filters, .dash nav.tabs { flex: none; }
.dash .split { flex: 1; min-height: 0; flex-wrap: nowrap; align-items: stretch; }
.dash ul.list { flex: 0 0 290px; overflow-y: auto; padding: 2px; }
.dash section.panel { overflow: hidden; align-self: stretch; }
/* in the PO, its header and the Lines / Activity / Email tabs stay; only what's under the tabs scrolls */
.dash section.panel > .po-details { flex: 0 1 auto; min-height: 0; }
.dash .po-details > .subpanel { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
/* a table in a tab (Lines): its header row stays, only the rows scroll; the tab scrolls it both ways */
.dash .po-details > .subpanel:has(> .tablebox) { padding: 0; overflow: auto; }
.dash .po-details > .subpanel > .tablebox { margin: 0; overflow: visible; }
.dash .po-details > .subpanel thead th { position: sticky; top: 0; z-index: 1; height: 36px; background: var(--card); box-shadow: inset 0 -1px 0 var(--line); }
.dash .po-details > .subpanel:has(> .tablebox)::-webkit-scrollbar-track { margin: 36px 0 10px; }   /* the bar starts under the header row */
.dash section.panel > *, .dash ul.list > li { flex-shrink: 0; }   /* the panel scrolls; its parts keep their size */
@media (max-width: 760px) {   /* a phone: one column, the page scrolls as usual */
  .dash .split { flex-wrap: wrap; }
  .dash ul.list { flex: 1 1 100%; overflow: visible; }
  .dash section.panel { overflow: visible; }
  .dash section.panel > .po-details, .dash .po-details > .subpanel { flex: none; overflow: visible; }
  .dash .po-details > .subpanel:has(> .tablebox) { overflow: visible; }
  .dash .po-details > .subpanel > .tablebox { overflow-x: auto; }
}
/* a host page's own styles stop at the box: properties onboarding (and similar pages) set on these shared names, put back */
.dash table { min-width: 0; }
.dash th, .dash td { border-bottom: 0; }
.dash .choice { justify-content: flex-start; }
.dash .choice:hover:not([aria-pressed="true"]) { border-color: var(--line-strong); }
.dash .link { min-height: 0; }
.dash .btn { justify-content: flex-start; }
.dash .btn:hover { filter: none; color: #fff; }
.dash .btn:disabled { opacity: 1; }
.dash .spin { margin: 0; }
.dash .notice { line-height: normal; }
.dash .hist .row { flex-wrap: nowrap; align-items: normal; }
