/* =====================================================================
   Lead CRM — components on top of the shared Lead design system (app.css)
   ===================================================================== */

/* ---------- kanban board ---------- */
.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(276px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: start;
    scrollbar-width: thin;
}
.kanban-col {
    background: var(--surface-2);
    border-radius: 16px;
    padding: 10px;
    min-height: 220px;
    border: 1.5px dashed transparent;
    transition: border-color .15s, background .15s;
}
.kanban-col.drop-target { border-color: var(--brand); background: var(--brand-soft); }
.kanban-head {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 6px 10px;
    font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}
.kanban-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kanban-head .kanban-count {
    margin-left: auto; background: var(--surface); color: var(--ink-soft);
    border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 700;
}
.kanban-sum { padding: 0 6px 8px; font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.kanban-card {
    background: var(--surface); border-radius: 13px;
    box-shadow: var(--shadow); padding: 12px 13px; margin-bottom: 9px;
    cursor: grab; border-left: 3px solid transparent;
    transition: transform .12s, box-shadow .12s;
}
.kanban-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; }
.kanban-card.won { border-left-color: var(--success); }
.kanban-card.lost { border-left-color: var(--danger); }
.kanban-card.hot { border-left-color: #f97316; }
.kanban-card.rotting { border-left-color: var(--warning); }
.kanban-title { font-weight: 700; font-size: 13.8px; line-height: 1.35; margin-bottom: 3px; }
.kanban-meta { font-size: 11.8px; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-value { font-weight: 800; font-size: 13.5px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.kanban-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.kanban-foot .spacer { flex: 1; }
.kanban-empty { text-align: center; color: var(--ink-faint); font-size: 12.5px; padding: 20px 8px; }

/* ---------- stage bar (deal detail) ---------- */
.stagebar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; }
.stagebar button {
    position: relative; flex: 1 1 110px; min-width: 96px;
    padding: 10px 12px 10px 20px;
    border: none; cursor: pointer; font-family: inherit;
    font-size: 12.8px; font-weight: 700; color: var(--ink-soft);
    background: var(--surface-2);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
    transition: background .15s, color .15s;
}
.stagebar button:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 10px 0 0 10px; }
.stagebar button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 10px 10px 0; }
.stagebar button:hover { background: var(--brand-soft); color: var(--brand); }
.stagebar button.done { background: #c7d2fe; color: #3730a3; }
.stagebar button.on { background: var(--brand); color: #fff; }
.stagebar button.on.win { background: var(--success); }
.stagebar button.on.loss { background: var(--danger); }
:root[data-theme="dark"] .stagebar button.done { background: #312e81; color: #c7d2fe; }

/* ---------- score ring ---------- */
.score-ring { position: relative; width: 60px; height: 60px; flex: none; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums;
}

/* ---------- funnel ---------- */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-row .f-name { width: 108px; font-size: 13px; font-weight: 600; flex: none; }
.funnel-row .f-bar { flex: 1; height: 26px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.funnel-row .f-fill {
    height: 100%; border-radius: 8px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    display: flex; align-items: center; justify-content: flex-end;
    padding-right: 9px; color: #fff; font-size: 11.5px; font-weight: 700;
    transition: width .5s ease;
}
.funnel-row .f-end { width: 108px; text-align: right; font-size: 13px; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }

/* ---------- calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border-radius: 14px; overflow: hidden; }
.cal-dow { background: var(--surface-2); padding: 9px 6px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.cal-cell { background: var(--surface); min-height: 108px; padding: 6px 7px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.dim { background: var(--surface-2); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-date { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.cal-cell.today .cal-date { color: var(--brand); }
.cal-ev {
    font-size: 11.2px; padding: 3px 7px; border-radius: 7px; cursor: pointer;
    background: var(--brand-soft); color: var(--brand); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev.done { background: var(--success-soft); color: var(--success); text-decoration: line-through; }
.cal-ev.over { background: var(--danger-soft); color: var(--danger); }
.cal-ev.meet { background: var(--warning-soft); color: var(--warning); }

/* ---------- timeline (richer than the base) ---------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.tl-item::before {
    content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-ico {
    width: 36px; height: 36px; border-radius: 11px; flex: none;
    display: inline-flex; align-items: center; justify-content: center; z-index: 1;
}
.tl-body { flex: 1; min-width: 0; padding-top: 2px; }
.tl-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tl-title { font-weight: 650; font-size: 14px; }
.tl-when { font-size: 11.5px; color: var(--ink-faint); margin-left: auto; white-space: nowrap; }
.tl-text { font-size: 13.3px; color: var(--ink-soft); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.tl-text.clip { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- composer ---------- */
.composer { border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.composer-tabs { display: flex; gap: 2px; padding: 6px 6px 0; background: var(--surface-2); }
.composer-tabs button {
    border: none; background: transparent; padding: 8px 14px; border-radius: 10px 10px 0 0;
    font: 600 13px Inter, system-ui; color: var(--ink-soft); cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
}
.composer-tabs button.on { background: var(--surface); color: var(--brand); }
.composer-body { padding: 12px 14px; }
.composer-foot { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.composer textarea { min-height: 110px; resize: vertical; }

/* token chips in the template editor */
.tokens { display: flex; flex-wrap: wrap; gap: 5px; }
.token {
    font: 600 11.5px ui-monospace, SFMono-Regular, Menlo, monospace;
    padding: 3px 8px; border-radius: 7px; cursor: pointer;
    background: var(--surface-2); color: var(--brand); border: 1px solid var(--line);
}
.token:hover { background: var(--brand-soft); border-color: var(--brand); }

/* email preview frame */
.mail-preview {
    border: 1.5px solid var(--line); border-radius: 12px; padding: 18px 20px;
    background: #fff; color: #1e2235; max-height: 460px; overflow: auto;
}
:root[data-theme="dark"] .mail-preview { background: #f8f9fe; }
.wa-preview {
    background: #e5ddd5; border-radius: 12px; padding: 16px; max-height: 460px; overflow: auto;
}
.wa-bubble {
    background: #dcf8c6; color: #111; border-radius: 10px 10px 2px 10px;
    padding: 9px 12px; font-size: 13.5px; max-width: 82%; margin-left: auto;
    white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.12); line-height: 1.5;
}

/* ---------- tag pills ---------- */
.tagbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-pill {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--brand-soft); color: var(--brand);
    border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 11.5px; font-weight: 700;
}
.tag-pill button { border: none; background: none; cursor: pointer; color: inherit; font-size: 13px; line-height: 1; padding: 0 2px; opacity: .7; }
.tag-pill button:hover { opacity: 1; }

/* ---------- split detail layout ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.split.wide-side { grid-template-columns: minmax(0, 1fr) 420px; }
@media (max-width: 1100px) { .split, .split.wide-side { grid-template-columns: 1fr; } }

/* ---------- record header ---------- */
.rec-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.rec-head .rec-main { flex: 1; min-width: 220px; }
.rec-head h1 { font-size: 22px; line-height: 1.2; }
.rec-sub { color: var(--ink-soft); font-size: 13.2px; margin-top: 5px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- compact stat strip ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--line); border-radius: 14px; overflow: hidden; }
.strip > div { background: var(--surface); padding: 13px 15px; }
.strip .s-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; }
.strip .s-v { font-size: 18px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- notification bell ---------- */
.bell-dot {
    position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.notif-pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; width: 360px; max-width: calc(100vw - 32px);
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
    max-height: min(520px, calc(100vh - 90px)); overflow-y: auto; animation: slideup .16s ease; }
.notif-row { display: flex; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-row:hover { background: var(--hover); }
.notif-row.unread { background: var(--brand-soft); }
.notif-row .n-t { font-weight: 650; font-size: 13.5px; }
.notif-row .n-b { font-size: 12.3px; color: var(--ink-faint); }

/* ---------- quotation print ---------- */
.quote-sheet { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 34px; }
.quote-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid var(--line); padding-bottom: 16px; }
.quote-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.quote-sheet table.data { width: 100%; border-collapse: collapse; table-layout: auto; }
.quote-sheet table.data th, .quote-sheet table.data td { padding: 8px 10px; vertical-align: top; border-bottom: 1px solid var(--line); }
.quote-sheet table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.quote-sheet table.data td.num, .quote-sheet table.data th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.quote-sheet table.data .q-item { width: 40%; }
.quote-sheet .totals-panel .totals-row { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
.quote-sheet .totals-panel .totals-row.grand { font-weight: 800; font-size: 15px; border-top: 2px solid var(--line); margin-top: 4px; padding-top: 8px; }
@media print {
    .quote-sheet { box-shadow: none; padding: 0; color: #000; }
    .quote-sheet table.data th, .quote-sheet table.data td { border-bottom: 1px solid #ccc; padding: 6px 8px; font-size: 11.5px; }
    .quote-sheet table.data th { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; }
    .quote-sheet .table-wrap { overflow: visible !important; }
    .quote-sheet .muted { color: #444 !important; }
    .kanban, .composer, .tabbar { display: none !important; }
}

.tint-gray { background: var(--surface-2); color: var(--ink-soft); }
.tint-orange { background: #fff1e6; color: #ea580c; }
:root[data-theme="dark"] .tint-orange { background: #3a2312; }

/* ---------- toast stack ---------- */
.toast-stack {
    position: fixed; bottom: 26px; right: 26px; z-index: 120;
    display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast-stack .toast { position: static; cursor: pointer; }
@media (max-width: 560px) { .toast-stack { left: 14px; right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); align-items: stretch; } }

/* ---------- misc ---------- */
.hint { font-size: 12.3px; color: var(--ink-faint); margin-top: 6px; line-height: 1.5; }
.key-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 20px; }
.key-list b { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; }
.key-list > div { font-size: 13.8px; }
.dot-sep::before { content: "·"; margin: 0 6px; color: var(--ink-faint); }
.list-scroll { max-height: 420px; overflow-y: auto; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.secret-set { color: var(--success); font-size: 12px; font-weight: 700; }
.w-100 { width: 100%; }
.gap-8 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gap-12 { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.mt-0 { margin-top: 0; }
.mt-12 { margin-top: 12px; }
.mt-18 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.flex-1 { flex: 1; min-width: 0; }

/* =====================================================================
   Jobs / field service
   ===================================================================== */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.kv { display: flex; gap: 12px; font-size: 13.5px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.kv:last-of-type { border-bottom: none; }
.kv > span:first-child { flex: none; width: 84px; color: var(--ink-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; border-radius: 9px; }
.gap-8 .grow { flex: 1; min-width: 0; }
.row-item.selected { background: var(--brand-soft); }
.ico.ok { color: var(--success); }

.progress-track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 99px; transition: width .3s; }

/* stage list on the job page */
.job-stages { display: flex; flex-direction: column; gap: 8px; }
.job-stage { border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.job-stage.current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.job-stage.done { opacity: .85; }
.job-stage.skipped { opacity: .6; }
.js-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.js-num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; background: var(--surface-2); color: var(--ink-soft); }
.job-stage.current .js-num { background: var(--brand); color: #fff; }
.job-stage.done .js-num { background: var(--success-soft); color: var(--success); }
.js-main { flex: 1; min-width: 0; }
.js-title { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.js-sub { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; }
.js-sub span { display: inline-flex; align-items: center; gap: 4px; }
.js-sub .req { padding: 1px 7px; border-radius: 999px; background: var(--surface-2); font-size: 11.5px; }
.js-sub .req.ok { background: var(--success-soft); color: var(--success); }
.js-body { padding: 4px 14px 14px 52px; font-size: 13.5px; }
@media (max-width: 640px) { .js-body { padding-left: 14px; } }

/* photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-tile { position: relative; display: block; border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile > a { display: block; width: 100%; height: 100%; }
.photo-tile .ph-cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-tile .ph-tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; background: rgba(255,255,255,.85); border-radius: 8px; }

/* crew board */
.crew-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.crew-card { margin: 0 !important; }
.crew-head { display: flex; align-items: center; gap: 10px; }
.crew-head .r-main { flex: 1; min-width: 0; }
.crew-head .r-name { font-weight: 700; }
.crew-head .r-sub { font-size: 12.5px; color: var(--ink-faint); }

/* setup page */
.setup-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .setup-grid { grid-template-columns: minmax(0, 1fr); } }
.stage-edit { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.se-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.se-head .grow { flex: 1; }
.se-flags { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; }
.se-flags label { display: inline-flex; align-items: center; gap: 6px; }

/* field page (mobile first, no app chrome) */
.field-shell { max-width: 640px; margin: 0 auto; padding: 0 0 40px; }
.field-shell .card { padding: 16px; }
.field-bar { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); margin: 0 0 14px; }
.fb-back { color: var(--ink); display: inline-flex; }
.fb-title { font-weight: 800; font-size: 16px; flex: 1; }
.fb-user { font-size: 12.5px; color: var(--ink-faint); }
.field-onsite { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--success-soft); color: var(--success); font-size: 13.5px; margin-bottom: 12px; }
.field-group { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; margin: 14px 0 6px; display: flex; gap: 8px; }
.field-card { display: block; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; color: inherit; text-decoration: none; }
.field-card:hover { box-shadow: var(--shadow-lg); }
.fc-top { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.fc-name { font-weight: 700; font-size: 15px; }
.fc-sub { font-size: 13px; color: var(--ink-soft); }
.fc-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-faint); margin-top: 6px; }
.fc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.field-job .fj-title { font-weight: 800; font-size: 17px; }
.field-job .fj-stage { margin: 6px 0 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.field-job .fj-row { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.field-job .fj-row > span { flex: 1; min-width: 120px; }
.field-job .fj-instr { font-size: 13.5px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.field-check { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.field-check input { width: 20px; height: 20px; margin-top: 1px; }
.photo-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-buttons .btn { cursor: pointer; }
.sig-wrap { border: 1.5px dashed var(--line); border-radius: 12px; background: #fff; }
.sig-pad { width: 100%; height: 180px; display: block; touch-action: none; }
.btn.btn-lg { padding: 14px 18px; font-size: 16px; }

/* customer tracking page */
.track-card { max-width: 640px !important; }
.track-head { margin-bottom: 6px; }
.track-steps { display: flex; flex-direction: column; }
.track-step { display: flex; gap: 12px; padding: 10px 0; border-left: 2px solid var(--line); margin-left: 14px; padding-left: 18px; position: relative; }
.track-step .ts-dot { position: absolute; left: -15px; top: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12.5px; border: 2px solid var(--surface); }
.track-step.done .ts-dot { background: var(--success); color: #fff; }
.track-step.current .ts-dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.track-step.skipped { opacity: .5; }
.track-step .ts-name { font-weight: 700; font-size: 14.5px; }
.track-step.current .ts-name { color: var(--brand); }
.track-step .ts-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }


/* ---------- layout fixes (Jobs pages) ---------- */
/* the global ".card + .card { margin-top }" pushed grid/flex siblings out of line */
.setup-grid > .card, .crew-grid > .card, .map-layout > .card, .two-col > .card { margin-top: 0; }
.kanban-card.job-card { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.kanban-card.job-card .kanban-foot { flex-wrap: wrap; }
.job-create { flex-wrap: nowrap; }
.job-create .select { flex: 1; min-width: 0; }
.job-create .btn { flex: none; }
.crew-card .crew-head .chip { flex: none; }
@media (max-width: 640px) {
    .crew-grid { grid-template-columns: 1fr; }
    .js-head { padding: 10px; gap: 10px; }
    .two-col .kv > span:first-child { width: 72px; }
}

/* compact inputs inside tables */
.input.input-sm, .select.input-sm { padding: 6px 9px; font-size: 13px; border-radius: 8px; min-height: 0; }
.input.num { text-align: right; }

/* ---------- materials ---------- */
.mat-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; padding: 12px 14px; margin-bottom: 14px; background: var(--surface-2); border-radius: 12px; }
.mat-bar label { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin-bottom: 4px; }
.mat-cust { margin-left: auto; }
@media (max-width: 760px) { .mat-cust { margin-left: 0; width: 100%; } }
.mat-table td { vertical-align: top; }
.mat-table td.num, .mat-table th.num { text-align: right; }
.vendor-btn { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; justify-content: flex-start; }

.doc-chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1000px) { .doc-chain { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .doc-chain { grid-template-columns: 1fr; } }
.doc-step { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.doc-step.done { border-color: var(--success); background: var(--success-soft); }
.doc-step .ds-ico { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-soft); }
.doc-step.done .ds-ico { background: var(--success); color: #fff; }
.doc-step .ds-name { font-weight: 700; font-size: 14px; }
.doc-step .ds-sub { font-size: 12.5px; color: var(--ink-faint); min-height: 18px; }
.doc-step .btn { align-self: flex-start; }

/* ---------- field: shift ---------- */
.shift-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 12px; border: 1.5px solid transparent; }
.shift-card.on { border-color: var(--success); }
.shift-card .sc-main { flex: 1; min-width: 0; }
.shift-card .sc-title { font-weight: 700; font-size: 14.5px; }
.shift-card .sc-sub { font-size: 12.5px; color: var(--ink-faint); }
.shift-card .sc-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--warning); }
.shift-card .sc-dot.live { background: var(--success); box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: sc-pulse 2s infinite; }
@keyframes sc-pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.45); } 70% { box-shadow: 0 0 0 10px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

/* ---------- crew map ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .map-layout { grid-template-columns: minmax(0, 1fr); } }
.crew-map { height: 560px; border-radius: 12px; overflow: hidden; background: var(--surface-2); z-index: 0; }
@media (max-width: 640px) { .crew-map { height: 380px; } }
.map-side { max-height: 640px; overflow: auto; }
.map-side-head { padding: 12px 16px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.map-side .row-item { padding-left: 14px; padding-right: 14px; }
.crm-pin span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; font: 700 11px/1 Inter, Segoe UI, Arial, sans-serif; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.mat-table td.mat-item { min-width: 220px; width: 40%; }
.mat-table td.mat-item .input { width: 100%; }
.mat-bar .mat-size .input { width: 110px; }
.kit-per { display: flex; justify-content: flex-end; gap: 4px; align-items: center; font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; white-space: nowrap; }
.kit-buy { display: flex; gap: 6px; align-items: center; margin-top: 4px; font-size: 12px; white-space: nowrap; }
.member-add { display: flex; gap: 8px; }
.member-add .select { flex: 1; min-width: 0; }
.member-add .btn { flex: none; }
.member-list { display: flex; flex-direction: column; gap: 10px; }
.member-row { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.member-row .mr-head { display: flex; align-items: center; gap: 10px; }
.member-row .mr-name { flex: 1; min-width: 0; font-weight: 700; }
.member-row .mr-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.member-row .mr-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; margin-top: 8px; }
.member-row .mr-fields .field { margin-bottom: 0; }
.member-row .mr-fields label { font-size: 11.5px; }
@media (max-width: 560px) { .member-row .mr-fields { grid-template-columns: minmax(0, 1fr); } }
.crew-grid { align-items: start; }
.check-line { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; margin-bottom: 9px; cursor: pointer; }
.check-line input[type=checkbox] { flex: none; margin-top: 3px; width: 16px; height: 16px; }

/* Blazor reconnect/error bar: hidden until the framework shows it (it sets display:block on an unhandled error) */
#blazor-error-ui { display: none; position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2000;
    width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px; background: #1f2937; color: #fff; font-size: 13.5px; line-height: 1.4;
    box-shadow: 0 10px 30px rgba(0,0,0,.25); }
#blazor-error-ui .reload { color: #a5b4fc; font-weight: 600; margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; margin-left: 10px; opacity: .7; }
#blazor-error-ui .dismiss:hover { opacity: 1; }

/* Number inputs inside data tables never collapse to zero width */
table.data td > .input[type=number] { min-width: 80px; }
/* Quotation line editor: fixed minimum widths so qty / rate stay readable; the wrapper scrolls on narrow screens */
.line-items-table { min-width: 980px; }
.line-items-table th, .line-items-table td { padding-left: 8px; padding-right: 8px; }
table.data.line-items-table td:nth-child(1) .input { min-width: 170px; }
table.data.line-items-table td:nth-child(2) .input { min-width: 150px; }
table.data.line-items-table td:nth-child(3) .input { min-width: 80px; }
table.data.line-items-table td:nth-child(4) .input { min-width: 100px; }
table.data.line-items-table td:nth-child(5) .input,
table.data.line-items-table td:nth-child(6) .input { min-width: 68px; }
.line-items-table .input[type=number] { text-align: right; -moz-appearance: textfield; appearance: textfield; }
.line-items-table .input[type=number]::-webkit-inner-spin-button,
.line-items-table .input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
