/* ==========================================================================
   LifeOS design system
   Dark, considered, calm. Built on CSS variables — no framework.
   ========================================================================== */

:root {
  /* Surfaces — deep, warm-neutral ink rather than pure black */
  --bg:            #0c0f14;
  --bg-elevated:   #131820;
  --surface:       #171d27;
  --surface-2:     #1e2530;
  --border:        #2a3340;
  --border-soft:   #222a35;

  /* Text */
  --text:          #e8edf3;
  --text-muted:    #9aa7b6;
  --text-faint:    #66727f;

  /* Brand — a quiet teal/green for "freedom", warm gold for "legacy" */
  --freedom:       #36d0a8;
  --freedom-dim:   #1f6f5c;
  --legacy:        #e9b949;
  --legacy-dim:    #8a6d20;
  --accent:        #5b8def;

  /* RAG status */
  --red:           #f0616d;
  --amber:         #f0a83c;
  --green:         #3fce8e;

  /* Urgency */
  --urgent-high:   var(--red);
  --urgent-medium: var(--amber);
  --urgent-low:    var(--text-faint);

  /* Geometry */
  --radius:        14px;
  --radius-sm:     9px;
  --radius-lg:     20px;
  --gap:           20px;
  --maxw:          1180px;

  --shadow:        0 6px 24px rgba(0,0,0,.35);
  --shadow-lg:     0 18px 50px rgba(0,0,0,.45);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 650; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.01em; }
p  { margin: 0 0 1em; color: var(--text-muted); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.center { text-align: center; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .95rem; cursor: pointer;
  border: 1px solid transparent; transition: .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--freedom); color: #04150f; }
.btn-primary:hover { background: #45e3ba; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-muted); background: var(--surface); }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }

/* ---- Pills / badges ---------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  padding: 5px 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border-soft);
}
.pill.red    { color: var(--red);   border-color: rgba(240,97,109,.35);  background: rgba(240,97,109,.10); }
.pill.amber  { color: var(--amber); border-color: rgba(240,168,60,.35);  background: rgba(240,168,60,.10); }
.pill.green  { color: var(--green); border-color: rgba(63,206,142,.35);  background: rgba(63,206,142,.10); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); } .dot.amber { background: var(--amber); } .dot.green { background: var(--green); }

/* ---- Cards ------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
}
.card.locked { opacity: .5; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* ==========================================================================
   Marketing site
   ========================================================================== */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(12,15,20,.72);
  border-bottom: 1px solid var(--border-soft);
}
.site-nav .container { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { font-weight: 750; font-size: 1.25rem; letter-spacing: -.02em; color: var(--text); display: flex; gap: 9px; align-items: center; }
.brand .mark { color: var(--freedom); }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a { color: var(--text-muted); font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.hero { padding: 90px 0 70px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% 0 auto 0; height: 600px;
  background: radial-gradient(60% 60% at 50% 0%, rgba(54,208,168,.16), transparent 70%);
  pointer-events: none;
}
.hero h1 { max-width: 14ch; margin-inline: auto; }
.hero .lede { font-size: 1.25rem; max-width: 60ch; margin: 18px auto 30px; color: var(--text-muted); }
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.twin-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 760px; margin: 56px auto 0; }
.metric-hero {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 26px; text-align: left;
}
.metric-hero .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.metric-hero .value { font-size: 3rem; font-weight: 720; letter-spacing: -.03em; margin: 6px 0; }
.metric-hero.freedom .value { color: var(--freedom); }
.metric-hero.legacy .value { color: var(--legacy); }

.section { padding: 70px 0; }
.section h2 { text-align: center; }
.section .sub { text-align: center; max-width: 56ch; margin: 0 auto 44px; }

.module-tile {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 18px; transition: .15s ease;
}
.module-tile:hover { border-color: var(--border); transform: translateY(-2px); }
.module-tile .icon { font-size: 1.5rem; }
.module-tile .name { font-weight: 650; margin-top: 8px; }
.module-tile .tag { font-size: .85rem; color: var(--text-faint); }

/* ---- Pricing ----------------------------------------------------------- */
.price-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: stretch; }
.price-card { position: relative; display: flex; flex-direction: column; }
.price-card.highlight { border-color: var(--freedom-dim); box-shadow: 0 0 0 1px var(--freedom-dim), var(--shadow); }
.price-card .tier-name { font-weight: 700; font-size: 1.15rem; }
.price-card .price { font-size: 2.3rem; font-weight: 720; letter-spacing: -.02em; margin: 8px 0 2px; }
.price-card .price small { font-size: .9rem; font-weight: 500; color: var(--text-faint); }
.price-card ul { list-style: none; padding: 0; margin: 18px 0; flex: 1; }
.price-card li { padding: 7px 0 7px 26px; position: relative; color: var(--text-muted); font-size: .92rem; }
.price-card li::before { content: "✓"; position: absolute; left: 0; color: var(--freedom); font-weight: 700; }
.tag-popular { position: absolute; top: -12px; right: 18px; background: var(--freedom); color: #04150f; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }

.toggle-row { display: flex; gap: 12px; align-items: center; justify-content: center; margin-bottom: 36px; }
.toggle-row button { background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-muted); padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
.toggle-row button.active { background: var(--freedom); color: #04150f; border-color: transparent; }

.site-footer { border-top: 1px solid var(--border-soft); padding: 40px 0; color: var(--text-faint); font-size: .9rem; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }

/* ==========================================================================
   App shell (dashboard)
   ========================================================================== */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-elevated); border-right: 1px solid var(--border-soft);
  padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { font-size: 1.15rem; padding: 0 8px 18px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500; font-size: .92rem;
}
.side-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.side-nav a.active { background: var(--surface-2); color: var(--text); }
.side-nav a.locked { color: var(--text-faint); opacity: .55; }
.side-nav a .ico { width: 20px; text-align: center; }
.side-nav .group-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); padding: 16px 11px 6px; }

