/* ============================================================
   Builtsy App — Main Stylesheet  (mobile-first)
   ============================================================ */

:root {
  --navy: #0D1220;
  --navy-light: #12192F;
  --navy-mid: #1a2550;
  --lime: #C7FF3D;
  --lime-dark: #9ecc00;
  --blue: #4666E6;
  --blue-light: #eef0fd;
  --pink: #FF5BA7;
  --pink-light: #ffe0ef;
  --amber: #FEBC2E;
  --amber-light: #FFF0B3;
  --amber-dark: #D4980A;
  --green: #28C840;
  --green-light: #f0fdf4;
  --red: #ef4444;
  --red-light: #fee2e2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --white: #ffffff;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --bottom-nav-height: 64px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  /* Safe area for iOS notch/home bar */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px; -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--navy);
  color: var(--white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  width: 100%;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-family: inherit; }

/* Prevent iOS zoom on input focus — keep inputs at 16px */
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="date"],
select, textarea { font-size: 16px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.login-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Mobile: full-screen form, brand hidden */
.login-brand { display: none; }

.login-form-panel {
  width: 100%;
  background: var(--navy-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 24px;
}

/* Mobile login has logo at top */
.login-mobile-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}
.login-mobile-logo svg { width: 32px; height: 32px; }
.login-mobile-logo span {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.login-mobile-logo span em { color: var(--lime); font-style: normal; }

.login-form-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 400px;
}

.login-form-container h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-sub {
  color: rgba(255,255,255,.5);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.login-footer {
  color: rgba(255,255,255,.3);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 24px;
}
.login-footer a { color: var(--lime); font-weight: 500; }

/* Desktop: split panel */
@media (min-width: 768px) {
  .login-page { background: var(--navy); }
  .login-mobile-logo { display: none; }
  .login-brand {
    display: flex;
    flex: 1;
    background: var(--navy);
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
  }
  .login-brand::before {
    content: '';
    position: absolute;
    top: -100px; right: -100px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(199,255,61,.15) 0%, transparent 70%);
    pointer-events: none;
  }
  .login-brand::after {
    content: '';
    position: absolute;
    bottom: -80px; left: -80px;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(70,102,230,.10) 0%, transparent 70%);
    pointer-events: none;
  }
  .brand-content { max-width: 420px; position: relative; z-index: 1; }
  .brand-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; }
  .brand-logo-icon { width: 40px; height: 40px; }
  .brand-logo-name { font-size: 1.5rem; font-weight: 700; color: var(--white); letter-spacing: -0.02em; }
  .brand-logo-name span { color: var(--pink); }
  .brand-content h1 { font-size: 2rem; font-weight: 700; color: var(--white); line-height: 1.3; margin-bottom: 16px; letter-spacing: -0.02em; }
  .brand-content p { color: var(--gray-400); font-size: 1rem; line-height: 1.6; margin-bottom: 40px; }
  .brand-features { display: flex; flex-direction: column; gap: 12px; }
  .brand-feature { display: flex; align-items: center; gap: 10px; color: var(--gray-300); font-size: 0.9rem; }
  .brand-feature-dot { width: 20px; height: 20px; background: rgba(70,102,230,.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .brand-feature-dot::after { content: ''; width: 8px; height: 8px; background: var(--blue); border-radius: 50%; }

  .login-form-panel { width: 480px; padding: 60px 56px; }
  .login-form-container { max-width: 360px; }
  .login-form-container h2 { font-size: 1.5rem; }
  .login-sub { margin-bottom: 32px; }
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #4666E6;
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--white);
  background: rgba(255,255,255,.07);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  min-height: 48px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(199,255,61,.18);
}

.form-group input::placeholder { color: rgba(255,255,255,.3); }

.form-row {
  display: grid;
  grid-template-columns: 1fr;  /* single col on mobile */
  gap: 0;
}

.form-hint { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }

@media (min-width: 480px) {
  .form-row { grid-template-columns: 1fr 1fr; gap: 16px; }
}

