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

:root {
  --navy: #070f1e;
  --navy2: #0d1b2e;
  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --red-light: #fef2f2;
  --amber-light: #fffbeb;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
}

body { font-family: var(--font); color: var(--gray-800); line-height: 1.6; }

.logo { font-size: 17px; font-weight: 600; color: white; text-decoration: none; letter-spacing: -0.01em; }
.logo span { color: #60a5fa; }

/* ── HOME PAGE ── */
.home-body { background: var(--navy); color: white; min-height: 100vh; }

.home-nav { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 2.5rem; border-bottom: 1px solid rgba(255,255,255,0.06); }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { color: rgba(255,255,255,0.6); text-decoration: none; font-size: 14px; }
.btn-nav { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); border-radius: var(--radius); padding: 0.4rem 0.9rem; color: white !important; font-size: 13px; }

.hero { text-align: center; padding: 5rem 2rem 4rem; max-width: 780px; margin: 0 auto; }
.hero-badge { display: inline-block; background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); border-radius: 20px; padding: 0.3rem 1rem; font-size: 12px; color: #93c5fd; margin-bottom: 1.5rem; letter-spacing: 0.02em; }
.hero h1 { font-size: 3rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; margin-bottom: 1.25rem; }
.hero-sub { font-size: 1.1rem; color: rgba(255,255,255,0.55); max-width: 560px; margin: 0 auto 2.5rem; line-height: 1.7; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 3.5rem; }
.btn-primary-lg { background: var(--blue); color: white; padding: 0.85rem 1.75rem; border-radius: var(--radius); font-size: 15px; font-weight: 600; text-decoration: none; }
.btn-ghost-lg { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: white; padding: 0.85rem 1.75rem; border-radius: var(--radius); font-size: 15px; text-decoration: none; }

.hero-stats { display: flex; align-items: center; justify-content: center; gap: 2rem; padding: 2rem; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-lg); }
.hstat { text-align: center; }
.hstat-num { display: block; font-size: 1.75rem; font-weight: 700; color: white; }
.hstat-label { font-size: 12px; color: rgba(255,255,255,0.4); line-height: 1.5; }
.hstat-label em { font-style: normal; color: rgba(255,255,255,0.25); }
.hstat-div { width: 1px; height: 40px; background: rgba(255,255,255,0.1); }

.how-it-works { max-width: 900px; margin: 0 auto; padding: 4rem 2rem; }
.section-label { font-size: 12px; color: rgba(255,255,255,0.3); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 2rem; text-align: center; }
.steps { display: flex; align-items: flex-start; gap: 1rem; }
.step { flex: 1; }
.step-num { font-size: 11px; color: var(--blue); font-weight: 600; letter-spacing: 0.08em; margin-bottom: 0.75rem; }
.step h3 { font-size: 15px; font-weight: 600; color: white; margin-bottom: 0.5rem; }
.step p { font-size: 13px; color: rgba(255,255,255,0.45); line-height: 1.6; }
.step-arrow { font-size: 18px; color: rgba(255,255,255,0.15); padding-top: 2.5rem; flex-shrink: 0; }

.home-footer { text-align: center; padding: 2rem; border-top: 1px solid rgba(255,255,255,0.06); font-size: 12px; color: rgba(255,255,255,0.25); }

/* ── APP LAYOUT ── */
.app-body { display: flex; min-height: 100vh; background: var(--gray-50); }

.sidebar { width: 200px; min-width: 200px; background: var(--navy); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; }
.sidebar-logo { padding: 1.25rem 1.25rem 1rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-live { display: flex; align-items: center; gap: 5px; font-size: 11px; color: rgba(255,255,255,0.3); }
.live-dot { width: 6px; height: 6px; background: #22c55e; border-radius: 50%; }

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; }
.nav-section-label { font-size: 10px; color: rgba(255,255,255,0.25); letter-spacing: 0.1em; text-transform: uppercase; padding: 0 0.5rem; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 0.5rem 0.75rem; border-radius: var(--radius); color: rgba(255,255,255,0.45); font-size: 13px; text-decoration: none; margin-bottom: 2px; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.7); }
.nav-item.active { background: rgba(59,130,246,0.15); color: #60a5fa; }

.sidebar-facility { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.4); }
.facility-name { font-size: 12px; color: rgba(255,255,255,0.7); margin: 0; }
.facility-sub { font-size: 11px; color: rgba(255,255,255,0.3); margin: 0; }

