/* ══════════════════════════════════════════
   TOKENS & RESET
══════════════════════════════════════════ */
:root {
  --bg:        #0c0c0f;
  --surface:   #131318;
  --surface2:  #1a1a22;
  --border:    #252530;
  --text:      #e8e6e0;
  --text-dim:  #6b6878;
  --text-mid:  #a09daf;
  --gold:      #c9a84c;
  --gold-lt:   #e8c96a;
  --red:       #e05252;
  --yellow:    #e0a830;
  --green:     #3ecf8e;
  --accent:    #7c6af7;
  --font-head: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --r:         12px;
  --r-lg:      20px;
  --shadow:    0 4px 32px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, video, svg, table { max-width: 100%; }
html { scroll-behavior: smooth; max-width: 100%; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

/* ══════════════════════════════════════════
   NAV
══════════════════════════════════════════ */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(12,12,15,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 32px;
  width: 100%;
  height: 64px;
  display: flex; align-items: center; gap: 32px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head);
  font-size: 20px; font-weight: 700;
  color: var(--text);
  text-decoration: none; cursor: default;
}
.logo-icon { font-size: 22px; }
.logo em { color: var(--gold); font-style: normal; }

.nav-links {
  display: flex; gap: 28px; list-style: none; margin-left: auto;
}
.nav-links a {
  color: var(--text-mid); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }

.nav-cta { display: flex; gap: 10px; align-items: center; }

.btn-ghost {
  background: none; border: 1px solid var(--border);
  color: var(--text-mid); padding: 8px 18px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
  font-family: var(--font-body);
  transition: all .2s;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--text); }

.btn-primary {
  background: var(--gold);
  color: #0c0c0f;
  border: none; padding: 9px 20px;
  border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600;
  font-family: var(--font-body);
  transition: all .2s;
}
.btn-primary:hover { background: var(--gold-lt); transform: translateY(-1px); }

/* ══════════════════════════════════════════
   HERO
══════════════════════════════════════════ */
#hero {
  min-height: 100vh;
  padding: 120px 32px 80px;
  max-width: 1200px; margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 64px;
  position: relative;
  box-sizing: border-box;
  width: 100%;
}

.hero-bg-grid {
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(201,168,76,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,168,76,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero-glow {
  position: absolute; top: 20%; left: -10%;
  width: min(600px, 100vw); height: min(600px, 100vw);
  background: radial-gradient(circle, rgba(124,106,247,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.2);
  color: var(--gold);
  padding: 6px 14px; border-radius: 100px;
  font-size: 13px; font-weight: 500;
  margin-bottom: 24px;
  animation: fadeUp .6s ease both;
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(1.3); }
}

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 900; line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 20px;
  animation: fadeUp .7s .1s ease both;
}
.title-accent {
  color: var(--gold);
  font-style: italic;
}

.hero-sub {
  color: var(--text-mid);
  font-size: 17px; line-height: 1.7;
  max-width: min(500px, 100%);
  margin-bottom: 36px;
  animation: fadeUp .7s .2s ease both;
}

.hero-actions {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 48px;
  animation: fadeUp .7s .3s ease both;
}

.btn-hero {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--gold);
  color: #0c0c0f;
  border: none; padding: 16px 32px;
  border-radius: 10px; cursor: pointer;
  font-family: var(--font-body);
  font-size: 16px; font-weight: 700;
  width: fit-content;
  transition: all .25s;
  box-shadow: 0 0 32px rgba(201,168,76,0.25);
}
.btn-hero:hover {
  background: var(--gold-lt);
  transform: translateY(-2px);
  box-shadow: 0 4px 40px rgba(201,168,76,0.4);
}
.btn-arrow { font-size: 18px; transition: transform .2s; }
.btn-hero:hover .btn-arrow { transform: translateX(4px); }

.hero-note { color: var(--text-dim); font-size: 13px; }

.hero-stats {
  display: flex; gap: 32px; align-items: center;
  animation: fadeUp .7s .4s ease both;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num {
  font-family: var(--font-mono);
  font-size: 28px; font-weight: 500;
  color: var(--text);
  letter-spacing: -1px;
}
.stat-label { font-size: 12px; color: var(--text-dim); }
.stat-div { width: 1px; height: 40px; background: var(--border); }

/* Hero visual / floating card */
.hero-visual {
  animation: fadeUp .8s .2s ease both;
}
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 80px rgba(124,106,247,0.06);
}
.doc-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.doc-icon { font-size: 28px; }
.doc-name { font-size: 14px; font-weight: 600; font-family: var(--font-mono); }
.doc-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.doc-status {
  margin-left: auto; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
}
.doc-status.analyzing {
  background: rgba(124,106,247,0.15);
  color: #a89af7;
  animation: blink 1.5s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.5} }