/* ============================================================
   BUTTONS  — 44px min height everywhere
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 18px;          /* 44px+ touch target */
  min-height: 44px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  transition: all .15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: linear-gradient(135deg, #ccff33 0%, #C7FF3D 100%); color: #0D1220; box-shadow: 0 2px 12px rgba(199,255,61,.45); font-weight: 700; }
.btn-primary:active { background: #a3d400; transform: scale(.98); box-shadow: none; }

.btn-secondary { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); border: 1.5px solid #4666E6; }
.btn-secondary:active { background: rgba(70,102,230,.25); }

.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:active { background: var(--red); color: var(--white); }

.btn-ghost { background: transparent; color: rgba(255,255,255,.65); border: 1.5px solid #4666E6; }
.btn-ghost:active { background: rgba(70,102,230,.18); }

.btn-full { width: 100%; }
.btn-lg { padding: 14px 20px; font-size: 1rem; min-height: 52px; }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; min-height: 36px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Desktop hover states */
@media (hover: hover) {
  .btn-primary:hover { background: linear-gradient(135deg, #dcff4d 0%, #C7FF3D 100%); box-shadow: 0 4px 18px rgba(199,255,61,.6); transform: translateY(-1px); }
  .btn-secondary:hover { background: rgba(70,102,230,.2); border-color: #6685f0; }
  .btn-danger:hover { background: var(--red); color: var(--white); }
  .btn-ghost:hover { background: rgba(70,102,230,.15); }
}

/* ============================================================
   FLOATING ACTION BUTTON (FAB)
   ============================================================ */

.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px + var(--safe-bottom));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ccff33 0%, #C7FF3D 100%);
  color: #0D1220;
  border: none;
  box-shadow: 0 4px 16px rgba(199,255,61,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(.94); box-shadow: 0 2px 8px rgba(199,255,61,.45); }

/* On desktop: hide FAB (use topbar button instead) */
@media (min-width: 768px) { .fab { display: none; } }

/* ============================================================
   ERRORS & ALERTS
   ============================================================ */

.error-msg {
  background: var(--red-light);
  color: var(--red);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.hidden { display: none !important; }

/* ============================================================
   APP LAYOUT — mobile-first
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
  /* Bottom padding so content isn't hidden under bottom nav */
  padding-bottom: 0;
}

/* ── Sidebar ── */
/* Mobile: off-canvas slide-in drawer */
.sidebar {
  width: var(--sidebar-width);
  background: var(--navy);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 300;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .25s ease;
}

.sidebar.open { transform: translateX(0); }

/* Sidebar overlay (tap to close on mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 299;
}
.sidebar-overlay.open { display: block; }

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(70,102,230,.2);
}
.sidebar-wordmark {
  font-size: 1.35rem;
  font-weight: 300;
  color: rgba(255,255,255,.9);
  letter-spacing: -.04em;
  line-height: 1;
}
.sidebar-wordmark span {
  font-family: 'Dancing Script', 'Georgia', cursive;
  color: #FF5BA7;
  font-weight: 700;
  font-size: 1.55rem;
  font-style: normal;
}
.sidebar-wordmark em {
  font-family: 'Dancing Script', 'Georgia', cursive;
  color: #4666E6;
  font-style: normal;
  font-weight: 700;
  font-size: 1.55rem;
}

.sidebar-company { padding: 12px 20px 16px; border-bottom: 1px solid rgba(70,102,230,.2); }
.sidebar-company-name { font-size: 0.75rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;          /* taller touch target */
  color: var(--gray-400);
  font-size: 0.9rem;
  font-weight: 450;
  transition: all .15s;
  position: relative;
  min-height: 48px;
}
.nav-item:hover { color: var(--white); background: rgba(70,102,230,.18); }
.nav-item.active { color: #C7FF3D; background: rgba(70,102,230,.25); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: #C7FF3D;
  border-radius: 0 2px 2px 0;
}
.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(70,102,230,.2); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
  min-height: 48px;
}
.sidebar-user:hover { background: rgba(255,255,255,.05); }

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--blue);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 500; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--gray-500); text-transform: capitalize; }

