/* ============================================================================
   BETTER HALF — UI STYLE SHEET (extracted from the betterhalf-mvp app)
   ----------------------------------------------------------------------------
   This is the complete look-and-feel of the Better Half MVP, pulled out of the
   app's single index.html into a standalone stylesheet so it can be dropped
   onto another build. Pair it with STRUCTURE-GUIDE.md.

   TWO THINGS THIS FILE NEEDS TO LOOK RIGHT:

   1) THE FONTS. Add these two lines to the <head> of your HTML (above this
      stylesheet). They load Satoshi (the UI font) and Source Serif 4 (used for
      the .serif accent). Without them the type falls back to system sans.

        <link rel="stylesheet"
          href="https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700,900&display=swap" />
        <link rel="stylesheet"
          href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;1,8..60,400;1,8..60,500&display=swap" />

   2) THE PHONE SHELL. The whole app lives inside <div id="app">, a fixed-width
      (max 440px) rounded "phone" centered on a gray page. Keep that wrapper and
      everything inside inherits the right proportions. See the guide.

   TO RESKIN: you almost never touch the rules below. Change the 8 color tokens
   in :root (next block) and the brand re-colors itself everywhere. That is the
   whole trick. --indigo is the primary/brand color, --purple is the accent.
   ============================================================================ */

  :root{
    --ink:#0b0b0c; --paper:#f5f5f5; --indigo:#0f1756; --purple:#6d5fe9;
    --lav:#dba8e1; --gray:#9a9aa2; --muted:#5a5a62; --line:rgba(11,11,12,.10);
  }
  *{box-sizing:border-box; -webkit-tap-highlight-color:transparent}
  html,body{margin:0;height:100%}
  body{ font-family:'Satoshi',-apple-system,BlinkMacSystemFont,system-ui,sans-serif; background:#e6e6e9; color:var(--ink); -webkit-font-smoothing:antialiased; display:flex; align-items:center; justify-content:center; }
  .serif{font-family:'Source Serif 4',Georgia,serif}
  #app{ width:min(440px,100vw); height:100dvh; max-height:920px; background:var(--paper); position:relative; z-index:1; overflow:hidden; display:flex; flex-direction:column; }
  @media (min-width:480px){ #app{ border-radius:30px; box-shadow:0 30px 80px rgba(15,23,86,.25) } }
  .statusbar{flex:0 0 auto; display:flex; justify-content:space-between; align-items:center; padding:11px 20px 4px; font-size:12px; font-weight:700; color:var(--ink)}
  .statusbar .dots{color:var(--gray)}

  .view{flex:1; min-height:0; display:none; flex-direction:column}
  .view.active{display:flex}
  button{font-family:inherit; cursor:pointer; border:none}
  .btn-primary{background:var(--indigo); color:#fff; font-weight:800; font-size:15px; padding:14px; border-radius:14px; display:flex; align-items:center; justify-content:center; gap:8px; width:100%}
  .btn-primary:active{transform:scale(.985)}
  .ghost{background:none; color:var(--gray); font-size:13px; font-weight:700}
  svg.ico{width:23px; height:23px; stroke:currentColor; stroke-width:2; fill:none; stroke-linecap:round; stroke-linejoin:round}

  /* STORY */
  #story{padding:26px 28px 24px}
  .bh-logo{width:170px; max-width:62%; height:auto}
  #story .slidewrap{flex:1; min-height:0; display:flex; flex-direction:column; justify-content:center}
  .slide{display:none}
  .slide.on{display:block}
  .slide .kicker{font-size:13px; font-weight:800; color:var(--purple); text-transform:uppercase; letter-spacing:.08em; margin-bottom:14px}
  .slide h1{font-size:26px; font-weight:900; letter-spacing:-.02em; line-height:1.12; margin:0}
  .slide p{font-size:17px; font-weight:500; line-height:1.5; color:var(--ink); margin:14px 0 0}
  .slide .big{font-weight:900}
  .dots{display:flex; gap:7px; justify-content:center; margin:0 0 16px}
  .dots i{width:7px; height:7px; border-radius:999px; background:#cfcde0; display:block}
  .dots i.on{background:var(--purple); width:20px}
  .storynav{display:flex; align-items:center; gap:12px}
  .storynav .next{flex:1}

  /* GATE */
  #gate{padding:28px; overflow-y:auto; align-items:stretch}
  .gatewrap{margin:auto; width:100%; max-width:360px; display:flex; flex-direction:column; align-items:center; text-align:center}
  #gate h1{font-size:24px; font-weight:900; letter-spacing:-.01em; line-height:1.1; margin:22px 0 12px}
  #gate .tag{font-size:14px; color:var(--muted); line-height:1.5; margin:0 0 22px}
  #gate .field-label{align-self:flex-start; width:100%; text-align:left; font-size:12px; font-weight:800; color:var(--indigo); margin-bottom:8px}
  #gate input{width:100%; background:#fff; border:1.6px solid var(--purple); border-radius:14px; padding:13px 16px; font-family:inherit; font-size:16px; font-weight:700; letter-spacing:.18em; text-align:center; color:var(--ink); margin-bottom:12px}
  #gate input:focus{outline:none; border-color:var(--indigo)}
  #gate .fine{font-size:11px; color:var(--gray); margin-top:22px; line-height:1.5}

  .pad{padding:14px 18px}
  .h-step{font-size:12px; font-weight:600; color:var(--muted)}
  .h-title{font-size:23px; font-weight:900; letter-spacing:-.02em; line-height:1.08; margin:6px 0 0}

  /* PERSONA */
  #personaList{flex:1; min-height:0; overflow-y:auto; padding:8px 16px; display:flex; flex-direction:column; gap:11px}
  .pcard{background:#fff; border:1.8px solid var(--line); border-radius:16px; padding:14px; display:flex; align-items:center; gap:13px; text-align:left; transition:border-color .12s}
  .pcard.sel{border:2.4px solid var(--purple)}
  .pcard .av{width:46px; height:46px; flex:0 0 auto; border-radius:13px; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:900; font-size:21px}
  .pcard .pn{font-size:17px; font-weight:900; display:block}
  .pcard .pd{font-size:12.5px; font-weight:500; color:var(--muted); line-height:1.4; margin-top:4px; display:block}
  .pcard .tick{margin-left:auto; width:24px; height:24px; flex:0 0 auto; border-radius:50%; background:var(--purple); color:#fff; display:none; align-items:center; justify-content:center}
  .pcard.sel .tick{display:flex}

  /* INTAKE */
  .scroll{flex:1; min-height:0; overflow-y:auto}
  .qz-intro{font-size:14px; color:var(--muted); padding:2px 18px 6px; font-weight:500; line-height:1.45}
  .q{padding:16px 18px 6px}
  .q .qq{font-size:15.5px; font-weight:800; margin-bottom:12px; line-height:1.3}
  input[type=range]{-webkit-appearance:none; width:100%; height:7px; border-radius:999px; background:#e6e4ee; outline:none}
  input[type=range]::-webkit-slider-thumb{-webkit-appearance:none; width:24px; height:24px; border-radius:50%; background:var(--indigo); border:3px solid #fff; box-shadow:0 1px 4px rgba(15,23,86,.35); cursor:pointer}
  input[type=range]::-moz-range-thumb{width:20px; height:20px; border-radius:50%; background:var(--indigo); border:3px solid #fff; cursor:pointer}
  .q .ends{display:flex; justify-content:space-between; font-size:11.5px; color:var(--muted); margin-top:8px; font-weight:600; gap:10px}
  .q .ends span:last-child{text-align:right}

  /* MAIN + nav */
  #screens{flex:1; min-height:0; position:relative}
  .screen{position:absolute; inset:0; display:none; flex-direction:column}
  .screen.active{display:flex}
  nav{flex:0 0 auto; display:flex; justify-content:space-around; align-items:flex-end; background:#fff; border-top:1px solid var(--line); padding:8px 2px calc(9px + env(safe-area-inset-bottom))}
  .tab{flex:1; background:none; display:flex; flex-direction:column; align-items:center; gap:3px; padding:0; color:var(--gray); position:relative}
  .tab svg{width:21px; height:21px}
  .tab .tl{font-size:9.5px; font-weight:800}
  .tab.on{color:var(--purple)}
  .tab.on .ind{position:absolute; bottom:-9px; width:18px; height:3px; border-radius:999px; background:var(--purple)}
  .tab .badge{position:absolute; top:-3px; left:50%; margin-left:6px; min-width:15px; height:15px; background:var(--purple); color:#fff; font-size:9px; font-weight:800; border-radius:999px; display:flex; align-items:center; justify-content:center; padding:0 3px}
  .screen-head{flex:0 0 auto; padding:12px 16px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:11px}
  .screen-head .av{width:38px; height:38px; flex:0 0 auto; border-radius:11px; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:900; font-size:17px}
  .screen-head .nm{font-size:16px; font-weight:900}
  .screen-head .meta{font-size:11px; font-weight:700; color:var(--purple); display:flex; align-items:center; gap:5px}
  .screen-head .meta .live{width:6px; height:6px; border-radius:50%; background:var(--purple)}
  .screen-head .back{background:none; color:var(--ink); display:flex; padding:0 4px 0 0}
  .screen-title{font-size:22px; font-weight:900; letter-spacing:-.02em; padding:16px 18px 2px}
  .screen-sub{font-size:13px; color:var(--muted); padding:0 18px 6px; font-weight:500; line-height:1.4}

  /* CHAT bubbles */
  .msgs{flex:1; min-height:0; overflow-y:auto; padding:16px 14px 8px; display:flex; flex-direction:column; gap:11px}
  .sys{align-self:center; background:#ececef; color:#6a6a72; font-size:10.5px; font-weight:700; padding:4px 12px; border-radius:999px; text-align:center}
  .bub{max-width:84%; font-size:14.5px; line-height:1.45; padding:11px 14px; white-space:pre-wrap; word-wrap:break-word; overflow-wrap:anywhere; font-weight:500}
  .me{align-self:flex-end; background:#e9e9ee; color:var(--ink); border-radius:20px 20px 6px 20px}
  .ai{align-self:flex-start; background:var(--purple); color:#fff; border-radius:20px 20px 20px 6px}
  .them{align-self:flex-start; background:#fff; border:1px solid var(--line); color:var(--ink); border-radius:20px 20px 20px 6px}
  .bh{align-self:center; background:var(--indigo); color:#fff; border-radius:16px; max-width:90%; font-size:13.5px; line-height:1.5; padding:12px 15px}
  .bh .who{font-size:10.5px; font-weight:800; color:var(--lav); display:flex; align-items:center; gap:6px; margin-bottom:6px; text-transform:uppercase; letter-spacing:.05em}
  .typing{align-self:flex-start; background:var(--purple); border-radius:20px; padding:13px 16px}
  .typing span{display:inline-block; width:6px; height:6px; margin:0 1px; background:#fff; border-radius:50%; opacity:.5; animation:blink 1.2s infinite both}
  .typing span:nth-child(2){animation-delay:.2s} .typing span:nth-child(3){animation-delay:.4s}
  @keyframes blink{0%,80%,100%{opacity:.3}40%{opacity:1}}
  .composer{flex:0 0 auto; border-top:1px solid var(--line); padding:10px 13px calc(12px + env(safe-area-inset-bottom)); display:flex; gap:9px; align-items:center}
  .composer textarea{flex:1; resize:none; border:1px solid var(--line); border-radius:999px; padding:10px 16px; font-family:inherit; font-size:14.5px; font-weight:500; background:#fff; max-height:120px; line-height:1.4}
  .composer textarea:focus{outline:none; border-color:var(--purple)}
  .composer .send{width:40px; height:40px; flex:0 0 auto; border-radius:50%; background:var(--indigo); color:#fff; display:flex; align-items:center; justify-content:center}
  .composer .send:disabled{opacity:.4}
  .composer .attach{width:40px; height:40px; flex:0 0 auto; border-radius:50%; background:#fff; border:1px solid var(--line); color:var(--gray); display:flex; align-items:center; justify-content:center}
  .composer .attach.has{color:var(--purple); border-color:var(--purple)}
  .attachbar{display:flex; align-items:center; gap:10px; padding:10px 14px 0}
  .attachbar[hidden]{display:none}
  .attachbar img{width:46px; height:46px; object-fit:cover; border-radius:10px; border:1px solid var(--line)}
  .attachbar .rm{font-size:12.5px; font-weight:700; color:var(--gray)}

  /* RELATE inbox */
  .inbox{flex:1; min-height:0; overflow-y:auto}
  .thread-row{display:flex; align-items:center; gap:12px; padding:13px 16px; border-bottom:1px solid var(--line); background:none; width:100%; text-align:left}
  .thread-row .av{width:46px; height:46px; flex:0 0 auto; border-radius:14px; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:900; font-size:18px}
  .thread-row .tn{font-size:15px; font-weight:800; display:flex; align-items:center; gap:7px}
  .thread-row .lbl{font-size:9px; font-weight:800; padding:2px 7px; border-radius:999px; letter-spacing:.04em}
  .lbl-ai{background:#ece9fc; color:var(--purple)}
  .lbl-person{background:#e7f6ef; color:#1d9e75}
  .thread-row .pv{font-size:12.5px; color:var(--muted); font-weight:500; margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:block}
  .thread-row .tm{margin-left:auto; align-self:flex-start; font-size:11px; color:var(--gray); font-weight:600; padding-top:3px; flex:0 0 auto}

  /* cards */
  .card{background:#fff; border:1px solid var(--line); border-radius:16px; padding:15px; margin:10px 18px}
  .section-h{font-size:12px; font-weight:800; color:var(--indigo); letter-spacing:.04em; padding:16px 18px 2px}

  /* QUEST */
  .qcard{background:#fff; border:1px solid var(--line); border-radius:16px; padding:14px; margin:11px 18px}
  .qcard .qfrom{display:flex; align-items:center; gap:9px; margin-bottom:9px}
  .qcard .qfrom .av{width:30px; height:30px; border-radius:9px; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:900; font-size:14px}
  .qcard .qfrom .qn{font-size:12.5px; font-weight:800}
  .qcard .qmsg{font-size:14px; font-weight:500; color:var(--ink); line-height:1.45; margin-bottom:11px}
  .loc{display:inline-flex; align-items:center; gap:5px; background:#f3f1fe; color:var(--indigo); font-size:11.5px; font-weight:800; padding:6px 11px; border-radius:999px; margin-bottom:11px}
  .qbtns{display:flex; gap:9px}
  .qbtns button{flex:1; padding:10px; border-radius:11px; font-weight:800; font-size:13px}
  .accept{background:var(--indigo); color:#fff}
  .skip{background:#f0f0f3; color:var(--muted)}
  .done-tag{display:inline-flex; align-items:center; gap:5px; color:#1d9e75; font-weight:800; font-size:13px}

  /* MEET */
  .intent-chips{display:flex; flex-direction:column; gap:8px; padding:6px 18px}
  .intent-chips .ic{background:#fff; border:1.4px solid var(--line); border-radius:13px; padding:11px 13px; font-size:13px; font-weight:600; color:var(--ink); text-align:left}
  .intentbox{margin:8px 18px; background:#fff; border:1.6px solid var(--purple); border-radius:16px; padding:5px}
  .intentbox textarea{width:100%; border:none; resize:none; padding:10px 12px; font-family:inherit; font-size:14px; font-weight:500; min-height:48px}
  .intentbox textarea:focus{outline:none}
  .intentbox .go{width:100%; background:var(--indigo); color:#fff; font-weight:800; padding:11px; border-radius:12px}
  .term{margin:10px 18px; background:var(--indigo); border-radius:16px; padding:16px; font-family:ui-monospace,'SF Mono',Menlo,monospace; font-size:12px; line-height:1.7; color:#c9c8e0; min-height:120px}
  .term .ln{opacity:0; transition:opacity .25s} .term .ln.show{opacity:1}
  .term .ok{color:var(--lav)} .term .cmd{color:#fff; font-weight:700}
  .matchcard{margin:10px 18px 20px; background:var(--indigo); border-radius:18px; padding:18px; color:#fff; display:none}
  .matchcard.show{display:block}
  .matchcard .fit{font-size:40px; font-weight:900; letter-spacing:-.02em}
  .matchcard .why{font-size:13px; color:#c9c8e0; font-weight:600; line-height:1.5; margin:6px 0 14px}
  .matchcard .mbtns{display:flex; gap:9px}
  .matchcard .mbtns button{flex:1; padding:12px; border-radius:12px; font-weight:800; font-size:13px}
  .mc-go{background:var(--purple); color:#fff} .mc-no{background:#181a52; color:#fff}

  /* SETTINGS */
  .set-row{display:flex; align-items:center; gap:13px; padding:14px 18px; border-bottom:1px solid var(--line); background:none; width:100%; text-align:left; font-size:15px; font-weight:700; color:var(--ink)}
  .set-row svg{width:20px; height:20px; color:var(--muted)}
  .set-row .chev{margin-left:auto; color:var(--gray)}
  .set-row.danger{color:#c0563a}
  .set-group{font-size:11px; font-weight:800; color:var(--gray); padding:18px 18px 6px; letter-spacing:.04em}

  .appbar{flex:0 0 auto; display:flex; align-items:center; justify-content:center; padding:9px 16px; border-bottom:1px solid var(--line); background:#fff}
  .appbar-logo{height:20px; width:auto; display:block}
  .inbox-section{font-size:11px; font-weight:800; color:var(--gray); letter-spacing:.06em; text-transform:uppercase; padding:18px 18px 6px}
  .tab .badge.up{background:#1d9e75} .tab .badge.down{background:#c0563a}
