/* contractor.css — Supplyprint Contractor Portal (Slice 1: read-only)
   Self-contained, no framework. Professional dashboard styling, mobile-first. */

:root {
  /* Supplyprint "Tiles" brand identity — forest / olive / clay (matches main portal). */
  --bg:        #f6f3ee;  /* cream */
  --surface:   #fefdfb;  /* card */
  --ink:       #1f2d22;  /* ink */
  --ink-soft:  #5a6b5e;
  --line:      #e2ded5;
  --brand:     #295233;  /* forest — primary */
  --brand-ink: #ffffff;  /* text on forest */
  --brand-2:   #54994d;  /* leaf — focus/accent */
  --good:      #15803d;
  --good-bg:   #dcfce7;
  --warn:      #b45309;
  --warn-bg:   #fef3c7;
  --danger:    #b91c1c;
  --danger-bg: #fee2e2;
  --radius:    12px;
  --shadow:    0 1px 2px rgba(26,46,30,.06), 0 8px 24px rgba(26,46,30,.06);
  --sp-font:   'Hanken Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
.boot { padding: 80px 20px; text-align: center; color: var(--ink-soft); }

button { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: var(--brand-ink); font-weight: 650;
  text-decoration: none; transition: filter .12s ease, opacity .12s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.sm { padding: 7px 12px; border-radius: 8px; font-size: 13.5px; }
.btn.block { width: 100%; }

label { display: block; font-weight: 600; font-size: 13px; color: var(--ink-soft); margin: 0 0 6px; }
input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
input:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; border-color: var(--brand-2); }
.field { margin-bottom: 14px; }

/* ── Auth ──────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 26px; }
.auth-brand { text-align: center; margin-bottom: 20px; }
.tenant-logo { display: block; width: min(220px, 82%); height: auto; max-height: 96px; object-fit: contain; margin: 0 auto 12px; }
.tenant-logo-fallback { display: none; font-size: 24px; font-weight: 800; color: var(--brand); letter-spacing: -.02em; margin-bottom: 8px; }
.auth-kicker { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.auth-powered { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; font-size: 11.5px; color: var(--ink-soft); }
.auth-powered span { color: var(--brand); font-weight: 700; }
.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.brand .sp-logo-mark { display: block; flex-shrink: 0; }
.brand .sp-wordmark { font-family: var(--sp-font); font-weight: 800; letter-spacing: -0.025em; line-height: 1; font-size: 20px; text-transform: none; }
.brand .sp-wordmark .supply { color: #295233; text-transform: none; }
.brand .sp-wordmark .print  { color: #a55b35; text-transform: none; }
.brand span { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.auth-card h1 { font-size: 18px; margin: 18px 0 6px; }
.auth-card p.sub { color: var(--ink-soft); margin: 0 0 20px; font-size: 13.5px; }

/* Login secondary actions (sign up + forgot) — grouped, centered, set apart from
   the primary Sign in button with a hairline divider. */
.login-help { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-help .forgot { font-size: 13.5px; }

/* ── Shell ─────────────────────────────────────────────────────── */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff; display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
/* Dark topbar: reversed tiles (cream/leaf/clay) + on-dark wordmark for contrast. */
.topbar .brand .sp-wordmark .supply { color: #eff3ec; }
.topbar .brand .sp-wordmark .print  { color: #e7a875; }
.topbar .brand .sp-logo-mark rect:nth-of-type(1) { fill: #ebf2dc; }
.topbar .brand .sp-logo-mark rect:nth-of-type(2) { fill: #54994d; }
.topbar .brand .sp-logo-mark rect:nth-of-type(3) { fill: #a55b35; }
.topbar .brand span { color: #a9b8a0; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: #c7ccd6; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: flex; gap: 4px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line); padding: 6px 8px; position: sticky; top: 49px; z-index: 15; }
.nav button { border: none; background: transparent; color: var(--ink-soft); font-weight: 600; padding: 9px 13px; border-radius: 8px; white-space: nowrap; }
.nav button.active { background: #eef3e6; color: var(--brand); }

.main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 18px 16px 60px; }
.view-title { font-size: 20px; margin: 4px 0 4px; letter-spacing: -.3px; }
.view-sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 16px; }

/* ── Cards / aging ─────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card .k { font-size: 12.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.card .v { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.card .v.due { color: var(--danger); }

.aging { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 20px; }
.aging .b { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.aging .b .lbl { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.aging .b .amt { font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.aging .b.hot { border-color: #fca5a5; background: #fff5f5; }
.aging .b.hot .amt { color: var(--danger); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel h2 { font-size: 15px; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.badge.paid { background: var(--good-bg); color: var(--good); }
.badge.sent, .badge.issued, .badge.draft { background: #eef3e6; color: #295233; }
.badge.partial { background: var(--warn-bg); color: var(--warn); }
.badge.overdue, .badge.void { background: var(--danger-bg); color: var(--danger); }

.msg { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; }
.msg.error { background: var(--danger-bg); color: var(--danger); }
.msg.ok { background: var(--good-bg); color: var(--good); }
.msg.info { background: #eef3e6; color: #295233; }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 16px; }
.loading { text-align: center; color: var(--ink-soft); padding: 30px; }
.muted { color: var(--ink-soft); }
.readonly-note { font-size: 12px; color: var(--ink-soft); margin-top: 18px; text-align: center; }

@media (max-width: 560px) {
  .aging { grid-template-columns: repeat(2, 1fr); }
  .topbar .who { display: none; }
}

/* ── Order builder (Slice 3) ─────────────────────────────────── */
.fulfil { display: flex; gap: 8px; margin-bottom: 14px; }
.fulfil button { flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 650; color: var(--ink-soft); }
.fulfil button.active { border-color: var(--brand); background: #eef3e6; color: var(--brand); }
.prod-list { display: grid; gap: 10px; margin-bottom: 12px; }
.prod { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.prod .meta { flex: 1; min-width: 0; }
.prod .meta .name { font-weight: 650; }
.prod .meta .sub { font-size: 12.5px; color: var(--ink-soft); }
.prod .price { font-weight: 700; white-space: nowrap; }
.prod .price .muted { font-weight: 400; }
.prod .qty { width: 84px; }
.prod.oos { opacity: .6; }
.cart-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 -6px 18px rgba(16,18,28,.05); border-radius: 0 0 var(--radius) var(--radius); }
.cart-bar .tot { flex: 1; } .cart-bar .tot b { font-size: 18px; }
@media (max-width: 560px) { .prod .qty { width: 68px; } }

/* ── Cart-based ordering: browse → cart → checkout → confirm ───── */
.cat-filter { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; }
.cat-filter button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 999px; white-space: nowrap; }
.cat-filter button.active { border-color: var(--brand); background: #eef3e6; color: var(--brand); }

.prod { flex-wrap: wrap; }
.prod .buy { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.pill { display: inline-block; margin-top: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; }
.pill.ok { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.incart { font-size: 12px; color: var(--good); font-weight: 650; white-space: nowrap; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 34px; height: 38px; border: none; background: transparent; font-size: 18px; color: var(--ink-soft); line-height: 1; }
.stepper button:hover { background: #f1f2f6; }
.stepper .stepqty { width: 60px; border: none; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; text-align: center; padding: 9px 4px; }
.stepper .stepqty:focus { outline: none; }

.cart-list { display: grid; gap: 10px; margin-bottom: 12px; }
.cart-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cart-line .meta { flex: 1; min-width: 140px; }
.cart-line .meta .name { font-weight: 650; }
.cart-line .meta .sub { font-size: 12.5px; color: var(--ink-soft); }
.cart-line .line-total { font-weight: 700; min-width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
.cart-line .rm { border: none; background: transparent; font-size: 22px; line-height: 1; color: var(--ink-soft); padding: 0 4px; }
.cart-line .rm:hover { color: var(--danger); }
.cart-line.err { border-color: #fca5a5; background: #fff5f5; }
.line-err { color: var(--danger); font-size: 12px; font-weight: 600; margin-top: 4px; }

/* ── Tier pricing banner + per-line badge (Slice A) ───────────── */
.tier-banner { background: #eef3e6; color: var(--brand); border: 1px solid #d7e3cf; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.tier-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; background: var(--good-bg); color: var(--good); vertical-align: middle; }

/* Job/PO# + Employee Name at the start of Place an order */
.order-head { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.order-head .field { margin-bottom: 14px; }

@media (max-width: 560px) {
  .prod .buy { width: 100%; margin-left: 0; }
  .prod .buy .price { flex: 1; }
  .order-head { grid-template-columns: 1fr; }
}

/* ── Card payment (due_on_receipt checkout) ────────────────────── */
#card-container { min-height: 44px; padding: 4px 0; }