/* ── Main content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  /* Full width on mobile (no sidebar offset) */
  margin-left: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-height);
  background: var(--navy-light);
  border-bottom: 1px solid rgba(70,102,230,.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Hamburger button (mobile only) */
.hamburger-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  padding: 8px;
  margin-left: -8px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.topbar-left h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subtitle hidden on mobile to save space */
.topbar-left p { display: none; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Page content ── */
.page-content {
  flex: 1;
  padding: 16px;
  /* Extra bottom padding so content clears the bottom nav */
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
}

/* ── Desktop sidebar override ── */
@media (min-width: 768px) {
  .sidebar {
    transform: translateX(0);   /* always visible */
    position: fixed;
  }
  .sidebar-overlay { display: none !important; }
  .hamburger-btn { display: none; }
  .main-content { margin-left: var(--sidebar-width); }
  .topbar {
    height: 64px;
    padding: 0 28px;
  }
  .topbar-left h1 { font-size: 1.1rem; }
  .topbar-left p { display: block; font-size: 0.8rem; color: var(--gray-500); }
  .page-content {
    padding: 28px;
    padding-bottom: 28px;       /* no bottom nav on desktop */
  }
  .bottom-nav { display: none; }
}

/* ============================================================
   BOTTOM NAV (admin: 4 items / worker: not used)
   ============================================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--navy-light);
  border-top: 1px solid rgba(70,102,230,.25);
  display: flex;
  align-items: stretch;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,.3);
  /* iOS: GPU compositing prevents touch-event freeze */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,.4);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: color .15s;
  padding: 6px 4px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.bottom-nav-item svg { width: 22px; height: 22px; }

.bottom-nav-item.active {
  color: #0D1220;
  font-weight: 700;
}

/* Lime pill behind active icon + label */
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  inset: 6px 6px;
  background: var(--lime);
  border-radius: 10px;
  z-index: -1;
}

/* Worker bottom nav — just 1 item, looks different */
.bottom-nav-worker {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(56px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 20px var(--safe-bottom);
  z-index: 100;
  gap: 12px;
  box-shadow: 0 -4px 12px rgba(0,0,0,.06);
}

@media (min-width: 768px) {
  .bottom-nav-worker { display: none; }
}

/* ============================================================
   STAT CARDS — 2 col on mobile
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-amber { background: rgba(199,255,61,.18);  color: var(--lime);  box-shadow: 0 0 16px rgba(199,255,61,.35); }
.stat-icon-blue  { background: rgba(70,102,230,.2);    color: #8ba2f0;    box-shadow: 0 0 16px rgba(70,102,230,.4); }
.stat-icon-green { background: rgba(40,200,64,.2);    color: #86EFAC;    box-shadow: 0 0 16px rgba(40,200,64,.45); }
.stat-icon-red   { background: rgba(239,68,68,.18);   color: #f87171;    box-shadow: 0 0 16px rgba(239,68,68,.3); }

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  margin-bottom: 3px;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: rgba(70,102,230,.8);
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* 4-col on large screens */
@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
  }
  .stat-card { padding: 20px 24px; gap: 16px; }
  .stat-icon { width: 44px; height: 44px; }
  .stat-value { font-size: 1.75rem; }
  .stat-label { font-size: 0.8rem; }
}

/* ============================================================
   CARDS & PANELS
   ============================================================ */

.card {
  background: var(--navy-light);
  border: 1px solid rgba(70,102,230,.3);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Cascade dark text colors to all children */
  --gray-50:  rgba(255,255,255,.02);
  --gray-100: rgba(255,255,255,.04);
  --gray-200: rgba(255,255,255,.08);
  --gray-300: rgba(255,255,255,.14);
  --gray-400: rgba(255,255,255,.38);
  --gray-500: rgba(255,255,255,.5);
  --gray-600: rgba(255,255,255,.62);
  --gray-700: rgba(255,255,255,.75);
  --gray-800: rgba(255,255,255,.88);
  --gray-900: rgba(255,255,255,.96);
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(70,102,230,.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #4666E6;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.card-body { padding: 0; }

@media (min-width: 768px) {
  .card-header { padding: 18px 24px; }
  .card-title { font-size: 0.72rem; }
}

/* ============================================================
   TABLES — scrollable on mobile
   ============================================================ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x; }

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(70,102,230,.85);
  text-transform: uppercase;
  letter-spacing: .08em;
  background: rgba(70,102,230,.06);
  border-bottom: 1px solid rgba(70,102,230,.25);
  white-space: nowrap;
}

tbody td {
  padding: 14px 12px;
  font-size: 0.85rem;
  color: rgba(255,255,255,.82);
  border-bottom: 1px solid rgba(70,102,230,.2);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: rgba(255,255,255,.02); }
tbody tr:hover td { background: rgba(70,102,230,.1); }
.td-primary { font-weight: 500; color: var(--white); }

@media (min-width: 768px) {
  thead th { padding: 11px 16px; font-size: 0.72rem; }
  tbody td  { padding: 15px 16px; font-size: 0.875rem; }
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  text-transform: none;
}

.badge-active    { background: var(--lime);  color: #0D1220; }
.badge-hold      { background: var(--pink);  color: #fff; }
.badge-done      { background: var(--blue);  color: #fff; }
.badge-progress  { background: var(--blue);  color: #fff; }
.badge-cancelled { background: var(--gray-300); color: var(--gray-700); }
.badge-pending   { background: var(--gray-200); color: var(--gray-600); }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p  { font-size: 0.875rem; margin-bottom: 20px; }

/* ============================================================
   MODAL — bottom sheet on mobile, centered on desktop
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;       /* bottom sheet on mobile */
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--navy-light);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; /* rounded top on mobile */
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.25,.46,.45,.94);
}

