/* JobNerve — neutral product brand, per-company accent applied at runtime */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700;14..32,800;14..32,900&display=swap');

:root {
  --brand: #24435C;        /* neutral steel blue — overridden by company brand_color */
  /* Derived from --brand (not hardcoded) so hover/gradient states stay correct
     for any per-company brand color, not just the default. */
  --brand-dark: color-mix(in srgb, var(--brand) 82%, black);
  --brand-light: color-mix(in srgb, var(--brand) 14%, white);
  --accent: #3E7CB1;
  --bg: #F3F4F6;
  --bg-wash: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 5%, transparent), transparent),
             radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, var(--accent) 5%, transparent), transparent);
  --card: #FFFFFF;
  --text: #171E28;
  --muted: #667085;
  --line: #E3E6EA;
  --line-strong: #C7CFD8;
  --danger: #B3372F;
  --ok: #2E7D46;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 45, .05), 0 1px 1px rgba(20, 30, 45, .04);
  --shadow-md: 0 8px 24px rgba(20, 30, 45, .10), 0 2px 6px rgba(20, 30, 45, .05);
  --shadow-lg: 0 24px 64px rgba(16, 24, 36, .20), 0 6px 18px rgba(16, 24, 36, .09);
  --ease: cubic-bezier(.2, .7, .3, 1);

  /* Type + spacing scale — the newer/high-visibility components (Dashboard
     stat tiles, customer portal) are built against these; the long tail of
     older rules keeps its original hardcoded values rather than a risky
     full migration. */
  --fs-xs: 11px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 17px;
  --fs-lg: 20px; --fs-xl: 26px; --fs-2xl: 34px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background-color: var(--bg); background-image: var(--bg-wash);
  background-attachment: fixed; color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0 0 12px; letter-spacing: -.02em; font-weight: 800; }
label { display: block; margin: 10px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 11px 12px; margin-top: 4px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-size: 16px; background: #fff;
  color: var(--text); font-family: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }

.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 11px 18px; font-size: 15px;
  font-weight: 650; letter-spacing: -.005em; cursor: pointer; background: var(--line); color: var(--text);
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand), white 12%), var(--brand));
  color: #fff; box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.14);
}
.btn.primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-md); }
.btn.ghost { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn.ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.error { color: var(--danger); font-size: 14px; }

/* Login */
#login-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 15% 10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent),
    linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
  padding: 16px;
}
.login-card {
  background: var(--card); border-radius: var(--radius-lg); padding: 36px 32px;
  width: 100%; max-width: 380px; box-shadow: 0 40px 90px rgba(0,0,0,.35), var(--shadow-lg);
}
.login-card h1 { font-size: 22px; text-align: center; }
.login-card .btn { width: 100%; margin-top: 18px; }

/* Shell */
#topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; padding: 13px 18px; box-shadow: var(--shadow-md);
}
#nav-toggle { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm); }
#nav-toggle:hover { background: rgba(255,255,255,.14); }
#topbar-title { font-weight: 800; letter-spacing: -.02em; flex: 1; }
#topbar-user { font-size: 13px; opacity: .9; font-weight: 500; }

#drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40; width: 264px;
  background: var(--card); box-shadow: var(--shadow-lg);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 3px;
}
#drawer hr { width: 100%; border: none; border-top: 1px solid var(--line); margin: 8px 0; }
.nav-link {
  position: relative; background: none; border: none; text-align: left; font-size: 15.5px; font-weight: 650;
  padding: 12px 14px 12px 17px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-link:hover { background: var(--bg); color: var(--accent); }
.nav-link.active {
  background: var(--brand-light); color: var(--brand-dark); font-weight: 750;
}
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-link.disabled { opacity: .4; cursor: default; }
.nav-badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px;
  text-align: center; vertical-align: middle; margin-left: 4px;
}
#drawer-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); }

#main { padding: 18px; max-width: 780px; margin: 0 auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.view-head h2 { margin: 0; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; }

