:root {
  --bg: #f3f5f9;
  --bg-elevated: #ffffff;
  --ink: #0f1b2d;
  --muted: #5b6b7c;
  --accent: #1d4ed8;
  --accent-2: #0ea5e9;
  --accent-soft: #e8effc;
  --border: #d9e1ec;
  --ok: #047857;
  --ok-soft: #d1fae5;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --out: #c2410c;
  --out-soft: #ffedd5;
  --site: #7c3aed;
  --site-soft: #ede9fe;
  --lane: #f59e0b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.04), 0 8px 24px rgba(15, 27, 45, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.05);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --topbar: #0b1f3a;
  --max: 1280px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #dbeafe 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e0f2fe 0%, transparent 50%),
    var(--bg);
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
code { font-family: var(--mono); font-size: 0.85em; background: #eef2f7; padding: 0.1em 0.35em; border-radius: 4px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap;
  padding: 0.75rem 1.1rem;
  background: linear-gradient(180deg, #0f2744 0%, var(--topbar) 100%);
  color: #e8eef7;
  box-shadow: 0 8px 24px rgba(11, 31, 58, 0.25);
}
.brand { display: flex; align-items: center; gap: 0.55rem; color: #fff; text-decoration: none; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 2rem; height: 2rem; border-radius: 9px;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; font-weight: 800; font-size: 0.95rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.brand-mark.lg { width: 3rem; height: 3rem; font-size: 1.35rem; border-radius: 12px; }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav a {
  color: #c9d7ea; padding: 0.4rem 0.7rem; border-radius: 999px; font-size: 0.92rem; font-weight: 500;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,0.12); color: #fff; text-decoration: none; }
.nav-toggle {
  display: none; margin-left: auto;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  color: #fff; border-radius: 8px; padding: 0.35rem 0.65rem; font-size: 1.1rem;
}
.user-chip { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.user-name { font-size: 0.8rem; opacity: 0.8; }
.logout-link { color: #d7e3f4 !important; font-size: 0.85rem; padding: 0.3rem 0.65rem; border-radius: 999px; }
.logout-link:hover { background: rgba(255,255,255,0.12); text-decoration: none !important; }
.wh-chip {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(14,165,233,0.25); color: #e0f2fe;
  border: 1px solid rgba(125,211,252,0.35); padding: 0.2rem 0.55rem; border-radius: 999px;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 1.25rem 1.1rem 2.5rem; }
.page-hero { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin: 0.4rem 0 1rem; }
.page-hero h1 { margin: 0; font-size: clamp(1.45rem, 2.5vw, 1.85rem); letter-spacing: -0.02em; }
.section-title { margin: 1.75rem 0 0.75rem; font-size: 1.1rem; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.muted.soft { font-size: 0.9rem; margin: 0.25rem 0 0.75rem; }
.tiny { font-size: 0.78rem; }
.lead { font-size: 1.05rem; margin: 0.35rem 0; }
.mono { font-family: var(--mono); font-size: 0.86rem; }
.strong { font-weight: 700; }
.crumb { font-size: 0.9rem; color: var(--muted); margin: 0 0 0.75rem; }
.footer-note { margin-top: 2rem; color: var(--muted); font-size: 0.8rem; }

.wh-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem;
  margin: 0 0 1rem; padding: 0.65rem 0.85rem;
  background: rgba(255,255,255,0.72); border: 1px solid var(--border);
  border-radius: 999px; backdrop-filter: blur(8px); box-shadow: var(--shadow-sm);
}
.wh-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.wh-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.wh-pill {
  padding: 0.35rem 0.75rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  color: var(--ink); background: #eef2f7; border: 1px solid transparent;
}
.wh-pill:hover { text-decoration: none; background: #e2e8f0; }
.wh-pill.active { background: var(--accent); color: #fff; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.85rem; margin: 1rem 0 1.25rem; }
.cards-sm { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.card, .card-panel, .card-soft {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card { padding: 1.05rem 1.15rem; }
.card-link { color: inherit; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,27,45,0.1); text-decoration: none; }
.card .label { color: var(--muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.card .value { font-size: 1.85rem; font-weight: 750; margin-top: 0.2rem; letter-spacing: -0.03em; }
.card .value.sm { font-size: 1.35rem; }
.card-panel { padding: 1.1rem; margin: 1rem 0; }
.card-soft { padding: 0.85rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.65rem; margin: 0.75rem 0 1rem; align-items: end; }
.toolbar label, .stack-form label, .login-form label {
  display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--muted);
}
input[type=text], input[type=password], select, textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem; font: inherit; min-width: 150px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(29,78,216,0.15);
}
.btn, button {
  border: none; border-radius: var(--radius-sm); padding: 0.55rem 0.95rem;
  font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
}
.btn.primary, button.primary, button[type=submit]:not(.secondary):not(.success):not(.status-btn) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
}
.btn.secondary, button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn.success, button.success { background: linear-gradient(135deg, #10b981, #047857); color: #fff; }
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }
.btn.block, button.block { width: 100%; }
.btn:hover, button:hover { filter: brightness(1.04); }
a.btn:hover { text-decoration: none; }

.table-wrap {
  overflow-x: auto; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  background: #f1f5f9; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); position: sticky; top: 0; font-weight: 700;
}
tr:hover td { background: #f8fafc; }
.qty { font-variant-numeric: tabular-nums; font-weight: 700; }

.pill {
  display: inline-flex; align-items: center; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; background: var(--accent-soft); color: #1e40af; margin-right: 0.25rem;
}
.pill.lane { background: var(--warn-soft); color: #92400e; }
.pill.out { background: var(--danger-soft); color: var(--danger); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.subtle { background: #eef2f7; color: #475569; }
.pill-row { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.45rem; }

.flash { padding: 0.75rem 0.95rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 500; }
.flash.ok, .flash:not(.error) { background: var(--ok-soft); border: 1px solid #6ee7b7; color: var(--ok); }
.flash.error, .error { background: var(--danger-soft); border: 1px solid #fecaca; color: var(--danger); }

/* Tools color coding */
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.85rem; }
.leg { font-size: 0.78rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 999px; }
.leg.out { background: var(--out-soft); color: var(--out); }
.leg.site { background: var(--site-soft); color: var(--site); }
.leg.avail { background: var(--ok-soft); color: var(--ok); }

.tool-list { display: flex; flex-direction: column; gap: 0.65rem; }
.tool-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem;
  padding: 0.9rem 1rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-elevated); box-shadow: var(--shadow-sm);
}
.tool-row.is-out {
  background: linear-gradient(90deg, #ffedd5 0%, #fff7ed 40%, #fff 100%);
  border-color: #fdba74; box-shadow: 0 0 0 1px rgba(194,65,12,0.08), var(--shadow-sm);
}
.tool-row.is-site {
  background: linear-gradient(90deg, #ede9fe 0%, #f5f3ff 45%, #fff 100%);
  border-color: #c4b5fd;
}
.tool-row.is-avail { border-left: 4px solid #34d399; }
.tool-main { flex: 1; min-width: 220px; display: grid; gap: 0.35rem; }
.tool-id { font-weight: 700; font-size: 1rem; }
.tool-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.35rem 0.75rem; margin-top: 0.35rem; font-size: 0.9rem; }
.meta-label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }
.emph-out { color: var(--out); font-weight: 700; }
.status-available { color: var(--ok); font-weight: 700; }
.status-out { color: var(--danger); font-weight: 700; }
.tool-actions { display: flex; align-items: center; }

.detail-hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem;
  padding: 1.2rem; border-radius: var(--radius); background: var(--bg-elevated);
  border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 1rem;
}
.detail-hero.banner-out { background: linear-gradient(135deg, #ffedd5, #fff); border-color: #fdba74; }
.detail-hero.banner-site { background: linear-gradient(135deg, #ede9fe, #fff); border-color: #c4b5fd; }
.detail-hero.banner-avail { border-left: 5px solid #34d399; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stack-form { display: grid; gap: 0.65rem; }
.stack-form input { width: 100%; min-width: 0; }

/* Board */
.wrap-wide { max-width: min(1400px, 100%); }

/* Consolidated board header controls (warehouse + search + share) */
.board-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem 0.75rem;
  margin: 0.35rem 0 0.55rem; padding: 0.45rem 0.65rem;
  background: rgba(255,255,255,0.82); border: 1px solid var(--border);
  border-radius: 14px; backdrop-filter: blur(8px); box-shadow: var(--shadow-sm);
}
.board-controls-wh { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.board-controls-search {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  flex: 1 1 220px; min-width: 0;
}
.board-controls-search input[type=search],
.board-controls-search input[type=text],
.board-controls-search input[type=date],
.board-controls-search select {
  min-width: 0; flex: 1 1 140px; padding: 0.4rem 0.55rem; font-size: 0.88rem;
}
.board-controls-search select { flex: 0 1 160px; }
.board-controls-actions { display: flex; align-items: center; gap: 0.35rem; margin-left: auto; }
.page-hero-compact { margin: 0.15rem 0 0.65rem; align-items: baseline; }
.page-hero-compact h1 { font-size: clamp(1.2rem, 2vw, 1.45rem); }
.page-hero-compact .muted { margin: 0.15rem 0 0; font-size: 0.85rem; }
.job-linked { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.job-linked-chip {
  font-size: 0.68rem; font-weight: 700; padding: 0.12rem 0.4rem; border-radius: 999px;
  background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; text-decoration: none;
}
.job-linked-chip:hover { background: #d1fae5; text-decoration: none; }
@media (max-width: 820px) {
  .board-controls-actions { margin-left: 0; width: 100%; }
  .board-controls-search { flex: 1 1 100%; }
}

.board-section { margin: 0.85rem 0 1.15rem; }
.board-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.45rem; margin-bottom: 0.45rem; }
.board-section-head h2 { margin: 0; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.03em; }
.count-chip {
  font-size: 0.72rem; font-weight: 700; background: #e2e8f0; color: #334155;
  padding: 0.12rem 0.45rem; border-radius: 999px;
}
.is-active-board .board-section-head h2 { color: #92400e; }
.is-history-board { opacity: 0.96; }
.is-history-board .job-card, .is-history-board .order-card { background: #f8fafc; }


/* Multi-section columns on wide screens; stack on narrow */
.board-sections-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.65rem;
  align-items: start;
}
.board-section.board-col {
  margin: 0;
  padding: 0.4rem 0.45rem 0.5rem;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 0;
  max-height: none;
}
.board-section.board-col .board-section-head {
  position: sticky; top: 3.4rem; z-index: 5;
  background: rgba(248,250,252,0.96); backdrop-filter: blur(6px);
  padding: 0.25rem 0.2rem; border-radius: 8px; margin-bottom: 0.35rem;
}
.board-section.board-col .job-grid { gap: 0.22rem; }
.board-section.board-col .job-card.dense { padding: 0.3rem 0.45rem; }
.board-section.board-col .job-num { font-size: 1.35rem; }
.board-section.board-col .lifecycle { display: none; } /* denser columns — timestamps via History */
@media (max-width: 900px) {
  .board-sections-row { grid-template-columns: 1fr; }
  .board-section.board-col .lifecycle { display: grid; }
}
@media (min-width: 1400px) {
  .board-sections-row { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

.job-grid {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.job-card, .order-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.55rem 0.7rem; margin-bottom: 0; box-shadow: var(--shadow-sm);
}
.job-card.dense { padding: 0.5rem 0.65rem; }
.job-card-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem 1rem;
  width: 100%;
}
.job-main { min-width: 0; flex: 1 1 52%; }
.job-side { flex: 1 1 42%; max-width: none; text-align: right; min-width: 12rem; }
.job-card.dense { padding: 0.35rem 0.55rem; }
.job-card, .order-card { margin-bottom: 0; width: 100%; }
.job-num { font-size: 1.55rem; }
.lifecycle { margin: 0.25rem 0 0.15rem; padding: 0.25rem 0.35rem; }
.status-actions { margin-top: 0.25rem; }
.board-section { margin: 0.55rem 0 0.75rem; }
.board-section-head { margin-bottom: 0.3rem; }
.job-side-empty { font-size: 0.72rem; }
.job-po-line {
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.35rem; align-items: center;
  line-height: 1.1; margin-bottom: 0.15rem;
}
.job-num {
  font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; color: #111827;
  line-height: 1; margin-right: 0.15rem;
}
.job-customer { font-size: 0.88rem; color: #374151; font-weight: 600; margin-top: 0.1rem; }
.job-address { font-size: 0.78rem; color: #6b7280; margin-top: 0.1rem; }
.job-meta, .job-meta-tight { color: var(--muted); font-size: 0.78rem; }
.job-meta-tight { display: flex; flex-wrap: wrap; gap: 0.35rem 0.55rem; align-items: center; margin-top: 0.25rem; }
.suffix { font-size: 0.75rem; font-weight: 700; color: #4b5563; background: #f3f4f6; padding: 0.05rem 0.35rem; border-radius: 4px; }
.intake { white-space: nowrap; color: #9ca3af; font-size: 0.72rem; }

.job-head, .order-head { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; align-items: baseline; margin-bottom: 0.35rem; }

/* Highlight colors — WH1 HTML rules */
.job-card.hl-delivery { background: #dbeafe; border-color: #2563eb; border-width: 2px; }
.job-card.hl-vendor { background: #ede9fe; border-color: #7c3aed; border-width: 2px; }
.job-card.hl-lane { background: #fffbeb; border-color: #fcd34d; }
.job-card.hl-willcall { background: #f9fafb; border-color: #d1d5db; }
.job-card.hl-wh1 { background: #fafafa; border-color: #e5e7eb; }
.job-card.hl-fixture {
  background: #fffbeb; border: 3px solid #d97706; box-shadow: 0 0 0 2px #fbbf24;
}
.job-card.hl-return {
  background: #fdf2f8; border: 3px solid #db2777; box-shadow: 0 0 0 2px #f9a8d4;
}
.job-card.hl-material-return { background: #f5f3ff; border-color: #7c3aed; }
.job-card.hl-other { background: #eef2ff; border-color: #c7d2fe; }
.job-card.hl-done { background: #fff; border-color: #e5e7eb; }

.pill {
  display: inline-block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.02em;
  text-transform: uppercase; border-radius: 999px; padding: 0.12rem 0.45rem;
  background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; vertical-align: middle;
}
.pill.subtle { text-transform: none; font-weight: 600; opacity: 0.85; font-size: 0.65rem; }
.pill.ok, .pill-in { background: #dcfce7; color: #14532d; border-color: #16a34a; }
.pill.out, .pill-out { background: #e0e7ff; color: #312e81; border-color: #6366f1; }
.pill.lane, .pill-lane { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.pill-order { background: #0f766e; color: #fff; border-color: #0d9488; box-shadow: 0 0 0 2px #99f6e4; }
.pill-pull { background: #ea580c; color: #fff; border-color: #c2410c; }
.pill-done { background: #f3f4f6; color: #4b5563; border-color: #9ca3af; }
.pill-fixture { background: #fef3c7; color: #92400e; border-color: #d97706; }
.pill-fixture-return { background: #fce7f3; color: #9d174d; border-color: #db2777; }
.pill-material-return { background: #ede9fe; color: #5b21b6; border-color: #7c3aed; }
.pill-willcall { background: #f3f4f6; color: #374151; border-color: #9ca3af; }
.pill-stockroom { background: #475569; color: #f8fafc; border-color: #334155; }
.pill-delivery { background: #d1fae5; color: #065f46; border-color: #34d399; }
.pill-muted { background: #fef3c7; color: #92400e; border-color: #f59e0b; }

.job-expand { margin-top: 0.2rem; text-align: right; }
.job-expand > summary {
  cursor: pointer; font-size: 0.72rem; font-weight: 700; color: #4b5563; list-style: none; user-select: none;
}
.job-expand > summary::-webkit-details-marker { display: none; }
.job-expand[open] > summary { color: #1a2332; }
.job-expand-body {
  margin-top: 0.3rem; font-size: 0.75rem; color: #4b5563; line-height: 1.35;
  background: #f8fafc; border-radius: 6px; padding: 0.4rem 0.5rem; text-align: left; max-height: 14rem; overflow: auto;
}
.job-expand-body p { margin: 0.25rem 0; }
.job-amount { color: #111827; }
.job-status-line { color: #6b7280; }
.materials-list { margin: 0.3rem 0 0; padding: 0; list-style: none; font-size: 0.74rem; color: #6b7280; column-gap: 0.75rem; text-align: left; }
.materials-list.cols-1 { columns: 1; }
.materials-list.cols-2 { columns: 2; }
.materials-list.cols-3 { columns: 3; }
.materials-list li { break-inside: avoid; padding: 0.05rem 0; }

.lifecycle {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.3rem;
  margin: 0.4rem 0 0.25rem; padding: 0.35rem 0.4rem; background: #f8fafc; border-radius: 8px; border: 1px dashed var(--border);
}
.life-label { display: block; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }
.life-value { font-size: 0.72rem; }

.status-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.4rem; }
.status-actions.compact .status-btn { padding: 0.22rem 0.45rem; font-size: 0.68rem; }
.status-btn {
  background: #fff; color: var(--ink); border: 1px solid var(--border) !important;
  border-radius: 999px !important; font-weight: 600;
}
.status-btn.is-current, .status-btn:disabled {
  background: var(--accent-soft); color: #1e40af; border-color: #93c5fd !important; opacity: 1;
}
.status-btn.status-picked_up:not(:disabled):hover { background: var(--warn-soft); }
.status-btn.status-delivered:not(:disabled):hover { background: var(--ok-soft); }
.status-btn.status-in_lane:not(:disabled):hover { background: #fff7ed; }

/* History */
.history-list { display: grid; gap: 0.4rem; }
.history-item {
  display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.65rem;
  padding: 0.55rem 0.7rem; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-sm);
}
.history-when { font-size: 0.72rem; color: var(--muted); }
.history-type {
  display: inline-block; font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 0.1rem 0.4rem; border-radius: 999px; background: #e2e8f0; color: #334155;
  margin-bottom: 0.2rem;
}
.history-type.type-job { background: #dbeafe; color: #1e3a8a; }
.history-type.type-order { background: #d1fae5; color: #065f46; }
.history-type.type-po { background: #ede9fe; color: #5b21b6; }
.history-type.type-tool { background: #ffedd5; color: #9a3412; }
.history-type.type-status { background: #fef3c7; color: #92400e; }
.history-type.type-board_update, .history-type.type-signal, .history-type.type-bot { background: #f3f4f6; color: #374151; }
.history-title { font-weight: 700; font-size: 0.92rem; margin: 0 0 0.15rem; }
.history-summary { font-size: 0.8rem; color: #4b5563; margin: 0; }
.history-meta { font-size: 0.72rem; color: var(--muted); margin-top: 0.25rem; display: flex; flex-wrap: wrap; gap: 0.45rem; }

@media (max-width: 820px) {
  .job-card-row { flex-direction: column; }
  .job-side { flex: 1 1 auto; max-width: 100%; text-align: left; }
  .history-item { grid-template-columns: 1fr; }
}

/* Photos */
.photo-section { margin: 1.25rem 0; padding: 1rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; margin: 0.75rem 0 1rem; }
.photo-card { margin: 0; background: #f8fafc; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-card figcaption { padding: 0.4rem 0.55rem 0; font-size: 0.82rem; }
.photo-card .tiny { padding: 0 0.55rem 0.5rem; }
.photo-upload { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.photo-picker { position: relative; overflow: hidden; cursor: pointer; }
.photo-picker input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; min-width: 0; width: 100%; height: 100%;
}

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(800px 400px at 20% 0%, #bfdbfe, transparent 60%),
    radial-gradient(700px 400px at 90% 20%, #a5f3fc, transparent 55%),
    #0b1f3a;
}
.login-card {
  width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-brand { text-align: center; margin-bottom: 1.25rem; }
.login-brand h1 { margin: 0.75rem 0 0.25rem; font-size: 1.45rem; }
.login-form { display: grid; gap: 0.85rem; }
.login-form input { width: 100%; min-width: 0; }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); }

@media (max-width: 820px) {
  .detail-hero, .grid-2 { grid-template-columns: 1fr; }
  .lifecycle { grid-template-columns: 1fr; }
  .materials-list.cols-2, .materials-list.cols-3 { columns: 1; }
  .hide-sm { display: none !important; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; cursor: pointer; z-index: 50; -webkit-tap-highlight-color: transparent;
  }
  .nav {
    display: none; order: 20; width: 100%; flex-direction: column; gap: 0.15rem;
    padding: 0.35rem 0 0.15rem;
  }
  .nav.open { display: flex; }
  .nav a { display: block; padding: 0.55rem 0.75rem; }
  .user-chip { width: 100%; order: 30; margin-left: 0; justify-content: flex-end; }
  .wh-bar { border-radius: 14px; }
}

.export-panel { margin-top: 0.5rem; }
.export-head h2 { margin: 0 0 0.35rem; }
.export-actions { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.75rem 0; }
.export-row {
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  padding: 0.45rem 0.55rem; background: #f8fafc; border-radius: 10px; border: 1px solid var(--border);
}
.export-label { font-weight: 700; font-size: 0.88rem; min-width: 7.5rem; }
.export-save { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: end; }

/* Compact Share modal */
.page-hero-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.page-hero-actions { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.share-trigger { min-width: 4.5rem; }
.share-modal {
  border: none; border-radius: 14px; padding: 0; max-width: min(520px, calc(100vw - 1.5rem));
  box-shadow: 0 20px 50px rgba(15,27,45,0.28); background: transparent;
}
.share-modal::backdrop { background: rgba(15, 27, 45, 0.45); }
.share-modal-inner {
  background: #fff; border-radius: 14px; padding: 1rem 1.1rem 0.85rem;
}
.share-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.share-modal-head h2 { margin: 0; font-size: 1.05rem; }
.share-modal-close {
  border: none; background: #f1f5f9; width: 2rem; height: 2rem; border-radius: 999px;
  font-size: 1.25rem; line-height: 1; cursor: pointer; color: #334155;
}
.share-modal .export-actions.compact { margin: 0.65rem 0; display: grid; gap: 0.35rem; }
.share-modal .export-row {
  display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center;
  padding: 0.35rem 0.45rem; background: #f8fafc; border-radius: 8px; border: 1px solid var(--border);
}
.share-modal .export-label { font-weight: 700; font-size: 0.8rem; min-width: 6.5rem; }
.export-save-inline { margin: 0.35rem 0; }
.export-save-label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; font-weight: 600; }
.share-save-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin: 0.5rem 0 0.35rem; }
.share-modal-foot { margin: 0.35rem 0 0; }
.btn.sm { padding: 0.28rem 0.55rem; font-size: 0.78rem; }

/* Subtle job source badge — glanceable, does not restyle the card */
.src-badge {
  display: inline-block; font-size: 0.58rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.05rem 0.32rem; border-radius: 4px;
  vertical-align: middle; margin-left: 0.15rem;
  opacity: 0.75; border: 1px solid transparent;
  background: #f1f5f9; color: #64748b;
}
.src-badge.src-board { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.src-badge.src-email { background: #eff6ff; color: #3b82f6; border-color: #bfdbfe; }
.src-badge.src-stockroom { background: #f8fafc; color: #475569; border-color: #cbd5e1; }
