/* ============================================================
   BlueCloud Technical — Design System
   Matching wireframes v2.0 exactly
   ============================================================ */

:root {
  --blue:        #0F2744;
  --blue-mid:    #1A3A5C;
  --blue-light:  #1E4976;
  --accent:      #0EA5E9;
  --accent-dark: #0284C7;
  --green:       #16A34A;
  --green-light: #DCFCE7;
  --orange:      #EA580C;
  --orange-light:#FFF7ED;
  --red:         #DC2626;
  --red-light:   #FEF2F2;
  --purple:      #7C3AED;
  --purple-light:#F5F3FF;
  --gray:        #64748B;
  --gray-light:  #94A3B8;
  --border:      #E2E8F0;
  --bg:          #F1F5F9;
  --white:       #FFFFFF;
  --dark:        #0F172A;
  --mono:        'IBM Plex Mono', monospace;
  --sans:        'Plus Jakarta Sans', sans-serif;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;
  --shadow:      0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:   0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.16);
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--dark);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font-family: var(--sans); cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: var(--sans); }
a { text-decoration: none; cursor: pointer; }

/* ── App Container ── */
#app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* JS sets --app-height to window.innerHeight to avoid Android Chrome overlap */
  height: var(--app-height, 100vh);
  overflow: hidden;
}

/* ── Screens ── */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.28s ease;
  background: var(--bg);
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}
.screen.slide-out {
  transform: translateX(-30%);
  opacity: 0;
}

