/* ==========================================================================
   QureNova — Design System
   Peach + White base, soft blue/purple/turquoise accents.
   Type: Sora (display) + Inter (body)
   ========================================================================== */

:root{
  /* --- Palette --- */
  --peach-50:   #FFF8F2;
  --peach-100:  #FFEEE0;
  --peach-300:  #FFCFA8;
  --peach-500:  #FF9A62;
  --white:      #FFFFFF;
  --blue-500:   #5B8DEF;
  --blue-700:   #3D64C4;
  --purple-500: #8C6FE8;
  --turquoise-500: #2FC7C0;
  --ink-900:    #201A2B;
  --ink-700:    #4A4258;
  --ink-500:    #7A7186;
  --line:       #EFE3D8;
  --danger:     #E2574C;
  --warn:       #E7A93B;
  --good:       #2FA88A;

  --grad-hero: linear-gradient(135deg, var(--peach-100) 0%, #FFF 45%, #EFF3FF 100%);
  --grad-brand: linear-gradient(120deg, var(--blue-500), var(--purple-500) 55%, var(--turquoise-500));
  --grad-orb: radial-gradient(circle at 30% 30%, var(--turquoise-500), var(--purple-500) 60%, var(--blue-700) 100%);

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 26px;
  --shadow-card: 0 1px 2px rgba(32,26,43,.04), 0 12px 28px -14px rgba(76,60,120,.22);
  --shadow-pop: 0 20px 60px -20px rgba(76,60,120,.35);

  --font-display: 'Sora', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

[data-theme="dark"]{
  --peach-50:  #1C1620;
  --peach-100: #241B28;
  --white:     #17131C;
  --ink-900:   #F4EFF9;
  --ink-700:   #D6CEDF;
  --ink-500:   #9C93A9;
  --line:      #322A3B;
  --grad-hero: linear-gradient(135deg, #241B28 0%, #17131C 45%, #1B1E2E 100%);
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--white);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4{
  font-family: var(--font-display);
  color: var(--ink-900);
  line-height: 1.15;
  margin: 0 0 .5em;
  font-weight: 600;
}
p{ margin: 0 0 1em; color: var(--ink-700); }
a{ color: var(--blue-700); text-decoration: none; }
img{ max-width: 100%; display:block; }
button{ font-family: inherit; }

.container{ max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.container-narrow{ max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* --- Buttons --- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 13px 26px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:active{ transform: scale(.97); }
.btn-primary{ background: var(--grad-brand); color: #fff; box-shadow: 0 10px 24px -10px rgba(92,110,232,.55); }
.btn-primary:hover{ box-shadow: 0 14px 30px -10px rgba(92,110,232,.7); }
.btn-outline{ background: transparent; border-color: var(--line); color: var(--ink-900); }
.btn-outline:hover{ border-color: var(--purple-500); color: var(--purple-500); }
.btn-soft{ background: var(--peach-100); color: var(--ink-900); }
.btn-soft:hover{ background: var(--peach-300); }
.btn-block{ width:100%; }
.btn-sm{ padding: 8px 16px; font-size: .85rem; }
.btn-danger{ background: var(--danger); color:#fff; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* --- Nav --- */
.nav{
  position: sticky; top:0; z-index: 50;
  background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
[data-theme="dark"] .nav{ background: rgba(23,19,28,.82); }
.nav-inner{ display:flex; align-items:center; justify-content:space-between; padding: 14px 24px; max-width: 1160px; margin:0 auto; }
.brand{ display:flex; align-items:center; gap:10px; font-family: var(--font-display); font-weight:700; font-size:1.15rem; color: var(--ink-900); }
.brand img{ width:34px; height:34px; border-radius:9px; }
.nav-links{ display:flex; align-items:center; gap:28px; }
.nav-links a{ color: var(--ink-700); font-weight:500; font-size:.93rem; }
.nav-links a:hover{ color: var(--purple-500); }
.nav-actions{ display:flex; align-items:center; gap:10px; }
.icon-btn{
  width:38px; height:38px; border-radius:999px; border:1px solid var(--line); background: var(--white);
  display:flex; align-items:center; justify-content:center; cursor:pointer; color: var(--ink-700);
}
.icon-btn:hover{ border-color: var(--purple-500); color: var(--purple-500); }
.lang-select{
  border:1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--white);
  font-size: .85rem; color: var(--ink-700); cursor:pointer;
}

/* --- Hero --- */
.hero{ background: var(--grad-hero); padding: 72px 0 88px; overflow: hidden; }
.hero-grid{ display:grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items:center; }
.eyebrow-tag{
  display:inline-flex; align-items:center; gap:8px; padding: 7px 14px; border-radius:999px;
  background: var(--white); border:1px solid var(--line); font-size:.82rem; color: var(--ink-700); margin-bottom:20px;
}
.eyebrow-tag .dot{ width:7px; height:7px; border-radius:50%; background: var(--turquoise-500); }
.hero h1{ font-size: clamp(2.1rem, 4vw, 3.1rem); max-width: 12ch; }
.hero .lead{ font-size: 1.08rem; max-width: 46ch; color: var(--ink-700); }
.hero-actions{ display:flex; gap:14px; margin-top:28px; flex-wrap:wrap; }
.hero-disclaimer{ margin-top:22px; font-size:.82rem; color: var(--ink-500); max-width:46ch; }

.orb-wrap{ position:relative; display:flex; align-items:center; justify-content:center; }
.orb{
  width: 320px; height: 320px; border-radius: 50%;
  background: var(--grad-orb);
  box-shadow: var(--shadow-pop);
  position: relative;
}
.orb::before, .orb::after{
  content:''; position:absolute; inset: -18px; border-radius:50%;
  border: 1px dashed rgba(140,111,232,.35);
}
.orb::after{ inset: -38px; border-color: rgba(47,199,192,.28); }
.orb-node{
  position:absolute; background: var(--white); border-radius: var(--radius-m);
  box-shadow: var(--shadow-card); padding: 10px 14px; font-size:.78rem; font-weight:600; color: var(--ink-900);
  display:flex; align-items:center; gap:8px;
}
.orb-node .sw{ width:8px; height:8px; border-radius:50%; }

/* --- Sections --- */
.section{ padding: 88px 0; }
.section-tight{ padding: 56px 0; }
.section-head{ max-width: 620px; margin-bottom: 46px; }
.section-head h2{ font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-alt{ background: var(--peach-50); }

.grid-3{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-2{ display:grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }

.feature-card{
  background: var(--white); border:1px solid var(--line); border-radius: var(--radius-l);
  padding: 30px 26px; box-shadow: var(--shadow-card);
}
.feature-card .icon{
  width:46px; height:46px; border-radius: 14px; display:flex; align-items:center; justify-content:center;
  background: var(--peach-100); color: var(--purple-500); margin-bottom: 18px;
}
.feature-card h3{ font-size: 1.08rem; }
.feature-card p{ font-size: .92rem; margin-bottom:0; }

/* --- Pipeline --- */
.pipeline{ display:flex; flex-direction:column; gap:0; max-width: 460px; margin: 0 auto; }
.pipeline-step{
  display:flex; align-items:center; gap:16px; padding: 14px 18px; background: var(--white);
  border:1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-card);
}
.pipeline-step .num{
  width:32px; height:32px; flex:0 0 auto; border-radius:50%; background: var(--grad-brand); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:.82rem; font-weight:700;
}
.pipeline-arrow{ text-align:center; color: var(--ink-500); padding: 4px 0; font-size:.9rem; }

/* --- Auth --- */
.auth-shell{ min-height: 100vh; display:grid; grid-template-columns: 1fr 1fr; }
.auth-visual{
  background: var(--grad-hero); display:flex; flex-direction:column; justify-content:center; padding: 60px;
  position:relative; overflow:hidden;
}
.auth-visual .orb{ width:220px; height:220px; position:absolute; right:-60px; bottom:-60px; opacity:.9; }
.auth-form-side{ display:flex; align-items:center; justify-content:center; padding: 40px 24px; }
.auth-card{ width:100%; max-width: 400px; }
.auth-card .brand{ margin-bottom: 30px; }
.role-toggle{ display:flex; background: var(--peach-100); border-radius: 999px; padding:4px; margin-bottom: 26px; }
.role-toggle button{
  flex:1; border:none; background:transparent; padding: 10px; border-radius:999px; font-weight:600;
  font-size:.9rem; color: var(--ink-700); cursor:pointer; transition: all .15s ease;
}
.role-toggle button.active{ background: var(--white); color: var(--purple-500); box-shadow: var(--shadow-card); }
.field{ margin-bottom: 18px; }
.field label{ display:block; font-size:.85rem; font-weight:600; color: var(--ink-700); margin-bottom: 6px; }
.field input, .field select, .field textarea{
  width:100%; padding: 12px 14px; border-radius: var(--radius-s); border: 1px solid var(--line);
  font-size: .94rem; font-family: inherit; color: var(--ink-900); background: var(--white);
}
.field input:focus, .field select:focus, .field textarea:focus{ outline: 2px solid var(--purple-500); outline-offset:1px; border-color: var(--purple-500); }
.field-row{ display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-note{ font-size:.78rem; color: var(--ink-500); margin-top:6px; }
.form-error{ color: var(--danger); font-size:.85rem; min-height: 1.2em; margin-bottom: 8px; }
.form-foot{ margin-top: 18px; font-size:.88rem; color: var(--ink-700); text-align:center; }
.info-note{
  background: var(--peach-50); border:1px solid var(--peach-300); border-radius: var(--radius-m);
  padding: 14px 16px; font-size: .82rem; color: var(--ink-700); margin-top: 20px;
}
.info-note strong{ display:block; color: var(--ink-900); margin-bottom:4px; }

/* --- App shell (dashboard layout) --- */
.app-shell{ display:grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar{ background: var(--peach-50); border-right: 1px solid var(--line); padding: 24px 18px; display:flex; flex-direction:column; }
.sidebar .brand{ padding: 6px 10px 26px; }
.side-nav{ display:flex; flex-direction:column; gap: 4px; flex:1; }
.side-nav a{
  display:flex; align-items:center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-s);
  color: var(--ink-700); font-size: .92rem; font-weight:500;
}
.side-nav a:hover{ background: var(--white); }
.side-nav a.active{ background: var(--white); color: var(--purple-500); box-shadow: var(--shadow-card); font-weight:600; }
.sidebar-foot{ padding-top: 16px; border-top: 1px solid var(--line); }
.main-area{ background: var(--white); }
.topbar{
  display:flex; align-items:center; justify-content:space-between; padding: 20px 32px;
  border-bottom: 1px solid var(--line); position:sticky; top:0; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); z-index: 10;
}
[data-theme="dark"] .topbar{ background: rgba(23,19,28,.9); }
.topbar h1{ font-size: 1.3rem; margin:0; }
.page-body{ padding: 28px 32px 60px; }

/* --- Cards / stats --- */
.stat-grid{ display:grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat-card{ background: var(--white); border:1px solid var(--line); border-radius: var(--radius-m); padding: 20px; box-shadow: var(--shadow-card); }
.stat-card .label{ font-size: .8rem; color: var(--ink-500); margin-bottom:6px; }
.stat-card .value{ font-family: var(--font-display); font-size: 1.7rem; font-weight:700; }
.stat-card .delta{ font-size:.78rem; margin-top:4px; }
.delta.up{ color: var(--good); }
.delta.down{ color: var(--danger); }

.card{ background: var(--white); border:1px solid var(--line); border-radius: var(--radius-l); padding: 24px; box-shadow: var(--shadow-card); margin-bottom: 22px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 16px; }
.card-head h2, .card-head h3{ margin:0; font-size: 1.05rem; }

.quick-actions{ display:grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quick-action{
  display:flex; flex-direction:column; align-items:flex-start; gap: 10px; padding: 18px; text-align:left;
  background: var(--white); border:1px solid var(--line); border-radius: var(--radius-m); cursor:pointer; box-shadow: var(--shadow-card);
}
.quick-action:hover{ border-color: var(--purple-500); }
.quick-action .icon{ width:38px; height:38px; border-radius:11px; background: var(--peach-100); color: var(--purple-500); display:flex; align-items:center; justify-content:center; }
.quick-action span.title{ font-weight:600; font-size:.92rem; color: var(--ink-900); }
.quick-action span.desc{ font-size:.78rem; color: var(--ink-500); }

/* --- Badges / tags --- */
.badge{ display:inline-flex; align-items:center; gap:6px; padding: 4px 11px; border-radius:999px; font-size:.76rem; font-weight:700; }
.badge-low{ background: #E4F6F0; color: var(--good); }
.badge-moderate{ background: #FFF3DE; color: #B8791A; }
.badge-high{ background: #FDE7E5; color: var(--danger); }
.badge-neutral{ background: var(--peach-100); color: var(--ink-700); }

/* --- Table --- */
table{ width:100%; border-collapse: collapse; font-size: .89rem; }
th{ text-align:left; color: var(--ink-500); font-weight:600; font-size:.78rem; text-transform: uppercase; letter-spacing:.02em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td{ padding: 13px 12px; border-bottom: 1px solid var(--line); color: var(--ink-900); }
tr:last-child td{ border-bottom:none; }
.table-wrap{ overflow-x:auto; }

/* --- Assessment form --- */
.progress-bar{ height:6px; background: var(--peach-100); border-radius:999px; overflow:hidden; margin-bottom: 30px; }
.progress-bar .fill{ height:100%; background: var(--grad-brand); border-radius:999px; transition: width .3s ease; }
.step-label{ font-size:.82rem; color: var(--ink-500); margin-bottom: 6px; }
.chip-group{ display:flex; flex-wrap:wrap; gap:10px; }
.chip{
  padding: 9px 16px; border-radius:999px; border:1px solid var(--line); font-size:.86rem; cursor:pointer; background: var(--white); color: var(--ink-700);
}
.chip.active{ background: var(--purple-500); border-color: var(--purple-500); color:#fff; }
.range-value{ font-weight:700; color: var(--purple-500); }

/* --- Results / explainability --- */
.risk-hero{ display:flex; align-items:center; gap: 26px; padding: 28px; border-radius: var(--radius-l); }
.risk-hero.low{ background: #E9F8F2; }
.risk-hero.moderate{ background: #FFF6E6; }
.risk-hero.high{ background: #FDEBE9; }
.risk-ring{ width:96px; height:96px; border-radius:50%; display:flex; align-items:center; justify-content:center; background: var(--white); box-shadow: var(--shadow-card); font-family: var(--font-display); font-weight:700; font-size:1.3rem; }
.factor-row{ display:grid; grid-template-columns: 160px 1fr 46px; align-items:center; gap: 14px; margin-bottom: 14px; }
.factor-track{ height: 9px; border-radius:999px; background: var(--peach-100); overflow:hidden; }
.factor-fill{ height:100%; background: var(--grad-brand); border-radius:999px; }
.factor-name{ font-size:.88rem; color: var(--ink-700); }
.factor-pct{ font-size:.82rem; color: var(--ink-500); text-align:right; }
.model-compare{ display:grid; grid-template-columns: 1fr 1fr; gap:18px; }
.model-box{ border:1px solid var(--line); border-radius: var(--radius-m); padding:18px; }
.model-box h4{ font-size:.9rem; margin-bottom:10px; }
.model-box .pct{ font-family: var(--font-display); font-size:2rem; font-weight:700; }

/* --- Consultation --- */
.consult-shell{ display:grid; grid-template-columns: 1fr 320px; gap:0; height: calc(100vh - 0px); background:#14101A; }
.video-stage{ position:relative; display:flex; align-items:center; justify-content:center; background:#0F0B14; }
.video-stage video{ width:100%; height:100%; object-fit:cover; background:#1E1826; }
.self-view{ position:absolute; width: 200px; bottom: 100px; right: 24px; border-radius: var(--radius-m); overflow:hidden; border: 2px solid rgba(255,255,255,.25); box-shadow: var(--shadow-pop); background:#000; }
.self-view video{ width:100%; height:130px; object-fit:cover; }
.consult-timer{ position:absolute; top:22px; left:24px; background: rgba(0,0,0,.4); color:#fff; padding:7px 14px; border-radius:999px; font-size:.82rem; }
.consult-controls{ position:absolute; bottom: 26px; left:50%; transform: translateX(-50%); display:flex; gap:12px; background: rgba(20,16,26,.7); backdrop-filter: blur(10px); padding: 12px 16px; border-radius: 999px; }
.ctrl-btn{ width:48px; height:48px; border-radius:50%; border:none; display:flex; align-items:center; justify-content:center; background: rgba(255,255,255,.14); color:#fff; cursor:pointer; }
.ctrl-btn.off{ background: var(--danger); }
.ctrl-btn.end{ background: var(--danger); width:auto; padding:0 22px; border-radius:999px; font-weight:600; }
.consult-side{ background: var(--white); display:flex; flex-direction:column; border-left: 1px solid var(--line); }
.side-tabs{ display:flex; border-bottom: 1px solid var(--line); }
.side-tabs button{ flex:1; padding: 14px; border:none; background:transparent; font-size:.85rem; font-weight:600; color: var(--ink-500); cursor:pointer; border-bottom: 2px solid transparent; }
.side-tabs button.active{ color: var(--purple-500); border-color: var(--purple-500); }
.side-panel{ padding: 18px; overflow-y:auto; flex:1; }
.chat-thread{ display:flex; flex-direction:column; gap:10px; margin-bottom:14px; }
.chat-msg{ max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size:.85rem; }
.chat-msg.mine{ align-self:flex-end; background: var(--grad-brand); color:#fff; border-bottom-right-radius:4px; }
.chat-msg.theirs{ align-self:flex-start; background: var(--peach-100); border-bottom-left-radius:4px; }
.chat-input{ display:flex; gap:8px; padding: 14px; border-top:1px solid var(--line); }
.chat-input input{ flex:1; border:1px solid var(--line); border-radius:999px; padding: 10px 14px; font-size:.85rem; }

/* --- Timeline --- */
.timeline{ position:relative; padding-left: 28px; }
.timeline::before{ content:''; position:absolute; left:7px; top:6px; bottom:6px; width:2px; background: var(--line); }
.timeline-item{ position:relative; padding-bottom: 26px; }
.timeline-item::before{ content:''; position:absolute; left:-28px; top:2px; width:14px; height:14px; border-radius:50%; background: var(--grad-brand); border: 3px solid var(--white); box-shadow: 0 0 0 1px var(--line); }
.timeline-date{ font-size:.76rem; color: var(--ink-500); margin-bottom:4px; }
.timeline-title{ font-weight:600; font-size:.94rem; margin-bottom:2px; }

/* --- Upload --- */
.dropzone{
  border: 2px dashed var(--line); border-radius: var(--radius-l); padding: 40px 20px; text-align:center;
  color: var(--ink-500); cursor:pointer; background: var(--peach-50);
}
.dropzone:hover{ border-color: var(--purple-500); }
.file-row{ display:flex; align-items:center; justify-content:space-between; padding: 12px 14px; border:1px solid var(--line); border-radius: var(--radius-s); margin-bottom:10px; }

/* --- Footer --- */
.footer{ background: var(--ink-900); color: rgba(255,255,255,.7); padding: 54px 0 28px; margin-top: 40px; }
.footer .brand{ color:#fff; }
.footer a{ color: rgba(255,255,255,.7); }
.footer-grid{ display:grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 36px; }
.footer h4{ color:#fff; font-size:.85rem; margin-bottom:14px; }
.footer-links{ display:flex; flex-direction:column; gap:10px; font-size:.86rem; }
.footer-bottom{ border-top: 1px solid rgba(255,255,255,.12); padding-top: 20px; font-size:.8rem; display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; }

/* --- Toast --- */
.toast-wrap{ position: fixed; top: 20px; right: 20px; z-index: 999; display:flex; flex-direction:column; gap:10px; }
.toast{ background: var(--ink-900); color:#fff; padding: 13px 18px; border-radius: var(--radius-m); font-size:.85rem; box-shadow: var(--shadow-pop); animation: toast-in .25s ease; }
@keyframes toast-in{ from{ opacity:0; transform: translateY(-8px); } to{ opacity:1; transform:none; } }

/* --- Modal --- */
.modal-backdrop{ position:fixed; inset:0; background: rgba(32,26,43,.45); display:flex; align-items:center; justify-content:center; z-index: 200; padding: 20px; }
.modal{ background: var(--white); border-radius: var(--radius-l); padding: 28px; max-width: 440px; width:100%; box-shadow: var(--shadow-pop); }

/* --- Utility --- */
.text-center{ text-align:center; }
.mt-0{ margin-top:0; } .mb-0{ margin-bottom:0; }
.flex{ display:flex; } .items-center{ align-items:center; } .justify-between{ justify-content:space-between; } .gap-8{ gap:8px; } .gap-12{ gap:12px; }
.muted{ color: var(--ink-500); font-size:.85rem; }
.hidden{ display:none !important; }
.empty-state{ text-align:center; padding: 46px 20px; color: var(--ink-500); }
.empty-state .icon{ font-size: 2.2rem; margin-bottom: 10px; }

/* --- Responsive --- */
@media (max-width: 980px){
  .hero-grid{ grid-template-columns: 1fr; }
  .orb-wrap{ order:-1; }
  .grid-3{ grid-template-columns: 1fr 1fr; }
  .footer-grid{ grid-template-columns: 1fr 1fr; }
  .stat-grid{ grid-template-columns: 1fr 1fr; }
  .quick-actions{ grid-template-columns: 1fr 1fr; }
  .auth-shell{ grid-template-columns: 1fr; }
  .auth-visual{ display:none; }
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{ display:none; }
  .consult-shell{ grid-template-columns: 1fr; }
  .consult-side{ display:none; }
  .model-compare{ grid-template-columns: 1fr; }
}
@media (max-width: 600px){
  .grid-3, .grid-2, .stat-grid, .quick-actions{ grid-template-columns: 1fr; }
  .field-row{ grid-template-columns: 1fr; }
  .nav-links{ display:none; }
  .factor-row{ grid-template-columns: 100px 1fr 40px; }
}
