/* FieldDocket App — Scheduling Dashboard
   Extends theme.css design tokens (--accent, --fg, --bg, etc.) */

/* ─── App Shell ─────────────────────────────────── */
.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Top Nav ────────────────────────────────────── */
.app-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
}
.nav-brand:hover { color: var(--accent); }
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.demo-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-muted);
}
.demo-badge {
  background: var(--accent-dim);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 100px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
}
.demo-badge:hover { background: rgba(245, 158, 11, 0.2); }
.demo-badge.active {
  background: var(--accent);
  color: #0F1117;
}

/* ─── Main Content ─────────────────────────────── */
.app-main {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Page Header ─────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 4px;
}
.page-subtitle { font-size: 14px; color: var(--fg-muted); }

/* ─── Date Strip ──────────────────────────────── */
.date-strip {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.date-today {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.job-count-badge {
  background: var(--accent-dim);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

/* ─── Job Card ────────────────────────────────── */
.job-list { display: flex; flex-direction: column; gap: 12px; }
.job-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 20px;
  transition: border-color 0.15s;
}
.job-card:hover { border-color: rgba(245, 158, 11, 0.3); }
.job-card.completed {
  opacity: 0.6;
  border-color: rgba(34, 197, 94, 0.3);
}
.job-time-col { display: flex; flex-direction: column; gap: 2px; }
.job-time { font-size: 13px; font-weight: 600; color: var(--accent); }
.job-duration { font-size: 11px; color: var(--fg-muted); }

.job-info { display: flex; flex-direction: column; gap: 4px; }
.job-customer { font-size: 15px; font-weight: 600; color: var(--fg); margin-bottom: 2px; }
.job-address { font-size: 13px; color: var(--fg-muted); }
.job-meta { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.job-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
}

.job-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.job-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.job-status-badge.scheduled {
  background: rgba(255,255,255,0.05);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.job-status-badge.confirmed {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.job-status-badge.completed {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.job-status-badge.sms-sent {
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary {
  background: var(--accent);
  color: #0F1117;
}
.btn-primary:hover { background: #D97706; }
.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--fg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── AI SMS Panel ────────────────────────────── */
.sms-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 28px;
}
.sms-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sms-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.ai-badge {
  background: var(--accent-dim);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 100px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.sms-log { display: flex; flex-direction: column; gap: 10px; }
.sms-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border-left: 2px solid var(--accent);
}
.sms-entry.read {
  border-left-color: rgba(139, 148, 167, 0.3);
  opacity: 0.75;
}
.sms-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sms-entry.read .sms-icon { background: rgba(255,255,255,0.06); }
.sms-content { flex: 1; }
.sms-to { font-size: 11px; font-weight: 600; color: var(--fg-muted); margin-bottom: 4px; }
.sms-message { font-size: 13px; color: var(--fg); line-height: 1.5; }
.sms-time { font-size: 11px; color: var(--fg-muted); margin-top: 4px; }
.sms-status-ok { font-size: 11px; color: var(--success); font-weight: 500; }

.sms-empty {
  text-align: center;
  padding: 24px;
  color: var(--fg-muted);
  font-size: 13px;
}

/* ─── Invoice Preview ─────────────────────────── */
.invoice-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.invoice-modal.open { display: flex; }
.invoice-sheet {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.invoice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.invoice-brand { font-family: 'Bricolage Grotesque', sans-serif; font-size: 16px; font-weight: 700; color: var(--fg); }
.invoice-num { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.invoice-date { font-size: 12px; color: var(--fg-muted); text-align: right; }
.invoice-status-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 100px;
  padding: 4px 12px;
  margin-top: 4px;
  display: inline-block;
}
.invoice-section { margin-bottom: 24px; }
.invoice-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 12px;
}
.invoice-customer-name { font-size: 15px; font-weight: 600; color: var(--fg); margin-bottom: 2px; }
.invoice-customer-addr { font-size: 13px; color: var(--fg-muted); }
.invoice-line-items { display: flex; flex-direction: column; gap: 0; }
.invoice-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--fg);
}
.invoice-row-label { color: var(--fg-muted); }
.invoice-row-amount { font-weight: 600; font-family: 'Bricolage Grotesque', sans-serif; }
.invoice-row.total {
  border-bottom: none;
  border-top: 1px solid rgba(245, 158, 11, 0.3);
  padding-top: 14px;
  margin-top: 4px;
  font-size: 16px;
}
.invoice-row.total .invoice-row-amount { font-size: 20px; color: var(--accent); }
.invoice-footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-muted);
}
.invoice-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ─── Empty State ─────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-muted);
}
.empty-state-icon {
  width: 56px; height: 56px;
  background: rgba(255,255,255,0.05);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ─── Notification Toast ─────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--fg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 200;
  animation: slideIn 0.2s ease-out;
}
@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.toast-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}