.modal-overlay.open .modal { transform: translateY(0); }

/* Modal drag handle */
.modal::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--gray-300);
  border-radius: 99px;
  margin: 12px auto 0;
}

.modal-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(70,102,230,.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--navy-light);
  z-index: 1;
}

.modal-title { font-size: 1rem; font-weight: 600; color: var(--white); }

.modal-close {
  background: none;
  border: none;
  color: var(--gray-400);
  padding: 6px;
  border-radius: 50%;
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:active { background: var(--gray-100); }

.modal-body { padding: 20px; }

.modal-footer {
  padding: 16px 20px;
  padding-bottom: calc(16px + var(--safe-bottom));
  border-top: 1px solid rgba(70,102,230,.25);
  display: flex;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--navy-light);
}

.modal-footer .btn { flex: 1; }  /* full-width buttons on mobile */

/* Desktop modal: centered, not bottom sheet */
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 20px; }
  .modal {
    border-radius: var(--radius-lg);
    max-width: 520px;
    max-height: 90vh;
    transform: translateY(12px) scale(.98);
  }
  .modal-overlay.open .modal { transform: translateY(0) scale(1); }
  .modal::before { display: none; }
  .modal-header { position: static; padding: 20px 24px; }
  .modal-body { padding: 24px; }
  .modal-footer { position: static; padding: 16px 24px; padding-bottom: 16px; }
  .modal-footer .btn { flex: initial; }
}

/* ============================================================
   TOAST — above bottom nav on mobile
   ============================================================ */

.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 12px);
  left: 16px;
  right: 16px;
  max-width: 400px;
  margin: 0 auto;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transform: translateY(16px);
  opacity: 0;
  transition: all .25s;
  text-align: center;
}

@media (min-width: 768px) {
  .toast {
    bottom: 24px;
    left: auto;
    right: 24px;
    max-width: 360px;
    text-align: left;
  }
}

.toast-show { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--navy); color: var(--white); }
.toast-error   { background: var(--red);  color: var(--white); }
.toast-warning { background: var(--lime); color: var(--navy); }

/* ============================================================
   LOADING
   ============================================================ */

.loading-spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.page-loader { display: flex; align-items: center; justify-content: center; min-height: 200px; }

/* ============================================================
   AVATARS / WORKER CHIPS
   ============================================================ */

.avatar-stack { display: flex; }
.avatar-chip {
  width: 28px; height: 28px;
  background: var(--blue); color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700;
  border: 2px solid var(--white);
  margin-left: -8px;
}
.avatar-chip:first-child { margin-left: 0; }

/* ============================================================
   SECTION HEADINGS
   ============================================================ */

.section-heading {
  font-size: 0.68rem;
  font-weight: 700;
  color: #4666E6;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 12px;
  margin-top: 24px;
}
.section-heading:first-child { margin-top: 0; }

/* ============================================================
   LIST ROWS (shared by tasks, logs, workers)
   ============================================================ */

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(70,102,230,.22);
  min-height: 64px;
  transition: background .1s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: rgba(70,102,230,.12); }

