/* =====================================================================
   Coachly v2 · Dark luxury. Open sections split by thin warm lines instead of boxes,
   big display type, one gold glow per screen, bottom tab bar on phones.
   Loaded after app.css.
   ===================================================================== */
body::after { /* light film grain */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 70; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
h1 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: 0.03em; font-size: 34px; line-height: 1.05; }
h2 { font-size: 17px; font-weight: 600; }

/* Top bar: logo left, quiet text links, gold underline on the active one */
.topbar { background: rgba(11, 11, 12, 0.9); border-bottom: 0; }
.topbar::after { background: linear-gradient(90deg, transparent 5%, rgba(255, 200, 90, 0.35) 50%, transparent 95%); }
.nav { gap: 2px; }
.nav a { border-radius: 0; padding: 8px 10px; position: relative; font-size: 13px; letter-spacing: 0.04em; }
.nav a.on { background: none; box-shadow: none; color: var(--text); }
.nav a.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--gold); box-shadow: 0 0 10px rgba(255, 200, 90, 0.7); }

/* Sections instead of boxes */
.card, .card.flat {
  background: none; border: 0; border-radius: 0; padding: 22px 0 8px;
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, rgba(255, 200, 90, 0.28), rgba(237, 230, 218, 0.06) 60%, transparent) 1;
}
.page-head + .card { border-image: none; border-top: 0; padding-top: 4px; }
.modal.card { background: #151311; border: 1px solid var(--line-strong); border-image: none; border-radius: 16px; padding: 22px; }
.auth .card { background: #151311; border: 1px solid var(--line); border-image: none; border-radius: 16px; padding: 22px; }
.stack > * + * { margin-top: 10px; }
.auth .stack > * + * { margin-top: 16px; }
.page-head { margin-bottom: 10px; }

/* Stats as an open grid with hairlines */
.stats { gap: 0; border-top: 1px solid var(--line); }
.stat { background: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); padding: 16px 14px 14px 0; }
.stat + .stat { padding-left: 14px; border-left: 1px solid var(--line); }
@media (min-width: 641px) { .stat:nth-child(4n + 1) { border-left: 0; padding-left: 0; } }
@media (max-width: 640px) {
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--line); padding-left: 14px; }
}
.stat .num { font-size: 30px; }

/* Lists and tiles: no boxes, just lines */
.tile { background: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); padding: 14px 0; }
.tile + .tile { margin-top: 0; }
.tile:hover { border-color: var(--line-strong); }
.mono { border-radius: 50%; background: none; border: 1px solid var(--line-strong); }

/* Buttons: squarer, quieter */
.btn { border-radius: 10px; letter-spacing: 0.02em; }
.btn.sm { border-radius: 8px; }
.seg { border-radius: 10px; background: none; border: 1px solid var(--line); }
.seg button { border-radius: 7px; }
.seg button.on { background: rgba(237, 230, 218, 0.08); box-shadow: none; }
.input, select.input, textarea.input { border-radius: 8px; background: rgba(255, 255, 255, 0.02); }

/* Week strip: gold line instead of a box */
.week .d.on { background: none; box-shadow: none; }
.week .d.on::before { content: ''; position: absolute; left: 25%; right: 25%; top: 0; height: 2px; background: var(--gold); box-shadow: 0 0 10px rgba(255, 200, 90, 0.7); }

/* Bottom tab bar (client app on phones) */
.tabbar { display: none; }
@media (max-width: 720px) {
  body.has-tabbar .nav { display: none; }
  body.has-tabbar .main { padding-bottom: 110px; }
  body.has-tabbar footer { padding-bottom: 96px !important; }
  body.has-tabbar .toast { bottom: 88px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(11, 11, 12, 0.94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: grid; justify-items: center; gap: 3px; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; position: relative; }
  .tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: var(--text); }
  .tabbar a.on::before { content: ''; position: absolute; top: -7px; left: 30%; right: 30%; height: 2px; background: var(--gold); box-shadow: 0 0 10px rgba(255, 200, 90, 0.8); }
}

