/* ========== Base / Reset ========== */
* { box-sizing: border-box; }
html, body { height: 100%; }

:root{
  /* Brand colors sampled from the new logo */
  --brand: #4DA763;         /* green */
  --brand-dark: #2F8B4A;
  --brand-light: rgba(77,167,99,0.08);
  --brand-hover: rgba(77,167,99,0.12);

  /* Light theme */
  --text: #151F1C;          /* near-black */
  --muted: #4C5059;         /* charcoal */
  --bg: #F7FAF8;            /* soft off-white */
  --panel: #FFFFFF;
  --panel-strong: #FFFFFF;

  --border: rgba(21,31,28,0.08);
  --border-strong: rgba(21,31,28,0.14);
  --border-brand: rgba(77,167,99,0.20);
  --shadow: 0 4px 16px rgba(21,31,28,0.06), 0 1px 4px rgba(21,31,28,0.04);
  --shadow-hover: 0 8px 24px rgba(21,31,28,0.08), 0 2px 8px rgba(21,31,28,0.06);
  --shadow-brand: 0 4px 20px rgba(77,167,99,0.15), 0 1px 4px rgba(77,167,99,0.10);

  /* Helper tokens */
  --stroke: var(--border);
  --radius: 18px;
  --radius-sm: 14px;
  --radius-lg: 24px;
  --radius2: var(--radius);

  /* Legacy tokens kept for compatibility */
  --success: var(--brand);
  --danger: #E44D4D;
  --warn: #F2B84B;

  --container: 1100px;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container{
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.muted{ color: var(--muted); opacity: 1; }
.lead{ font-size: clamp(1.05rem, 1.2vw, 1.2rem); color: var(--muted); }

.skip-link{
  position: absolute;
  left: -999px;
  top: 0;
  padding: 10px 12px;
  background: #fff;
  color: #000;
  border-radius: 10px;
  z-index: 9999;
}
.skip-link:focus{ left: 12px; top: 12px; }

/* ========== Header ========== */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 1px 2px rgba(21,31,28,0.03);
}

.header-inner{
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  padding: 18px 20px;
  gap: 18px;
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 14px;
}

.header-inner > .brand{
  grid-column: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Mobile language toggle for index page */
.lang-switch-mobile {
  display: none; /* Hidden by default */
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

/* Mobile language toggle for index page */
@media (max-width: 920px) {
  /* Hide desktop language toggle on mobile for index page */
  body[data-page="landing"] .lang-switch-desktop {
    display: none;
  }
  
  /* Show mobile language toggle */
  body[data-page="landing"] .lang-switch-mobile {
    display: inline-flex;
  }
  
  /* Ensure logo stays centered on mobile for index page */
  body[data-page="landing"] .header-inner {
    grid-template-columns: 1fr auto;
    position: relative;
  }
  
  body[data-page="landing"] .header-inner > .brand {
    grid-column: 1;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
  }
  
  /* Position language toggle on the right */
  body[data-page="landing"] .lang-switch-mobile {
    grid-column: 2;
    position: relative;
    right: 0;
    top: auto;
    transform: none;
  }
  
  /* Hide header-actions on mobile for index page (or adjust as needed) */
  body[data-page="landing"] .header-actions {
    display: none;
  }
}

.brand{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--text);
}

.brand-logo{
  height: 84px;
  width: auto;
  display: block;
}
.footer-brand .footer-logo,
.footer-logo{ 
  height: 38px; 
}

.brand-mark{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(77,167,99,0.18), rgba(47,139,74,0.14));
  border: 1px solid var(--border);
}
.brand-name{ font-size: 1.05rem; }

/* Nav */
.nav{ display: flex; align-items: center; gap: 10px; }
.nav-menu{
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-link{
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.nav-link:hover{
  background: var(--brand-light);
  color: var(--brand-dark);
}
.nav-link.active{
  color: var(--brand-dark);
  background: var(--brand-light);
  font-weight: 600;
}

/* Mobile menu button */
.nav-toggle{
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 6px 16px rgba(21,31,28,0.14);
  cursor: pointer;
}
.hamburger{
  width: 18px;
  height: 2px;
  background: var(--muted);
  display: inline-block;
  position: relative;
}
.hamburger::before,
.hamburger::after{
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--muted);
}
.hamburger::before{ top: -6px; }
.hamburger::after{ top: 6px; }

.sr-only{
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Language switch */
.header-actions{ display: flex; align-items: center; gap: 10px; }

/* Header Avatar Button */
.header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--panel);
  box-shadow: 0 2px 8px rgba(21,31,28,0.1);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  text-decoration: none;
}
.header-avatar:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(77,167,99,0.2);
  border-color: var(--border-brand);
}
.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.header-avatar-initials {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-switch{
  display: inline-flex;
  background: rgba(77,167,99,0.06);
  border: 1px solid rgba(77,167,99,0.18);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}
.chip{
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.chip[aria-pressed="true"]{
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow-brand);
}
.chip:hover:not([aria-pressed="true"]){
  background: var(--brand-light);
  color: var(--brand-dark);
}

/* ========== Sections ========== */
.section{ padding: 64px 0; }

.section.alt{
  background: radial-gradient(900px 500px at 10% 0%, rgba(77,167,99,0.14), transparent 55%),
              radial-gradient(700px 420px at 90% 20%, rgba(77,167,99,0.10), transparent 55%);
  border-top: 1px solid rgba(21,31,28,0.06);
  border-bottom: 1px solid rgba(21,31,28,0.06);
}

.section-head{ margin-bottom: 18px; }
.section-head h2{
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

/* Hero */
.hero{
  padding: 64px 0 32px;
  background:
    radial-gradient(900px 540px at 20% 10%, rgba(77,167,99,0.16), transparent 55%),
    radial-gradient(900px 540px at 80% 20%, rgba(47,139,74,0.12), transparent 55%);
}
.hero-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
  max-width: 800px;
  margin: 0 auto;
}
.hero-copy h1{
  margin: 0 0 14px;
  font-size: clamp(2rem, 3.2vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.6px;
  color: var(--text);
  font-weight: 800;
}

.cta-row{ display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0 14px; justify-content: center; }
.cta-row .btn{ font-size: 1.15rem; padding: 14px 32px; }
.trust-row{ display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.pill{
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pill:hover{
  background: var(--brand-light);
  border-color: var(--border-brand);
  color: var(--brand-dark);
}

/* Cards */
.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover{
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}
.card-header{ padding: 18px 18px 10px; }
.card-header h2, .card-header h3{ margin: 0 0 6px; color: var(--text); }
.card-footer{ padding: 14px 18px 18px; }

.hero-card .card{ overflow: hidden; }

/* Dashboard Grid */
.completion-status-card {
  margin-bottom: 32px;
}

.prequal-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.prequal-dashboard-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 44px;
}

.prequal-dashboard-item .dashboard-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.prequal-dashboard-item .dashboard-status span:not(.dot) {
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  flex: 1;
  min-width: 0;
}

.prequal-dashboard-item .btn {
  flex-shrink: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.dashboard-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dashboard-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.dashboard-status .dot {
  flex-shrink: 0;
}

.dashboard-status h2 {
  margin: 0;
  font-size: 1.1rem;
}

.dashboard-card-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-card-actions .btn {
  flex: 1 1 auto;
  min-width: 120px;
}

.dashboard-card-actions .btn.small {
  min-width: 80px;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.dashboard-upload-form {
  margin-top: 12px;
}

.dashboard-upload-form .field {
  margin-bottom: 12px;
}

.dashboard-upload-form .btn {
  width: 100%;
  margin-top: 8px;
}

.dashboard-current-file {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.dashboard-current-file .kv-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.dashboard-current-file .kv-val {
  font-weight: 600;
}

@media (max-width: 920px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.checklist{
  list-style: none;
  padding: 0 18px 4px;
  margin: 0;
  display: grid;
  gap: 10px;
}
.checklist li{
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--brand-light);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.checklist li:hover{
  background: var(--brand-hover);
  border-color: var(--border-brand);
  transform: translateX(2px);
}
.check{
  width: 18px; 
  height: 18px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  background: var(--panel);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.check.checked,
.checklist li.completed .check{
  background: var(--brand);
  border-color: var(--brand-dark);
}
.check.checked::after,
.checklist li.completed .check::after{
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* Buttons / links */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(21,31,28,0.04);
}
.btn:hover{ 
  transform: translateY(-2px); 
  background: var(--brand-light);
  color: var(--brand-dark);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-brand);
}
.btn.primary{
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: white;
  border-color: var(--brand-dark);
  box-shadow: var(--shadow-brand);
}
.btn.primary:hover{
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(77,167,99,0.25), 0 2px 8px rgba(77,167,99,0.15);
  background: linear-gradient(135deg, #5BB875 0%, #359650 100%);
}
.btn.ghost{ 
  background: transparent; 
  border-color: var(--border);
  box-shadow: none;
}
.btn.ghost:hover{
  background: var(--brand-light);
  border-color: var(--border-brand);
  color: var(--brand-dark);
}
.btn.small{ 
  padding: 10px 16px; 
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}

.mini-link{
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.mini-link:hover{
  background: var(--brand);
  border-color: var(--brand-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(77,167,99,0.2);
}

/* Grids */
.grid-3{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.feature{ padding: 18px; }
.feature h3{ margin: 0 0 8px; color: var(--text); }

/* Value Proposition Section */
.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}
.value-card {
  text-align: center;
  padding: 24px 20px;
}
.value-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}
.value-card h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 700;
}
.value-card p {
  margin: 0;
  line-height: 1.6;
}

/* Tools Section */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 32px;
}
.tool-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}
.tool-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text);
  font-weight: 700;
  flex: 1;
}
.tool-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-light);
  border: 1px solid var(--border-brand);
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tool-card p {
  margin: 0 0 16px;
  flex: 1;
  line-height: 1.6;
}
.tool-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tool-feature {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(77,167,99,0.06);
  border: 1px solid rgba(77,167,99,0.15);
  color: var(--brand-dark);
  font-size: 0.8rem;
  font-weight: 500;
}
.tool-card .btn {
  margin-top: auto;
  align-self: flex-start;
}

/* Steps Section */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}
.step-item {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.step-number {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(77,167,99,0.25);
}
.step-content {
  flex: 1;
}
.step-content h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 700;
}
.step-content p {
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 940px){
  .value-grid,
  .tools-grid,
  .steps-grid {
    grid-template-columns: 1fr;
  }
  .step-item {
    flex-direction: column;
    gap: 12px;
  }
}

.steps{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.step{ padding: 18px; }
.step-num{
  width: 36px;
  height: 36px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Footer */
.site-footer{
  padding: 34px 0 16px;
  border-top: 1px solid rgba(21,31,28,0.10);
  color: var(--text);
}
.footer-inner{
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-links{
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.footer-links a{
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.footer-links a:hover{
  background: var(--brand-light);
  border-color: var(--border-brand);
  color: var(--brand-dark);
  transform: translateY(-1px);
}
.footer-bottom{
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(21,31,28,0.10);
}

/* ===== Auth Pages ===== */

/* ============================
   Standalone Auth Pages (Login/Signup)
   Centers the auth card and shows a large logo above it
   ============================ */
.auth-page {
  background: var(--bg);
  color: var(--text);
}

.auth-center{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px 16px;
}

.auth-logo-wrap{
  display: inline-flex;
  justify-content: center;
  margin-bottom: 8px;
}

.auth-logo{
  width: min(320px, 75vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 26px rgba(21,31,28,.10));
}

.auth-card{
  width: min(520px, 92vw);
}

.auth-links{
  display: flex;
  gap: 10px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Ensure headings on auth pages are readable */
.auth-page h1, .auth-page h2 {
  color: var(--text);
}


.auth-wrap { padding: 40px 0 70px; }
.auth-grid{
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 18px;
  align-items: start;
}
.auth-card{ padding-bottom: 18px; }
.auth-title{ margin: 0 0 6px; font-size: clamp(1.6rem, 2.2vw, 2rem); color: var(--text); }

.field{ display: grid; gap: 6px; }
.field-label{ color: var(--muted); font-weight: 650; font-size: 0.95rem; }

input, select, textarea{
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  outline: none;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input::placeholder, textarea::placeholder{
  color: rgba(76,80,89,0.75);
}

input:hover, select:hover, textarea:hover{
  border-color: var(--border-strong);
}

input:focus, select:focus, textarea:focus{
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(77,167,99,0.1);
  border-color: rgba(77,167,99,0.55);
  box-shadow: 0 0 0 3px rgba(77,167,99,0.18);
}

.form-error{
  margin: 0;
  color: var(--danger);
  min-height: 1.2em;
}
.tiny{ font-size: 0.95rem; }
.mini-link.inline{ display: inline-flex; margin-left: 8px; }

.auth-side{
  padding: 18px;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: rgba(77,167,99,0.06);
  color: var(--text);
}
@media (max-width: 940px){
  .auth-grid{ grid-template-columns: 1fr; }
}

/* ===== Prequal + COI helpers ===== */
.page-title { margin: 0 0 8px; font-size: clamp(1.7rem, 2.4vw, 2.2rem); color: var(--text); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pad { padding: 18px; }
.mt { margin-top: 16px; }

.row-between { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.divider { height: 1px; background: rgba(21,31,28,0.10); margin: 14px 0; }

.h2 { margin: 0 0 6px; font-size: 1.25rem; color: var(--text); }
.h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--text); }

.small { font-size: 0.95rem; color: var(--muted); }

.status-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.status-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: rgba(77,167,99,0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.status-title { font-weight: 750; }
.status-text { display: grid; gap: 2px; }

.dot { width: 12px; height: 12px; border-radius: 999px; border: 1px solid rgba(21,31,28,0.18); }
.dot-off { background: var(--panel); }
.dot-on  { background: rgba(77,167,99,0.30); border-color: rgba(77,167,99,0.48); }

.badge {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(77,167,99,0.06);
  font-weight: 750;
  color: var(--text);
}
.badge-ok {
  border-color: rgba(77,167,99,0.50);
  background: rgba(77,167,99,0.16);
}
.badge-wip {
  border-color: var(--border);
}
.badge-warn {
  border-color: rgba(242,184,75,0.55);
  background: rgba(242,184,75,0.16);
}

.form-grid { display: grid; gap: 12px; }

.kv { display: grid; gap: 10px; }
.kv-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: baseline; }
.kv-val { font-weight: 700; color: var(--text); }

.note {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(77,167,99,0.06);
  color: var(--text);
}
.note.warn {
  border-color: rgba(242,184,75,0.55);
  background: rgba(242,184,75,0.16);
}

/* Support page styles */
.contact-info {
  display: grid;
  gap: 14px;
}
.contact-item {
  display: grid;
  gap: 6px;
}
.contact-item strong {
  font-weight: 600;
  color: var(--text);
}
.contact-item a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-color: rgba(77,167,99,0.3);
  transition: all 0.2s;
}
.contact-item a:hover {
  color: var(--brand-dark);
  text-decoration-color: var(--brand);
}

.faq-section {
  margin-top: 32px;
}

.dashboard-top-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
  margin-bottom: 32px;
}

.account-info-card {
  min-width: 0;
}

.facebook-feed-card {
  min-width: 0;
}

.facebook-feed-container {
  width: 100%;
  min-height: 400px;
  overflow: hidden;
  display: block;
}

/* Force Facebook plugin to fill container width */
.facebook-feed-container .fb-page {
  width: 100% !important;
  max-width: 100% !important;
  display: block;
}

.facebook-feed-container .fb-page > span {
  width: 100% !important;
  max-width: 100% !important;
  display: block;
}

.facebook-feed-container .fb-page iframe,
.facebook-feed-container iframe {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  display: block;
}

@media (max-width: 900px) {
  .dashboard-top-grid {
    grid-template-columns: 1fr;
  }
}

.quick-links-section {
  margin-top: 0;
}

.faq-item {
  margin-bottom: 0;
}
.faq-item:last-child {
  margin-bottom: 0;
}

.bullets {
  list-style: none;
  padding: 0;
  padding-left: 8px;
  margin: 0;
  display: grid;
  gap: 8px;
}
.bullets li::before {
  content: "•";
  color: var(--brand);
  font-weight: bold;
  display: inline-block;
  width: 1em;
  margin-left: -1em;
}
.bullets li a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-color: rgba(77,167,99,0.3);
  transition: all 0.2s;
}
.bullets li a:hover {
  color: var(--brand-dark);
  text-decoration-color: var(--brand);
}

@media (max-width: 940px){
  .grid-2 { grid-template-columns: 1fr; }
  .kv-row { grid-template-columns: 1fr; }
}

/* ===== Account Page Styles ===== */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

.page-title {
  margin-bottom: 32px;
}

.page-title h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 2.4vw, 2.2rem);
  color: var(--text);
}

.page-title .muted {
  font-size: 1rem;
  line-height: 1.5;
}

/* Account page specific card padding */
.account-page .card,
.page-wrap .card {
  padding: 24px;
}

.account-page .card h2,
.page-wrap .card h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.account-page .card .muted,
.page-wrap .card .muted {
  margin-bottom: 0;
  line-height: 1.6;
}

.profile-picture-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 24px 0;
}
.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--panel);
  box-shadow: 0 4px 16px rgba(21,31,28,0.12);
  position: relative;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-initials {
  font-size: 2.5rem;
  font-weight: 800;
  color: white;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-section {
  margin-bottom: 32px;
  padding: 0;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--text);
  font-weight: 700;
}

.form-section .muted {
  margin-bottom: 16px;
  display: block;
}

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

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.4;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="file"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(77, 167, 99, 0.1);
}

.form-group input[type="file"] {
  padding: 8px 12px;
  cursor: pointer;
}

.form-group .small.muted {
  margin-top: 6px;
  display: block;
  font-size: 0.85rem;
  line-height: 1.4;
}

.current-email-display {
  font-weight: 600;
  margin: 4px 0 20px;
  font-size: 1rem;
  color: var(--text);
  padding: 8px 0;
}

.account-page .divider {
  margin: 24px 0;
}

.account-page .card form {
  margin-top: 0;
}

.account-page .btn {
  margin-top: 4px;
}

/* Account page grid layout */
.account-page .grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .account-page .grid {
    grid-template-columns: 1fr;
  }
  
  .account-page .page-wrap {
    padding: 20px 16px;
  }
}
.form-msg {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(77,167,99,0.1);
  border: 1px solid rgba(77,167,99,0.2);
  color: var(--brand-dark);
  font-size: 0.9rem;
  display: none;
  line-height: 1.5;
  margin-top: 12px;
}