/* ── Splash ── */
.screen-splash {
  background: linear-gradient(160deg, var(--blue) 0%, #0a1e36 100%);
  transform: none;
  z-index: 100;
}
.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
}
.splash-icon { width: 96px; height: 96px; }
.splash-logo { width: 220px; }
.splash-loading { margin-top: 32px; }
.splash-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Login ── */
.screen-login {
  background: linear-gradient(160deg, var(--blue) 0%, #0a1e36 100%);
  transform: none;
}
.login-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 32px 24px;
  gap: 16px;
}
.login-icon { width: 72px; height: 72px; }
.login-logo { width: 220px; }
.login-logo-img { width: 260px; max-width: 80vw; margin-bottom: 4px; }
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.login-brand-icon { width: 72px; height: 72px; border-radius: 16px; }
.login-brand-text { display: flex; flex-direction: column; gap: 2px; }
.login-brand-name { font-size: 22px; font-weight: 700; color: #ffffff; letter-spacing: 0.02em; line-height: 1.2; }
.login-brand-blue { color: #0EA5E9; }
.login-brand-light { font-weight: 400; font-size: 18px; letter-spacing: 0.12em; color: rgba(255,255,255,0.85); }
.login-brand-tagline { font-size: 10px; letter-spacing: 0.18em; color: rgba(255,255,255,0.45); text-transform: uppercase; margin-top: 2px; }
.login-subtitle { color: rgba(255,255,255,.6); font-size: 14px; }
.login-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.login-error { background: var(--red-light); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.login-footer { color: rgba(255,255,255,.3); font-size: 12px; margin-top: 16px; }
.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap .form-input { flex: 1; padding-right: 64px; }
.password-toggle { position: absolute; right: 12px; background: none; border: none; color: rgba(255,255,255,.6); font-size: 12px; font-weight: 700; cursor: pointer; padding: 4px 6px; letter-spacing: .5px; text-transform: uppercase; }
.login-clear-cache-btn { background: none; border: none; color: rgba(255,255,255,.25); font-size: 11px; cursor: pointer; padding: 8px; margin-top: 4px; text-decoration: underline; }

/* ── App Header (Juan) ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: var(--blue);
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-icon { width: 32px; height: 32px; }
.header-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.7);
  letter-spacing: 0.08em;
}
.header-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: white;
  cursor: pointer;
}

/* ── Screen Header ── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: var(--blue);
  flex-shrink: 0;
}
.back-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.back-btn:active { background: rgba(255,255,255,.1); }
.screen-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: white;
}
.header-action-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.7);
}

/* ── Step Indicator ── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.step {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.5);
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
}
.step.active { background: var(--accent); color: white; }
.step.done { background: var(--green); color: white; }
.step-line { width: 16px; height: 2px; background: rgba(255,255,255,.2); }

/* ── Screen Content ── */
.screen-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Extra padding to clear bottom nav + safe area */
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
.screen-content::-webkit-scrollbar { display: none; }

/* ── Greeting ── */
.greeting-row {
  padding: 20px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.greeting { font-size: 24px; font-weight: 800; color: var(--dark); }

/* Status change buttons (Juan job detail) */
.status-change-btn {
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.status-change-btn:active { opacity: 0.8; transform: scale(0.98); }
.status-change-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Refresh button */
.refresh-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  box-shadow: var(--shadow);
  flex-shrink: 0;
  transition: transform 0.3s ease, color 0.2s;
}
.refresh-btn:active { transform: rotate(180deg); color: var(--accent); }
.refresh-btn.spinning svg { animation: spin 0.7s linear; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── KPI Tiles ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px 16px;
}
.kpi-tile {
  background: white;
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid transparent;
}
.kpi-active { border-top-color: var(--green); }
.kpi-locked { border-top-color: var(--red); }
.kpi-signoff { border-top-color: var(--purple); }
.kpi-num {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
}
.kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray);
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ── Filter Tabs ── */
.filter-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
}
.filter-tab {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray);
  background: white;
  border: 1.5px solid var(--border);
  transition: all 0.15s;
}
.filter-tab.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

/* ── Jobs Search ── */
.jobs-search-wrap { padding: 0 16px 12px; }
.jobs-search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aab' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center;
  font-size: 14px;
  color: var(--dark);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.jobs-search-input:focus { border-color: var(--blue); }
.jobs-search-input::placeholder { color: var(--gray); }
/* ── Job Cards ── */
.jobs-list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.job-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px 14px 14px 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.job-card:active { transform: scale(0.99); }
.job-card.status-active { border-left-color: var(--green); }
.job-card.status-signoff { border-left-color: var(--purple); }
.job-card.status-locked { border-left-color: var(--red); }
.job-card.status-quoted { border-left-color: var(--gray-light); }
.job-card.status-awaiting-quote { border-left-color: var(--gray-light); }
.job-card.status-complete { border-left-color: var(--accent); opacity: 0.82; }

.job-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.job-card-title { font-size: 15px; font-weight: 700; color: var(--dark); flex: 1; }
.job-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.job-card-location { font-size: 12px; color: var(--gray); }
.job-card-number { font-family: var(--mono); font-size: 11px; color: var(--gray-light); }
.job-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.job-card-status-text { font-size: 12px; color: var(--gray); }
.job-card-locked-msg { font-size: 12px; color: var(--red); display: flex; align-items: center; gap: 4px; }

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.badge-active { background: var(--green-light); color: var(--green); }
.badge-signoff { background: var(--purple-light); color: var(--purple); }
.badge-locked { background: var(--red-light); color: var(--red); }
.badge-quoted { background: var(--bg); color: var(--gray); }
.badge-awaiting { background: var(--orange-light); color: var(--orange); }
.badge-complete { background: #EFF6FF; color: #2563EB; }
.badge-new { background: #FEF3C7; color: #92400E; }
.badge-cancelled { background: var(--bg); color: var(--gray-light); }

/* ── Bottom Nav ── */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Account for iOS safe area and Android Chrome navigation bar */
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: white;
  border-top: 1px solid var(--border);
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--gray-light);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.nav-btn.nav-active { color: var(--accent); }
.nav-btn.nav-disabled { color: var(--border); pointer-events: none; }
.nav-fab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--blue);
  color: white;
  width: 56px; height: 56px;
  border-radius: 50%;
  margin-top: -20px;
  box-shadow: 0 4px 16px rgba(14,165,233,.4);
  font-size: 10px;
  font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-fab:active { transform: scale(0.95); }
.nav-fab span { font-size: 9px; margin-top: -2px; }

/* ── Job Detail Header ── */
.job-detail-header { flex-direction: row; }
.job-header-info { flex: 1; }
.job-number { font-family: var(--mono); font-size: 12px; color: rgba(255,255,255,.6); }
.job-title { font-size: 16px; font-weight: 700; color: white; }

/* ── Job Detail Status Banner ── */
.status-banner {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.status-banner.locked { background: linear-gradient(135deg, #7F1D1D, var(--red)); }
.status-banner.ready { background: linear-gradient(135deg, #14532D, var(--green)); }
.status-banner.active { background: linear-gradient(135deg, #14532D, #15803D); }
.status-banner.override { background: linear-gradient(135deg, #4C1D95, var(--purple)); }
.status-banner-icon { font-size: 28px; flex-shrink: 0; }
.status-banner-text h3 { font-size: 16px; font-weight: 800; color: white; }
.status-banner-text p { font-size: 13px; color: rgba(255,255,255,.75); margin-top: 2px; }

/* ── Job Info Card ── */
.job-info-card {
  background: white;
  border-radius: var(--radius);
  margin: 12px 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.job-info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg);
}
.job-info-row:last-child { border-bottom: none; }
.job-info-label { font-size: 12px; color: var(--gray); font-weight: 500; }
.job-info-value { font-size: 13px; color: var(--dark); font-weight: 600; text-align: right; max-width: 60%; }
.job-info-value.mono { font-family: var(--mono); }

/* ── Timer ── */
.timer-section {
  background: var(--blue);
  margin: 0 16px 12px;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.timer-display {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 600;
  color: white;
  letter-spacing: 0.04em;
}
.timer-label { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 2px; }
.clock-out-btn {
  background: var(--red);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.clock-out-btn:active { opacity: 0.85; }

/* ── Quick Actions Grid ── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 12px;
}
.quick-action-btn {
  background: white;
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  box-shadow: var(--shadow);
  transition: transform 0.1s;
}
.quick-action-btn:active { transform: scale(0.97); }
.quick-action-btn.primary { background: var(--accent); color: white; }
.quick-action-btn.disabled { opacity: 0.4; pointer-events: none; }
.qa-icon { font-size: 20px; }

/* ── Checklist Progress ── */
.checklist-progress-section {
  margin: 0 16px 12px;
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.checklist-title { font-size: 13px; font-weight: 700; color: var(--dark); letter-spacing: 0.04em; }
.checklist-count { font-family: var(--mono); font-size: 13px; color: var(--gray); }
.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ── Costs Summary ── */
.costs-section {
  margin: 0 16px 12px;
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.costs-title { font-size: 13px; font-weight: 700; color: var(--dark); letter-spacing: 0.04em; margin-bottom: 10px; }
.cost-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  color: var(--gray);
  border-bottom: 1px solid var(--bg);
}
.cost-row:last-child { border-bottom: none; }
.cost-row.total {
  font-weight: 700;
  color: var(--dark);
  font-size: 14px;
  border-top: 2px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}
.cost-amount { font-family: var(--mono); font-weight: 600; }
/* ── Uploaded Invoices List ── */
.uploaded-invoice-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.uploaded-invoice-row:last-child { border-bottom: none; }
.uploaded-invoice-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.uploaded-invoice-info { flex: 1; min-width: 0; }
.uploaded-invoice-supplier { font-size: 13px; font-weight: 600; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uploaded-invoice-meta { font-size: 11px; color: var(--gray); margin-top: 2px; }
.uploaded-invoice-desc { font-size: 11px; color: var(--gray-light); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uploaded-invoice-amount { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--dark); flex-shrink: 0; white-space: nowrap; }
/* ── Clock In Button ── */
.clock-in-section {
  padding: 16px;
}
.clock-in-btn {
  width: 100%;
  padding: 18px;
  background: var(--green);
  color: white;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(22,163,74,.35);
  transition: transform 0.1s, box-shadow 0.1s;
}
.clock-in-btn:active { transform: scale(0.98); box-shadow: none; }
.clock-in-btn:disabled { background: var(--gray-light); box-shadow: none; cursor: not-allowed; }

/* ── Locked Quick Actions ── */
.locked-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px;
}
.locked-action-btn {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  box-shadow: var(--shadow);
}

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 700; color: var(--gray); letter-spacing: 0.04em; text-transform: uppercase; }
.form-label .required { color: var(--red); }
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--dark);
  background: white;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input.error { border-color: var(--red); }
.form-input.ai-filled { border-color: var(--accent); background: #F0F9FF; }
textarea.form-input { resize: vertical; min-height: 90px; }
select.form-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.form-section { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── AI Badge ── */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: #EFF6FF;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.1s, opacity 0.15s;
  cursor: pointer;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-green { background: var(--green); color: white; }
.btn-red { background: var(--red); color: white; }
.btn-outline { background: white; color: var(--dark); border: 1.5px solid var(--border); }
.btn-full { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 17px; border-radius: var(--radius); }

/* ── Sticky Bottom CTA ── */
.sticky-cta {
  position: sticky;
  bottom: 0;
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  background: white;
  border-top: 1px solid var(--border);
  z-index: 5;
}

/* ── Job Type Cards ── */
.job-type-grid { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.job-type-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.job-type-card:active { transform: scale(0.99); }
.job-type-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
.job-type-icon { font-size: 28px; flex-shrink: 0; }
.job-type-info h3 { font-size: 15px; font-weight: 700; color: var(--dark); }
.job-type-info p { font-size: 12px; color: var(--gray); margin-top: 2px; }
.job-type-radio {
  margin-left: auto;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.job-type-card.selected .job-type-radio {
  border-color: var(--accent);
  background: var(--accent);
}
.job-type-card.selected .job-type-radio::after {
  content: '';
  width: 8px; height: 8px;
  background: white;
  border-radius: 50%;
}

/* ── Customer Search ── */
.customer-search-results {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 4px;
}
.customer-result {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--bg);
  font-size: 14px;
}
.customer-result:last-child { border-bottom: none; }
.customer-result:hover { background: var(--bg); }
.customer-result-name { font-weight: 600; color: var(--dark); }
.customer-result-type { font-size: 11px; color: var(--gray); }

/* ── Cost Line Items ── */
.cost-items { display: flex; flex-direction: column; gap: 10px; }
.cost-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  position: relative;
}
.cost-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cost-item-title { font-size: 12px; font-weight: 700; color: var(--gray); }
.cost-item-remove { color: var(--red); font-size: 18px; padding: 2px 6px; }
.add-cost-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 0;
}

/* ── Invoice Upload ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin: 16px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: #F0F9FF; }
.upload-zone-icon { font-size: 40px; margin-bottom: 12px; }
.upload-zone-title { font-size: 16px; font-weight: 700; color: var(--dark); }
.upload-zone-sub { font-size: 13px; color: var(--gray); margin-top: 4px; }
.upload-divider { display: flex; align-items: center; gap: 12px; padding: 0 16px; color: var(--gray-light); font-size: 13px; }
.upload-divider::before, .upload-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.upload-alt-btn {
  margin: 12px 16px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  background: white;
  cursor: pointer;
}
.upload-preview {
  margin: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
}
.upload-preview img { max-height: 200px; object-fit: contain; }
.job-link-tag {
  margin: 0 16px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

/* ── Invoice Review ── */
.invoice-review-card {
  background: white;
  border-radius: var(--radius);
  margin: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.review-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg);
  font-size: 14px;
}
.review-row:last-child { border-bottom: none; }
.review-label { color: var(--gray); }
.review-value { font-weight: 600; color: var(--dark); text-align: right; }
.review-value.mono { font-family: var(--mono); }

/* ── Checklist ── */
.checklist-list { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.checklist-item.checked { background: var(--green-light); }
.checklist-checkbox {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.checklist-item.checked .checklist-checkbox {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.checklist-item-text { font-size: 14px; font-weight: 500; color: var(--dark); }
.checklist-item.checked .checklist-item-text { text-decoration: line-through; color: var(--gray); }
.checklist-complete-banner {
  margin: 0 16px 12px;
  background: var(--green-light);
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
}

/* ── Photo Grid ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px;
}
.photo-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
  position: relative;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb-type {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,.6);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.photo-add-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--gray);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: white;
}
.photo-add-btn:active { background: var(--bg); }
.photo-requirement {
  margin: 0 16px 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.photo-requirement.met { background: var(--green-light); color: var(--green); }
.photo-requirement.unmet { background: var(--orange-light); color: var(--orange); }

/* ── Signature Canvas ── */
.signature-section { padding: 16px; }
.signature-label { font-size: 13px; color: var(--gray); margin-bottom: 8px; }
.signature-canvas-wrap {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: white;
  overflow: hidden;
  position: relative;
}
#signature-canvas {
  display: block;
  width: 100%;
  touch-action: none;
  cursor: crosshair;
}
.signature-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-light);
  font-size: 14px;
  pointer-events: none;
}
.signature-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.sign-off-summary {
  background: white;
  border-radius: var(--radius);
  margin: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.sign-off-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--bg);
  font-size: 14px;
}
.sign-off-summary-row:last-child { border-bottom: none; }
.sign-off-summary-label { color: var(--gray); }
.sign-off-summary-value { font-weight: 600; color: var(--dark); }
.sign-off-summary-value.warning { color: var(--orange); font-weight: 700; }

/* ── Dale Admin Layout ── */
.screen-dale {
  background: var(--bg);
  flex-direction: column;
  /* Override slide transition — dashboard uses display:none/flex instead */
  transform: none !important;
  opacity: 1 !important;
  transition: none !important;
  /* Hidden by default until .active is added */
  display: none !important;
}
.screen-dale.active {
  display: flex !important;
  pointer-events: all !important;
}
/* ── Dale Admin Header ── */
.dale-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--blue);
  flex-shrink: 0;
  height: 56px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.dale-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.dale-admin-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(14,165,233,.15);
  border: 1px solid rgba(14,165,233,.3);
  border-radius: 20px;
  padding: 2px 8px;
  text-transform: uppercase;
}
/* Nav tabs */
.dale-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
  height: 100%;
}
.dale-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 100%;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.5);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.dale-nav-btn:hover {
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.05);
}
.dale-nav-btn.active {
  color: white;
  border-bottom-color: var(--accent);
  background: rgba(255,255,255,.06);
}
.dale-nav-btn svg { opacity: 0.7; flex-shrink: 0; }
.dale-nav-btn.active svg { opacity: 1; }
/* User profile button */
.dale-user-badge-wrap {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
}
.dale-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.dale-user-btn:hover {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.22);
}
.dale-user-avatar {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.dale-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.dale-user-name {
  font-size: 13px;
  font-weight: 700;
  color: white;
}
.dale-user-role {
  font-size: 10px;
  color: rgba(255,255,255,.5);
  letter-spacing: 0.04em;
}
.dale-user-chevron {
  color: rgba(255,255,255,.5);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.dale-user-btn[aria-expanded="true"] .dale-user-chevron {
  transform: rotate(180deg);
}
/* Dropdown */
.dale-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  min-width: 200px;
  z-index: 2000;
  overflow: hidden;
}
.dale-user-dropdown.open { display: block; }
.dale-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.dale-dropdown-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.dale-dropdown-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
}
.dale-dropdown-role {
  font-size: 11px;
  color: var(--gray);
  margin-top: 1px;
}
.dale-dropdown-divider {
  height: 1px;
  background: var(--border);
}
.dale-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.dale-dropdown-item:hover { background: var(--bg); }
.dale-dropdown-item svg { flex-shrink: 0; color: var(--gray); }
.dale-dropdown-signout { color: #dc2626; }
.dale-dropdown-signout svg { color: #dc2626; }
/* Inline status select in jobs table */
.dale-status-select {
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--sans);
  background: white;
  color: var(--dark);
  cursor: pointer;
  max-width: 160px;
}
.dale-status-select:focus { outline: none; border-color: var(--accent); }
.dale-status-select:disabled { opacity: 0.5; cursor: not-allowed; }
/* Missing costs badge in Dale's jobs table */
.costs-missing-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  cursor: default;
}
.dale-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}
.dale-sidebar {
  width: 220px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-drawer-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-close-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--gray);
  transition: background 0.15s;
}
.sidebar-close-btn:hover { background: var(--bg); }
.sidebar-section { padding: 0 12px 16px; }
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-light);
  letter-spacing: 0.1em;
  padding: 0 4px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  position: relative;
  transition: background 0.1s, color 0.1s;
}
.sidebar-link:hover { background: var(--bg); color: var(--dark); }
.sidebar-link.active { background: #EFF6FF; color: var(--accent); font-weight: 700; }
.sidebar-alert { color: var(--dark); }
.sidebar-create { color: var(--accent); font-weight: 700; }
.alert-dot {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  margin-left: auto;
}
.dale-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Dale KPI Row ── */
.dale-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.dale-kpi {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.dale-kpi-num {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
}
.dale-kpi-num.accent { color: var(--accent); }
.dale-kpi-num.orange { color: var(--orange); }
.dale-kpi-num.green { color: var(--green); }
.dale-kpi-label { font-size: 11px; color: var(--gray); font-weight: 600; margin-top: 4px; letter-spacing: 0.04em; }
.dale-kpi-sub { font-size: 11px; color: var(--gray-light); margin-top: 2px; }

/* ── Dale Jobs Table ── */
.dale-table-wrap {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.dale-table-wrap table {
  min-width: 540px;
}
.dale-table-filters {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.dale-search {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--dark);
}
.dale-search:focus { outline: none; border-color: var(--accent); }
.dale-filter-select {
  padding: 9px 32px 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--dark);
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748B' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  cursor: pointer;
}
.dale-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dale-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.dale-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bg);
  color: var(--dark);
  vertical-align: middle;
}
.dale-table tr:last-child td { border-bottom: none; }
.dale-table tr:hover td { background: #FAFBFC; cursor: pointer; }
.dale-table .mono { font-family: var(--mono); font-size: 12px; }
.margin-cell { font-family: var(--mono); font-weight: 700; }
.margin-cell.good { color: var(--green); }
.margin-cell.warn { color: var(--orange); }
.margin-cell.bad { color: var(--red); }

/* ── Loading / Empty States ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  color: var(--gray);
  font-size: 14px;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 8px;
  text-align: center;
}
.empty-icon { font-size: 40px; margin-bottom: 4px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--dark); }
.empty-sub { font-size: 14px; color: var(--gray); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 90px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ── Utilities ── */
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.text-gray { color: var(--gray); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-accent { color: var(--accent); }
.fw-700 { font-weight: 700; }
.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 16px 16px 8px;
}
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 0 16px 12px;
}