/* ---------- Today ---------- */
.today-hero { text-align: center; padding: 14px 0 6px; }
.today-hero .hero-num { font-size: 84px; }
.greet { font-family: var(--display); text-transform: uppercase; font-size: 30px; letter-spacing: 0.03em; line-height: 1.05; }
.macro-line { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.macro-line b { color: var(--text); font-weight: 600; }
.streak { display: flex; align-items: baseline; gap: 10px; }
.streak .num { font-size: 40px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.badge { font-size: 12px; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--cream); }
.badge.locked { opacity: 0.35; border-style: dashed; }
.habit { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 13px 0; color: var(--text); cursor: pointer; text-align: left; font-size: 15px; }
.habit .box { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; font-size: 14px; }
.habit.done .box { background: var(--cream); color: #17130F; border-color: var(--cream); }
.habit.done .t { color: var(--muted); text-decoration: line-through; }
.habit .ic { width: 22px; text-align: center; flex: none; }

/* ---------- Workout mode ---------- */
.wo-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.wo-steps { display: flex; gap: 4px; margin: 10px 0 18px; }
.wo-steps i { flex: 1; height: 3px; background: var(--line-strong); border-radius: 2px; }
.wo-steps i.done { background: var(--cream); }
.wo-steps i.now { background: var(--gold); box-shadow: 0 0 8px rgba(255, 200, 90, 0.7); }
.wo-name { font-family: var(--display); text-transform: uppercase; font-size: 38px; line-height: 1.02; letter-spacing: 0.02em; }
.wo-target { color: var(--cream); margin-top: 6px; }
.set-head, .set-row { display: grid; grid-template-columns: 34px 1fr 1fr 44px; gap: 8px; align-items: center; }
.set-head { font-size: 11px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; padding-bottom: 4px; }
.set-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.set-row .n { font-family: var(--display); font-size: 20px; color: var(--muted); }
.set-row.logged .n { color: var(--text); }
.set-row .ok { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: none; color: var(--cream); cursor: pointer; font-size: 18px; }
.set-row.logged .ok { background: var(--cream); color: #17130F; border-color: var(--cream); }
.set-row input { text-align: center; }
.rest { text-align: center; padding: 18px 0; }
.rest .hero-num { font-size: 72px; }
.lasttime { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Coach view: habit completion grid */
.habit-grid { display: grid; grid-template-columns: minmax(90px, 140px) repeat(14, 1fr); gap: 3px; align-items: center; font-size: 12px; }
.habit-grid .c { height: 16px; border-radius: 3px; background: rgba(237, 230, 218, 0.07); }
.habit-grid .c.on { background: var(--cream); }

/* Dropdown lists: some browsers draw the open list white, which hid our light text */
select.input, select { color-scheme: dark; }
select option, select optgroup { background: #151311; color: #EDE6DA; }
select option:checked { background: #2A231E; color: #FFFFFF; }

/* Phone-friendly pass: bigger text and tap targets, no iPhone zoom on inputs */
@media (max-width: 720px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 16px; -webkit-tap-highlight-color: transparent; }
  .main { padding: 20px 16px 110px; }
  .btn { min-height: 46px; font-size: 15px; padding-left: 18px; padding-right: 18px; }
  .btn.sm { min-height: 42px; font-size: 14px; padding-left: 14px; padding-right: 14px; }
  .btn:active, .tabbar a:active { opacity: 0.7; transform: scale(0.98); }
  input, select, textarea, .input { font-size: 16px !important; min-height: 48px; }
  textarea { min-height: 96px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 22px; height: 22px; }
  .label { font-size: 12px; }
  .small { font-size: 14px; }
  .muted.small { line-height: 1.5; }
  .card { padding: 18px 16px; }
  .topbar a, .topbar button { min-height: 40px; display: inline-flex; align-items: center; }
  .tabbar a { font-size: 11.5px; padding: 8px 0 6px; min-height: 56px; }
  .tabbar svg { width: 25px; height: 25px; }
  .row { row-gap: 10px; }
  .card-head > a { display: inline-flex; align-items: center; min-height: 40px; padding-left: 12px; }
  .main nav.nav { flex-wrap: wrap; overflow: visible; gap: 8px; }
  .main nav.nav a { min-height: 42px; display: inline-flex; align-items: center; }
}