.form-msg:not(:empty) {
  display: block;
}

.form-error {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(228,77,77,0.1);
  border: 1px solid rgba(228,77,77,0.2);
  color: #C53030;
  font-size: 0.9rem;
  display: none;
  line-height: 1.5;
  margin-top: 12px;
}

.form-error:not(:empty) {
  display: block;
}
  font-size: 0.9rem;
  display: none;
}

/* ===== W-9 preview overlay ===== */
.w9-stage{
  width: 100%;
  overflow: auto;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(77,167,99,0.06);
}
.w9-sheet{
  position: relative;
  width: 816px;
  height: 1056px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.w9-bg{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.w9-txt, .w9-check{
  position: absolute;
  left: calc(var(--x) * 1px);
  top: calc(var(--y) * 1px);
  z-index: 2;
  pointer-events: none;
}
.w9-txt{
  width: calc(var(--w, 200) * 1px);
  font-size: calc(var(--size, 14) * 1px);
  line-height: 1.1;
  color: #111;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.w9-check{
  width: 12px;
  height: 12px;
  border: 2px solid #111;
  border-radius: 2px;
  background: transparent;
  opacity: 0;
}
.w9-check.on{
  opacity: 1;
  background:
    linear-gradient(45deg, transparent 45%, #111 46%, #111 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #111 46%, #111 54%, transparent 55%);
}

.fieldset{
  border: 1px solid var(--border);
  background: rgba(77,167,99,0.06);
  border-radius: 16px;
  padding: 12px;
  color: var(--text);
}

.radio-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.radio{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(77,167,99,0.06);
  color: var(--text);
}
.grid-2.tight{ gap: 10px; }

/* ===== Agreement helpers ===== */
.legal { color: var(--text); }
.legal h4 { margin: 14px 0 6px; font-size: 1.02rem; }
.legal p { margin: 0 0 10px; line-height: 1.55; color: var(--muted); }
.legal-title { margin: 0 0 10px; font-size: 1.15rem; letter-spacing: 0.02em; }
.legal-ol { margin: 8px 0 12px 20px; }
.legal-ol li { margin: 8px 0; line-height: 1.5; }

.pdf-frame{
  width: 100%;
  height: 520px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(77,167,99,0.06);
}
.pdf-frame iframe{
  width: 100%;
  height: 100%;
  border: 0;
}

.checkline{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(77,167,99,0.06);
  color: var(--text);
}
.checkline input{ margin-top: 4px; }

/* ===== Signature Canvas ===== */
.signature-container {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 12px;
  position: relative;
}

#signatureCanvas {
  display: block;
  width: 100%;
  max-width: 600px;
  height: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  cursor: crosshair;
  touch-action: none;
}

.signature-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

@media (max-width: 640px) {
  #signatureCanvas {
    height: 150px;
  }
}

/* ===== Payroll Page (legacy selector) ===== */
/* (kept) Add class="payroll-page" on <body> of payroll.html for these styles */
.payroll-page .page { padding: 24px 0; }

.payroll-page .panel{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  color: var(--text);
}

.payroll-page .form{
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.payroll-page .form label{ display: grid; gap: 6px; font-weight: 650; color: var(--text); }

.payroll-page .form input,
.payroll-page input[type="date"],
.payroll-page input[type="number"],
.payroll-page input[type="text"]{
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

.payroll-page .form-note{ margin-top: 6px; font-weight: 650; min-height: 1.2em; color: var(--muted); }

.payroll-page .divider{
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
  height: auto;
  background: transparent;
}

.payroll-page .table-wrap{ overflow: auto; }
.payroll-page .table{
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  background: #fff;
  color: var(--text);
}
.payroll-page .table th,
.payroll-page .table td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(21,31,28,0.10);
}
.payroll-page .table thead th{
  text-align: left;
  font-size: 0.95rem;
  opacity: 1;
  color: var(--muted);
}
.payroll-page .right{ text-align: right; }

.payroll-page .btn-secondary{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.payroll-page .btn-secondary:hover{ filter: brightness(1.03); }

.payroll-page .table .btn-link{
  background: transparent;
  border: none;
  color: var(--brand-dark);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 750;
  padding: 6px 0;
}
.payroll-page .table .btn-link:hover{ opacity: 0.9; }

/* ========== Responsive ========== */
@media (max-width: 940px){
  .hero-grid{ grid-template-columns: 1fr; }
  .grid-3{ grid-template-columns: 1fr; }
  .steps{ grid-template-columns: 1fr; }
  .nav-toggle{ display: inline-flex; align-items: center; justify-content: center; }
  .nav-menu{
    display: none;
    position: absolute;
    top: 64px;
    right: 20px;
    left: 20px;
    padding: 12px;
    flex-direction: column;
    background: rgba(247,250,248,0.98);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
  }
  .nav-menu.open{ display: flex; }
}

/* ========== App Layout (Header + Left Sidebar) ========== */
.layout{
  display: grid;
  grid-template-columns: 1fr; /* Sidebar is now fixed, not in grid flow */
  align-items: start;
  min-height: calc(100vh - 72px);
}

/* New Permanent Sidebar (Desktop Only) */
.sidebar{
  position: fixed;
  top: var(--header-height, 72px); /* Will be set dynamically to match header */
  left: 0;
  width: 260px;
  height: calc(100vh - var(--header-height, 72px));
  background-color: var(--panel);
  padding: 20px 0;
  z-index: 100;
  overflow-y: auto;
  box-shadow: 0 0 1px var(--border);
  transition: none; /* Permanent - no transitions */
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.menu_content {
  position: relative;
  height: 100%;
  padding-bottom: 80px; /* Space for logout button at bottom */
}

.menu_items {
  padding: 0;
  list-style: none;
  margin: 0;
}

.menu_title {
  margin: 15px 0;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.menu_main::before {
  content: "Main";
}

.menu_support::before {
  content: "Support";
}

/* Sidebar bottom logout button */
.sidebar-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px 10px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  z-index: 10;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 15px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.2s;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
}

.sidebar-logout-btn:hover {
  color: white;
  background: var(--danger);
}

.sidebar-logout-btn .navlink_icon {
  color: inherit;
}

.navlink_icon {
  position: relative;
  font-size: 22px;
  min-width: 50px;
  line-height: 40px;
  display: inline-block;
  text-align: center;
  border-radius: 6px;
  color: var(--muted);
  transition: all 0.2s;
}

.navlink_icon:hover {
  background: var(--brand);
  color: white;
}

.sidebar .nav_link {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 15px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.2s;
  margin: 2px 10px;
}

.sidebar .nav_link:hover {
  color: white;
  background: var(--brand);
}

.sidebar .nav_link.active {
  color: white;
  background: var(--brand);
  font-weight: 600;
}

/* Active state for old sidebar structure (backward compatibility) */
.sidebar .sidebar-link.active,
.sidebar-nav .sidebar-link.active {
  color: white;
  background: var(--brand);
  font-weight: 600;
}

.submenu_item {
  cursor: pointer;
  position: relative; /* Required for absolute positioning of arrow-left */
}

.submenu {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
}

.submenu_item .arrow-left {
  position: absolute;
  right: 10px;
  display: inline-block;
  margin-right: auto;
  transition: transform 0.2s;
}

.show_submenu ~ .submenu {
  display: block;
}

.show_submenu .arrow-left {
  transform: rotate(90deg);
}

.submenu .sublink {
  padding: 10px 15px 10px 52px;
  font-size: 0.95rem;
}

.submenu .sublink:hover {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.submenu .sublink.active {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 600;
}

/* Page content area */
.layout > main{
  padding: 24px 0;
  margin-left: 260px; /* Account for permanent sidebar on desktop */
  transition: margin-left 0.3s ease;
}

@media (max-width: 920px) {
  .layout > main {
    margin-left: 0;
  }
}

/* Header tweaks */
.layout .brand-logo:not(.footer-logo){
  height: 64px;
  width: auto;
}

.sidebar-toggle{
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: none;
  cursor: pointer;
}

.sidebar-toggle .hamburger{
  display: block;
  width: 18px;
  height: 2px;
  background: var(--muted);
  position: relative;
  margin: 0 auto;
}
.sidebar-toggle .hamburger::before,
.sidebar-toggle .hamburger::after{
  content:"";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--muted);
}
.sidebar-toggle .hamburger::before{ top: -6px; }
.sidebar-toggle .hamburger::after{ top: 6px; }

/* Mobile: hide sidebar completely, only show bottom nav */
@media (max-width: 920px){
  .header-inner{
    grid-template-columns: auto 1fr auto;
  }
  .header-left{
    padding-left: 0;
  }
  .layout{
    grid-template-columns: 1fr;
    padding-bottom: 70px; /* Space for bottom nav */
  }
  .sidebar{
    display: none !important; /* Completely hide sidebar on mobile */
  }
  .sidebar-toggle{
    display: none !important; /* Hide sidebar toggle on mobile */
  }
  .layout > main{
    padding: 18px 0;
    margin-left: 0;
  }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 60px;
  padding: 0 8px;
}

.mobile-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 6px 8px;
  text-decoration: none;
  color: var(--muted);
  transition: all 0.2s;
  min-width: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
}

.mobile-bottom-nav-item:active {
  transform: scale(0.95);
}

.mobile-bottom-nav-item.active {
  color: var(--brand-dark);
}

.mobile-bottom-nav-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.mobile-bottom-nav-label {
  font-size: 0.7rem;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 920px) {
  .mobile-bottom-nav {
    display: block;
  }
  
  /* Hide header avatar and logout button on mobile */
  .header-avatar {
    display: none !important;
  }
  
  .header-actions {
    display: none !important;
  }
  
  /* Add padding to body on mobile for landing page bottom nav */
  body[data-page="landing"] {
    padding-bottom: 70px;
  }
}

/* Mobile Bottom Navigation for Landing Page (mobile only) */
.mobile-bottom-nav-landing {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  padding: 12px 16px;
}

.mobile-bottom-nav-landing-content {
  display: flex;
  justify-content: center;
  align-items: center;
}

.mobile-bottom-nav-landing-content .btn {
  width: 100%;
  max-width: 400px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  justify-content: center;
}

@media (max-width: 920px) {
  .mobile-bottom-nav-landing {
    display: block;
  }
}

/* Mobile logout button (only visible on mobile) */
.mobile-logout-btn {
  display: none;
}

@media (max-width: 920px) {
  .mobile-logout-btn {
    display: block;
    width: 100%;
    margin-top: 24px;
    padding: 20px 16px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 60px; /* Position above mobile bottom nav */
    z-index: 10;
  }
  
  .mobile-logout-btn .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 1rem;
  }
}

/* ============================
   Auth Pages (Login/Signup/Forgot) - Professional integrated hero
   ============================ */

.auth-page {
  position: relative;
  /* Base background color */
  background: #f7faf8;
  color: var(--text);
  overflow: hidden;
}

/* Masonry pattern background with BELISTO image */
.auth-page::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  right: -10%;
  bottom: -10%;
  opacity: 0.035;
  background-image: 
    url('images/belisto.png'),
    url('images/belisto.png'),
    url('images/belisto.png'),
    url('images/belisto.png'),
    url('images/belisto.png'),
    url('images/belisto.png'),
    url('images/belisto.png'),
    url('images/belisto.png'),
    url('images/belisto.png'),
    url('images/belisto.png');
  background-size: 
    380px auto, 
    420px auto, 
    350px auto, 
    400px auto, 
    360px auto,
    390px auto,
    410px auto,
    370px auto,
    430px auto,
    340px auto;
  background-position: 
    5% 8%,
    45% 2%,
    85% 12%,
    15% 25%,
    65% 22%,
    35% 38%,
    75% 35%,
    8% 52%,
    55% 48%,
    92% 55%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
  transform: rotate(-2deg);
  animation: masonryFloat 60s ease-in-out infinite;
}

/* ========== Login Animation ========== */
.login-animation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-in;
}