/* ── Profile ── */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 24px;
  gap: 8px;
}
.profile-avatar {
  width: 72px; height: 72px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
}
.profile-name { font-size: 20px; font-weight: 800; color: var(--dark); }
.profile-role { font-size: 14px; color: var(--gray); }
.profile-section { padding: 0 16px; }
.profile-btn {
  width: 100%;
  padding: 14px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--red);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s;
}
.profile-btn:active { background: var(--bg); }
/* Tool buttons in the Profile Tools section use dark text, not red */
.profile-btn[data-nav] { color: var(--dark); }

/* ── Animations ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.25s ease forwards; }

/* ── Responsive (Dale web view) ── */
/* ── Hamburger button (always visible on mobile) ── */
.dale-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: white;
  flex-shrink: 0;
  transition: background 0.15s;
}
.dale-hamburger:hover { background: rgba(255,255,255,.1); }
/* Hide name/role/chevron on mobile — show avatar only */
.dale-user-info-desktop { display: flex; }
.dale-user-chevron-desktop { display: block; }
/* Sidebar overlay */
.dale-sidebar-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
  pointer-events: none;
}
.dale-sidebar-overlay.open { display: block; pointer-events: all; }
@media (max-width: 768px) {
  /* Header: hamburger visible, nav tabs hidden */
  .dale-hamburger { display: flex; }
  .dale-nav { display: none; }
  .dale-user-info-desktop { display: none; }
  .dale-user-chevron-desktop { display: none; }
  .dale-user-btn { padding: 4px; background: transparent; border: none; }
  .dale-user-btn:hover { background: rgba(255,255,255,.1); }
  .dale-user-avatar { width: 34px; height: 34px; }
  /* Sidebar: hidden by default, slides in as drawer */
  .dale-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    width: 260px;
    display: block;
    padding-top: 0;
  }
  .dale-sidebar.open {
    transform: translateX(0);
  }
  .sidebar-drawer-header { display: flex; }
  /* KPI grid: 2 columns on mobile */
  .dale-kpi-row { grid-template-columns: repeat(2, 1fr); }
  /* Dropdown: align right edge to viewport on mobile */
  .dale-user-dropdown { right: 0; min-width: 200px; }
}

