/* CamOps - look of the approved prototype */
:root {
  --ink: #1d1c1a; --muted: #5c5952; --line: #DEDBD5; --line2: #CFCBC4; --bg: #F4F3F0; --head: #EFEDE8;
  --brand: #900028; --brand-dark: #6a001d; --brand-soft: #F7EEF0; --warn-bg: #FFF4E5; --warn-line: #F0C27A;
  --ok-bg: #E3F1E6; --ok-ink: #1c5a2c; --green-row: #D7F0DD; --yellow-row: #FFF1A8; --red: #C00000;
  --excel: #217346; --excel-bg: #E9F4EC;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.4; }
a { color: var(--brand); } a:hover { color: var(--brand-dark); }
h1 { margin: 0; font-size: 26px; } h2 { margin: 0; font-size: 17px; } h3 { margin: 0; font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.wrap { min-height: 100vh; display: flex; flex-direction: column; }

/* header */
.top { background: var(--ink); color: #fff; padding: 0 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; min-height: 60px; }
.brand { font-weight: 700; font-size: 17px; padding: 10px 0; color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { height: 36px; max-width: 160px; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px 6px; }
.login-logo { display: block; max-height: 72px; max-width: 100%; object-fit: contain; align-self: flex-start; }
.logo-preview { max-height: 90px; max-width: 320px; object-fit: contain; border: 1px solid var(--line, #e2dfd9); border-radius: 8px; padding: 8px; background: #fff; }
.update-log { background: #1f1e1c; color: #e8e6e1; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 12px; border-radius: 8px; max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a { color: #fff; text-decoration: none; border-radius: 8px; padding: 9px 14px; font-size: 14px; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.top nav a.on { background: #3a3834; font-weight: 600; }
.badge { background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #d6d3cd; flex-wrap: wrap; }
.who form { margin: 0; }
.who button { background: transparent; color: #fff; border: 1px solid #6b6862; border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }

main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 28px 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-start { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flush { padding: 0; overflow-x: auto; }
.scroll { overflow-x: auto; }
/* a wide table scrolls inside its own box (both ways), so its sideways scrollbar is always on screen */
.tbl-box { max-height: calc(100vh - 120px); overflow: auto; }
.tbl-box .tbl thead th { position: sticky; top: 0; z-index: 2; }
.tbl.fit { table-layout: fixed; min-width: 1120px; }
.tbl.fit td { overflow: hidden; }
.tbl.fit input[type=text], .tbl.fit select { box-sizing: border-box; width: 100%; min-width: 0; padding-left: 6px; padding-right: 6px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: #fff; color: var(--ink); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 14px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { border-color: #9d9890; color: var(--ink); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.small { padding: 5px 11px; font-size: 13px; min-height: 32px; }
.btn.link { background: none; border: 0; color: var(--brand); padding: 0; min-height: 0; }
.btn.xlsx { background: var(--excel-bg); border-color: var(--excel); }
.btn.wide { justify-content: flex-start; border-left: 6px solid var(--excel); }
.tag-xlsx { background: var(--excel); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.inline { display: inline; margin: 0; }

/* forms */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea {
  font: inherit; font-weight: 400; font-size: 15px; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #f2b8c6; outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.drop { border: 2px dashed var(--line2); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 400; }
.check input { width: auto; }

/* messages */
.msg { border-radius: 10px; padding: 12px 16px; font-size: 14px; }
.msg.err { background: #FCE8EA; border: 1px solid #E2A3AE; color: #6a001d; }
.msg.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.msg.ok { background: var(--ok-bg); border: 1px solid #9BCBA6; }
.msg.info { background: #EAF1FB; border: 1px solid #A9C3E8; }
.msg ul { margin: 6px 0 0; padding-left: 20px; }
.attn { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; flex-wrap: wrap; }
.attn.brand { background: var(--brand-soft); border-color: #DDB3BD; }

/* pills / status */
.pill { border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; background: var(--head); color: #4a4740; white-space: nowrap; }
.pill.active { background: var(--ok-bg); color: var(--ok-ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { background: #fff; border: 1px solid var(--line2); border-radius: 999px; padding: 6px 14px; font-size: 13px; text-decoration: none; color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.nokit { background: var(--red); color: #fff; font-weight: 600; padding: 2px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; }

/* tables */
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: #4a4740; background: var(--head); padding: 8px 10px; border: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 7px 10px; border: 1px solid var(--line); vertical-align: middle; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c { text-align: center; }
.tbl .b { font-weight: 600; }
.tbl tr.green td { background: var(--green-row); }
.tbl tr.yellow td { background: var(--yellow-row); }
.tbl td.red { background: #FFC7CE; }
.tbl td.missing { background: var(--yellow-row); }
.tbl tfoot td { font-weight: 700; }
.tbl.big { font-size: 16px; }
.tbl input, .tbl select { padding: 5px 8px; font-size: 14px; }

/* job tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 10px 14px; font-size: 15px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }

.bar { height: 8px; background: var(--head); border-radius: 999px; overflow: hidden; min-width: 80px; flex: 1; }
.bar > div { height: 100%; background: #2f7d43; }
.bar.big { height: 10px; }

/* packing */
.stepper { display: flex; align-items: center; gap: 6px; justify-content: center; }
.stepper button { width: 36px; height: 36px; border: 1px solid #b9b5ad; background: #fff; border-radius: 6px; font: inherit; font-size: 18px; cursor: pointer; }
.stepper button.all { width: auto; font-size: 12px; padding: 0 8px; }
.stepper .val { min-width: 32px; text-align: center; font-weight: 600; }

/* kits */
.kits { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.devlist { flex: 1 1 260px; max-width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.devlist a { text-align: left; border-radius: 6px; padding: 9px 10px; font-size: 14px; color: var(--ink); text-decoration: none; }
.devlist a.on { background: #F3E3E7; font-weight: 600; }
.kitmain { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.redbar { background: var(--brand); color: #fff; font-weight: 700; padding: 9px 14px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kitcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kitcard .tbl { border: 0; }
.aliaschip { background: var(--head); border-radius: 999px; padding: 4px 6px 4px 12px; display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.aliaschip button { background: none; border: 0; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); padding: 2px 6px; }
details > summary { cursor: pointer; color: var(--brand); }

/* sign-in */
.login { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.login .card { max-width: 380px; width: 100%; padding: 40px; gap: 18px; }

/* drawings */
.drawings { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.drawing { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.drawing .prev { height: 150px; background: var(--head); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; overflow: hidden; }
.drawing .prev img { width: 100%; height: 100%; object-fit: cover; }
.drawing .foot { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  main { padding: 20px 16px 40px; }
  .top { padding: 0 16px; gap: 12px; }
}
@media print {
  .top, .tabs, .noprint, form { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}

/* parts table: keep cells readable; the table scrolls inside its box on narrow screens */
#parts td:first-child { white-space: nowrap; }
/* the Parts table's column widths are set by its colgroup (it fits the window, or scrolls in its box) */

/* offline */
.offline-banner { background: #B54708; color: #fff; padding: 10px 24px; font-size: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.offline-banner strong { letter-spacing: .04em; }
.offline-banner a { color: #fff; font-weight: 600; }
.outbox-note { background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); padding: 8px 24px; font-size: 14px; }
.is-offline .js-online { pointer-events: none; opacity: .45; }
.tbl tr.conflict td { background: #FCE8EA; }
.conflict-note { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; color: #6a001d; font-weight: 400; }
.tbl tr.offline-saved td:first-child { box-shadow: inset 4px 0 0 #B54708; }

/* inventory pulls on Packing */
#packing:not(.show-pulls) .pullcol { display: none; }
#packing.show-pulls .pulltag { display: none !important; }
.pulltag { display: inline-block; background: #EAF1FB; color: #1d3a6b; border: 1px solid #A9C3E8; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 500; margin-left: 4px; }
.tbl tr.secrow td { background: var(--head); }
/* Part No. picker */
.partpick { position: fixed; z-index: 50; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 320px; overflow-y: auto; max-width: min(560px, calc(100vw - 8px)); }
.partpick li { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.partpick li span { color: var(--muted); font-size: 13px; }
.partpick li[aria-selected=true], .partpick li:hover { background: var(--head); }
.partpick li.none { color: var(--muted); cursor: default; }
.part-desc { display: block; font-size: 13px; font-weight: 400; color: var(--muted); min-height: 1.2em; margin-top: 3px; }
