/* ApexOS / RoofOps — SPA system styles
 * Extracted from the inline <style> block previously embedded in
 * public/app.html so the SPA shell, pages, badges, buttons, forms,
 * modals, calendar, photos, tabs, and SMS hub pick up a single
 * shared stylesheet that consolidates the design-system tokens and
 * component classes used by app.html.
 *
 * Token palette: theme.css owns the brand defaults (RoofOps amber +
 * navy). System.css adds the SPA-only purple/green/yellow/red status
 * set used by the production-management and CRM UI inside public/app.html.
 * Where theme.css also defines the same class (e.g. .btn, .input,
 * .modal) the SPA must keep its variant — those classes were tuned
 * for the production module and removing them would regress the
 * existing visual behavior of /app/*.
 */

:root {
  --accent: #8b5cf6;
  --accent-dim: rgba(139, 92, 246, 0.15);
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
}

body { background: var(--bg); color: var(--fg); }

.page { display: none; }
.page.active { display: block; }

.nav-link { color: var(--fg-2); transition: color 0.15s; }
.nav-link:hover,
.nav-link.active { color: var(--fg); }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge-scheduled { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.badge-in_progress { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.badge-on_hold { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.badge-completed { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.badge-closed { background: rgba(113, 113, 122, 0.2); color: #71717a; }
.badge-lead { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.badge-qualified { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.badge-proposal_sent { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.badge-negotiation { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.badge-won { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.badge-lost { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.badge-draft { background: rgba(113, 113, 122, 0.2); color: #a1a1aa; }
.badge-sent { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.badge-signed { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.badge-active { background: rgba(52, 211, 153, 0.18); color: #34d399; }
.badge-cancelled { background: rgba(113, 113, 122, 0.2); color: #71717a; }
.badge-expired { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }
.badge-pending { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.badge-submitted { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.badge-approved { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.badge-rejected { background: rgba(248, 113, 113, 0.15); color: #f87171; }

.material-ordered { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.material-in_transit { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.material-delivered { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.material-returned { background: rgba(248, 113, 113, 0.15); color: #f87171; }

.input { background: var(--bg-2); border: 1px solid var(--border); color: var(--fg); padding: 8px 12px; border-radius: 8px; font-size: 14px; width: 100%; }
.input:focus { outline: none; border-color: rgba(139, 92, 246, 0.5); }
.select { background: var(--bg-2); border: 1px solid var(--border); color: var(--fg); padding: 8px 12px; border-radius: 8px; font-size: 14px; width: 100%; }
.select:focus { outline: none; border-color: rgba(139, 92, 246, 0.5); }

.btn { padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; border: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #7c3aed; }
.btn-ghost { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-2); color: var(--fg); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-3); border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-2); }

.stepper { display: flex; align-items: center; gap: 4px; }
.stepper-step { display: flex; align-items: center; gap: 4px; }
.stepper-step.active { color: #a78bfa; }
.stepper-step.completed { color: #34d399; }
.stepper-line { width: 32px; height: 1px; background: var(--border); }
.stepper-line.completed { background: #34d399; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calendar-cell { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-height: 64px; }
.calendar-cell.available { border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.05); }
.calendar-cell.booked { border-color: rgba(139, 92, 246, 0.3); background: rgba(139, 92, 246, 0.05); }
.calendar-cell.blocked { border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.05); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-thumb { border-radius: 8px; overflow: hidden; background: var(--bg-3); aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; color: var(--fg-3); position: relative; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }

.tab { padding: 8px 16px; font-size: 13px; font-weight: 500; color: var(--fg-3); border-bottom: 2px solid transparent; cursor: pointer; }
.tab:hover { color: var(--fg-2); }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 50; display: none; align-items: center; justify-content: center; }
.modal-backdrop.show { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }

.section-divider { border-top: 1px solid var(--border); padding-top: 24px; margin-top: 24px; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--fg-3); }
.empty-state svg { margin: 0 auto 16px; opacity: 0.4; }

/* SMS Hub — message bubbles, conversation rows, status badge set */
.sms-msg-in { background: var(--surface-2); border-radius: 14px 14px 14px 4px; padding: 10px 14px; max-width: 70%; font-size: 14px; line-height: 1.45; }
.sms-msg-out { background: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; padding: 10px 14px; max-width: 70%; font-size: 14px; line-height: 1.45; }
.sms-conv-row { padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; transition: background 0.12s; }
.sms-conv-row:hover { background: var(--bg-2); }
.sms-conv-row.active { background: var(--surface-2); }
.sms-status-badge { font-size: 10px; padding: 2px 6px; border-radius: 8px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.sms-status-queued { background: rgba(251, 191, 36, 0.18); color: #fbbf24; }
.sms-status-sending { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
.sms-status-sent { background: rgba(96, 165, 250, 0.18); color: #60a5fa; }
.sms-status-delivered { background: rgba(52, 211, 153, 0.18); color: #34d399; }
.sms-status-failed, .sms-status-undelivered { background: rgba(248, 113, 113, 0.18); color: #f87171; }
.sms-status-stub_queued { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }
.sms-status-received { background: rgba(52, 211, 153, 0.18); color: #34d399; }
