*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #080810;
  --surface: #0e0e1a;
  --surface2:#131320;
  --border:  #1e1e30;
  --accent:  #10b981;
  --text:    #e2e2f0;
  --muted:   #888;
  --radius:  12px;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
.mono   { font-family: 'JetBrains Mono', monospace; }
.accent { color: var(--accent); }
.muted  { color: var(--muted); }

/* ─── Gate ─── */
.gate {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 999; padding: 24px;
}
.gate-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px 32px; width: 100%; max-width: 360px;
  text-align: center; display: flex; flex-direction: column; gap: 16px;
}
.gate-logo { font-size: 40px; }
.gate-box h2 { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.gate-sub { color: var(--muted); font-size: 14px; margin-top: -8px; }
.gate-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; color: var(--text);
  font-size: 15px; font-family: 'Inter', sans-serif; outline: none;
  transition: border-color .2s; text-align: center; letter-spacing: .1em;
}
.gate-input:focus { border-color: var(--accent); }
.gate-btn {
  background: var(--accent); color: #000; border: none;
  border-radius: 10px; padding: 13px; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: 'Inter', sans-serif; transition: opacity .2s;
}
.gate-btn:hover { opacity: .85; }
.gate-error { color: #f87171; font-size: 13px; min-height: 18px; }

/* ─── Nav ─── */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(8,8,16,.9);
  backdrop-filter: blur(12px); z-index: 10;
}
.nav-left { display: flex; align-items: center; gap: 8px; font-family: 'JetBrains Mono', monospace; font-size: 14px; }
.nav-home { color: var(--muted); transition: color .2s; }
.nav-home:hover { color: var(--text); }
.nav-sep  { color: var(--muted); }
.nav-cur  { font-weight: 600; }
.logout-btn { background: none; border: 1px solid var(--border); color: var(--muted); font-size: 12px; padding: 5px 14px; border-radius: 6px; cursor: pointer; font-family: 'Inter', sans-serif; transition: all .2s; }
.logout-btn:hover { border-color: #f87171; color: #f87171; }

/* ─── Main ─── */
main { max-width: 640px; margin: 0 auto; padding: 32px 24px 80px; display: flex; flex-direction: column; gap: 16px; }

.dashboard-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 8px; }
.dash-label { font-size: 12px; letter-spacing: .08em; margin-bottom: 8px; opacity: .8; }
.dashboard-header h1 { font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.today-date { font-size: 12px; color: var(--muted); }

/* ─── Card ─── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.label { font-size: 12px; color: var(--muted); letter-spacing: .08em; }

.btn-sm { background: none; border: 1px solid var(--border); color: var(--muted); font-size: 12px; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-family: 'Inter', sans-serif; transition: all .2s; }
.btn-sm:hover { border-color: var(--text); color: var(--text); }
.accent-btn { border-color: var(--accent) !important; color: var(--accent) !important; }
.accent-btn:hover { background: rgba(16,185,129,.1) !important; }

/* ─── Weight ─── */
.weight-display { display: flex; align-items: baseline; gap: 6px; margin-bottom: 12px; }
.weight-now { font-size: 48px; font-weight: 700; letter-spacing: -2px; font-family: 'JetBrains Mono', monospace; }
.weight-unit { font-size: 18px; color: var(--muted); }
.weight-diff { font-size: 14px; font-weight: 500; margin-left: 8px; }
.weight-diff.down { color: var(--accent); }
.weight-diff.up   { color: #f87171; }

.weight-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.form-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 14px; outline: none; transition: border-color .2s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.form-label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.weight-history { display: flex; flex-direction: column; gap: 6px; }
.weight-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; background: var(--bg); border-radius: 8px; font-size: 13px; }
.weight-row-val { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.weight-row-date { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.weight-row-note { color: var(--muted); font-size: 12px; }

/* ─── Challenge List ─── */
.challenge-list { display: flex; flex-direction: column; gap: 12px; }
.challenge-item { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.challenge-item-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.challenge-item-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.challenge-item-target { font-size: 12px; color: var(--muted); }
.challenge-item-actions { display: flex; gap: 6px; }

.progress-bar-wrap { background: var(--surface); border-radius: 100px; height: 6px; overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), #34d399); border-radius: 100px; transition: width .6s ease; }
.progress-meta { display: flex; justify-content: space-between; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }

.checkin-btn { width: 100%; background: var(--accent); color: #000; border: none; border-radius: 8px; padding: 11px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: 'Inter', sans-serif; transition: opacity .2s; margin-top: 10px; }
.checkin-btn:hover { opacity: .85; }
.checkin-btn.done { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); cursor: default; }
.checkin-btn.done:hover { opacity: 1; }

.streak-badge { display: inline-flex; align-items: center; gap: 4px; background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); color: var(--accent); font-size: 11px; font-family: 'JetBrains Mono', monospace; padding: 2px 8px; border-radius: 100px; }

/* ─── Recent Logs ─── */
.recent-logs { display: flex; flex-direction: column; gap: 8px; }
.log-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg); border-radius: 8px; font-size: 13px; }
.log-icon { font-size: 16px; flex-shrink: 0; }
.log-text { flex: 1; color: var(--muted); }
.log-text strong { color: var(--text); }
.log-date { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); flex-shrink: 0; }
.empty-state { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; }

.loading { padding: 30px 0; text-align: center; color: var(--muted); font-size: 13px; }
.dots { animation: blink 1s steps(3) infinite; }
@keyframes blink { to { opacity: 0; } }

/* ─── Modal ─── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 420px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; margin-bottom: 16px; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; padding: 0 4px; transition: color .2s; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 0 24px; display: flex; flex-direction: column; gap: 10px; }
.modal-footer { padding: 20px 24px; display: flex; gap: 10px; justify-content: flex-end; }

.btn-primary { background: var(--accent); color: #000; border: none; border-radius: 8px; padding: 10px 20px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: 'Inter', sans-serif; transition: opacity .2s; }
.btn-primary:hover { opacity: .85; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 20px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: 'Inter', sans-serif; transition: all .2s; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 480px) {
  .dashboard-header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .form-row { grid-template-columns: 1fr; }
}