/* ── Materials Checklist (Ready State) ─────────────────────── */
.material-check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.material-check-row:last-of-type { border-bottom: none; }
.material-check-row:active { background: var(--bg); }
.material-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.material-check-row.checked .material-checkbox {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.material-check-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.material-check-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}
.material-check-row.checked .material-check-name {
  text-decoration: line-through;
  color: var(--gray);
}
.material-check-qty {
  font-size: 12px;
  color: var(--gray);
  font-family: var(--mono);
}

/* ── Quotes & Follow-Up Cards ─────────────────────────────── */
.followup-section {
  margin-bottom: 28px;
}
.followup-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 10px;
  gap: 10px;
}
.followup-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.followup-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.followup-customer {
  font-weight: 700;
  font-size: 15px;
  color: var(--dark);
}
.followup-meta {
  font-size: 12px;
  color: var(--gray);
  margin-top: 2px;
}
.followup-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
}
.followup-detail-item {
  font-size: 12px;
  color: var(--dark);
}
.followup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.followup-btn {
  font-size: 12px !important;
  padding: 6px 14px !important;
}
.followup-empty {
  text-align: center;
  padding: 20px;
  color: var(--gray);
  font-size: 13px;
  background: var(--surface);
  border-radius: var(--radius);
}

/* ── Quotes & Follow-Up Cards ─────────────────────────────── */
.followup-section { margin-bottom: 28px; }
.followup-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--surface, #F1F5F9); border-radius: var(--radius);
  margin-bottom: 10px; gap: 10px;
}
.followup-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.followup-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; margin-bottom: 8px;
}
.followup-customer { font-weight: 700; font-size: 15px; color: var(--dark); }
.followup-meta { font-size: 12px; color: var(--gray); margin-top: 2px; }
.followup-details { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.followup-detail-item { font-size: 12px; color: var(--dark); }
.followup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.followup-empty {
  text-align: center; padding: 20px; color: var(--gray); font-size: 13px;
  background: var(--bg); border-radius: var(--radius);
}

.job-card-customer {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-dark, #0284C7);
  margin-top: 2px;
}

/* ── Xero Sidebar Status ── */
.xero-sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--dark);
}
.xero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.xero-dot-connected    { background: var(--green); }
.xero-dot-disconnected { background: var(--red); }
.xero-dot-unknown      { background: var(--gray-light); }
.xero-connect-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.xero-connect-link:hover { text-decoration: underline; }