.login-animation-content {
  text-align: center;
  animation: slideUp 0.5s ease-out;
}

.login-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
  animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
  border-top-color: var(--brand-dark);
  animation-delay: 0.15s;
}

.spinner-ring:nth-child(3) {
  width: 50%;
  height: 50%;
  top: 25%;
  left: 25%;
  border-top-color: var(--brand);
  animation-delay: 0.3s;
  opacity: 0.7;
}

.login-animation-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.login-animation-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin: 0;
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes masonryFloat {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(-1.5deg) translateY(-20px); }
}

/* Add overlay for better content readability */
.auth-page::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(900px 520px at 18% 10%, rgba(77,167,99,0.12), transparent 60%),
    radial-gradient(820px 520px at 85% 20%, rgba(47,139,74,0.08), transparent 62%),
    linear-gradient(180deg, rgba(247,250,248,0.95) 0%, rgba(244,248,246,0.92) 70%, rgba(247,250,248,0.95) 100%);
  pointer-events: none;
  z-index: 1;
}

.auth-page > * {
  position: relative;
  z-index: 2;
}

.auth-center{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  align-content: center;
}

/* Create a "stack" so logo area + card feels like one unit */
.auth-stack{
  width: min(560px, 94vw);
  max-width: 100%;
  display: grid;
  gap: 8px;
  align-items: center;
}