.app-main { margin-left: 200px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.app-header { background: white; border-bottom: 1px solid var(--gray-200); padding: 0.75rem 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bc-sep { color: var(--gray-400); }
.bc-active { color: var(--gray-800); font-weight: 500; }
.bc-back { color: var(--blue); text-decoration: none; font-size: 13px; }

.btn-upload { background: var(--navy); color: white; border: none; border-radius: var(--radius); padding: 0.45rem 0.9rem; font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; }
.app-content { padding: 1.5rem; flex: 1; }

.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 13px; }
.flash-success { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
.flash-error { background: var(--red-light); color: #991b1b; border: 1px solid #fecaca; }

/* ── METRICS ── */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 1.25rem; }
.metric-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; position: relative; overflow: hidden; }
.metric-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.metric-label { font-size: 12px; color: var(--gray-600); margin-bottom: 6px; }
.metric-value { font-size: 26px; font-weight: 700; color: var(--gray-800); margin-bottom: 3px; line-height: 1; }
.metric-value.green { color: var(--green); }
.metric-sub { font-size: 11px; color: var(--gray-400); }

/* ── PIPELINE ── */
.pipeline-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.card-title { font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 12px; }
.pipeline { display: flex; align-items: center; gap: 8px; }
.pipe-step { text-align: center; flex: 1; }
.pipe-box { font-size: 18px; font-weight: 700; padding: 0.6rem; border-radius: var(--radius); margin-bottom: 5px; }
.pipe-box.red { background: var(--red-light); color: #dc2626; }
.pipe-box.amber { background: var(--amber-light); color: #d97706; }
.pipe-box.blue { background: var(--blue-light); color: var(--blue); }
.pipe-box.green { background: var(--green-light); color: var(--green); }
.pipe-label { font-size: 11px; color: var(--gray-400); }
.pipe-arrow { font-size: 16px; color: var(--gray-400); flex-shrink: 0; }

/* ── INSIGHT ── */
.insight-card { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 0.85rem 1rem; margin-bottom: 1.25rem; display: flex; align-items: flex-start; gap: 10px; color: #1e40af; font-size: 13px; }
.insight-icon { flex-shrink: 0; margin-top: 1px; }

/* ── TABLE ── */
.table-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.table-header { padding: 0.85rem 1rem; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.table-filters { display: flex; gap: 6px; }
.filter { font-size: 12px; color: var(--gray-600); background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 20px; padding: 3px 10px; cursor: pointer; }
.filter.active { background: var(--navy); color: white; border-color: var(--navy); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--gray-50); text-align: left; padding: 0.6rem 1rem; color: var(--gray-600); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--gray-200); }
td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }
.td-id { font-weight: 600; color: var(--gray-800); font-size: 12px; }
.td-muted { color: var(--gray-600); }
.td-amount { font-weight: 600; color: var(--gray-800); }
.td-days { font-size: 12px; color: var(--gray-600); }
.days-urgent { color: #dc2626; font-weight: 600; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.badge-hard { background: var(--red-light); color: #991b1b; border: 1px solid #fecaca; }
.badge-soft { background: var(--amber-light); color: #92400e; border: 1px solid #fde68a; }

.status-soft { font-size: 12px; color: var(--green); font-weight: 500; }
.status-hard { font-size: 12px; color: #dc2626; font-weight: 500; }

.btn-appeal { background: var(--navy); color: white; padding: 4px 12px; border-radius: 6px; text-decoration: none; font-size: 12px; font-weight: 500; white-space: nowrap; }
.btn-review { background: var(--gray-100); color: var(--gray-600); padding: 4px 12px; border-radius: 6px; text-decoration: none; font-size: 12px; border: 1px solid var(--gray-200); }

.table-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--gray-200); font-size: 12px; color: var(--gray-400); }
.table-footer a { color: var(--blue); text-decoration: none; }

/* ── UPLOAD ── */
.upload-container { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; max-width: 900px; }
.upload-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 2rem; }
.upload-card h2 { font-size: 18px; font-weight: 700; color: var(--gray-800); margin-bottom: 0.5rem; }
.upload-sub { font-size: 13px; color: var(--gray-600); margin-bottom: 1.5rem; line-height: 1.6; }
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--gray-200); border-radius: var(--radius); padding: 2.5rem 1rem; cursor: pointer; margin-bottom: 1rem; color: var(--gray-400); transition: border-color 0.2s; }
.drop-zone:hover { border-color: var(--blue); color: var(--blue); }
.dz-title { font-size: 14px; font-weight: 500; color: var(--gray-800); }
.dz-sub { font-size: 12px; }
.required-cols { margin-bottom: 1.25rem; }
.cols-label { font-size: 12px; color: var(--gray-600); margin-bottom: 6px; }
.cols-list { display: flex; flex-wrap: wrap; gap: 5px; }
.col-pill { background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 4px; padding: 2px 8px; font-size: 11px; font-family: monospace; color: var(--gray-600); }
.btn-analyze { width: 100%; background: var(--navy); color: white; border: none; border-radius: var(--radius); padding: 0.75rem; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-analyze:hover { background: #0d1b2e; }
.upload-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; font-size: 12px; }
.sample-link { color: var(--blue); text-decoration: none; display: flex; align-items: center; gap: 4px; }
.upload-note { color: var(--gray-400); }
.upload-note a { color: var(--blue); text-decoration: none; }
.upload-info { display: flex; flex-direction: column; gap: 1rem; }
.info-block { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 1.25rem; }
.info-title { font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 1rem; }
.info-step { display: flex; gap: 10px; margin-bottom: 0.85rem; align-items: flex-start; }
.info-step:last-child { margin-bottom: 0; }
.info-num { min-width: 20px; height: 20px; background: var(--navy); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0; margin-top: 1px; }
.info-step p { font-size: 13px; color: var(--gray-600); line-height: 1.5; }
.info-stat-block { background: var(--navy); border-radius: var(--radius-lg); padding: 1.25rem; }
.istat-num { font-size: 2.5rem; font-weight: 700; color: white; margin-bottom: 0.5rem; }
.istat-label { font-size: 12px; color: rgba(255,255,255,0.5); line-height: 1.6; }

/* ── APPEAL ── */
.appeal-actions { display: flex; gap: 8px; }
.btn-copy { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.4rem 0.9rem; font-size: 13px; cursor: pointer; color: var(--gray-800); transition: all 0.2s; }
.btn-pdf { background: var(--navy); color: white; border: none; border-radius: var(--radius); padding: 0.4rem 0.9rem; font-size: 13px; cursor: pointer; text-decoration: none; }
.appeal-layout { display: grid; grid-template-columns: 1fr 260px; gap: 1.25rem; }
.appeal-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 1.25rem; }
.meta-pill { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.65rem 0.85rem; }
.meta-key { display: block; font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.meta-val { font-size: 13px; font-weight: 500; color: var(--gray-800); }
.meta-val.amount { color: var(--green); }
.letter-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; }
.letter-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.letter-title { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.letter-badge { font-size: 11px; color: var(--blue); background: var(--blue-light); border: 1px solid #bfdbfe; border-radius: 20px; padding: 2px 10px; }
.letter-body { padding: 1.75rem; white-space: pre-wrap; font-size: 13px; line-height: 1.8; color: var(--gray-800); font-family: Georgia, serif; max-height: 65vh; overflow-y: auto; }
.appeal-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.tip-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 1.25rem; }
.tip-title { font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 1rem; }
.tip { display: flex; gap: 8px; margin-bottom: 0.75rem; align-items: flex-start; }
.tip:last-child { margin-bottom: 0; }
.tip-dot { width: 5px; height: 5px; background: var(--blue); border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.tip p { font-size: 12px; color: var(--gray-600); line-height: 1.5; }
.stat-card { background: var(--navy); border-radius: var(--radius-lg); padding: 1.25rem; }
.stat-big { font-size: 2.5rem; font-weight: 700; color: white; margin-bottom: 0.5rem; }
.stat-desc { font-size: 12px; color: rgba(255,255,255,0.5); line-height: 1.6; }

/* ── LEGAL PAGES ── */
.legal-body { max-width: 760px; margin: 0 auto; padding: 3rem 2rem 5rem; }
.legal-container h1 { font-size: 2rem; font-weight: 700; color: white; margin-bottom: 1rem; }
.legal-container h2 { font-size: 1.1rem; font-weight: 600; color: white; margin: 2rem 0 0.75rem; }
.legal-container p { font-size: 14px; color: rgba(255,255,255,0.55); line-height: 1.8; margin-bottom: 0.75rem; }
.legal-date { font-size: 12px; color: rgba(255,255,255,0.3); margin-bottom: 0.5rem; }
.legal-intro { font-size: 15px; color: rgba(255,255,255,0.65); margin-bottom: 2rem; line-height: 1.7; }
.legal-quote { background: rgba(255,255,255,0.05); border-left: 3px solid rgba(59,130,246,0.5); padding: 1rem 1.25rem; border-radius: 0 8px 8px 0; font-style: italic; color: rgba(255,255,255,0.5) !important; margin: 1rem 0 !important; }


/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVE — 768px and below
   These styles override everything above them
═══════════════════════════════════════════════ */
@media only screen and (max-width: 768px) {

  /* ── Force sidebar hidden ── */
  .sidebar {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
  }

  /* ── Body layout ── */
  .app-body {
    display: block !important;
  }

  /* ── Main area full width ── */
  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* ── Mobile nav bar ── */
  .mobile-app-nav,
  .mobile-top-nav {
    display: flex !important;
  }

  /* ── Header ── */
  .app-header {
    padding: 0.6rem 1rem !important;
  }

  /* ── Content padding ── */
  .app-content {
    padding: 1rem !important;
  }

  /* ── Upload page ── */
  .upload-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    max-width: 100% !important;
  }
  .upload-card {
    width: 100% !important;
    max-width: 100% !important;
  }
  .upload-info {
    width: 100% !important;
    flex-direction: column !important;
  }
  .info-stat-block {
    width: 100% !important;
  }

  /* ── Metrics grid ── */
  .metrics-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .metric-value {
    font-size: 18px !important;
  }

  /* ── Table scroll ── */
  .table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  table {
    min-width: 580px !important;
  }
  .table-header {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .table-filters {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }

  /* ── Pipeline ── */
  .pipeline {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* ── Appeal page ── */
  .appeal-layout {
    display: flex !important;
    flex-direction: column !important;
  }
  .appeal-meta-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .appeal-sidebar {
    display: none !important;
  }
  .appeal-actions {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .letter-body {
    font-size: 12px !important;
    max-height: none !important;
  }

  /* ── Page footer ── */
  .page-footer {
    flex-direction: column !important;
    text-align: center !important;
    gap: 0.5rem !important;
  }
}