/* ── Ready to Invoice Cards ── */
.invoice-ready-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  border: 1.5px solid var(--border);
  transition: border-color 0.2s, background 0.2s;
}
.invoice-ready-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.invoice-ready-jobnum {
  font-size: 12px;
  color: var(--gray);
}
.invoice-ready-customer {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  margin-top: 2px;
}
.invoice-ready-meta {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.invoice-ready-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.invoice-xero-btn {
  display: flex;
  align-items: center;
}

/* ── Commission Tracking ─────────────────────────────────── */
.profile-commission-section {
  margin: 0 16px 16px;
  background: white;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
}
.profile-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.commission-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  color: var(--gray);
  font-size: 13px;
}
.commission-total-card {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
  padding: 20px 16px;
  text-align: center;
}
.commission-total-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.commission-total-amount {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
}
.commission-total-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}
.commission-job-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.commission-job-item:last-child {
  border-bottom: none;
}
.commission-job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.commission-job-num {
  font-size: 12px;
  color: var(--gray);
}
.commission-job-amount {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--orange);
}
.commission-job-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--dark);
}

/* ── Fuel Slips Screen ─────────────────────────────────── */
.fuel-summary-card {
  background: linear-gradient(135deg, #1e3a5f, #0ea5e9);
  border-radius: var(--radius);
  margin: 16px 16px 8px;
  padding: 16px;
  color: #fff;
}
.fuel-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.fuel-summary-item {
  text-align: center;
  flex: 1;
}
.fuel-summary-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.fuel-summary-label {
  font-size: 10px;
  opacity: 0.75;
  margin-top: 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fuel-summary-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
}
.fuel-slips-list {
  padding: 0 16px;
  margin-top: 8px;
}
.fuel-slip-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fuel-slip-row:last-child {
  border-bottom: none;
}
.fuel-slip-row:active {
  background: var(--bg);
  margin: 0 -16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}
.fuel-slip-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f7ff;
  border-radius: 50%;
}
.fuel-slip-info {
  flex: 1;
  min-width: 0;
}
.fuel-slip-station {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fuel-slip-meta {
  font-size: 11px;
  color: var(--gray);
  margin-top: 2px;
}
.fuel-slip-detail {
  font-size: 12px;
  color: var(--gray);
  margin-top: 1px;
}
.fuel-slip-amount {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
  flex-shrink: 0;
}


/* -- Quote Request Screen -- */
.qr-form-wrap { padding: 16px; max-width: 600px; margin: 0 auto; }
.qr-intro { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px 8px 20px; }
.qr-intro-icon { font-size: 36px; margin-bottom: 8px; }
.qr-intro-text { font-size: 13px; color: var(--gray); line-height: 1.5; max-width: 320px; }
.qr-suggestions { position: absolute; z-index: 100; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); max-height: 160px; overflow-y: auto; width: 100%; left: 0; top: 100%; margin-top: 2px; }
.qr-suggestion-item { padding: 10px 14px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border); }
.qr-suggestion-item:last-child { border-bottom: none; }
.qr-suggestion-item:hover { background: var(--bg); }
.qr-attach-btn { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--bg); border: 1.5px dashed var(--border); border-radius: 8px; font-size: 13px; color: var(--gray); cursor: pointer; width: 100%; justify-content: center; }
.qr-file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px; font-size: 12px; color: var(--dark); }
.qr-submit-btn { margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.qr-disclaimer { text-align: center; font-size: 11px; color: var(--gray); margin-top: 10px; line-height: 1.4; }

/* -- Quote Review Screen -- */
.qr-review-wrap { padding: 16px; max-width: 600px; margin: 0 auto; }
.qr-profit-bar { display: flex; gap: 8px; background: var(--blue); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.qr-profit-item { flex: 1; text-align: center; }
.qr-profit-label { font-size: 10px; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.qr-profit-val { font-size: 14px; font-weight: 700; color: #fff; }
.qr-profit-gp { color: #4ade80; }
.qr-client-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.qr-client-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.qr-client-row:last-child { border-bottom: none; }
.qr-client-label { font-size: 11px; color: var(--gray); min-width: 60px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.qr-client-input { flex: 1; border: none; background: transparent; font-size: 13px; color: var(--dark); outline: none; padding: 2px 0; }
.qr-section-label { font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 0.5px; margin: 16px 0 8px; }
.qr-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
.qr-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.qr-table th { background: var(--blue); color: #fff; padding: 8px 10px; text-align: left; font-size: 11px; font-weight: 600; }
.qr-section-header { background: var(--bg); font-size: 11px; font-weight: 700; color: var(--blue); padding: 5px 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.qr-line-row td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.qr-line-input { border: none; background: transparent; font-size: 12px; color: var(--dark); width: 100%; outline: none; padding: 2px 0; }
.qr-num-input { text-align: right; }
.qr-line-total { text-align: right; font-weight: 600; white-space: nowrap; font-size: 12px; }
.qr-total-row { display: flex; justify-content: space-between; align-items: center; background: var(--blue); color: #fff; padding: 10px 14px; font-weight: 700; font-size: 14px; border-radius: 0 0 8px 8px; }
.qr-scope-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 4px; }
.qr-scope-list { padding-left: 18px; font-size: 13px; line-height: 1.7; color: var(--dark); margin-bottom: 8px; }
.qr-text-btn { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 2px 0; font-weight: 600; }
.qr-doctype-option { display:inline-flex; align-items:center; gap:6px; cursor:pointer; font-size:13px; font-weight:500; padding:6px 14px; border:1.5px solid var(--border); border-radius:20px; transition:border-color .15s,background .15s; }
.qr-doctype-option:has(input:checked) { border-color:var(--accent); background:rgba(14,165,233,.08); color:var(--accent); }
.qr-doctype-option input[type=radio] { accent-color:var(--accent); }
.qr-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

/* -- Quote Requests List (Dale) -- */
.qr-requests-list { padding: 0 16px 16px; }
.qr-request-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; cursor: pointer; transition: box-shadow 0.15s; }
.qr-request-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.qr-request-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.qr-request-client { font-size: 14px; font-weight: 700; color: var(--blue); }
.qr-request-site { font-size: 12px; color: var(--gray); margin-top: 2px; }
.qr-status-badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.qr-request-meta { display: flex; gap: 12px; font-size: 12px; color: var(--gray); flex-wrap: wrap; }
.sidebar-alert { position: relative; }
.alert-dot { width: 8px; height: 8px; background: #ef4444; border-radius: 50%; display: inline-block; margin-left: 4px; vertical-align: middle; }

/* ══════════════════════════════════════════════════════════
   POLISH v2 — Micro-interactions, skeletons, visual refinements
   ══════════════════════════════════════════════════════════ */

/* ── Skeleton loading shimmer ── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px 14px 14px 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--border);
  margin-bottom: 10px;
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }
.skeleton-line.long { width: 90%; }
.skeleton-line.thin { height: 10px; }

/* ── Staggered fade-in for lists ── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.jobs-list .job-card:nth-child(1) { animation: slideUp 0.22s ease both; }
.jobs-list .job-card:nth-child(2) { animation: slideUp 0.28s ease both; }
.jobs-list .job-card:nth-child(3) { animation: slideUp 0.34s ease both; }
.jobs-list .job-card:nth-child(4) { animation: slideUp 0.40s ease both; }
.jobs-list .job-card:nth-child(5) { animation: slideUp 0.46s ease both; }
.jobs-list .job-card:nth-child(n+6) { animation: slideUp 0.50s ease both; }

/* ── Job card hover lift (desktop/tablet) ── */
@media (hover: hover) {
  .job-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
  .qr-request-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }
}

/* ── Improved toast — wider, icon support ── */
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  max-width: calc(100vw - 48px);
  white-space: normal;
  text-align: left;
}
.toast::before {
  font-size: 16px;
  flex-shrink: 0;
}
.toast.success::before { content: '✓'; }
.toast.error::before   { content: '✕'; }
.toast.info::before    { content: 'ℹ'; }

/* ── AI polish indicator on inputs ── */
@keyframes polishPulse {
  0%, 100% { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(14,165,233,0); }
  50%       { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,0.2); }
}
.ai-polished {
  animation: polishPulse 0.6s ease 2;
  background: #f0f9ff !important;
  border-color: var(--accent) !important;
}

/* ── Pending badge pulse (alert dot on sidebar) ── */
@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.5); opacity: 0.7; }
}
.alert-dot { animation: dotPulse 2s ease infinite; }

/* ── Button loading state ── */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.btn-primary.btn-loading::after { border-top-color: white; }
.btn-outline.btn-loading::after { border-top-color: var(--accent); }

/* ── Improved form focus rings ── */
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}
.qr-client-input:focus-within,
.qr-line-input:focus {
  background: #f0f9ff;
}

/* ── Status badge for Scheduled ── */
.badge-scheduled { background: #EFF6FF; color: #2563EB; }

/* ── Smooth scroll for screen content ── */
.screen-content {
  scroll-behavior: smooth;
}

/* ── Quote review profit bar — better contrast ── */
.qr-profit-bar {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
  box-shadow: var(--shadow-md);
}

/* ── Improved empty state icon ── */
.empty-icon {
  font-size: 48px;
  filter: grayscale(0.2);
  margin-bottom: 8px;
}

/* ── Subtle card press feedback ── */
.job-card:active,
.qr-request-card:active,
.invoice-ready-card:active {
  transform: scale(0.985);
  box-shadow: var(--shadow);
}

/* ── Scheduled date chip on job card ── */
.job-card-date {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  font-family: var(--mono);
  background: rgba(14,165,233,0.08);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ── Quote number chip ── */
.quote-num-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  background: rgba(14,165,233,0.08);
  border: 1px solid rgba(14,165,233,0.2);
  border-radius: 4px;
  padding: 1px 6px;
}

/* ── Improved clock-in button — pulse when ready ── */
@keyframes clockPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(22,163,74,.35); }
  50%       { box-shadow: 0 4px 24px rgba(22,163,74,.6); }
}
.clock-in-btn:not(:disabled) {
  animation: clockPulse 2.5s ease infinite;
}

