/* ═══════════════════════════════════════════════════════════════════════════════
   FieldComm Pro — Professional Construction Field Management
   Industrial dark theme. Clean, fast, purpose-built.
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
  --slate: #1a2744;
  --slate-light: #243260;
  --accent: #c9a84c;
  --accent-hover: #d4b85c;
  --accent-muted: rgba(201, 168, 76, 0.15);
  --green: #27ae60;
  --green-bg: rgba(39, 174, 96, 0.1);
  --red: #c0392b;
  --red-bg: rgba(192, 57, 43, 0.08);
  --orange: #e67e22;
  --orange-bg: rgba(230, 126, 34, 0.08);
  --blue: #2980b9;
  --blue-bg: rgba(41, 128, 185, 0.08);
  --purple: #8e44ad;
  --purple-bg: rgba(142, 68, 173, 0.08);
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #dde3ef;
  --border-hover: #c5cee0;
  --text: #222222;
  --text-secondary: #556677;
  --text-muted: #6b7f94;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --transition: 0.15s ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --bottom-nav-h: 60px;
  --top-bar-h: 54px;
  --base-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: var(--base-size); }
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: var(--base-size);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* Fluid tap targets — minimum 44px per WCAG */
button, a, [data-action] { min-height: 44px; }
input, select, textarea { min-height: 44px; font-size: max(16px, 1rem); /* prevent iOS zoom */ }

/* ═══ ICON SYSTEM ═══ */
.icon-svg { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; flex-shrink: 0; }
.icon-wrap { display: inline-flex; align-items: center; justify-content: center; }
.icon-wrap.icon-lg .icon-svg { width: 1.3em; height: 1.3em; }
.icon-wrap.icon-xl .icon-svg { width: 2.2em; height: 2.2em; }
.icon-wrap.icon-brand .icon-svg { width: 2.5rem; height: 2.5rem; }
.icon-wrap.icon-nav .icon-svg { width: 1.35rem; height: 1.35rem; }
.icon-wrap.icon-gold { color: var(--accent); }
.icon-wrap.icon-green { color: var(--green); }
.icon-wrap.icon-red { color: var(--red); }
.icon-wrap.icon-blue { color: var(--blue); }
.icon-wrap.icon-orange { color: var(--orange); }
.icon-wrap.icon-muted { color: var(--text-secondary); }

/* ═══ APP SHELL ═══ */
#app { height: 100%; display: flex; flex-direction: column; }

.top-bar {
  height: var(--top-bar-h);
  background: var(--slate);
  border-bottom: none;
  display: flex;
  align-items: center;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0);
  gap: 8px;
  flex-shrink: 0;
  z-index: 100;
}
.top-bar .logo {
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.top-bar .project-name {
  font-size: 0.75rem;
  color: #aabbcc;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  padding-bottom: 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0));
  padding-right: max(16px, env(safe-area-inset-right, 0));
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.main-content::-webkit-scrollbar { width: 4px; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.bottom-nav {
  height: var(--bottom-nav-h);
  background: var(--slate);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  position: relative;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}
.bottom-nav .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: #a0b0c0;
  font-size: 0.72rem;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  letter-spacing: 0.2px;
  padding: 6px 2px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}
.bottom-nav .tab.active { color: var(--accent); }
.bottom-nav .tab.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}
.bottom-nav .tab .badge-dot {
  position: absolute;
  top: 8px;
  right: calc(50% - 16px);
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ═══ AUTH SCREENS ═══ */
.auth-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--slate);
  flex: 1;
}
.auth-screen .brand {
  text-align: center;
  margin-bottom: 32px;
}
.auth-screen .brand-icon {
  margin-bottom: 12px;
  color: var(--accent);
}
.auth-screen .brand h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}
.auth-screen .brand p { color: #aabbcc; font-size: 0.95rem; margin-top: 6px; }

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}
.auth-card h2 { font-size: 1.2rem; margin-bottom: 20px; text-align: center; font-weight: 700; }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--text);
  font-family: var(--font);
  transition: var(--transition);
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-bg);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: #aabbcc; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}
.btn:active { transform: scale(0.98); }
.btn-gold {
  background: var(--accent);
  color: var(--slate);
  font-weight: 700;
}
.btn-gold:hover { background: var(--accent-hover); }
.btn-primary {
  background: var(--slate);
  color: #ffffff;
  border: none;
}
.btn-primary:hover { background: var(--slate-light); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 10px 16px; font-size: 0.88rem; min-height: 40px; }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn-ghost:hover { text-decoration: underline; }