.doc-body { padding: 20px; }
.risk-bar { margin-bottom: 16px; }
.risk-label { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.risk-track {
  height: 6px; background: var(--border); border-radius: 3px;
  overflow: hidden; margin-bottom: 6px;
}
.risk-fill {
  height: 100%; background: linear-gradient(90deg, var(--yellow), var(--red));
  border-radius: 3px;
  animation: growBar 1.5s 1s ease both;
}
@keyframes growBar { from{width:0!important} }
.risk-score {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 1px;
}
.risk-score.medium { color: var(--yellow); }

.clause-list { display: flex; flex-direction: column; gap: 10px; }
.clause-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r);
  border-left: 3px solid transparent;
  animation: fadeUp .5s ease both;
}
.clause-item:nth-child(1) { animation-delay:.2s; }
.clause-item:nth-child(2) { animation-delay:.4s; }
.clause-item:nth-child(3) { animation-delay:.6s; }
.clause-item.red   { background:rgba(224,82,82,.07); border-color:var(--red); }
.clause-item.yellow{ background:rgba(224,168,48,.07); border-color:var(--yellow); }
.clause-item.green { background:rgba(62,207,142,.07); border-color:var(--green); }
.clause-icon { font-size: 18px; flex-shrink:0; margin-top:1px; }
.clause-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.clause-desc  { font-size: 12px; color: var(--text-mid); line-height:1.4; }

/* ══════════════════════════════════════════
   SECTIONS SHARED
══════════════════════════════════════════ */
section { padding: 100px 32px; width: 100%; box-sizing: border-box; }
.section-inner { max-width: 1200px; margin: 0 auto; width: 100%; padding: 0; }
.section-label {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 2px;
  color: var(--gold); text-transform: uppercase;
  margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-head);
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 700; line-height: 1.15;
  margin-bottom: 56px;
}

/* ══════════════════════════════════════════
   HOW IT WORKS
══════════════════════════════════════════ */
#how { background: var(--surface); }
.steps-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.step-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 36px 28px;
  position: relative; overflow: hidden;
  transition: border-color .3s, transform .3s;
}
.step-card:hover { border-color: var(--gold); transform: translateY(-4px); }
.step-num {
  font-family: var(--font-mono); font-size: 64px; font-weight: 500;
  color: rgba(201,168,76,0.06); position: absolute;
  top: 12px; right: 20px; line-height: 1; pointer-events:none;
}
.step-icon { font-size: 36px; margin-bottom: 16px; display:block; }
.step-card h3 {
  font-family: var(--font-head); font-size: 22px;
  margin-bottom: 12px;
}
.step-card p { color: var(--text-mid); font-size: 14px; line-height:1.7; }

/* ══════════════════════════════════════════
   FEATURES
══════════════════════════════════════════ */
#features { background: var(--bg); }
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto;
  gap: 20px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 28px;
  position: relative;
  transition: border-color .3s, transform .3s;
}
.feature-card:hover { border-color: rgba(201,168,76,0.3); transform: translateY(-3px); }
.feature-card.large {
  grid-column: span 2;
}
.feature-icon { font-size: 32px; margin-bottom: 14px; display:block; }
.feature-card h3 {
  font-family: var(--font-head); font-size: 20px;
  margin-bottom: 10px;
}
.feature-card p { color: var(--text-mid); font-size: 14px; line-height:1.7; }
.feature-tag {
  display: inline-block; margin-top: 16px;
  background: rgba(201,168,76,0.1); border: 1px solid rgba(201,168,76,0.25);
  color: var(--gold); font-size: 11px; font-weight: 600;
  font-family: var(--font-mono); letter-spacing: 1px;
  padding: 3px 10px; border-radius: 20px;
}

/* ══════════════════════════════════════════
   PRICING
══════════════════════════════════════════ */
#pricing { background: var(--surface); }
.pricing-toggle {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 48px;
}
.toggle-opt {
  font-size: 15px; font-weight: 500; cursor: pointer;
  color: var(--text-dim); transition: color .2s; user-select:none;
}
.toggle-opt.active { color: var(--text); }
.toggle-sep { color: var(--border); }
.save-badge {
  background: rgba(62,207,142,0.15);
  color: var(--green); font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 20px; font-style:normal;
  margin-left: 4px;
}