/* Stat tiles (Dashboard KPI row) */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.stat-tile .stat-label {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.stat-tile .stat-value { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat-tile.warn .stat-value { color: #9A6300; }
.stat-tile.warn { border-color: color-mix(in srgb, #C98A1F 35%, var(--line)); }

/* Cards */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 15px 17px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); transform: translateY(-2px); }
.card:active { transform: translateY(0); }
.card .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .title { font-weight: 700; letter-spacing: -.005em; }
.card .amount { font-weight: 800; white-space: nowrap; letter-spacing: -.01em; }
.card .meta { color: var(--muted); font-size: 13px; margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chip {
  font-size: 10.5px; font-weight: 750; padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--line);
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; flex-shrink: 0; }
.chip.sent { background: #DCEAF6; color: #1F5C8A; }
.chip.approved, .chip.paid { background: #DCF0E1; color: var(--ok); }
.chip.declined { background: #F7DEDB; color: var(--danger); }
.chip.partial { background: #FCEED2; color: #8A5A00; }
.chip.converted { background: #E7E2F3; color: #4A3E7D; }

/* Pipeline segmented status bar: draft/sent/approved/deposit/scheduled/invoiced/paid */
.pipe-bar { display: flex; gap: 3px; margin-top: 9px; }
.pipe-seg { flex: 1; height: 7px; border-radius: 4px; background: var(--line); }
.pipe-seg:first-child { border-radius: 4px 2px 2px 4px; }
.pipe-seg:last-child { border-radius: 2px 4px 4px 2px; }
.pipe-seg.done { background: linear-gradient(180deg, color-mix(in srgb, var(--ok), white 22%), var(--ok)); }
.pipe-seg.pending { background: var(--line); }
.pipe-seg.skip { background: repeating-linear-gradient(45deg, var(--line), var(--line) 3px, var(--card) 3px, var(--card) 6px); }
.pipe-seg.warn { background: linear-gradient(180deg, #E0A73C, #C98A1F); }
.pipe-seg.declined-stop { background: linear-gradient(180deg, color-mix(in srgb, var(--danger), white 18%), var(--danger)); }
.pipe-warn { color: #9A6300; font-weight: 700; cursor: pointer; }
.eye { color: var(--ok); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 36px 0; font-size: 14px; }

/* Tabs */
.tabs { display: flex; gap: 3px; margin-bottom: 14px; background: var(--line); padding: 4px; border-radius: calc(var(--radius-sm) + 2px); }
.tab {
  flex: 1; padding: 9px; border: none; background: transparent; color: var(--muted);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 650;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs.scroll { flex-wrap: nowrap; overflow-x: auto; margin-top: 10px; background: none; padding: 0; gap: 6px; }
.tabs.scroll .tab { flex: 0 0 auto; background: var(--card); border: 1px solid var(--line); }
.tabs.scroll .tab.active { border-color: var(--accent); color: var(--accent); }

/* Modals */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(16, 20, 28, .6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 20px 10px;
  animation: modal-fade .15s var(--ease);
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--card); border-radius: var(--radius-lg); padding: 24px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
  animation: modal-pop .18s var(--ease);
}
@keyframes modal-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-box.wide { max-width: 620px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* Invoice document — mirrors the KT Milling invoice layout, themed with the
   company's brand color instead of a hardcoded one. */
.inv-doc { background: #fff; padding: 26px 30px; font-family: Arial, sans-serif; font-size: 13px; color: #1a1a1a; }
.inv-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.inv-header img { height: 56px; width: auto; max-width: 140px; object-fit: contain; }
.inv-logo-generic {
  height: 56px; width: 56px; border-radius: 10px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; flex-shrink: 0;
}
.inv-header-right { text-align: right; }
.inv-header-right .inv-label { font-size: 26px; font-weight: 900; letter-spacing: .04em; color: #1a1a1a; line-height: 1; }
.inv-header-right .inv-date { font-size: 12px; color: #555; margin-top: 4px; }
.inv-colorbar { height: 3px; background: var(--brand); margin-bottom: 14px; }
.inv-addr-row { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.inv-addr { flex: 1; }
.inv-addr .al { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #888; margin-bottom: 4px; }
.inv-addr .an { font-size: 14px; font-weight: 800; color: #1a1a1a; }
.inv-addr .ap { font-size: 12px; color: #333; line-height: 1.6; white-space: pre-wrap; }
.inv-meta { display: flex; gap: 18px; margin-bottom: 16px; border-top: 1px solid #eee; border-bottom: 1px solid #eee; padding: 8px 0; flex-wrap: wrap; }
.inv-meta-cell .ml { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #888; }
.inv-meta-cell .mv { font-size: 13px; font-weight: 700; color: #1a1a1a; margin-top: 2px; text-transform: capitalize; }
.inv-lines { width: 100%; border-collapse: collapse; margin-bottom: 0; }
.inv-lines thead th { background: #1a1a1a; color: #fff; padding: 7px 10px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; text-align: left; }
.inv-lines thead th.r { text-align: right; }
.inv-lines tbody td { padding: 7px 10px; border-bottom: 1px solid #eee; font-size: 12px; }
.inv-lines tbody tr:nth-child(even) td { background: #fafafa; }
.inv-lines .r { text-align: right; }
.inv-totals-wrap { display: flex; justify-content: flex-end; margin: 8px 0 18px; }
.inv-totals { width: 260px; border-collapse: collapse; }
.inv-totals td { padding: 5px 10px; font-size: 12px; }
.inv-totals .rv { text-align: right; font-weight: 700; }
.inv-totals .grand td { border-top: 2px solid var(--brand); font-weight: 800; font-size: 14px; }
.inv-notes { font-size: 11px; color: #555; margin-top: 6px; }

@media print {
  body * { visibility: hidden; }
  #inv-doc-modal, #inv-doc-modal * { visibility: visible; }
  #inv-doc-modal { position: absolute; inset: 0; margin: 0; padding: 0; background: #fff; }
  #inv-doc-modal .modal-box { box-shadow: none; max-width: 100%; width: 100%; border-radius: 0; padding: 0.4in; }
  #inv-doc-modal .no-print { display: none !important; }
}

/* Fence Designer — full-screen overlay, breaks out of #main's 760px cap */
#fence-view {
  position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; flex-direction: column;
}
#fence-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; padding: 12px 16px; flex-shrink: 0; box-shadow: var(--shadow-md);
}
#fence-header .btn.ghost { border-color: #fff; color: #fff; }
#fence-steps { display: flex; gap: 18px; }
.fence-step { font-size: 13px; opacity: .6; }
.fence-step.active { opacity: 1; font-weight: 700; border-bottom: 2px solid #fff; padding-bottom: 2px; }
.fence-step-panel { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-width: 900px; margin: 0 auto; width: 100%; box-sizing: border-box; }

#fence-canvas-wrap { position: relative; flex: 1; min-height: 55vh; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
#fence-svg { width: 100%; height: 100%; touch-action: none; cursor: crosshair; display: block; }
#fence-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }

.fence-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fence-type-card {
  background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 16px 10px;
  text-align: center; cursor: pointer;
}
.fence-type-card .icon { font-size: 32px; }
.fence-type-card .label { font-size: 13px; font-weight: 600; margin-top: 6px; }
.fence-type-card.selected { border-color: var(--brand); background: #F0F4F1; }

.fence-gate-row { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; }
.fence-gate-row .run-label { flex: 1; font-size: 14px; }
.fence-gate-row select { width: auto; margin: 0; }

#fence-length-popover .modal-box { max-width: 320px; }
.section-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; }
.section-head { display: flex; gap: 8px; align-items: center; }
.section-head input { flex: 1; margin: 0; }
.item-row { display: grid; grid-template-columns: 28px 1fr 56px 84px 28px 28px; gap: 5px; margin-top: 8px; align-items: center; }
.item-row input { margin: 0; padding: 8px; font-size: 14px; }
.item-row .opt-toggle { text-align: center; font-size: 18px; cursor: pointer; user-select: none; }
.item-row .del { text-align: center; cursor: pointer; color: var(--danger); font-size: 18px; }
.item-row .inv-link { text-align: center; font-size: 16px; cursor: pointer; user-select: none; opacity: .35; }
.item-row .inv-link.linked { opacity: 1; }
.item-cols { display: grid; grid-template-columns: 28px 1fr 56px 84px 28px 28px; gap: 5px; margin-top: 8px; font-size: 11px; color: var(--muted); }

/* Scheduler — same category colors as the original GCF scheduler */
:root {
  --cat-fencing: #2fae43;
  --cat-decking: #e2891b;
  --cat-estimate: #2f80d8;
  --cat-other: #8a94a0;
}
#cal-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 8px; }
#cal-month-label { font-weight: 600; min-width: 140px; text-align: center; }
#category-filter { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cat-btn {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-size: 13px; cursor: pointer; color: var(--muted);
}
.cat-btn[data-category="fencing"].active { background: var(--cat-fencing); color: #fff; border-color: var(--cat-fencing); }
.cat-btn[data-category="decking"].active { background: var(--cat-decking); color: #fff; border-color: var(--cat-decking); }
.cat-btn[data-category="estimate"].active { background: var(--cat-estimate); color: #fff; border-color: var(--cat-estimate); }
.cat-btn[data-category="other"].active { background: var(--cat-other); color: #fff; border-color: var(--cat-other); }
.cat-btn[data-category="all"].active { background: var(--brand); color: #fff; border-color: var(--brand); }

#unscheduled-tray {
  background: #FBF3DC; border: 1px dashed #C9A94E; border-radius: 10px;
  padding: 10px; margin-bottom: 10px;
}
#unscheduled-tray .tray-label { font-size: 13px; color: #8A5A00; margin-bottom: 6px; }
#unscheduled-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tray-job {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 14px; cursor: pointer;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-weekday { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  min-height: 64px; padding: 3px; cursor: pointer; overflow: hidden;
}
.cal-cell-empty { background: transparent; border: none; cursor: default; }
.cal-weekend { background: #EDF0F3; }
.cal-cell.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: #EAF3EA; }
.tray-job { cursor: grab; }
.cal-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day-num { font-size: 11px; color: var(--muted); }
.cal-job {
  font-size: 10px; border-radius: 4px; padding: 1px 4px; margin-top: 2px;
  color: #fff; background: var(--cat-other);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-job.category-fencing { background: var(--cat-fencing); }
.cal-job.category-decking { background: var(--cat-decking); }
.cal-job.category-estimate { background: var(--cat-estimate); }
.cal-job.status-completed { opacity: .45; }
.cal-job.status-cancelled { opacity: .45; text-decoration: line-through; }
.cal-job.frozen::before { content: '❄️ '; }

.seg-row { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.seg {
  flex: 1; min-width: 52px; padding: 8px 6px; border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; cursor: pointer; font-size: 14px; opacity: .55;
}
.seg.active { opacity: 1; background: var(--brand); color: #fff; border-color: var(--brand); }
.seg.cat.active[data-cat="fencing"] { background: var(--cat-fencing); border-color: var(--cat-fencing); }
.seg.cat.active[data-cat="decking"] { background: var(--cat-decking); border-color: var(--cat-decking); }
.seg.cat.active[data-cat="estimate"] { background: var(--cat-estimate); border-color: var(--cat-estimate); }
.seg.cat.active[data-cat="other"] { background: var(--cat-other); border-color: var(--cat-other); }
.hint { font-size: 13px; color: var(--muted); }
.check-label { display: flex; align-items: center; gap: 8px; }
.check-label input { width: auto; margin: 0; }
.tap-link { color: var(--accent); }

/* Inventory */
.inv-card { display: flex; gap: 12px; align-items: center; }
.inv-thumb {
  width: 52px; height: 52px; border-radius: 8px; object-fit: cover;
  background: var(--bg); border: 1px solid var(--line); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.inv-body { flex: 1; min-width: 0; }
.onhand { font-weight: 700; white-space: nowrap; }
.onhand.low { color: var(--danger); }
#item-photo { max-height: 72px; max-width: 120px; object-fit: contain; border-radius: 8px; margin-right: 8px; }
#item-photo-row { display: flex; align-items: center; margin-bottom: 6px; }
.mov-delta { font-weight: 700; }
.mov-delta.in { color: var(--ok); }
.mov-delta.out { color: var(--danger); }

/* Pick list */
.pick-row {
  display: flex; gap: 10px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.pick-row input[type=checkbox] { width: 26px; height: 26px; flex-shrink: 0; }
.pick-row .pick-desc { flex: 1; }
.pick-row .pick-qty { font-weight: 700; white-space: nowrap; }
.pick-row.done .pick-desc { text-decoration: line-through; opacity: .55; }
.pick-row .pick-del { color: var(--danger); cursor: pointer; font-size: 18px; }
.pick-row .pick-added { font-size: 11px; color: var(--accent); }
.pick-row .pick-short { font-size: 11px; color: var(--danger); }
#pick-status-banner {
  background: #D9EBDD; color: var(--ok); border-radius: 8px; padding: 10px;
  font-size: 14px; margin-bottom: 8px;
}

/* Branding */
#topbar-logo { height: 30px; max-width: 110px; object-fit: contain; }
#login-logo { display: block; margin: 0 auto 10px; max-height: 72px; max-width: 220px; object-fit: contain; }

/* Settings */
.settings-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.settings-card h3 { font-size: 16px; font-weight: 750; }
#logo-row { margin: 8px 0; }
#logo-preview { max-height: 80px; max-width: 240px; object-fit: contain; background: var(--bg); border-radius: 8px; padding: 6px; }
.color-row { display: flex; gap: 18px; flex-wrap: wrap; }
.color-row label { flex: 1; min-width: 140px; }
.color-row input[type=color] { height: 44px; padding: 4px; cursor: pointer; }
.perm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.perm-row select { width: 130px; margin: 0; padding: 6px; font-size: 14px; }
#user-perms { margin-top: 12px; }

/* Work-instruction style step guide (Settings → App) */
.wi-platform-switch { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 18px; }
.wi-platform-switch button {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
}
.wi-platform-switch button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.wi-steps { display: flex; flex-direction: column; }
.wi-step { position: relative; display: flex; gap: 14px; padding-bottom: 22px; }
.wi-step:last-child { padding-bottom: 0; }
.wi-step-icon-wrap { position: relative; flex: 0 0 auto; }
.wi-step-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--brand-light);
  display: flex; align-items: center; justify-content: center; position: relative; z-index: 1;
}
.wi-step-icon svg { width: 24px; height: 24px; stroke: var(--brand-dark); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wi-step:not(:last-child) .wi-step-icon-wrap::after {
  content: ''; position: absolute; top: 44px; left: 50%; transform: translateX(-50%);
  width: 2px; height: 22px; background: var(--line);
}
.wi-step-num {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; z-index: 2; border: 2px solid var(--card);
}
.wi-step-body { padding-top: 4px; }
.wi-step-body h4 { font-size: 14px; font-weight: 750; margin-bottom: 2px; }
.wi-step-body p { font-size: 13px; color: var(--muted); }

/* Feedback widget + pins */
#fb-widget { position: fixed; right: 16px; bottom: 16px; z-index: 70; text-align: right; }
#fb-bubble {
  width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 20px; box-shadow: var(--shadow-md);
  position: relative; transition: transform .1s var(--ease);
}
#fb-bubble:hover { transform: scale(1.05); }
#fb-count {
  position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff;
  font-size: 11px; border-radius: 999px; padding: 1px 6px;
}
#fb-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-lg);
}
body.fb-dropping { cursor: crosshair; }
body.fb-dropping main * { cursor: crosshair !important; }
#fb-drop-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  background: var(--danger); color: #fff; text-align: center; padding: 8px;
  font-size: 14px;
}
.fb-pin-dot {
  position: absolute; z-index: 65; width: 22px; height: 22px; border-radius: 50% 50% 50% 0;
  background: var(--danger); transform: rotate(-45deg); border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: pointer;
}
.fb-pin-dot span { transform: rotate(45deg); display: block; color: #fff; font-size: 11px; text-align: center; line-height: 18px; }
.fb-flash { animation: fbflash 1.6s ease-out 2; }
@keyframes fbflash {
  0%, 100% { outline: 0 solid transparent; }
  30% { outline: 3px solid var(--danger); outline-offset: 2px; }
}

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 600; box-shadow: var(--shadow-lg);
}

@media (min-width: 900px) {
  /* Desktop: drawer becomes a persistent sidebar */
  #drawer { box-shadow: none; border-right: 1px solid var(--line); }
  #main { margin-left: 264px; }
  #nav-toggle { display: none; }
  #drawer-scrim { display: none !important; }
}
