
  :root{
    --bg:#0B0C10;
    --card:#16181D;
    --card2:#1C1F26;
    --border:#262930;
    --blue:#4FA9F7;
    --green:#3DDC84;
    --amber:#F5A623;
    --muted:#6B6F7A;
    --text:#ECEDEF;
    --flame:#FF6B4A;
    --radius:14px;
  }
  *{box-sizing:border-box;}
  body{
    margin:0;
    background:var(--bg);
    color:var(--text);
    font-family:'Inter',sans-serif;
    padding:20px 20px 100px 20px;
    min-height:100vh;
  }
  h1,h2,h3,.num{ font-family:'Space Grotesk',sans-serif; }
  .wrap{ max-width:640px; margin:0 auto; }
  .page{ display:none; }
  .page.active{ display:block; }

  /* Ring header */
  .ring-card{
    display:flex; flex-direction:column; align-items:center;
    padding:20px 0 8px 0; margin-bottom:18px; position:relative;
  }
  .ring-wrap{ position:relative; width:170px; height:170px; }
  .ring-wrap svg{ transform:rotate(0deg); }
  .ring-center{
    position:absolute; top:0; left:0; width:100%; height:100%;
    display:flex; flex-direction:column; align-items:center; justify-content:center;
  }
  .ring-pct{ font-size:34px; font-weight:700; color:var(--blue); line-height:1; }
  .ring-frac{ font-size:12px; color:var(--muted); margin-top:6px; }
  .status-pill{
    margin-top:14px; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
    background:var(--card2); border:1px solid var(--border); color:var(--muted);
    padding:6px 16px; border-radius:20px;
  }
  .status-pill.complete{ color:var(--green); border-color:rgba(61,220,132,0.4); background:rgba(61,220,132,0.08); }

  .stat-row{ display:flex; gap:10px; margin-top:14px; }
  .bt-row{ display:flex; align-items:center; gap:12px; padding:10px 0; }
  .bt-row:first-child{ padding-top:0; }
  .bt-row.done .bt-input{ text-decoration:line-through; color:var(--muted); }
  .bt-input{
    flex:1; background:none; border:none; border-bottom:1px solid var(--border);
    color:var(--text); font-family:'Inter',sans-serif; font-size:14px; padding:8px 2px;
  }
  .bt-input:focus{ outline:none; border-bottom-color:var(--blue); }
  .check.checked{ background:var(--green); border-color:var(--green); color:#06210f; }

  /* Mileage 30-day goal widget */
  .mileage-box{ margin:4px 16px 16px 16px; padding:14px; background:var(--card2); border-radius:10px; border:1px solid var(--border); }
  .mileage-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
  .mileage-title{ font-size:13px; font-weight:700; }
  .mileage-week-badge{
    font-size:11px; font-weight:700; color:var(--blue); background:var(--bg);
    border:1px solid var(--border); padding:3px 9px; border-radius:20px;
  }
  .mileage-week-badge.done{ color:var(--green); border-color:rgba(61,220,132,.4); }
  .mileage-target{ font-size:13px; color:var(--muted); margin-bottom:8px; }
  .mileage-target b{ color:var(--text); }
  .mileage-track{ height:14px; background:var(--bg); border-radius:8px; overflow:hidden; border:1px solid var(--border); }
  .mileage-fill{
    height:100%; border-radius:8px; transition:width .5s ease;
    background-color: var(--green);
    background-image: repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.18) 0, rgba(255,255,255,0.18) 8px,
      transparent 8px, transparent 16px
    );
    background-size: 24px 24px;
    animation: mileage-diagonal-move 1s linear infinite;
  }
  @keyframes mileage-diagonal-move{
    from{ background-position: 0 0; }
    to{ background-position: 24px 0; }
  }
  .mileage-sync-row{ display:flex; align-items:center; justify-content:space-between; margin-top:10px; font-size:11px; color:var(--muted); }
  .mileage-sync-dot{ width:7px; height:7px; border-radius:50%; display:inline-block; margin-right:5px; background:var(--muted); }
  .mileage-sync-dot.live{ background:var(--green); box-shadow:0 0 6px var(--green); }
  .mileage-sync-dot.waiting{ background:var(--amber); }
  .mileage-sync-btn{
    background:none; border:1px solid var(--border); color:var(--muted); border-radius:6px;
    font-size:11px; padding:3px 9px; cursor:pointer; font-family:'Inter',sans-serif;
  }
  .mileage-sync-btn:hover{ color:var(--text); border-color:var(--muted); }
  .mileage-week-dots{ display:flex; gap:6px; margin-top:12px; }
  .mileage-dot{
    flex:1; text-align:center; font-size:10px; font-weight:700; color:var(--muted);
    background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:5px 2px;
  }
  .mileage-dot.current{ color:var(--blue); border-color:var(--blue); }
  .mileage-dot.past{ color:var(--green); border-color:rgba(61,220,132,.4); }
  .mileage-note{ font-size:11px; color:var(--muted); margin-top:8px; }
  .sync-status{
    position:fixed; top:14px; right:16px; font-size:11px; color:var(--muted);
    background:var(--card); border:1px solid var(--border); padding:5px 11px; border-radius:20px;
    transition:opacity .4s ease; opacity:0; z-index:60;
  }
  .sync-status.saving{ color:var(--blue); }
  .sync-status.saved{ color:var(--green); }
  .sync-status.error{ color:var(--amber); }

  /* MedTech Pulse */
  .mt-loading, .mt-error{ font-size:13px; color:var(--muted); }
  .mt-error{ line-height:1.6; }
  .mt-item{ padding:14px 0; border-top:1px solid var(--border); }
  .mt-item:first-child{ padding-top:0; border-top:none; }
  .mt-headline{ font-size:14px; font-weight:700; margin-bottom:3px; }
  .mt-summary{ font-size:13px; color:var(--muted); line-height:1.4; }
  .mt-source{ font-size:11px; color:var(--blue); margin-top:4px; text-transform:uppercase; letter-spacing:.04em; }
  .mt-question{ margin-top:10px; padding:10px 12px; background:var(--card2); border-radius:8px; }
  .mt-question-label{
    display:inline-block; font-size:10px; font-weight:700; text-transform:uppercase;
    letter-spacing:.06em; color:var(--blue); margin-bottom:4px;
  }
  .mt-question-text{ color:var(--text); font-size:13px; font-weight:600; line-height:1.45; }

  /* Daily Motivation */
  .motivation-title{ font-size:13px; color:var(--muted); margin-bottom:10px; }
  .video-thumb{
    position:relative; display:block; width:100%; padding-top:56.25%;
    border-radius:10px; overflow:hidden; background:#000; border:1px solid var(--border);
  }
  .video-thumb img{ position:absolute; top:0; left:0; width:100%; height:100%; object-fit:cover; }
  .play-badge{
    position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
    width:52px; height:52px; border-radius:50%; background:rgba(0,0,0,0.55);
    border:2px solid #fff; color:#fff; font-size:18px;
    display:flex; align-items:center; justify-content:center; padding-left:3px;
  }

  .dual-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:20px; align-items:stretch; }
  .dual-grid > .card{ margin-top:0; height:100%; box-sizing:border-box; display:flex; flex-direction:column; }
  #medtechContent{ flex:1; }
  @media (max-width:600px){
    .dual-grid{ grid-template-columns:1fr; }
    .dual-grid > .card{ height:auto; }
  }

  /* Interview Prep */
  .ip-header{ display:flex; align-items:center; justify-content:space-between; }
  .ip-title{ font-size:13px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:700; }
  .ip-progress-pill{
    font-size:12px; font-weight:700; color:var(--blue); background:var(--card2);
    border:1px solid var(--border); padding:4px 11px; border-radius:20px;
  }
  .ip-progress-pill.complete{ color:var(--green); border-color:rgba(61,220,132,.4); background:rgba(61,220,132,.08); }
  .ip-question{ padding:16px 0; border-top:1px solid var(--border); }
  .ip-question:first-child{ border-top:none; padding-top:0; }
  .ip-question.answered .ip-question-text{ color:var(--muted); }
  .ip-question-text{ font-size:14px; font-weight:600; line-height:1.45; margin-bottom:10px; }
  .ip-hint{ font-size:11px; color:var(--muted); margin-bottom:8px; line-height:1.4; }
  .ip-answered-badge{ font-size:12px; color:var(--green); font-weight:700; display:flex; align-items:center; gap:5px; }
  .ip-transcript{ font-size:12px; color:var(--muted); margin-top:10px; line-height:1.45; font-style:italic; padding:10px 12px; background:var(--card2); border-radius:8px; }
  .ip-text-fallback{ margin-top:0; }
  .ip-text-fallback textarea{
    width:100%; background:var(--card2); border:1px solid var(--border); border-radius:8px;
    padding:9px 11px; color:var(--text); font-family:'Inter',sans-serif; font-size:13px; resize:vertical; min-height:56px;
  }
  .ip-save-btn{ margin-top:8px; }
  .stat-chip{
    display:flex; align-items:center; gap:6px; background:var(--card); border:1px solid var(--border);
    border-radius:10px; padding:6px 12px; font-size:13px; color:var(--muted);
  }
  .stat-chip b{ color:var(--text); font-family:'Space Grotesk',sans-serif; }

  /* Section */
  .section{ margin-bottom:14px; }
  .section-header{
    display:flex; align-items:center; gap:12px;
    background:var(--card); border:1px solid var(--border); border-radius:12px 12px 0 0;
    padding:14px 16px; cursor:pointer;
  }
  .section-index{ color:var(--blue); font-weight:700; font-size:14px; width:16px; text-align:center; flex-shrink:0;}
  .section-check{
    width:22px;height:22px;border-radius:6px; background:var(--green); color:#06210f;
    display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex-shrink:0;
  }
  .section-title{ flex:1; font-weight:700; font-size:15px; }
  .section-frac{
    font-size:12px; color:var(--muted); background:var(--card2); border:1px solid var(--border);
    padding:3px 9px; border-radius:8px;
  }
  .chevron{ color:var(--muted); font-size:12px; transition:transform .2s; }
  .chevron.collapsed{ transform:rotate(-90deg); }
  .section-progress-track{
    height:4px; background:var(--card2); border:1px solid var(--border); border-top:none;
  }
  .section-progress-fill{ height:100%; background:var(--blue); transition:width .4s ease; }
  .section-progress-fill.full{ background:var(--green); }
  .section-body{
    background:var(--card); border:1px solid var(--border); border-top:none;
    border-radius:0 0 12px 12px; overflow:hidden;
  }
  .section-body.collapsed{ display:none; }

  .quest-row{
    display:flex; align-items:center; gap:14px; padding:14px 16px;
    border-top:1px solid var(--border);
  }
  .quest-row:first-child{ border-top:none; }
  .check{
    width:24px;height:24px;border-radius:6px;border:2px solid #383B44;
    display:flex;align-items:center;justify-content:center;flex-shrink:0; cursor:pointer;
    font-size:14px; font-weight:700; background:var(--card2);
  }
  .quest-row.done .check{ background:var(--green); border-color:var(--green); color:#06210f; }
  .quest-row.skipped .check{ background:var(--card2); border-color:#383B44; color:var(--muted); }
  .quest-text{ flex:1; min-width:0; }
  .quest-name{ font-size:14px; font-weight:600; }
  .quest-row.done .quest-name{ text-decoration:line-through; color:var(--muted); font-weight:500; }
  .quest-row.skipped .quest-name{ color:var(--muted); font-weight:500; }
  .quest-sub{ font-size:11px; color:var(--green); margin-top:3px; display:flex; align-items:center; gap:4px; }
  .quest-sub.skip-sub{ color:var(--muted); }
  .quest-right{ display:flex; align-items:center; gap:10px; flex-shrink:0; }
  .xp-tag{ font-size:13px; font-weight:700; color:var(--amber); }
  .skip-btn{
    font-size:11px; color:var(--muted); background:none; border:1px solid var(--border);
    border-radius:7px; padding:5px 10px; cursor:pointer; font-family:'Inter',sans-serif;
  }
  .skip-btn:hover{ color:var(--text); border-color:var(--muted); }
  .skip-btn.active{ color:var(--blue); border-color:var(--blue); }
  .done-check{ color:var(--green); font-size:16px; font-weight:700; }

  /* Weekly card */
  .card{
    background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
    padding:20px; margin-top:20px;
  }
  .card h2{ margin:0 0 14px 0; font-size:13px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:700;}
  .week-row{ display:flex; align-items:flex-end; gap:8px; height:90px; margin-bottom:10px;}
  .week-bar-col{ flex:1; display:flex; flex-direction:column; align-items:center; gap:6px;}
  .bar-track{ width:100%; height:64px; background:var(--card2); border-radius:6px; display:flex; align-items:flex-end; overflow:hidden; border:1px solid var(--border);}
  .bar-fill{ width:100%; background:var(--blue); border-radius:0 0 6px 6px; transition:height .4s ease;}
  .week-day-label{ font-size:11px; color:var(--muted); }
  .week-day-label.excluded{ opacity:.35; }
  .weekly-total{ font-size:26px; font-weight:700; margin:0 0 10px; }
  .toggle-row{ display:flex; align-items:center; justify-content:space-between; margin-top:12px; font-size:13px; color:var(--muted);}
  .switch{ position:relative; width:38px; height:22px; background:var(--card2); border:1px solid var(--border); border-radius:12px; cursor:pointer;}
  .switch .knob{ position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:50%; background:var(--muted); transition:.2s;}
  .switch.on{ background:rgba(79,169,247,0.2); }
  .switch.on .knob{ left:18px; background:var(--blue);}

  /* Month grid */
  .month-title{ font-size:26px; font-weight:700; margin-bottom:10px;}
  .month-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px;}
  .month-cell{
    aspect-ratio:1; border-radius:6px; background:var(--card2); border:1px solid var(--border);
    display:flex; align-items:center; justify-content:center; font-size:12px; color:var(--muted);
  }
  .month-cell.future{ opacity:.25; }
  .month-dow-row{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-bottom:6px; }
  .month-dow{ text-align:center; font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }

  /* Manage habits */
  .habit-row{ display:flex; align-items:center; gap:8px; margin-bottom:8px; flex-wrap:wrap; }
  .habit-row input[type=text]{
    background:var(--card2); border:1px solid var(--border); border-radius:8px;
    padding:8px 10px; color:var(--text); font-family:'Inter',sans-serif; font-size:13px;
  }
  .habit-row .name-input{ flex:1; min-width:120px; }
  .habit-row .section-input{ width:110px; }
  .wkdy-label{ display:flex; align-items:center; gap:5px; font-size:11px; color:var(--muted); white-space:nowrap; }
  .habit-row input[type=number]{
    width:58px; background:var(--card2); border:1px solid var(--border); border-radius:8px;
    padding:8px 6px; color:var(--amber); font-weight:600; font-size:13px;
  }
  .icon-btn{
    background:none; border:1px solid var(--border); border-radius:8px; color:var(--muted);
    width:32px; height:32px; cursor:pointer; font-size:14px; flex-shrink:0;
  }
  .icon-btn:hover{ color:var(--text); border-color:var(--muted); }
  .add-habit-btn{
    width:100%; padding:10px; margin-top:8px; background:var(--card2); border:1px dashed var(--border);
    border-radius:10px; color:var(--muted); cursor:pointer; font-size:14px;
  }
  .add-habit-btn:hover{ color:var(--text); }
  details{ margin-top:20px; }
  summary{ cursor:pointer; font-size:13px; color:var(--muted); font-weight:600; padding:6px 0; }

  /* Celebration */
  #celebration{
    position:fixed; top:20px; left:50%; transform:translateX(-50%) translateY(-120%);
    background:linear-gradient(135deg,var(--green),#8bf0b8); color:#06210f;
    padding:14px 26px; border-radius:12px; font-weight:700; font-size:15px;
    box-shadow:0 10px 30px rgba(0,0,0,.5); transition:transform .5s cubic-bezier(.2,1.4,.4,1);
    z-index:100;
  }
  #celebration.show{ transform:translateX(-50%) translateY(0); }

  /* Bottom tab nav */
  .tabbar{
    position:fixed; bottom:0; left:0; right:0;
    background:#0E0F13; border-top:1px solid var(--border);
    display:flex; justify-content:center; gap:10px;
    padding:12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    z-index:50;
  }
  .tab-btn{
    background:none; border:none; color:var(--muted); cursor:pointer;
    display:flex; flex-direction:column; align-items:center; gap:3px;
    font-family:'Inter',sans-serif; font-size:11px; font-weight:600;
    padding:9px 26px; border-radius:12px; letter-spacing:.03em;
  }
  .tab-btn .tab-icon{ font-size:18px; }
  .tab-btn.active{ color:var(--text); background:var(--card); }
  .tab-btn.active .tab-icon{ filter:none; }

/* ============================================================
   Additions for the standalone/free PWA build
   ============================================================ */

/* iPhone safe-area support */
html{ height:100%; }
body{
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
* { -webkit-text-size-adjust: 100%; }
input, textarea, button { font-size: 16px; } /* prevents iOS auto-zoom on focus */
.wrap { overflow-x: hidden; }

/* Integration status badges (Live / Cached / Connecting / Unavailable) */
.integration-badge{
  display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700;
  padding:4px 10px; border-radius:20px; border:1px solid var(--border); background:var(--card2);
  color:var(--muted); white-space:nowrap;
}
.integration-badge.status-live{ color:var(--green); border-color:rgba(61,220,132,.4); background:rgba(61,220,132,.08); }
.integration-badge.status-cached{ color:var(--blue); border-color:rgba(79,169,247,.4); background:rgba(79,169,247,.08); }
.integration-badge.status-connecting{ color:var(--amber); border-color:rgba(245,166,35,.4); background:rgba(245,166,35,.08); }
.integration-badge.status-unavailable{ color:var(--muted); }
.card-header-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:10px; flex-wrap:wrap; }
.card-header-row h2{ margin:0; }
.reference-note{ font-size:11px; color:var(--muted); font-style:italic; margin-top:10px; line-height:1.5; }

/* Settings / Data page */
.settings-section{ margin-bottom:22px; }
.settings-section h3{ font-size:13px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin:0 0 10px; }
.settings-btn{
  width:100%; padding:12px; margin-bottom:8px; background:var(--card2); border:1px solid var(--border);
  border-radius:10px; color:var(--text); cursor:pointer; font-size:14px; font-family:'Inter',sans-serif;
  display:flex; align-items:center; justify-content:center; gap:8px; min-height:44px;
}
.settings-btn:hover{ border-color:var(--muted); }
.settings-btn.primary{ background:rgba(79,169,247,0.12); border-color:rgba(79,169,247,0.4); color:var(--blue); }
.settings-note{ font-size:12px; color:var(--muted); line-height:1.5; margin-top:8px; }
.settings-input-row{ display:flex; gap:8px; margin-bottom:8px; }
.settings-input-row input{
  flex:1; background:var(--card2); border:1px solid var(--border); border-radius:8px;
  padding:10px; color:var(--text); font-family:'Inter',sans-serif; font-size:14px; min-height:44px;
}
.feed-list-item{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  background:var(--card2); border:1px solid var(--border); border-radius:8px;
  padding:8px 10px; margin-bottom:6px; font-size:12px; color:var(--muted); word-break:break-all;
}
.storage-backend-note{
  font-size:11px; color:var(--muted); background:var(--card2); border:1px solid var(--border);
  border-radius:8px; padding:10px 12px; margin-top:12px; line-height:1.5;
}

/* Toast for export/import feedback */
#toast{
  position:fixed; bottom:90px; left:50%; transform:translateX(-50%) translateY(20px);
  background:var(--card); border:1px solid var(--border); color:var(--text);
  padding:12px 20px; border-radius:12px; font-size:13px; font-weight:600;
  box-shadow:0 10px 30px rgba(0,0,0,.5); opacity:0; pointer-events:none;
  transition:opacity .3s ease, transform .3s ease; z-index:100; max-width:90%; text-align:center;
}
#toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
#toast.error{ border-color:rgba(255,107,74,.5); color:var(--flame); }

/* Install banner */
#installBanner{
  display:none; align-items:center; justify-content:space-between; gap:12px;
  background:var(--card); border:1px solid var(--border); border-radius:12px;
  padding:12px 14px; margin-bottom:16px; font-size:13px;
}
#installBanner.show{ display:flex; }
#installBanner button{
  background:var(--blue); color:#06210f; border:none; border-radius:8px;
  padding:8px 14px; font-weight:700; font-size:12px; cursor:pointer; flex-shrink:0;
}

/* Ensure tap targets meet iOS minimum (44px) */
.tab-btn{ min-height:48px; }
.skip-btn, .icon-btn, .strava-sync-btn, .mileage-sync-btn{ min-height:32px; }
.check{ min-width:24px; min-height:24px; }

/* Bottom nav gets a 3rd tab for Settings */