.pricing-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.plan-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 32px 28px;
  position: relative;
  transition: transform .3s, border-color .3s;
}
.plan-card:hover { transform: translateY(-4px); border-color: rgba(201,168,76,0.2); }
.plan-card.featured {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(201,168,76,0.05) 0%, var(--bg) 60%);
  transform: translateY(-8px);
}
.plan-card.featured:hover { transform: translateY(-12px); }

.plan-badge {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: #0c0c0f;
  font-size: 11px; font-weight: 700; letter-spacing:.5px;
  padding: 4px 14px; border-radius: 20px;
  white-space: nowrap;
}
.plan-name {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 700; margin-bottom: 16px;
}
.plan-price {
  display: flex; align-items: baseline; gap: 4px;
  margin-bottom: 8px;
}
.price-amount {
  font-family: var(--font-mono);
  font-size: 40px; font-weight: 500; color: var(--text);
  transition: all .3s;
}
.price-per { font-size: 14px; color: var(--text-dim); }
.plan-desc { font-size: 13px; color: var(--text-mid); margin-bottom: 24px; }

.plan-features { list-style: none; display:flex; flex-direction:column; gap:10px; margin-bottom:28px; }
.plan-features li { font-size: 14px; color: var(--text-mid); }
.plan-features li.dim { color: var(--text-dim); }

.btn-plan {
  width: 100%; padding: 12px;
  border-radius: 8px; cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  background: none; border: 1px solid var(--border);
  color: var(--text);
  transition: all .2s;
}
.btn-plan:hover { border-color: var(--gold); color: var(--gold); }
.btn-plan.primary {
  background: var(--gold); color: #0c0c0f; border-color: var(--gold);
}
.btn-plan.primary:hover { background: var(--gold-lt); }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 64px 32px 0;
  width: 100%;
  box-sizing: border-box;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 48px; flex-wrap: wrap;
  padding-bottom: 48px;
}
.footer-brand { max-width: min(220px, 100%); }
.footer-brand .logo { margin-bottom: 14px; }
.footer-brand p { font-size: 13px; color: var(--text-dim); line-height:1.6; }
.footer-links { display: flex; gap: 40px; margin-left: auto; flex-wrap: wrap; }
.fl-col { display:flex; flex-direction:column; gap:10px; }
.fl-col h5 {
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px;
}
.fl-col a { color: var(--text-mid); text-decoration: none; font-size: 14px; transition: color .2s; }
.fl-col a:hover { color: var(--gold); }
.footer-bottom {
  max-width: 1200px; margin: 0 auto;
  padding: 20px 0;
  width: 100%;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}

/* ══════════════════════════════════════════
   APP OVERLAY & MODAL
══════════════════════════════════════════ */
#app-overlay {
  position: fixed; inset:0; z-index: 200;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .3s ease;
}
#app-overlay.hidden { display: none; }
@keyframes fadeIn { from{opacity:0} }

#app-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%; max-width: 1000px;
  height: 86vh; max-height: 780px;
  display: flex; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  animation: slideUp .35s ease;
}
@keyframes slideUp { from{opacity:0;transform:translateY(24px)} }

/* Sidebar */
.modal-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 0;
}
.sidebar-logo {
  font-family: var(--font-head);
  font-size: 18px; font-weight: 700;
  color: var(--gold);
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-nav { display: flex; flex-direction: column; padding: 0 10px; }
.snav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-mid);
  cursor: pointer; text-decoration: none;
  transition: all .2s;
  user-select: none;
}
.snav-item:hover { color: var(--text); background: var(--surface2); }
.snav-item.active { color: var(--gold); background: rgba(201,168,76,0.08); }
.snav-item span { font-size: 16px; }