@media (min-width: 768px) {
  .list-row { padding: 14px 20px; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: rgba(255,255,255,.5); }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.two-col   { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }
.three-col { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }

@media (min-width: 640px) {
  .two-col   { grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
  .three-col { grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
}
@media (min-width: 1024px) {
  .three-col { grid-template-columns: 1fr 1fr 1fr; }
}

/* Forgot password */
.forgot-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--gray-500);
  min-height: 44px;
  line-height: 44px;
}
.forgot-link:hover { color: var(--blue); }

/* ============================================================
   PULL-TO-REFRESH INDICATOR (CSS only, UX polish)
   ============================================================ */

.ptr-indicator {
  text-align: center;
  padding: 12px;
  color: var(--gray-400);
  font-size: 0.75rem;
  display: none;
}

/* ============================================================
   JOB CARD — status-colored left border + tint
   ============================================================ */

.job-card-active {
  border-left: 4px solid var(--green) !important;
  background: #f0fdf4 !important;
}
.job-card-hold {
  border-left: 4px solid var(--pink) !important;
  background: rgba(255,91,167,.1) !important;
}
.job-card-completed {
  border-left: 4px solid var(--blue) !important;
  background: #eceffe !important;
}
.job-card-cancelled {
  border-left: 4px solid var(--gray-300) !important;
  background: var(--gray-50) !important;
}

/* Table row status indicator (left border on td) */
.tr-active td:first-child   { border-left: 3px solid #C7FF3D; }
.tr-hold td:first-child      { border-left: 3px solid var(--pink); }
.tr-completed td:first-child { border-left: 3px solid var(--blue); }
.tr-cancelled td:first-child { border-left: 3px solid var(--gray-300); }

/* ============================================================
   DARK HERO CARD — worker job header
   ============================================================ */

.hero-card {
  background: linear-gradient(145deg, var(--navy-light) 0%, var(--navy) 100%);
  border: 1px solid rgba(70,102,230,.3);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  color: var(--white);
}

.hero-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #4666E6;
  margin-bottom: 6px;
}

.hero-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.hero-card-sub {
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-bottom: 16px;
}

.hero-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.hero-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: var(--gray-300);
}

.hero-meta-chip svg { opacity: .7; }

.hero-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 6px;
  color: var(--gray-400);
}

.hero-progress-label span:last-child {
  font-weight: 700;
  color: var(--lime);
}

.hero-progress-bar {
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.hero-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--lime-dark), var(--lime));
  box-shadow: 0 0 10px rgba(199,255,61,.6);
  transition: width .4s ease;
}

@media (min-width: 768px) {
  .hero-card { padding: 28px; }
  .hero-card-title { font-size: 1.5rem; }
}

/* ============================================================
   MOBILE APP POLISH — card-style table rows + filter bars
   ============================================================ */

/* Admin tables: card rows on mobile (req-table, exp-table) */
@media (max-width: 767px) {
  .req-table, .exp-table {
    border-collapse: separate;
    border-spacing: 0 6px;
    margin-top: -6px;
  }
  /* Each row = tappable card */
  .req-table tbody tr, .exp-table tbody tr {
    background: rgba(255,255,255,.05) !important;
  }
  .req-table tbody td, .exp-table tbody td {
    border: none !important;
    border-top: 1px solid rgba(70,102,230,.18) !important;
    border-bottom: 1px solid rgba(70,102,230,.18) !important;
    background: transparent !important;
    padding: 10px 12px;
  }
  .req-table tbody td:first-child, .exp-table tbody td:first-child {
    border-left: 1px solid rgba(70,102,230,.18) !important;
    border-radius: 10px 0 0 10px;
  }
  .req-table tbody td:last-child, .exp-table tbody td:last-child {
    border-right: 1px solid rgba(70,102,230,.18) !important;
    border-radius: 0 10px 10px 0;
  }

  /* Summary cards: 2-up grid instead of horizontal scroll */
  .summary-strip {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .summary-card { min-width: 0 !important; }
  .summary-val { font-size: 1.25rem !important; }

  /* Filter bars: stack vertically, full-width controls */
  .filter-bar {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .filter-bar select,
  .filter-bar input[type="text"],
  .filter-bar input[type="date"] {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 16px !important; /* prevent iOS zoom */
  }
  .filter-bar .btn-export,
  .filter-bar .btn-add {
    width: 100% !important;
    justify-content: center !important;
    min-height: 44px !important;
    margin-left: 0 !important;
  }
}

/* AI dashboard: sticky chat input above bottom nav */
.vf-chat-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: #0D1220;
  border-top: 1px solid rgba(255,255,255,.06);
  /* iOS: GPU compositing layer prevents touch-event freeze */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}

/* On desktop (sidebar present), offset the footer */
@media (min-width: 768px) {
  .vf-chat-footer { left: 240px; /* var(--sidebar-width) */ }
}
