:root {
  --navy: #0a2f6b;
  --blue: #0b3d91;
  --blue-soft: #e8effc;
  --orange: #f97316;
  --orange-soft: #fff1e6;
  --ink: #14213a;
  --muted: #5c6b8a;
  --line: #dbe4f5;
  --bg: #f4f7fd;
  --card: #ffffff;
  --green: #0f9d58;
  --amber: #b45309;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  color: var(--ink);
  background: var(--bg);
}
button { font: inherit; cursor: pointer; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--blue) 55%, #1256c4 100%);
  padding: 24px;
}
.login-card {
  background: var(--card); border-radius: 20px; padding: 36px 28px;
  width: 100%; max-width: 420px; box-shadow: 0 24px 60px rgba(4, 20, 55, .35);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--blue);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-name { font-size: 22px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.login-card h1 { font-size: 28px; margin: 18px 0 4px; color: var(--navy); }
.login-sub { color: var(--muted); margin: 0 0 24px; font-size: 17px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 14px 16px; font-size: 18px; border: 2px solid var(--line);
  border-radius: 12px; background: #fbfdff; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--blue); background: #fff; }
.btn {
  width: 100%; padding: 15px; font-size: 19px; font-weight: 800; color: #fff;
  background: var(--orange); border: none; border-radius: 12px;
}
.btn:active { transform: translateY(1px); }
.login-err { color: #b3261e; font-size: 15px; min-height: 22px; margin: 4px 0 10px; }
.login-note { margin-top: 18px; font-size: 14px; color: var(--muted); text-align: center; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 30;
  background: var(--navy); color: #fff;
  padding: 12px 16px; align-items: center; gap: 12px;
}
.topbar .brand-name { color: #fff; font-size: 19px; }
.topbar .portal-tag { font-size: 13px; font-weight: 700; background: var(--orange); padding: 3px 10px; border-radius: 999px; }
.icon-btn { background: rgba(255,255,255,.12); border: none; color: #fff; border-radius: 10px; padding: 8px 12px; font-size: 20px; line-height: 1; }

.sidebar {
  width: 300px; flex: none; background: var(--navy); color: #dbe6ff;
  padding: 20px 14px 40px; overflow-y: auto;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 4px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.14); margin-bottom: 14px; }
.sidebar .brand-name { color: #fff; }
.portal-pill {
  display: inline-block; background: var(--orange); color: #fff; font-size: 13px; font-weight: 800;
  padding: 4px 12px; border-radius: 999px; margin: 0 8px 14px; letter-spacing: .04em; text-transform: uppercase;
}
.nav-group { margin-bottom: 6px; }
.nav-group-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; color: #9fb4dd; padding: 10px 10px 6px;
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
}
.nav-group-head .chev { transition: transform .15s; font-size: 12px; }
.nav-group.closed .nav-group-head .chev { transform: rotate(-90deg); }
.nav-group.closed .nav-items { display: none; }
.nav-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: #dbe6ff; padding: 11px 12px; border-radius: 10px; font-size: 17px;
  border-left: 4px solid transparent; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: rgba(255,255,255,.14); border-left-color: var(--orange); color: #fff; font-weight: 700; }
.nav-item .sub { display: block; font-size: 13px; color: #9fb4dd; font-weight: 400; margin-top: 2px; }
.nav-item.active .sub { color: #c9d8f8; }
.sidebar-foot { margin-top: 24px; padding: 0 8px; }
.logout-btn {
  width: 100%; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25);
  padding: 12px; border-radius: 10px; font-size: 16px; font-weight: 700;
}

.main { flex: 1; min-width: 0; padding: 28px 28px 60px; max-width: 980px; }
.scrim { display: none; }

/* ---------- routine header card ---------- */
.routine-head {
  background: linear-gradient(135deg, var(--blue) 0%, #1256c4 100%);
  color: #fff; border-radius: 18px; padding: 24px 24px 20px; margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(11, 61, 145, .25);
}
.routine-head .group-tag {
  display: inline-block; background: rgba(255,255,255,.18); font-size: 13px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px;
}
.routine-head h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.01em; }
.routine-head p { margin: 0 0 14px; font-size: 17px; color: #dbe6ff; line-height: 1.5; }
.head-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.meta-chip {
  background: rgba(255,255,255,.14); border-radius: 10px; padding: 7px 12px; font-size: 14px; font-weight: 600;
}
.meta-chip b { color: #ffd9b8; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #34d399; }
.status-badge.paused .status-dot { background: #fbbf24; }
.status-badge.done .status-dot { background: #93c5fd; }

/* ---------- updates ---------- */
.day-label {
  font-size: 15px; font-weight: 800; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; margin: 26px 2px 12px;
}
.update-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 22px; margin-bottom: 14px; box-shadow: 0 2px 10px rgba(20, 33, 58, .05);
}
.update-card h3 { margin: 0 0 6px; font-size: 20px; color: var(--navy); }
.update-when { font-size: 14px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.update-body { font-size: 17px; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word; }
.update-links { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.update-links a {
  background: var(--orange-soft); color: #c2510a; text-decoration: none; font-size: 15px; font-weight: 700;
  padding: 8px 14px; border-radius: 10px; border: 1px solid #ffd9b8;
}
.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-state .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .topbar { display: flex; }
  .shell { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; height: 100vh;
    transform: translateX(-105%); transition: transform .2s ease; width: 82vw; max-width: 320px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .scrim.show {
    display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8, 20, 45, .5);
  }
  .main { padding: 18px 16px 60px; }
  .routine-head h1 { font-size: 25px; }
  body { font-size: 17px; }
}

/* ---------- account + misc links ---------- */
.link-btn { background: none; border: none; color: var(--blue); font-size: 15px; font-weight: 700; padding: 12px 0 0; text-decoration: underline; display: block; }
.account-btn {
  width: 100%; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25);
  padding: 12px; border-radius: 10px; font-size: 16px; font-weight: 700; margin-bottom: 10px;
}
.account-btn:hover, .logout-btn:hover { background: rgba(255,255,255,.18); }

/* ---------- whole-sidebar collapse (desktop) ---------- */
.edge-tab {
  position: fixed; top: 50%; margin-top: -40px; left: 300px; z-index: 70;
  width: 26px; height: 80px; padding: 0; border: none; border-radius: 0 12px 12px 0;
  background: var(--navy); color: #fff; font-size: 18px; line-height: 1;
  box-shadow: 2px 0 12px rgba(8, 20, 45, .25); transition: left .2s ease;
}
.edge-tab:hover { background: var(--blue); }
body.side-collapsed .edge-tab { left: 0; }
@media (min-width: 901px) {
  body.side-collapsed .sidebar { display: none; }
}
@media (max-width: 900px) {
  .edge-tab { display: none; }
}
.login-pill { margin: 0 0 6px; font-size: 14px; }
.boot-msg{padding:40px 16px;text-align:center;color:var(--muted,#9fb4dd);font-size:16px}