.sidebar-plan {
  margin-top: auto; padding: 0 20px 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.plan-pill {
  background: rgba(124,106,247,0.15);
  color: #a89af7; font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
  width: fit-content; margin-bottom: 6px;
}
.plan-usage { font-size: 11px; color: var(--text-dim); }

.close-modal {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 13px;
  padding: 12px 20px; text-align:left;
  font-family: var(--font-body);
  transition: color .2s;
}
.close-modal:hover { color: var(--text); }

/* Modal main */
.modal-main {
  flex:1; overflow-y: auto; padding: 32px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.modal-view { display: none; }
.modal-view.active { display: block; }

.view-header { margin-bottom: 28px; }
.view-header h2 {
  font-family: var(--font-head);
  font-size: 26px; font-weight: 700; margin-bottom: 6px;
}
.view-header p { color: var(--text-mid); font-size: 14px; }

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 36px; text-align: center;
  cursor: pointer;
  transition: all .25s;
  margin-bottom: 0;
}
.upload-area:hover { border-color: var(--gold); background: rgba(201,168,76,0.03); }
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.upload-sub { font-size: 13px; color: var(--text-dim); }

.or-divider {
  text-align: center; margin: 16px 0;
  position: relative;
}
.or-divider::before {
  content:''; position:absolute;
  top:50%; left:0; right:0; height:1px;
  background: var(--border);
}
.or-divider span {
  background: var(--surface); padding: 0 14px;
  font-size: 12px; color: var(--text-dim);
  position: relative;
}

.contract-textarea {
  width: 100%; height: 160px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-family: var(--font-mono); font-size: 13px;
  padding: 16px; resize: vertical;
  outline: none; transition: border-color .2s;
  line-height: 1.6;
}
.contract-textarea:focus { border-color: var(--gold); }
.contract-textarea::placeholder { color: var(--text-dim); }

.analyze-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px;
}
.jurisdiction-select {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-mid);
}
.jurisdiction-select select {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 8px;
  font-family: var(--font-body); font-size: 13px;
  outline: none; cursor: pointer;
}

