/* ap.hcarr.net styles. Brand colors from hcarr.com, same as packing.hcarr.net. */
  /* Brand colors from hcarr.com, same as packing.hcarr.net. */
  :root { --brand:#016390; --brand-light:#8eb6dc; --tint:#eaeaee; --ok:#1e7b3a; --ok-bg:#e5f4ea; --bad:#b42318; --bad-bg:#fde8e7;
    --warn:#8a5a00; --warn-bg:#fdf1d8; --info:#35507a; --info-bg:#e6eef8; --line:#d0d5dd; --muted:#5b6472; }
  /* hcarr.com uses Adobe's Kepler, licensed to that domain only; Georgia is the closest system serif. */
  h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight:normal; color:var(--brand); }
  * { box-sizing:border-box; }
  body { margin:0; background:var(--tint); border-top:6px solid var(--brand); font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif; color:#111; }
  .wrap { max-width:1280px; margin:0 auto; padding:12px 16px 30px; }
  header { display:flex; align-items:center; gap:18px; flex-wrap:wrap; padding:6px 0 12px; }
  header .logo { width:210px; height:auto; display:block; }
  header h1 { font-size:26px; margin:0; flex:1; min-width:160px; }
  header .who { font-size:13px; color:var(--muted); text-align:right; }
  header .who a { color:var(--brand); }
  section { background:#fff; border:1px solid var(--line); border-radius:12px; padding:18px; margin-bottom:16px; }
  h2 { font-size:20px; margin:0 0 6px; }
  h3 { font-size:17px; margin:0 0 6px; }
  .sub { color:var(--muted); font-size:14px; margin:0 0 10px; }
  button, .btn { font-size:14px; padding:8px 14px; border-radius:8px; border:1px solid var(--brand); background:#fff; color:var(--brand); cursor:pointer; font-weight:600; font-family:inherit; text-decoration:none; display:inline-block; }
  button.primary, .btn.primary { background:var(--brand); color:#fff; }
  button.danger { border-color:var(--bad); color:var(--bad); }
  button.big { font-size:16px; padding:11px 22px; }
  button:disabled { opacity:.45; cursor:not-allowed; }
  .tabs { display:flex; gap:4px; margin-bottom:-1px; flex-wrap:wrap; }
  .tabs button { border-radius:8px 8px 0 0; border-color:var(--line); border-bottom:none; background:#f5f6f8; color:var(--muted); }
  .tabs button.on { background:#fff; color:var(--brand); }
  .toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
  .toolbar input, .toolbar select { font:inherit; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:#fff; }
  .toolbar input { flex:1; min-width:200px; }
  .chips { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
  .chip { border:1px solid var(--line); border-radius:20px; padding:4px 12px; font-size:13px; cursor:pointer; background:#fff; color:#222; font-weight:500; }
  .chip.on { outline:2px solid var(--brand); }
  .chip b { margin-left:4px; }
  table { width:100%; border-collapse:collapse; font-size:14px; }
  th { text-align:left; font-weight:600; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.04em; border-bottom:2px solid var(--line); padding:8px 8px; }
  td { border-bottom:1px solid #eceef2; padding:8px 8px; vertical-align:top; }
  tr.click { cursor:pointer; }
  tr.click:hover td { background:#f4f8fc; }
  .num { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
  .badge { display:inline-block; font-size:12px; font-weight:600; padding:2px 9px; border-radius:10px; white-space:nowrap; }
  .b-matched { background:var(--ok-bg); color:var(--ok); }
  .b-discrepancy, .b-qty_short, .b-backordered, .b-damaged, .b-not_on_slip { background:var(--bad-bg); color:var(--bad); }
  .b-not_invoiced, .b-pending, .b-unchecked { background:var(--warn-bg); color:var(--warn); }
  .b-invoice_only { background:var(--warn-bg); color:var(--warn); }
  .b-slip_only { background:var(--info-bg); color:var(--info); }
  .b-confirmed { background:#eef0f3; color:#333; }
  .muted { color:var(--muted); }
  .small { font-size:12px; }
  .empty { text-align:center; color:var(--muted); padding:30px 0; }
  .error { color:var(--bad); font-size:14px; margin:8px 0; }
  .error:empty { display:none; }
  .center { text-align:center; }
  a { color:var(--brand); }
  [hidden] { display:none !important; }
  header .titlebox { flex:1; min-width:160px; }
  header .titlebox h1 { flex:none; }
  .ver { font-size:12px; color:var(--muted); letter-spacing:.04em; }
  .alerts { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }
  .alert { font-size:11px; font-weight:600; padding:1px 7px; border-radius:9px; white-space:nowrap; }
  .alert.warn { background:var(--bad-bg); color:var(--bad); }
  .alert.info { background:#eef0f3; color:var(--muted); }
  .alertbox { border-radius:10px; padding:10px 14px; margin:8px 0 12px; font-size:14px; }
  .alertbox.warn { background:var(--bad-bg); color:var(--bad); }
  .alertbox.info { background:#f2f4f7; color:#333; }
  .alertbox div + div { margin-top:4px; }
  .b-ok { background:var(--ok-bg); color:var(--ok); }
  .b-price_over, .b-substitution, .b-not_on_quote, .b-issues { background:var(--bad-bg); color:var(--bad); }
  .b-charge, .b-discount, .b-no_quote { background:#eef0f3; color:#333; }
  tr.charge-line td { color:#555; }
  .tag { display:inline-block; font-size:11px; padding:0 6px; border-radius:8px; background:#eef0f3; color:#444; margin-right:4px; }
  .linesum { margin-top:6px; }
  .b-verified { background:var(--ok-bg); color:var(--ok); }
  .b-seen { background:var(--warn-bg); color:var(--warn); }
  .radios { display:flex; gap:18px; flex-wrap:wrap; }
  .radios label { font-size:15px; cursor:pointer; display:flex; align-items:center; gap:6px; }
  th.sel, td.sel { width:34px; padding-right:0; }
  td.sel input, th.sel input { width:18px; height:18px; cursor:pointer; }
  tr.picked td { background:#eef5fb; }
  .selbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; background:var(--info-bg); border-radius:10px; padding:8px 12px; margin-bottom:10px; }
  .selbar b { margin-right:6px; }
  a.vlink { color:inherit; text-decoration:underline dotted; text-underline-offset:3px; }
  a.vlink:hover { color:var(--accent, #0b5cad); text-decoration-style:solid; }
  .fieldbox { background:var(--info-bg); color:#1d2c44; border-radius:8px; padding:8px 10px; font-size:13px; margin-top:8px; }
  .fieldbox .kv { font-size:13px; margin-top:4px; }
  .form { display:grid; grid-template-columns:140px 1fr; gap:8px 12px; align-items:center; max-width:640px; }
  .form input, .form textarea, .form select { font:inherit; padding:7px 9px; border:1px solid var(--line); border-radius:7px; width:100%; }
  .form textarea { min-height:60px; }
  .form label { color:var(--muted); font-size:14px; }
  @media (max-width:600px) { .form { grid-template-columns:1fr; } }

  /* detail drawer */
  .drawer-bg { position:fixed; inset:0; background:rgba(20,30,40,.35); z-index:20; }
  .drawer { position:fixed; top:0; right:0; bottom:0; width:min(1100px, 100%); background:var(--tint); z-index:21; overflow:auto; padding:16px; box-shadow:-6px 0 24px rgba(0,0,0,.15); }
  .drawer .close { float:right; }
  .cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:12px; margin-bottom:12px; }
  .card { background:#fff; border:1px solid var(--line); border-radius:10px; padding:14px; }
  .card h3 { display:flex; justify-content:space-between; gap:8px; align-items:baseline; }
  .kv { display:grid; grid-template-columns:110px 1fr; gap:2px 10px; font-size:14px; }
  .kv div:nth-child(odd) { color:var(--muted); }
  .note { background:var(--warn-bg); color:var(--warn); border-radius:8px; padding:8px 10px; font-size:13px; margin-top:8px; }
  .reasons { font-size:13px; color:var(--muted); margin:4px 0 10px; }
  .actions { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0; }
  .cmp td.desc { max-width:340px; }
  .cand { display:flex; gap:10px; align-items:flex-start; padding:8px; border-bottom:1px solid #eceef2; }
  .cand:hover { background:#f4f8fc; }
  .cand input { margin-top:4px; }

  /* scan overlay */
  .overlay { position:fixed; inset:0; background:rgba(234,234,238,.94); display:grid; place-items:center; z-index:30; }
  .overlay .box { background:#fff; border:1px solid var(--line); border-radius:12px; padding:26px 30px; text-align:center; width:min(520px, 92vw); }
  .bar { height:10px; background:#e3e7ec; border-radius:5px; margin-top:14px; overflow:hidden; }
  .bar div { height:100%; width:0; background:var(--brand); transition:width .25s; }
  .stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:10px; margin:12px 0; }
  .stat { background:#f7f8fa; border:1px solid var(--line); border-radius:10px; padding:10px 12px; }
  .stat b { display:block; font-size:24px; font-family:Georgia, serif; color:var(--brand); font-weight:normal; }
  .stat span { font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
  @media (max-width:700px) { th.hide-sm, td.hide-sm { display:none; } header .logo { width:160px; } }

/* Contracts */
ul.watch { margin:6px 0 0; padding-left:18px; } ul.watch li { margin:3px 0; } ul.watch li.warn { color:var(--warn, #8a5a00); }
/* Ask panel: under the detail drawer, so records opened from an answer show on top and Close returns to the conversation. */
.askpanel { position:fixed; top:0; right:0; bottom:0; width:min(520px, 100%); background:#fff; z-index:19; display:flex; flex-direction:column; box-shadow:-6px 0 24px rgba(0,0,0,.15); border-left:1px solid #d0d5dd; }
.askhead { display:flex; align-items:center; gap:10px; padding:12px 14px; border-bottom:1px solid #eceef2; flex-wrap:wrap; }
.asklog { flex:1; overflow:auto; padding:14px; }
.asklog .msg { margin:0 0 12px; padding:10px 12px; border-radius:10px; line-height:1.45; }
.asklog .msg p { margin:0 0 6px; } .asklog .msg p:last-child { margin:0; }
.asklog .msg.user { background:#eef3f7; margin-left:40px; }
.asklog .msg.assistant { background:#f7f8fa; border:1px solid #eceef2; margin-right:20px; }
.asklog .bullet { margin:2px 0 2px 6px; }
.asklog .examples { display:flex; flex-direction:column; gap:6px; margin:10px 0; }
.asklog .examples .ex { text-align:left; font-weight:400; }
.askform { display:flex; gap:8px; padding:12px 14px; border-top:1px solid #eceef2; }
.askform textarea { flex:1; font:inherit; padding:8px 10px; border:1px solid #d0d5dd; border-radius:8px; resize:vertical; }
.jobinput { font:inherit; padding:3px 6px; border:1px solid #d0d5dd; border-radius:6px; }

/* Read-only accounts (8.0.0; body.readonly from boot.js). The server refuses these actions anyway; this hides them.
   Kept: viewing, opening documents, Ask and Upload. Hidden: Run scan, CSV exports, selection and batch actions,
   every data-act button (confirm, reopen, compare, unlink, link, remove, vendor save/verify/merge), Read again, job # edits. */
body.readonly #scanBtn, body.readonly #uscan, body.readonly a[href^="/api/export.csv"], body.readonly .sel, body.readonly #selbar,
body.readonly [data-act], body.readonly [data-dismiss], body.readonly [data-qedit], body.readonly [data-reread], body.readonly [data-job-edit], body.readonly [data-job-save],
body.readonly [data-job-cancel], body.readonly label[for="mergeFrom"], body.readonly #mergeFrom { display:none !important; }
body.readonly #vform { pointer-events:none; }
/* search: where a word was found on the document, and matches on other tabs */
.hit { max-width:420px; margin-top:2px; font-style:italic; }
.searchother { margin:-4px 0 8px; }
/* Health viewers who aren't IT (HEALTH_VIEWERS, 8.0.4): no buttons, no Ask log */
body.notadmin .adminonly { display:none !important; }

/* Files that couldn't be read (8.0.16), above the scan reports. */
.failed { margin:0 0 18px; padding:12px 14px; border:1px solid var(--bad); border-radius:8px; }
.failed h3 { margin-top:0; }
/* Price lists (8.0.20): a line above each job's first row; the vendor/jobs form. */
#quotesBody tr.jobstart td { border-top:2px solid var(--line); }
.qform { display:grid; gap:10px; margin-top:12px; }
.qform label { display:grid; gap:4px; font-weight:600; }
.qform input, .qform select { font:inherit; padding:6px 8px; }
/* Triple J's system (9.0.0): the company name where H. Carr's logo goes. */
.coname { font:600 26px Georgia, serif; color:var(--brand, #016390); white-space:nowrap; }
.coname[hidden] { display:none; }
