/* Millsawn Purchase Orders: additions on top of the shared admin.css */
.po-page { display: grid; gap: 1rem; max-width: 1200px; margin: 0 auto; }
.po-head { align-items: center; }
.po-head .h { margin: 0; display: flex; align-items: center; gap: 0.5rem; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; padding: 0.35rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; color: inherit; }
.po-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; }
.po-tile { display: grid; gap: 2px; text-align: left; padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; font-weight: 400; }
.po-tile strong { font-size: 24px; font-weight: 600; }
.po-steps { margin: 0.4rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.po-steps li.done a { text-decoration: line-through; color: var(--muted); }
.po-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; margin: 0.5rem 0; }
.po-step { display: grid; gap: 2px; padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--soft); }
.po-filters { align-items: center; }
.po-filters input[type=search] { width: min(100%, 18rem); }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.75rem; background: var(--panel); font-weight: 400; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--ink, #303030); color: #fff; border-color: transparent; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
td.late { color: #b42318; font-weight: 600; }
.pill.st-draft { background: #EFEDE6; color: #5F5E5A; }
.pill.st-sent { background: #E6F1FB; color: #185FA5; }
.pill.st-partial { background: #FAEEDA; color: #854F0B; }
.pill.st-received { background: #EAF3DE; color: #3B6D11; }
.pill.st-cancel { background: #FCEBEB; color: #A32D2D; }
.po-grid { display: grid; gap: 1rem; }
.cols3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.8rem; }
.po-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--soft); display: block; }
.po-lines td { vertical-align: top; }
.po-prop { font-size: 12.5px; }
.sm { font-size: 12px; }
input.qty { width: 5rem; }
input.cost { width: 7rem; }
.po-foot { align-items: center; margin-top: 0.6rem; }
.po-total { font-size: 18px; }
.po-history { margin: 0; padding-left: 1rem; display: grid; gap: 0.25rem; font-size: 13px; max-height: 14rem; overflow: auto; }
.order-list { display: grid; gap: 4px; max-height: 50vh; overflow: auto; margin-top: 0.6rem; }
.order-row { display: grid; grid-template-columns: 5rem 10rem minmax(0, 1fr) 6rem auto; gap: 0.6rem; align-items: center; text-align: left; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-weight: 400; cursor: pointer; }
.order-row:hover { background: var(--soft); }
@media (max-width: 720px) { .order-row { grid-template-columns: 1fr 1fr; } }
.split-card { padding: 0.7rem 0.9rem; }
.split-lines { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 13px; display: grid; gap: 0.2rem; }
.empty-state { text-align: center; padding: 2rem 1rem; display: grid; gap: 0.6rem; justify-items: center; }
body.busy { cursor: progress; }
body.busy main { opacity: 0.7; pointer-events: none; }

/* Printable purchase order (PDF / Print) */
.po-print { display: none; }
@media print {
  body.printing > *:not(.po-print) { display: none !important; }
  body.printing .po-print { display: block; color: #111; font: 12px/1.45 Inter, Arial, sans-serif; }
  @page { margin: 14mm; }
}
.po-print pre { font: inherit; white-space: pre-wrap; margin: 0; }
.po-print h1 { font-size: 20px; margin: 0 0 4px; }
.po-print h2 { font-size: 18px; letter-spacing: 0.08em; margin: 0 0 6px; }
.po-print h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #666; margin: 0 0 4px; }
.pp-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid #111; padding-bottom: 12px; }
.pp-logo { max-height: 50px; max-width: 200px; display: block; margin-bottom: 6px; }
.pp-meta table td { padding: 1px 0 1px 12px; }
.pp-addr { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 14px 0; }
.pp-lines { width: 100%; border-collapse: collapse; margin-top: 6px; }
.pp-lines th { text-align: left; font-size: 11px; text-transform: uppercase; color: #666; border-bottom: 1px solid #999; padding: 6px; }
.pp-lines td { border-bottom: 1px solid #ddd; padding: 8px 6px; vertical-align: top; }
.pp-lines td img { width: 70px; height: 70px; object-fit: cover; border-radius: 4px; }
.pp-prop { font-size: 11.5px; color: #333; }
.pp-sku { font-size: 11px; color: #777; }
.pp-totals { margin: 10px 0 0 auto; }
.pp-totals td { padding: 3px 0 3px 24px; text-align: right; }
.pp-notes { margin-top: 16px; }
.pp-foot { margin-top: 24px; color: #666; font-size: 11px; }
/* Supplier links: chips + pick list */
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--panel); }
.chips-pick input { border: 0; flex: 1 1 10rem; min-width: 8rem; padding: 4px; background: transparent; }
.chip.on-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 13px; border: 1px solid var(--line); }
.chip-x { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; color: var(--muted); }
.vend-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 4px 12px; max-height: 50vh; overflow: auto; }
.vend-row.off { color: var(--muted); }
.warn-text { color: #854F0B; }
/* PO page (layout like Ultimate Purchase Orders) */
.po-edit { max-width: 1100px; }
.icon-btn { padding: 0.3rem 0.6rem; font-size: 16px; }
.banner.warn { background: #FAEEDA; border: 1px solid #EF9F27; color: #633806; border-radius: 10px; padding: 0.7rem 1rem; }
.banner.warn a { color: inherit; font-weight: 600; }
.addr-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; }
.addr-card { display: grid; gap: 0.3rem; align-content: start; }
.addr-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.addr-head .lbl { flex: 1; }
.lbl { font-size: 11px; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.addr { white-space: pre-line; font-style: italic; font-size: 13px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #E6F1FB; color: #185FA5; }
.link-select { border: 0; background: transparent; color: #185FA5; font-size: 13px; cursor: pointer; padding: 0; width: auto; min-height: 0; }
button.link { border: 0; background: transparent; color: #185FA5; cursor: pointer; padding: 0; font-weight: 400; text-align: left; }
.products-card .tbl-scroll { overflow-x: auto; }
.po-lines th { white-space: nowrap; }
.prod-cell { display: flex; gap: 0.6rem; align-items: flex-start; min-width: 15rem; }
.po-lines input.sku { width: 8rem; }
.po-lines input.tax { width: 5rem; }
.money-in { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding-left: 8px; background: var(--panel); }
.money-in input { border: 0; width: 6rem; }
.totals-wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 0.6rem; padding-top: 0.6rem; }
.grid-gap { display: grid; gap: 0.4rem; align-content: start; }
table.totals { min-width: 16rem; }
table.totals td { padding: 3px 0; }
table.totals tr.grand td { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 700; font-size: 15px; }
.details-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0.8rem; align-items: start; }
@media (max-width: 860px) { .details-grid { grid-template-columns: 1fr; } }
.details-card, .terms-card { display: grid; gap: 0.6rem; }
.send-box { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0.6rem 0; display: grid; gap: 0.2rem; }
.split-btn { display: inline-flex; }
.split-btn .green { background: #0F6E56; border-color: #0F6E56; color: #fff; }
.split-btn button.green { border-radius: 8px 0 0 8px; }
.split-btn select.caret { border-radius: 0 8px 8px 0; width: 2.4rem; padding: 0 0.4rem; border-left: 1px solid rgba(255,255,255,.35); appearance: none; text-align: center; cursor: pointer; }
.pp-addr.three { grid-template-columns: 1fr 1fr 1fr; }
/* Top tabs + list pages like Ultimate Purchase Orders */
.top-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -0.25rem 0 1rem; overflow-x: auto; }
.top-tabs a { padding: 0.6rem 1rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.top-tabs a.on { color: var(--ink, #222); border-bottom-color: #0F6E56; font-weight: 600; }
.primary.green, button.green { background: #0F6E56; border-color: #0F6E56; color: #fff; }
.link-btn { border: 0; background: transparent; font-weight: 500; cursor: pointer; padding: 0.4rem 0.6rem; }
.list-card { display: grid; gap: 0.6rem; }
.filters { align-items: center; }
.filters input[type=search] { min-width: 14rem; }
select.filter { width: auto; min-width: 7.5rem; }
select.filter.on { border-color: #0F6E56; color: #0F6E56; }
.filter-in { width: 9.5rem; }
.tbl-scroll { overflow-x: auto; }
.po-tbl td, .po-tbl th, .ord-tbl td, .ord-tbl th, .sup-tbl td, .sup-tbl th { white-space: nowrap; }
details.drop { position: relative; display: inline-block; }
details.drop summary { cursor: pointer; list-style: none; }
details.drop summary::after { content: ' ▾'; color: var(--muted); }
details.drop ul { position: absolute; z-index: 20; left: 0; top: 1.5rem; margin: 0; padding: 0.4rem 0.6rem 0.4rem 1.4rem; background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 16rem; white-space: normal; display: grid; gap: 0.2rem; }
tr.voided td { text-decoration: line-through; color: var(--muted); }
.pager { justify-content: center; }
.pill.st-issued { background: #E1F5EE; color: #085041; }
.pill.st-confirmed { background: #FAEEDA; color: #633806; }
.pill.st-pending { background: #FAEEDA; color: #854F0B; }
.pill.st-paid { background: #EAF3DE; color: #3B6D11; }
.pill.st-no { background: #FCEBEB; color: #791F1F; }
.pill.st-vendor { background: #E6F1FB; color: #0C447C; }
.pill.st-tag { background: #FAEEDA; color: #633806; }
.avatar { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.avatar.a0 { background: #FAC775; color: #633806; } .avatar.a1 { background: #F5C4B3; color: #712B13; } .avatar.a2 { background: #9FE1CB; color: #085041; } .avatar.a3 { background: #B5D4F4; color: #0C447C; }
.btn-group { display: inline-flex; gap: 4px; align-items: center; }
.hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.5rem; }
.hub-item { display: flex; gap: 0.8rem; text-decoration: none; color: inherit; padding: 0.4rem; border-radius: 8px; }
.hub-item:hover { background: var(--soft); }
.hub-item strong { display: block; color: #0F6E56; margin-bottom: 2px; }
.hub-item .muted { font-size: 13px; }
.hub-ic { width: 36px; height: 36px; border-radius: 8px; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 16px; }
.settings-page, .settings-hub { max-width: 900px; }
@media print { .po-print.no-prices .pp-lines th:nth-child(n+5), .po-print.no-prices .pp-lines td:nth-child(n+5), .po-print.no-prices .pp-totals { display: none; } }

/* List pages use the full width */
main.page { max-width: 1600px; }
.po-page { max-width: none; }
.po-edit { max-width: 1150px; margin: 0 auto; }

/* Full-width pages and tables (like Ultimate Purchase Orders) */
main.page { max-width: none; padding: 0.75rem 1.25rem 2rem; }
.po-page { margin: 0; width: 100%; justify-self: stretch; }
.po-edit, .settings-page, .settings-hub { justify-self: center; width: min(100%, 1150px); }
.po-page table.tbl { width: 100%; border-collapse: collapse; }
.po-page table.tbl th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--line); background: var(--soft); }
.po-page table.tbl td { padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.po-page table.tbl tr:last-child td { border-bottom: 0; }
.po-page table.tbl th.r, .po-page table.tbl td.r { text-align: right; }
.ord-tbl td a, .po-tbl td strong { font-weight: 600; }
.ord-tbl td a { color: inherit; text-decoration: none; }
.ord-tbl td a:hover { text-decoration: underline; }
.list-card { padding: 1rem 0 0.5rem; }
.list-card > .filters, .list-card > p, .list-card > .pager { padding: 0 1rem; }
.filters input[type=search] { min-height: 2.4rem; }

/* General settings: label on the left, card on the right (like Ultimate Purchase Orders) */
.settings-page.general { width: min(100%, 1000px); }
.set-row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-side .h { font-size: 15px; margin: 0.4rem 0; }
@media (max-width: 760px) { .set-row { grid-template-columns: 1fr; gap: 0.5rem; } }
.req { color: #b42318; }
.img-drop { position: relative; display: flex; align-items: center; justify-content: center; min-height: 8rem; border: 1.5px dashed var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; padding: 0.6rem; font-weight: 400; }
.img-drop img { max-height: 7rem; max-width: 100%; object-fit: contain; }
.img-x { position: absolute; top: 4px; right: 8px; font-size: 18px; color: var(--muted); }
.pp-sign { margin: 28px 0 0 auto; width: 220px; text-align: center; font-size: 11.5px; }
.pp-sign img { max-height: 60px; max-width: 200px; display: block; margin: 0 auto 4px; }
.pp-sign .pp-line { border-bottom: 1px solid #333; height: 40px; margin-bottom: 4px; }

/* Settings options: checkbox / radio beside a title, description underneath, grouped sections */
.card.opts { display: grid; gap: 0; padding: 0; overflow: hidden; }
.card.opts > .cols2 { padding: 1rem 1.1rem 0.4rem; }
.card.opts > .opt, .card.opts > p { padding-left: 1.1rem; padding-right: 1.1rem; }
.card.opts > p { margin: 0.2rem 0 0.9rem; }
.opt { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: 0.15rem 0.65rem; align-items: start; padding: 0.6rem 0; cursor: pointer; }
.opt > input { margin: 0.15rem 0 0; width: 1rem; height: 1rem; accent-color: #0F6E56; cursor: pointer; }
.opt > span { display: grid; gap: 0.15rem; }
.opt strong { font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 0.45rem; }
.opt .muted { font-size: 12.5px; line-height: 1.4; }
.opt.radio { margin-left: 1.9rem; padding: 0.35rem 0; }
.opt.off { opacity: 0.45; cursor: default; }
.opt-group { display: grid; padding: 0.85rem 1.1rem 0.6rem; border-top: 1px solid var(--line); }
.card.opts > .opt-group:first-child { border-top: 0; }
.opt-group > .lbl { font-size: 11px; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin-bottom: 0.2rem; }
.opt-group .sub-opt { margin: 0.2rem 0 0.4rem 1.9rem; max-width: 18rem; }
.card.opts > .opt + .opt { border-top: 1px solid var(--line); }
.set-row { padding: 1.25rem 0; align-items: start; }
.set-side { position: sticky; top: 0.75rem; }
.set-side .h { font-size: 15px; font-weight: 600; margin: 0 0 0.35rem; }
.set-side .muted { font-size: 13px; line-height: 1.45; margin: 0; }