/* Logo area */
.auth-hero{
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 6px 8px 2px;
  margin-bottom: 4px;
}

.auth-logo-wrap{
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 4px 6px;
  border-radius: 18px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(21,31,28,0.10);
  backdrop-filter: blur(8px);
}

/* Softer, "integrated" logo treatment (no boxy hard shadow) */
.auth-logo{
  width: min(320px, 75vw);
  height: auto;
  display: block;
  filter:
    drop-shadow(0 10px 18px rgba(21,31,28,0.10))
    drop-shadow(0 0 26px rgba(77,167,99,0.18));
}

/* Reduce logo container height on mobile by ~1/3 */
@media (max-width: 768px) {
  .auth-hero {
    padding: 2px 6px 1px; /* Reduced from 6px 8px 2px */
    margin-bottom: 2px; /* Reduced from 4px */
  }
  
  .auth-logo-wrap {
    padding: 2px 4px; /* Reduced from 4px 6px */
  }
  
  .auth-logo {
    width: min(280px, 70vw); /* Slightly smaller on mobile */
  }
}

/* Card: slightly translucent so it blends with background */
.auth-card{
  width: 100%;
  max-width: 100%;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(21,31,28,0.12);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(21,31,28,0.12);
  backdrop-filter: blur(10px);
  overflow: visible;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

/* Tighten spacing inside auth cards */
.auth-card .card-header{
  padding: 18px 18px 10px;
}
.auth-card .auth-title{
  margin: 0 0 6px;
  color: var(--text);
  letter-spacing: -0.2px;
}
.auth-card .auth-subtitle{
  margin: 0;
  color: var(--muted);
}

.auth-form{
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
}

.auth-form .field {
  margin: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: grid;
  gap: 6px;
}

.auth-form .field:last-of-type {
  margin-bottom: 0;
}

.auth-form .checkbox-label {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.auth-form .checkbox-label input[type="checkbox"] {
  margin-top: 4px;
  flex-shrink: 0;
  width: auto;
  height: auto;
}

.auth-form .checkbox-label span {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  font-size: 0.9rem;
  line-height: 1.5;
  display: inline;
}

.auth-form .form-error {
  margin: 0 0 4px 0;
  padding: 0;
  order: 100;
}

.auth-form .btn {
  margin-top: 0;
  order: 101;
}

.auth-form .auth-links {
  order: 102;
  margin-top: 4px;
}

.auth-links{
  display: flex;
  gap: 10px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Optional: a small footer line under the card */
.auth-footnote{
  text-align: center;
  color: rgba(76,80,89,0.85);
  font-size: 0.92rem;
  margin-top: 6px;
}

/* Ensure headings on auth pages are readable */
.auth-page h1, .auth-page h2 {
  color: var(--text);
}

/* ========== Logout Confirmation Modal ========== */
.logout-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.logout-modal-overlay.show {
  display: flex;
}

.logout-modal-content {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

.logout-modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.logout-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text);
  font-weight: 700;
}

.logout-modal-body {
  padding: 20px 24px;
}

.logout-modal-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.logout-modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.logout-modal-footer .btn {
  min-width: 100px;
}
