:root {
  --ez-primary: #0B3D2E;
  --ez-primary-light: #1B7A54;
  --ez-primary-soft: #E8F3ED;
  --ez-accent: #C9A227;
  --ez-navy: #0F172A;
  --ez-muted: #5C6B63;
  --ez-border: #D8E4DC;
  --ez-bg: #F4F7F5;
  --ez-card: #FFFFFF;
  --ez-danger: #B42318;
  --ez-danger-bg: #FEF3F2;
  --ez-success: #067647;
  --ez-success-bg: #ECFDF3;
  --ez-warn: #B54708;
  --ez-shadow: 0 4px 24px rgba(11, 61, 46, 0.08);
  --ez-radius: 14px;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--ez-bg);
  color: var(--ez-navy);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Shared ── */
.ez-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ez-primary);
  letter-spacing: -0.02em;
}
.ez-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ez-primary), var(--ez-primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.advisory-strip {
  background: linear-gradient(90deg, #FFF8E7, #FEF9E7);
  border: 1px solid #F5E6B8;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  color: #7A5C00;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}
.advisory-strip strong { color: #5C4500; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--ez-primary); color: white; box-shadow: 0 4px 14px rgba(11,61,46,0.25); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-secondary { background: white; color: var(--ez-primary); border: 2px solid var(--ez-border); }
.btn-ghost { background: transparent; color: var(--ez-muted); border: 1px solid var(--ez-border); padding: 8px 14px; font-size: 13px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ez-muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--ez-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  background: white;
  margin-bottom: 14px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--ez-primary-light);
  box-shadow: 0 0 0 3px rgba(27,122,84,0.15);
}
.card {
  background: var(--ez-card);
  border: 1px solid var(--ez-border);
  border-radius: var(--ez-radius);
  padding: 22px;
  box-shadow: var(--ez-shadow);
}
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; color: var(--ez-navy); }
.card-desc { font-size: 13px; color: var(--ez-muted); margin: 0 0 18px; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-ok { background: var(--ez-success-bg); color: var(--ez-success); border: 1px solid #ABEFC6; }
.alert-err { background: var(--ez-danger-bg); color: var(--ez-danger); border: 1px solid #FECDCA; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-likely { background: var(--ez-success-bg); color: var(--ez-success); }
.badge-unlikely { background: var(--ez-danger-bg); color: var(--ez-danger); }
.badge-demo { background: var(--ez-primary-soft); color: var(--ez-primary); }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--ez-primary); letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--ez-muted); margin-top: 4px; }

/* ── Landing ── */
.landing-page { min-height: 100vh; }
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.landing-nav .badge { background: var(--ez-primary-soft); color: var(--ez-primary); }
.landing-hero-wrap {
  background: linear-gradient(165deg, #0B3D2E 0%, #145A42 45%, #1B7A54 100%);
  color: white;
  padding: 56px 24px 72px;
  position: relative;
  overflow: hidden;
}
.landing-hero-wrap::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 60%;
  height: 140%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.landing-hero-inner { max-width: 720px; margin: 0 auto; text-align: center; position: relative; z-index: 1; }
.landing-hero-inner h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.5rem);
  font-weight: 400;
  margin: 16px 0 12px;
  line-height: 1.1;
}
.landing-hero-inner .lead { font-size: 1.1rem; opacity: 0.92; max-width: 560px; margin: 0 auto 28px; line-height: 1.6; }
.landing-hero-inner .btn-primary {
  background: white;
  color: var(--ez-primary);
  font-size: 1rem;
  padding: 14px 32px;
}
.trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 36px;
  font-size: 12px;
  opacity: 0.9;
}
.trust-item { display: flex; align-items: center; gap: 6px; }
.landing-body { max-width: 1100px; margin: -40px auto 0; padding: 0 20px 60px; position: relative; z-index: 2; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 40px; }
.pillar-card {
  background: white;
  border-radius: var(--ez-radius);
  padding: 28px 24px;
  border: 1px solid var(--ez-border);
  box-shadow: var(--ez-shadow);
}
.pillar-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--ez-primary-soft);
  color: var(--ez-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.pillar-card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.pillar-card p { margin: 0; font-size: 14px; color: var(--ez-muted); line-height: 1.55; }
.how-section { margin-bottom: 40px; }
.how-section h2 { font-family: var(--font-display); font-size: 1.75rem; text-align: center; margin-bottom: 28px; color: var(--ez-primary); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.step { text-align: center; padding: 20px; }
.step-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ez-primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; margin: 0 auto 12px; font-size: 14px;
}
.step h4 { margin: 0 0 6px; font-size: 15px; }
.step p { margin: 0; font-size: 13px; color: var(--ez-muted); }
.landing-footer {
  text-align: center;
  padding: 32px 20px;
  font-size: 12px;
  color: var(--ez-muted);
  border-top: 1px solid var(--ez-border);
  margin-top: 20px;
}

/* ── App shell ── */
.app-shell { display: flex; min-height: 100vh; position: relative; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
  cursor: pointer;
}
.app-sidebar {
  width: 272px;
  background: var(--ez-primary);
  color: white;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.sidebar-close {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.app-sidebar .ez-logo { color: white; }
.app-sidebar .ez-logo-mark { background: rgba(255,255,255,0.2); }
.sidebar-sub { font-size: 11px; opacity: 0.75; margin-bottom: 20px; padding-left: 46px; }
.sidebar-nav { flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.18); color: white; font-weight: 600; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-label { white-space: nowrap; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.12); }
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; width: 100%; }
.app-header {
  background: white;
  border-bottom: 1px solid var(--ez-border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.header-left h2 {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 700;
  line-height: 1.2;
}
.header-demo-badge { display: inline-block; margin-top: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 1px solid var(--ez-border);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ez-primary);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.app-shell.sidebar-open .menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.app-shell.sidebar-open .menu-bar:nth-child(2) { opacity: 0; }
.app-shell.sidebar-open .menu-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.app-content { padding: 20px; flex: 1; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.product-tile {
  border: 1px solid var(--ez-border);
  border-radius: 12px;
  padding: 18px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.product-tile .price { font-size: 1.2rem; font-weight: 700; color: var(--ez-primary); }
.product-tile .cat { font-size: 12px; color: var(--ez-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ez-primary-soft);
  border-radius: 10px;
  margin-bottom: 10px;
}
.lfe-result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 16px; }
.lfe-metric { background: var(--ez-bg); padding: 14px; border-radius: 10px; text-align: center; }
.lfe-metric .val { font-weight: 700; font-size: 1.05rem; color: var(--ez-primary); word-break: break-word; }
.lfe-metric .lbl { font-size: 11px; color: var(--ez-muted); margin-top: 4px; }
.upload-zone {
  border: 2px dashed var(--ez-border);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  background: var(--ez-bg);
  margin-bottom: 16px;
}
.upload-zone input { margin-top: 12px; max-width: 100%; }

/* Apply page */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(165deg, var(--ez-bg), var(--ez-primary-soft));
}
.auth-card { max-width: 420px; width: 100%; }

/* ── Tablet & mobile ── */
@media (max-width: 900px) {
  .menu-toggle { display: flex; }
  .header-signout { display: none; }
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: min(288px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    box-shadow: 8px 0 32px rgba(0,0,0,0.18);
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }
  .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-overlay { display: block; }
  .app-content { padding: 16px 14px 28px; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .app-header { padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
  .landing-nav .badge { display: none; }
  .landing-nav { padding: 12px 16px; }
  .landing-body { margin-top: -28px; padding: 0 14px 40px; }
  .pillars { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .group-row { flex-direction: column; align-items: stretch; }
  .group-row .btn { width: 100%; }
  .advisory-strip { font-size: 11px; }
}

@media (max-width: 480px) {
  .steps { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr; }
  .panel-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.6rem; }
  .landing-hero-wrap { padding: 40px 16px 56px; }
  .trust-row { flex-direction: column; gap: 8px; align-items: center; }
  .btn, .field input, .field select { font-size: 16px; }
}