.app-main { padding: 26px 30px 60px; max-width: 1280px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.topbar .greeting h1 { font-size: 1.5rem; margin: 0; }
.topbar .greeting p { margin: 2px 0 0; font-size: .92rem; }
.bell { position: relative; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 50%; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer; }
.bell .count { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; }

/* Headline twin metrics in-app */
.headline { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 24px; }
.headline .metric-hero { position: relative; overflow: hidden; }
.headline .metric-hero .trend { font-size: .82rem; color: var(--freedom); }
.headline .metric-hero .ring { float: right; }

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

.widget h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-bottom: 14px; }
.row-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.row-item:last-child { border-bottom: none; }
.row-item .lead { display: flex; align-items: center; gap: 11px; }
.row-item .when { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: .88rem; white-space: nowrap; }
.row-item .days { font-weight: 700; color: var(--text); }

.module-card {
  display: flex; flex-direction: column; gap: 10px; min-height: 132px;
  transition: .15s ease;
}
.module-card:hover { border-color: var(--border); transform: translateY(-2px); }
.module-card .head { display: flex; align-items: center; gap: 10px; }
.module-card .head .icon { font-size: 1.3rem; }
.module-card .head .name { font-weight: 650; }
.module-card .next { font-size: .85rem; color: var(--text-muted); margin-top: auto; }
.module-card .health { display: flex; align-items: center; gap: 7px; font-size: .82rem; }

.action-prompt {
  background: linear-gradient(135deg, rgba(54,208,168,.12), rgba(91,141,239,.08));
  border: 1px solid var(--freedom-dim);
  border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.action-prompt .icon { font-size: 1.4rem; flex-shrink: 0; }
.action-prompt > div:nth-child(2) { flex: 1; min-width: 160px; }

.alert-banner {
  background: rgba(240,97,109,.10); border: 1px solid rgba(240,97,109,.35);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px;
}
.alert-banner .title { color: var(--red); font-weight: 650; }

/* ---- Auth pages -------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.6rem; text-align: center; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-size: .95rem; font-family: inherit;
}
.field select { appearance: none; cursor: pointer; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--freedom-dim); }
.field .errorlist, .errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--red); font-size: .85rem; }
.helptext { font-size: .8rem; color: var(--text-faint); }
.form-foot { text-align: center; margin-top: 18px; font-size: .92rem; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 880px) {
  .twin-metrics, .headline { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; transition: left .2s ease; z-index: 100; width: 248px; }
  .sidebar.open { left: 0; }
  .app-main { padding: 18px; }
  .menu-toggle { display: inline-grid !important; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 18px; }
  .topbar h1 { font-size: 1.1rem; }
}
@media (max-width: 560px) {
  .price-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .topbar .greeting p { display: none; }   /* hide household subtitle on tiny screens */
  .topbar .bell { display: none; }          /* declutter — notifications accessible elsewhere */
}
.menu-toggle { display: none; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); width: 42px; height: 42px; place-items: center; cursor: pointer; font-size: 1.1rem; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99; }
.sidebar-overlay.active { display: block; }