/* ═══ CARDS ═══ */
.card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  transition: var(--transition);
}
@media (hover: hover) { .card:hover { box-shadow: var(--shadow-lg); } }
.card h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--slate);
}

/* ═══ STAT BOXES ═══ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  min-width: 0;
}
.stat-box .num { font-size: 1.4rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--slate); }
.stat-box .label { font-size: 0.74rem; color: var(--text-secondary); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }

/* ═══ INSPECTION ROWS ═══ */
.inspection-group { margin-bottom: 16px; }
.inspection-group-header {
  background: var(--slate);
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.inspection-group-header .permit { font-weight: 700; font-size: 0.9rem; color: #ffffff; }
.inspection-group-header .type { font-size: 0.82rem; color: #c0cdd8; flex: 1; }

.inspection-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--surface);
  transition: var(--transition);
  min-height: 52px;
}
.inspection-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.inspection-row:active { background: var(--surface-2); }
.inspection-row .status-icon { text-align: center; }
.inspection-row .info .name { font-weight: 600; font-size: 0.92rem; }
.inspection-row .info .sub { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }

/* ═══ PUNCH ITEMS ═══ */
.punch-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 8px;
  border-left: 4px solid var(--border);
}
.punch-item.critical { border-left-color: var(--red); background: #fff8f8; }
.punch-item.high { border-left-color: var(--orange); background: #fffbf0; }
.punch-item.complete { opacity: 0.6; border-left-color: var(--green); border-color: #b0e0c0; }
.punch-item .location { font-weight: 700; font-size: 0.92rem; margin-bottom: 4px; }
.punch-item .issue { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.4; }
.punch-item .meta { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.punch-item .ai-badge {
  background: var(--blue-bg);
  color: var(--blue);
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
}

/* ═══ BADGES ═══ */
.badge-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-pass { background: var(--green-bg); color: var(--green); }
.badge-fail { background: var(--red-bg); color: var(--red); }
.badge-scheduled { background: var(--blue-bg); color: var(--blue); }
.badge-pending { background: var(--orange-bg); color: var(--orange); }
.badge-critical { background: var(--red-bg); color: var(--red); }
.badge-high { background: var(--orange-bg); color: var(--orange); }

/* ═══ CONTACT CARD ═══ */
.contact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  font-size: 0.92rem;
  line-height: 1.9;
}
.contact-card strong { color: var(--accent); }
.contact-card a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }

/* ═══ MATERIAL ROW ═══ */
.material-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  min-width: 0;
}
.material-row:last-child { border-bottom: none; }
.material-row .cost { font-weight: 700; color: var(--green); font-size: 0.9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ═══ EMPTY STATE ═══ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty-state .icon { margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.95rem; margin-bottom: 18px; line-height: 1.5; }

/* ═══ TOAST ═══ */
.toast-container { position: fixed; top: 16px; right: 16px; left: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  color: var(--text);
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
@keyframes slideIn { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease;
  padding: 16px;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.modal .close-btn {
  margin-left: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal .close-btn:hover { border-color: var(--border-hover); color: var(--text); }

/* ═══ LOADING ═══ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen {
  height: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

/* ═══ SECTION HEADER ═══ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
}
.section-header h1 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.3px; color: var(--slate); white-space: nowrap; }
.section-header .subtitle { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ═══ NOTIFICATIONS / ALERT CARDS ═══ */
.alert-card { padding: 14px 16px; border-radius: 12px; margin-bottom: 12px; cursor: pointer; transition: transform 0.15s; }
.alert-card:active { transform: scale(0.98); }
.alert-card strong { display: block; font-size: 0.9rem; margin-bottom: 4px; }
.alert-card p { font-size: 0.8rem; color: var(--text-secondary); margin: 0; line-height: 1.5; }
.alert-critical { background: var(--red-bg, #fef2f2); border-left: 4px solid var(--red, #ef4444); }
.alert-warn { background: var(--orange-bg, #fff7ed); border-left: 4px solid var(--orange, #f97316); }
.alert-info { background: var(--blue-bg, #eff6ff); border-left: 4px solid var(--blue, #3b82f6); }

/* ═══ TAKEOFF TABLES ═══ */
.takeoff-table-wrap { overflow-x: auto; margin: 0 -4px; }
.takeoff-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.takeoff-table th { background: var(--slate); color: #fff; padding: 10px 8px; text-align: left; font-weight: 600; white-space: nowrap; }
.takeoff-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.takeoff-table tr:nth-child(even) td { background: var(--bg); }
.tk-pass { color: var(--green, #16a34a); font-weight: 600; font-size: 0.82rem; }
.tk-warn { color: var(--orange, #f97316); font-weight: 600; font-size: 0.82rem; }
.tk-fail { color: var(--red, #ef4444); font-weight: 700; font-size: 0.82rem; }
.tk-critical-row td { background: var(--red-bg, #fef2f2) !important; }

/* ═══ PRICING GRID ═══ */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.pricing-card { background: var(--bg); border-radius: 12px; padding: 16px 10px; text-align: center; border: 2px solid var(--border); }
.pricing-card.pricing-featured { border-color: var(--accent); background: linear-gradient(135deg, var(--bg), #fffbea); }
.pricing-name { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.pricing-price { font-size: 1.5rem; font-weight: 800; color: var(--slate); margin: 6px 0 2px; }
.pricing-sub { font-size: 0.78rem; color: var(--text-secondary); }

/* ═══ ROLE PICKER (Signup) ═══ */
.role-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.role-option { cursor: pointer; }
.role-option input[type="radio"] { display: none; }
.role-card { display: flex; flex-direction: column; align-items: center; padding: 14px 6px; border-radius: 12px; border: 2px solid var(--border); text-align: center; transition: all 0.2s; }
.role-card strong { font-size: 0.78rem; margin-top: 6px; color: var(--slate); }
.role-card small { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.role-option input:checked + .role-card { border-color: var(--accent); background: linear-gradient(135deg, #fffbea, var(--surface)); box-shadow: 0 0 0 2px var(--accent); }
.role-icon { font-size: 1.3rem; }

/* ═══ TEAM MANAGEMENT ═══ */
.team-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.team-row:last-child { border-bottom: none; }
.team-info { flex: 1; min-width: 0; }
.team-name { font-weight: 700; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-detail { font-size: 0.78rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.88rem; background: var(--bg); }

/* ═══ RESPONSIVE ═══ */

/* Small phones (≤360px) */
@media (max-width: 360px) {
  :root { --base-size: 14px; --bottom-nav-h: 64px; --top-bar-h: 48px; }
  .section-header h1 { font-size: 1.15rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .btn { padding: 12px 16px; font-size: 0.9rem; }
  .inspection-row { grid-template-columns: 24px 1fr auto; gap: 8px; padding: 10px 12px; }
  .ppe-header-row, .ppe-row { grid-template-columns: 1fr 28px 28px 28px 28px auto; gap: 4px; }
  .crew-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .crew-actions { width: 100%; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .site-map { height: 180px; }
  .tab-bar { font-size: 0.75rem; }
}

/* Standard phones (361-479px) — default styles apply */

/* Large phones / small tablets (480-767px) */
@media (min-width: 480px) {
  .main-content { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
  .site-map { height: 250px; }
}

/* ═══ SIDE NAV (hidden on mobile) ═══ */
.side-nav { display: none; }
.desktop-layout { display: flex; flex-direction: column; height: 100%; }
.app-main { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; }

/* Tablets (768px+) — sidebar + full-width content */
@media (min-width: 768px) {
  body { background: var(--bg); overflow: hidden; }
  #app { max-width: none; margin: 0; height: 100vh; border: none; border-radius: 0; }
  .desktop-layout { flex-direction: row; }
  .side-nav {
    display: flex;
    flex-direction: column;
    width: 220px;
    min-width: 220px;
    background: var(--slate);
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
  }
  .side-nav-brand {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .side-nav-logo {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .side-nav-project {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .side-nav-project-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .side-nav-project-addr {
    font-size: 0.78rem;
    color: #a0b0c0;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .side-nav-links {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
  }
  .side-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #a0b0c0;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    min-height: 40px;
  }
  .side-nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
  .side-nav-item.active { color: var(--accent); background: rgba(201,168,76,0.1); border-right: 3px solid var(--accent); }
  .side-nav-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
  }
  .side-nav-user {
    font-size: 0.8rem;
    color: #a0b0c0;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
  }
  .side-nav-actions { display: flex; flex-direction: column; gap: 2px; }

  .app-main { flex: 1; min-width: 0; }
  .bottom-nav { display: none; }
  .main-content { padding: 24px 28px; }
  .modal { border-radius: var(--radius-lg); align-self: center; }
  .toast-container { left: auto; right: 16px; width: 360px; }
  .site-map { height: 260px; }
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }

  /* Top bar: hide logo on desktop (sidebar shows it) */
  .top-bar .logo { display: none; }
  .top-bar .project-name { font-size: 0.95rem; font-weight: 700; color: #fff; }
  .top-bar { padding: 0 20px; }
}

/* Desktop (1024px+) — wider sidebar, 2-col grids */
@media (min-width: 1024px) {
  .side-nav { width: 250px; min-width: 250px; }
  .main-content { padding: 28px 36px; max-width: 1100px; }
  .quick-actions { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
  .card { padding: 20px; }
  .takeoff-table { font-size: 0.88rem; }
  .form-row input, .form-row select, .form-row textarea { font-size: 0.92rem; }
  .inspection-group { padding: 16px; }
  .punch-item { padding: 14px 16px; }
  .section-header h1 { font-size: 1.4rem; }
}

/* Ultra-wide (1440px+) — limit content width */
@media (min-width: 1440px) {
  .main-content { max-width: 1200px; padding: 32px 48px; }
  .quick-actions { grid-template-columns: repeat(6, 1fr); }
}

/* Desktop dashboard: 2-column card grid */
@media (min-width: 1024px) {
  .main-content > .section-header,
  .main-content > .weather-card,
  .main-content > .stats-grid,
  .main-content > .quick-actions,
  .main-content > .alert-banner { grid-column: 1 / -1; }
}

/* Auth screens: centered on desktop */
@media (min-width: 768px) {
  .auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
  }
  .auth-screen .auth-card {
    max-width: 400px;
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
}

/* ═══ QUICK ACTIONS ═══ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.quick-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  text-align: center;
  word-break: break-word;
}
.quick-btn:active { transform: scale(0.96); background: var(--surface-2); }
.quick-btn .icon-wrap { color: var(--slate); }

/* ═══ ALERT BANNER ═══ */
.alert-banner {
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--red);
}

/* ═══ WALK ITEMS ═══ */
.walk-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.walk-row:last-child { border-bottom: none; }
.walk-row .walk-date { font-weight: 700; color: var(--accent); font-size: 0.85rem; }
.walk-row .walk-detail { color: var(--text-secondary); font-size: 0.85rem; margin-top: 2px; }

.walk-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: start;
}
.walk-item-date { text-align: center; }
.walk-item-date .walk-day { font-weight: 700; font-size: 0.88rem; color: var(--accent); }
.walk-item-date .walk-time { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.walk-item-info .walk-inspector { font-weight: 600; font-size: 0.92rem; }
.walk-item-info .walk-location { font-size: 0.85rem; color: var(--text-secondary); margin-top: 3px; }
.walk-item-info .walk-notes { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; font-style: italic; }

/* ═══ SAFETY SCREEN ═══ */
.ppe-header-row {
  display: grid;
  grid-template-columns: 1fr 32px 32px 32px 32px auto;
  gap: 6px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.ppe-header-row .ppe-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
}
.ppe-row {
  display: grid;
  grid-template-columns: 1fr 32px 32px 32px 32px auto;
  gap: 6px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.ppe-row:last-child { border-bottom: none; }
.ppe-row.has-issue { background: var(--red-bg); margin: 0 -18px; padding: 10px 18px; border-radius: var(--radius); }
.ppe-row .worker-info .worker-name { font-weight: 600; font-size: 0.9rem; }
.ppe-row .worker-info .worker-trade { font-size: 0.78rem; color: var(--text-secondary); }
.ppe-row .ppe-grid { display: contents; }
.ppe-ok, .ppe-fail, .ppe-na { text-align: center; display: flex; align-items: center; justify-content: center; }
.ppe-na { color: var(--text-secondary); font-size: 0.8rem; }
.ppe-actions { display: flex; gap: 6px; align-items: center; }

.incident-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  border-left: 4px solid var(--orange);
}
.incident-item.recordable, .incident-item.lost_time { border-left-color: var(--red); }
.incident-item.near_miss { border-left-color: var(--orange); }
.incident-item.first_aid { border-left-color: var(--blue); }
.incident-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.incident-date { font-size: 0.82rem; color: var(--text-secondary); }
.incident-desc { font-size: 0.9rem; line-height: 1.4; }
.incident-worker { font-size: 0.82rem; color: var(--text-secondary); margin-top: 6px; }
.incident-corrective { font-size: 0.82rem; color: var(--green); margin-top: 4px; }

/* ═══ ACTIVITY FEED ═══ */
.activity-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  display: flex;
  gap: 8px;
}
.activity-row:last-child { border-bottom: none; }
.activity-action { font-weight: 600; white-space: nowrap; }
.activity-detail { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══ CREW ═══ */

/* Tab Bar */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  padding: 10px 6px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--slate);
  color: var(--accent);
}
.tab-btn:not(.active):hover { background: var(--surface-2); }

/* Site Map */
.site-map {
  background: var(--slate);
  border-radius: var(--radius);
  height: 220px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* Leaflet map container */
.crew-leaflet-map {
  width: 100%;
  height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 1;
}
@media (min-width: 768px) { .crew-leaflet-map { height: 420px; } }
@media (min-width: 1024px) { .crew-leaflet-map { height: 500px; } }

/* Custom Leaflet marker icons */
.map-worker-icon {
  width: 14px !important;
  height: 14px !important;
  background: var(--blue);
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.map-you-icon {
  width: 16px !important;
  height: 16px !important;
  background: var(--green);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(39, 174, 96, 0.3), 0 2px 6px rgba(0,0,0,0.3);
}
.map-bldg-icon {
  background: none;
  border: none;
}
.map-bldg-icon span {
  display: block;
  background: var(--accent);
  color: var(--slate);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  text-align: center;
}
.map-grid {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 18px, #fff 18px, #fff 19px),
    repeating-linear-gradient(90deg, transparent, transparent 18px, #fff 18px, #fff 19px);
}
.map-boundary {
  position: absolute;
  inset: 6%;
  border: 2px dashed rgba(201, 168, 76, 0.4);
  border-radius: var(--radius);
}
.bldg-zone {
  position: absolute;
  background: rgba(201, 168, 76, 0.12);
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: 6px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
}
.bldg-label {
  background: var(--accent);
  color: var(--slate);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.worker-pin {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--blue);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.15s;
}
.worker-pin:hover {
  transform: scale(1.6);
  z-index: 20;
}
.worker-pin .pin-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: var(--shadow);
}
.worker-pin:hover .pin-label { opacity: 1; }
.you-pin {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--green);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.3);
  z-index: 15;
}
.map-legend {
  position: absolute;
  bottom: 8px;
  left: 10px;
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: #c0cdd8;
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid #fff; }
.dot-worker { background: var(--blue); }
.dot-you { background: var(--green); }
.map-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Find Worker */
.find-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  min-height: 40px;
}
.find-input:focus { border-color: var(--blue); }
.worker-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.worker-list-row:last-child { border-bottom: none; }
.wl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.wl-info { flex: 1; }
.wl-info strong { color: var(--slate); }
.wl-sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 1px; }

/* Crew rows */
.crew-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.crew-row:last-child { border-bottom: none; }
.crew-info { flex: 1; min-width: 0; overflow: hidden; }
.crew-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crew-trade { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }
.crew-gps { font-size: 0.75rem; color: var(--green); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.crew-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.crew-gps-status { font-size: 0.82rem; color: var(--text-secondary); margin: 8px 0; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.photo-card {
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-thumb { width: 100%; height: 100px; object-fit: cover; }
.photo-placeholder { width: 100%; height: 100px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.photo-desc { font-size: 0.8rem; padding: 6px 8px; color: var(--text); font-weight: 500; }
.photo-meta { font-size: 0.78rem; padding: 0 8px 6px; color: var(--text-secondary); }

.msg-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.msg-row:last-child { border-bottom: none; }
.msg-to { color: var(--text-secondary); white-space: nowrap; }
.msg-text { color: var(--text); }

.icon-green { color: var(--green); }
.icon-blue { color: var(--blue); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-sm.crew-btn { font-size: 0.75rem; padding: 6px 10px; border-radius: 6px; min-height: 36px; }

/* ═══ SETTINGS ═══ */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
.settings-value { font-size: 0.9rem; color: var(--text); font-weight: 600; text-align: right; }
.settings-toggle-group { display: flex; gap: 4px; }
.settings-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  font-family: var(--font);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
}
.settings-toggle.active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}
.settings-toggle:hover { border-color: var(--border-hover); }
.top-bar-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #ffffff;
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  min-height: 36px;
  font-size: 0.75rem;
}
.top-bar-btn:hover { background: rgba(255,255,255,0.16); }
.top-bar-actions { display: flex; gap: 6px; align-items: center; }
.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--red, #e53e3e);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 99px;
  padding: 0 4px;
}

/* ═══ AI ASSISTANT ═══ */
.ai-hero {
  text-align: center;
  padding: 24px 16px 16px;
}
.ai-hero h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.3px; color: var(--slate); }
.ai-hero p { color: var(--text-secondary); font-size: 0.92rem; margin-top: 6px; }

.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}
.ai-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.ai-chip:active { background: var(--slate); border-color: var(--slate); color: var(--accent); transform: scale(0.96); }

.ai-chatbox {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ai-messages {
  padding: 16px;
  min-height: 120px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  max-width: 88%;
  line-height: 1.4;
}
.ai-msg.ai {
  background: var(--bg);
  border-left: 3px solid var(--accent);
  align-self: flex-start;
}
.ai-msg.user {
  background: var(--slate);
  color: #ffffff;
  align-self: flex-end;
  border: none;
}
.ai-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.ai-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
  font-family: var(--font);
  outline: none;
}
.ai-input:focus { border-color: var(--accent); }
.ai-input::placeholder { color: #5a6577; }

/* ═══ NOTIFY BUTTONS (Inspections) ═══ */
.btn-notify {
  border: none;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  margin-top: 4px;
  font-family: var(--font);
}
.btn-notify-green { background: var(--green); color: #fff; }
.btn-notify-green:active { background: #28a745; }
.btn-notify-orange { background: var(--orange); color: #fff; }
.btn-notify-orange:active { background: #e68a00; }

.insp-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.insp-toolbar { margin-bottom: 14px; display: flex; gap: 8px; }

/* ═══ PERMIT CALLOUT ═══ */
.permit-callout {
  background: var(--orange-bg);
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--orange);
  margin-top: 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ═══ PUNCH ENHANCEMENTS ═══ */
.dep-warning {
  background: var(--orange-bg);
  border: 1px solid rgba(255,149,0,0.3);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--orange);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.punch-trade { font-size: 0.85rem; color: var(--text-secondary); }
.punch-summary { display: flex; gap: 8px; margin-bottom: 12px; }
.punch-item .ai-badge {
  background: var(--blue-bg);
  color: var(--blue);
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 4px;
  font-weight: 600;
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}

/* ═══ STEP BAR (Procore forms) ═══ */
.step-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}
.step-item {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg);
  border-radius: 6px;
  color: var(--text-secondary);
}
.step-item.active { background: var(--accent); color: var(--slate); }
.step-item.done { background: var(--green-bg); color: var(--green); }

/* ═══ PTT RADIO ═══ */
.ptt-btn {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid var(--red, #e53e3e);
  background: var(--surface);
  font-size: 2.4rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ptt-btn:active, .ptt-btn.talking {
  background: var(--red, #e53e3e);
  transform: scale(1.08);
  box-shadow: 0 0 30px rgba(229, 62, 62, 0.5);
}

/* ═══ DRONE UPLOAD ═══ */
.drone-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drone-upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-bg, rgba(201, 168, 76, 0.06));
}

/* ═══ TRANSLATION OVERLAY ═══ */
.translate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s, visibility 0.25s;
}

/* ═══ SCHEDULE / GANTT ═══ */
.schedule-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.schedule-progress-ring {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.schedule-progress-ring .ring-visual {
  width: 64px;
  height: 64px;
  position: relative;
}
.schedule-progress-ring .ring-visual svg {
  transform: rotate(-90deg);
  width: 64px;
  height: 64px;
}
.schedule-progress-ring .ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
}
.schedule-progress-ring .ring-info {
  flex: 1;
}
.schedule-progress-ring .ring-info h3 {
  font-size: 0.88rem;
  margin-bottom: 4px;
  color: var(--text);
}
.schedule-progress-ring .ring-info .ring-stats {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.schedule-progress-ring .ring-info .ring-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.schedule-progress-ring .ring-info .ring-stats .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.gantt-container {
  position: relative;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.gantt-timeline-header {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px 8px calc(160px + 12px);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.gantt-timeline-header .today-label {
  color: var(--red);
  font-weight: 700;
}
.gantt-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  transition: background 0.12s;
  min-height: 52px;
}
.gantt-row:last-child { border-bottom: none; }
.gantt-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.gantt-label {
  width: 160px;
  min-width: 160px;
  padding: 8px 12px;
  border-right: 1px solid var(--border);
}
.gantt-task-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-task-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-bar-area {
  flex: 1;
  padding: 6px 12px;
  position: relative;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.gantt-bar {
  position: absolute;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}
.gantt-bar:hover {
  transform: scaleY(1.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.gantt-bar.status-complete {
  background: color-mix(in srgb, var(--green) 25%, transparent);
  border: 1.5px solid var(--green);
}
.gantt-bar.status-complete .gantt-bar-fill { background: var(--green); }
.gantt-bar.status-in_progress {
  background: color-mix(in srgb, var(--blue) 18%, transparent);
  border: 1.5px solid var(--blue);
}
.gantt-bar.status-in_progress .gantt-bar-fill { background: var(--blue); }
.gantt-bar.status-not_started {
  background: color-mix(in srgb, var(--text-secondary) 12%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--text-secondary) 40%, transparent);
}
.gantt-bar.status-not_started .gantt-bar-fill { background: var(--text-secondary); }
.gantt-bar.status-delayed {
  background: color-mix(in srgb, var(--red) 18%, transparent);
  border: 1.5px solid var(--red);
}
.gantt-bar.status-delayed .gantt-bar-fill { background: var(--red); }
.gantt-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.gantt-bar-pct {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.7;
}
.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red);
  z-index: 3;
  pointer-events: none;
}
.gantt-today::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--red);
  border-radius: 50%;
}

/* Schedule Task List - improved */
.task-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.task-list-filters {
  display: flex;
  gap: 6px;
}
.task-filter-btn {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.task-filter-btn.active, .task-filter-btn:hover {
  background: var(--accent);
  color: var(--accent-fg, #fff);
  border-color: var(--accent);
}

/* ═══ BUDGET PROGRESS ═══ */
.progress-bar-mini {
  height: 6px;
  border-radius: 3px;
  background: var(--slate-light);
  overflow: hidden;
  margin-top: 4px;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.progress-fill.over-budget { background: var(--red); }
.progress-fill.near-budget { background: var(--orange); }

/* ═══ SCHEDULE TASKS LIST ═══ */
.schedule-task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 8px;
  margin: 2px 0;
}
.schedule-task-row:hover { background: var(--accent-muted); }
.schedule-task-row:last-child { border-bottom: none; }
.schedule-task-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
}
.schedule-task-info {
  flex: 1;
  min-width: 0;
}
.schedule-task-progress {
  width: 48px;
  text-align: right;
  font-weight: 700;
  font-size: 0.82rem;
}
.schedule-task-bar {
  width: 60px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.schedule-task-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.schedule-task-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--text);
}
.schedule-task-info p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ═══ RFI / SUBMITTAL / CO CARDS ═══ */
.rfi-card, .submittal-card, .co-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.rfi-card:hover, .submittal-card:hover, .co-card:hover {
  border-color: var(--accent);
}
.rfi-card .card-header, .submittal-card .card-header, .co-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.rfi-card .card-number, .submittal-card .card-number, .co-card .card-number {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
}
.rfi-card .card-title, .submittal-card .card-title, .co-card .card-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 4px;
}
.rfi-card .card-meta, .submittal-card .card-meta, .co-card .card-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Budget summary cards */
.budget-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.budget-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.budget-summary-card .label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.budget-summary-card .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.budget-summary-card .value.negative { color: var(--red); }
.budget-summary-card .value.positive { color: var(--green); }
.translate-overlay.open {
  visibility: visible;
  opacity: 1;
}
.translate-panel {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px 24px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}
.lang-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s;
}
.lang-btn.active {
  background: var(--accent);
  color: var(--slate);
  border-color: var(--accent);
}
.chip {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); background: var(--accent-bg, rgba(201, 168, 76, 0.08)); }

/* ═══ WEATHER CARD ═══ */
.weather-card {
  background: linear-gradient(135deg, var(--slate) 0%, #2d3e5c 100%);
  color: #fff;
  border: none;
}
.weather-card .badge-pill { font-size: 0.72rem; }
.weather-temp {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  min-width: 80px;
}

/* ═══ ALERT CARDS (Notifications - enhanced) ═══ */
.alert-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 4px;
}
.alert-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══ PROCORE STATUS (Dashboard) ═══ */
.procore-row { display: flex; gap: 16px; font-size: 0.88rem; color: var(--text-secondary); }

/* ═══ INSPECTION TOOLBAR ═══ */
.insp-toolbar { margin-bottom: 12px; }

/* ═══ TOAST NOTIFICATIONS ═══ */
.toast-container {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
}
.toast {
  background: var(--slate);
  color: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
  line-height: 1.4;
}
.toast.toast-out {
  animation: toastOut 0.25s ease forwards;
}
.toast-offline { border-left: 4px solid var(--orange); }
.toast-online { border-left: 4px solid var(--green); }
.toast-sync { border-left: 4px solid var(--blue); }
.toast-update { border-left: 4px solid var(--accent); }
.toast-icon { font-size: 1.3rem; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  min-height: auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

/* ═══ PWA INSTALL BANNER ═══ */
.install-banner {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  gap: 14px;
  width: 90%;
  max-width: 380px;
  animation: slideUp 0.35s ease;
  border: 1px solid var(--border);
}
.install-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}
.install-banner-text {
  flex: 1;
}
.install-banner-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 2px;
}
.install-banner-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.install-banner-btn {
  background: var(--accent);
  color: var(--slate);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
}
.install-banner-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  min-height: auto;
  padding: 4px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(30px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