/* ── Smooth tab transitions ── */
[data-job-tab] {
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

/* ── Dale table row hover ── */
.dale-table tbody tr {
  transition: background 0.1s;
}

/* ── Quick Approve button ─────────────────────────────────────────────────── */
.qr-quick-approve-btn {
  transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
}
.qr-quick-approve-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(34, 197, 94, 0.35);
}
.qr-quick-approve-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* ── Needs-attention banner chips ─────────────────────────────────────────── */
#needs-attention-items button {
  transition: filter 0.15s, transform 0.15s;
}
#needs-attention-items button:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Calendar / Diary Screen
   ═══════════════════════════════════════════════════════════════════════════ */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.cal-month-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}
.cal-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cal-nav-btn:hover { background: var(--bg); color: var(--dark); }
.cal-nav-btn:active { background: var(--border); }

.cal-month-grid {
  padding: 0 8px 8px;
  background: white;
}
.cal-day-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}
.cal-day-header {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gray-light);
  padding: 6px 0 4px;
  text-transform: uppercase;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding: 4px 2px 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.cal-day:active { background: var(--bg); }
.cal-day-empty { cursor: default; }
.cal-day-num {
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
  line-height: 1;
}
.cal-day-empty .cal-day-num { visibility: hidden; }

.cal-today .cal-day-num {
  background: var(--accent);
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.cal-selected { background: rgba(14, 165, 233, 0.10); }
.cal-selected .cal-day-num { color: var(--accent); font-weight: 700; }
.cal-today.cal-selected .cal-day-num { background: var(--accent); color: white; }

.cal-dots { display: flex; gap: 2px; margin-top: 3px; }
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.cal-dot-more { background: var(--gray-light); }

.cal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.cal-day-panel {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 0 0 16px;
}
.cal-day-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  background: white;
  border-bottom: 1px solid var(--border);
}
.cal-day-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}
.cal-add-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.cal-add-btn:active { transform: scale(0.97); }