.btn-analyze {
  background: var(--gold); color: #0c0c0f;
  border: none; padding: 12px 28px;
  border-radius: 8px; cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  transition: all .2s;
}
.btn-analyze:hover { background: var(--gold-lt); transform: translateY(-1px); }
.btn-analyze:disabled { opacity:.5; cursor: not-allowed; transform: none; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #0c0c0f;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }
.hidden { display: none !important; }

/* Results */
.results-section {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.results-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.results-header h3 { font-family: var(--font-head); font-size: 22px; }
.btn-export {
  background: none; border: 1px solid var(--border);
  color: var(--text-mid); padding: 8px 16px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
  font-family: var(--font-body);
  transition: all .2s;
}
.btn-export:hover { border-color: var(--gold); color: var(--gold); }

.risk-overview {
  display: flex; gap: 28px; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px;
  margin-bottom: 24px;
}
.risk-meter { text-align: center; width: 130px; flex-shrink:0; position: relative; }
.meter-svg { width: 130px; }
.meter-value {
  font-family: var(--font-mono); font-size: 32px; font-weight: 500;
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
}
.meter-label { font-size: 11px; color: var(--text-dim); margin-top: -6px; }
.risk-summary-text { font-size: 15px; color: var(--text-mid); line-height:1.7; }

.findings-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.finding-item {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: var(--r); padding: 16px;
  animation: fadeUp .4s ease both;
}
.finding-item.risk-high   { border-left-color: var(--red); }
.finding-item.risk-medium { border-left-color: var(--yellow); }
.finding-item.risk-low    { border-left-color: var(--green); }
.finding-emoji { font-size: 22px; flex-shrink:0; margin-top:1px; }
.finding-body {}
.finding-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.finding-desc  { font-size: 13px; color: var(--text-mid); line-height:1.6; }
.finding-suggest {
  margin-top: 8px; font-size: 12px;
  color: var(--accent); background: rgba(124,106,247,0.08);
  border-radius: 6px; padding: 6px 10px;
  font-style: italic;
}

.ai-summary-box {
  background: linear-gradient(135deg, rgba(201,168,76,0.05) 0%, var(--bg) 100%);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--r-lg); padding: 24px;
}
.ai-summary-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--gold); }
.ai-summary-content { font-size: 14px; color: var(--text-mid); line-height:1.8; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-empty { color: var(--text-dim); font-size: 14px; text-align:center; padding: 60px 0; }
.history-item {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 20px;
  cursor: pointer; transition: border-color .2s;
}
.history-item:hover { border-color: var(--gold); }
.history-icon { font-size: 28px; }
.history-info { flex:1; }
.history-name { font-size: 14px; font-weight: 600; font-family: var(--font-mono); margin-bottom: 3px; }
.history-date { font-size: 12px; color: var(--text-dim); }
.history-risk {
  font-size: 11px; font-weight: 700; font-family: var(--font-mono);
  letter-spacing: 1px; padding: 4px 10px; border-radius: 20px;
}
.history-risk.high   { background: rgba(224,82,82,.12); color: var(--red); }
.history-risk.medium { background: rgba(224,168,48,.12); color: var(--yellow); }
.history-risk.low    { background: rgba(62,207,142,.12); color: var(--green); }

/* Chat */
.chat-container {
  display: flex; flex-direction: column;
  height: calc(86vh - 180px); max-height: 560px;
}
.chat-messages {
  flex:1; overflow-y: auto; padding: 8px 0;
  display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-msg { display: flex; gap: 12px; align-items: flex-start; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(201,168,76,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.chat-msg.user .chat-avatar { background: rgba(124,106,247,0.15); }
.chat-bubble {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 16px;
  font-size: 14px; color: var(--text-mid); line-height:1.6;
  max-width: 75%;
}
.chat-msg.user .chat-bubble {
  background: rgba(201,168,76,0.08);
  border-color: rgba(201,168,76,0.2);
  color: var(--text);
}

.chat-input-row {
  display: flex; gap: 10px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex:1; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 12px 16px;
  border-radius: 8px; font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border-color .2s;
}
.chat-input-row input:focus { border-color: var(--gold); }
.chat-send {
  background: var(--gold); color: #0c0c0f;
  border: none; padding: 12px 22px;
  border-radius: 8px; cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  transition: all .2s;
}
.chat-send:hover { background: var(--gold-lt); }

/* Settings */
.settings-grid { display: flex; flex-direction: column; gap: 20px; }
.settings-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px;
}
.settings-card h4 {
  font-family: var(--font-head); font-size: 18px;
  margin-bottom: 20px;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.setting-row:last-child { border-bottom: none; }
.setting-row label { font-size: 14px; color: var(--text-mid); }
.setting-input {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 8px;
  font-family: var(--font-body); font-size: 13px;
  outline: none; min-width: 0; max-width: 100%; transition: border-color .2s;
}
.setting-input:focus { border-color: var(--gold); }
.toggle-row label { flex:1; }

.toggle {
  width: 42px; height: 24px; border-radius: 12px;
  background: var(--border); position: relative; cursor: pointer;
  flex-shrink: 0; transition: background .2s;
}
.toggle::after {
  content:''; position:absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform .2s;
}
.toggle.on { background: var(--gold); }
.toggle.on::after { transform: translateX(18px); }

.current-plan-box {
  background: linear-gradient(135deg, rgba(201,168,76,0.06) 0%, transparent 100%);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--r); padding: 20px;
}
.cp-name { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--gold); }
.cp-price { font-family: var(--font-mono); font-size: 16px; margin: 6px 0; }
.cp-renew { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }
.btn-upgrade {
  background: none; border: 1px solid var(--gold);
  color: var(--gold); padding: 10px 20px;
  border-radius: 8px; cursor: pointer;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  transition: all .2s;
}
.btn-upgrade:hover { background: var(--gold); color: #0c0c0f; }

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ══════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ══════════════════════════════════════════
   GLOBAL OVERFLOW GUARD
══════════════════════════════════════════ */
html, body { overflow-x: hidden; max-width: 100%; }
img, video, table { max-width: 100%; }

/* ══════════════════════════════════════════
   RESPONSIVE — TABLET (≤900px)
══════════════════════════════════════════ */
@media (max-width: 900px) {
  #hero {
    grid-template-columns: 1fr;
    padding: 100px 20px 60px;
    gap: 40px;
    text-align: center;
  }
  .hero-content { align-items: center; display: flex; flex-direction: column; }
  .hero-sub { max-width: 100%; }
  .hero-actions { align-items: center; }
  .hero-stats { justify-content: center; }
  .hero-visual { max-width: 100%; margin: 0 auto; }

  .steps-grid { grid-template-columns: 1fr; gap: 16px; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .feature-card.large { grid-column: span 2; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; }
  .plan-card.featured { transform: none; }

  .footer-inner { flex-direction: column; gap: 36px; }
  .footer-links { flex-wrap: wrap; gap: 28px; margin-left: 0; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE (≤600px)
══════════════════════════════════════════ */
@media (max-width: 600px) {
  section { padding: 60px 16px; }
  .section-title { font-size: 26px; margin-bottom: 28px; }

  #navbar { padding: 0; }
  .nav-inner { padding: 0 16px; gap: 8px; }
  .nav-links { display: none; }
  .btn-ghost { display: none; }
  .btn-primary { padding: 8px 14px; font-size: 13px; }

  #hero {
    grid-template-columns: 1fr;
    padding: 80px 16px 40px;
    gap: 32px;
    text-align: center;
    overflow: hidden;
  }
  .hero-content { align-items: center; display: flex; flex-direction: column; }
  .hero-title { font-size: 28px; letter-spacing: 0; }
  .hero-sub { font-size: 14px; max-width: 100%; }
  .hero-badge { font-size: 11px; }
  .hero-stats { flex-wrap: wrap; gap: 16px; justify-content: center; }
  .stat-div { display: none; }
  .stat-num { font-size: 22px; }
  .hero-visual { width: 100%; overflow: hidden; }
  .doc-card { width: 100%; box-sizing: border-box; }
  .doc-name { font-size: 11px; word-break: break-all; }
  .clause-title { font-size: 12px; }
  .clause-desc { font-size: 11px; }
  .hero-glow { width: 100vw; height: 100vw; max-width: 400px; max-height: 400px; }

  .steps-grid { grid-template-columns: 1fr; }
  .step-card { padding: 24px 18px; }
  .features-grid { grid-template-columns: 1fr; }
  .feature-card.large { grid-column: span 1; }
  .feature-card { padding: 22px 18px; }

  .pricing-grid { grid-template-columns: 1fr; max-width: 100%; }
  .plan-card { padding: 24px 18px; }
  .plan-card.featured { transform: none; }
  .price-amount { font-size: 32px; }

  footer { padding: 40px 16px 0; }
  .footer-inner { flex-direction: column; gap: 28px; padding-bottom: 36px; }
  .footer-links { flex-direction: column; gap: 20px; margin-left: 0; }
  .footer-brand { max-width: 100%; }

  /* APP MODAL — bottom sheet */
  #app-overlay { padding: 0; align-items: flex-end; }
  #app-modal {
    flex-direction: column;
    height: 96vh;
    max-height: 96vh;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .modal-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: auto;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
  }
  .modal-sidebar::-webkit-scrollbar { display: none; }
  .sidebar-logo { display: none; }
  .sidebar-plan { display: none; }
  .close-modal {
    margin-left: auto;
    padding: 5px 10px;
    font-size: 18px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
  }
  .sidebar-nav { flex-direction: row; padding: 0; gap: 2px; flex-shrink: 0; }
  .snav-item {
    padding: 7px 10px;
    font-size: 11px;
    white-space: nowrap;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent;
    flex-direction: column;
    gap: 1px;
    align-items: center;
  }
  .snav-item.active { border-bottom-color: var(--gold); background: rgba(201,168,76,0.07); }
  .snav-item span { font-size: 15px; }

  .modal-main { padding: 14px; overflow-x: hidden; }
  .view-header { margin-bottom: 14px; }
  .view-header h2 { font-size: 20px; }

  .upload-area { padding: 18px 14px; }
  .upload-icon { font-size: 26px; margin-bottom: 6px; }
  .upload-title { font-size: 14px; }
  .upload-sub { font-size: 11px; }
  .contract-textarea { height: 110px; font-size: 12px; width: 100%; box-sizing: border-box; }

  .analyze-footer { flex-direction: column; gap: 10px; align-items: stretch; }
  .jurisdiction-select select { flex: 1; min-width: 0; max-width: 100%; }
  .btn-analyze { width: 100%; justify-content: center; }

  .risk-overview { flex-direction: column; gap: 14px; align-items: center; text-align: center; }
  .results-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .btn-export { width: 100%; text-align: center; }
  .finding-item { padding: 12px; gap: 10px; }
  .finding-title { font-size: 13px; }
  .finding-desc { font-size: 12px; }
  .finding-suggest { font-size: 11px; }

  .chat-container { height: calc(96vh - 310px); min-height: 260px; }
  .chat-bubble { font-size: 13px; max-width: 90%; padding: 10px 12px; }
  .chat-input-row { gap: 8px; }
  .chat-input-row input { font-size: 14px; padding: 10px 12px; min-width: 0; }
  .chat-send { padding: 10px 14px; font-size: 13px; flex-shrink: 0; }
  .chat-avatar { width: 26px; height: 26px; font-size: 12px; }

  .settings-grid { gap: 12px; }
  .settings-card { padding: 16px; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .setting-row.toggle-row { flex-direction: row; align-items: center; }
  .setting-input { min-width: 0; width: 100%; box-sizing: border-box; }
  .btn-upgrade { width: 100%; }
}