.cal-day-appts {
  padding: 8px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-empty-day {
  padding: 20px 4px;
  text-align: center;
  color: var(--gray);
  font-size: 14px;
}
.cal-appt-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: white;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.cal-appt-time {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  min-width: 40px;
  padding-top: 2px;
  flex-shrink: 0;
}
.cal-appt-body { flex: 1; min-width: 0; }
.cal-appt-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 3px;
}
.cal-appt-meta {
  font-size: 12px;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 1px;
}
.cal-appt-icon { font-size: 11px; }
.cal-appt-notes {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
}
.cal-appt-edit-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.12s;
  flex-shrink: 0;
}
.cal-appt-edit-btn:hover { background: var(--bg); }

/* ── Calendar Modal (bottom sheet) ── */
#cal-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
}
#cal-modal-overlay.active { display: block; }

#cal-modal {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  z-index: 2001;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.15);
  flex-direction: column;
}
#cal-modal.active { display: flex; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}
.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  color: var(--gray);
  cursor: pointer;
  transition: background 0.12s;
}
.modal-close-btn:hover { background: var(--border); }

.modal-body { padding: 16px 20px; flex: 1; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: white;
  position: sticky;
  bottom: 0;
}

.btn-danger-outline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  color: var(--red);
  border: 1.5px solid var(--red);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-danger-outline:hover { background: var(--red-light); }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-textarea { resize: vertical; min-height: 72px; }

/* ── Spell-check suggestion ─────────────────────────────── */
.spell-suggestion {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 4px;
  animation: fadeIn 0.2s ease;
}
