:root{
  --paper:#EFF3EC;
  --paper-card:#FFFFFF;
  --ink:#1F2A24;
  --ink-soft:#5B6A60;
  --line:#DDE4DA;
  --gold:#D9A441;
  --gold-soft:#F4E3BE;
  --teal:#2C6E63;
  --teal-soft:#D9EDE8;
  --danger:#C1543C;
  --radius:14px;
  --shadow:0 2px 10px rgba(31,42,36,0.06);
}

body.dark{
  --paper:#1B2420;
  --paper-card:#232E28;
  --ink:#EDEFE9;
  --ink-soft:#9DAA9F;
  --line:#33413A;
  --gold:#E4B662;
  --gold-soft:#3A2F16;
  --teal:#4FB3A0;
  --teal-soft:#1E3630;
  --danger:#E17A5F;
  --shadow:0 2px 10px rgba(0,0,0,0.25);
}
body{ transition:background-color .2s ease, color .2s ease; }

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:'Public Sans', system-ui, sans-serif;
  background:var(--paper);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{font-family:'Fraunces', Georgia, serif; margin:0;}

/* ---------- AUTH ---------- */
.auth-body{
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  padding:24px;
}
.auth-wrap{ width:100%; max-width:380px; }
.brand{ text-align:center; margin-bottom:28px; }
.brand-mark{ font-size:28px; color:var(--gold); }
.brand h1{ font-size:26px; font-weight:600; margin:8px 0 4px; }
.brand p{ color:var(--ink-soft); font-size:14px; margin:0; }

.auth-card{
  background:var(--paper-card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
}
.auth-tabs{ display:flex; gap:4px; background:var(--paper); border-radius:10px; padding:4px; margin-bottom:18px; }
.auth-tab{
  flex:1; border:none; background:transparent; padding:10px; border-radius:8px;
  font-weight:600; color:var(--ink-soft); cursor:pointer; font-size:14px;
}
.auth-tab.active{ background:var(--paper-card); color:var(--ink); box-shadow:var(--shadow); }

.auth-form label{ display:block; font-size:13px; color:var(--ink-soft); margin-bottom:14px; font-weight:600; }
.auth-form input{
  display:block; width:100%; margin-top:6px; padding:11px 12px;
  border:1px solid var(--line); border-radius:10px; font-size:15px; font-family:inherit;
  background:var(--paper);
}
.auth-error{ color:var(--danger); font-size:13px; min-height:18px; margin:0 0 8px; }
.hidden{ display:none !important; }

.btn-primary{
  width:100%; background:var(--teal); color:#fff; border:none; border-radius:10px;
  padding:12px; font-size:15px; font-weight:700; cursor:pointer; font-family:inherit;
}
.btn-primary:active{ transform:scale(0.98); }

/* ---------- APP SHELL ---------- */
.app-shell{ display:flex; flex-direction:column; min-height:100vh; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; background:var(--paper-card); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:10;
}
.topbar-brand{ font-family:'Fraunces', serif; font-weight:600; font-size:18px; display:flex; align-items:center; gap:8px; }
.topbar-user{ display:flex; align-items:center; gap:10px; }
.user-name{ font-size:13px; color:var(--ink-soft); font-weight:600; }
@media (max-width: 380px){
  .user-name{ display:none; }
}
.icon-btn{
  background:var(--paper); border:1px solid var(--line); border-radius:8px; width:34px; height:34px;
  display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:15px;
}

.content{ flex:1; padding:16px; padding-bottom:90px; max-width:720px; margin:0 auto; width:100%; }

.tab-panel{ display:none; animation:fade .15s ease; }
.tab-panel.active{ display:block; }
@keyframes fade{ from{opacity:0;} to{opacity:1;} }

.panel-title{ font-size:22px; font-weight:600; margin-bottom:16px; }
.section-sub{ font-size:14px; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft); margin:22px 0 10px; font-family:'Public Sans'; font-weight:700; }

/* ---------- BOTTOM NAV ---------- */
.bottom-nav{
  position:fixed; bottom:0; left:0; right:0; display:flex;
  background:var(--paper-card); border-top:1px solid var(--line);
  padding:8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index:10;
}
.nav-btn{
  flex:1; display:flex; flex-direction:column; align-items:center; gap:2px;
  background:none; border:none; padding:6px; font-size:11px; font-weight:600;
  color:var(--ink-soft); cursor:pointer; border-radius:10px; font-family:inherit;
}
.nav-btn span{ font-size:18px; }
.nav-btn.active{ color:var(--teal); background:var(--teal-soft); }

/* ---------- FORMS ---------- */
.quick-form{
  background:var(--paper-card); border-radius:var(--radius); padding:14px; box-shadow:var(--shadow); margin-bottom:16px;
}
.quick-form input[type=text], .quick-form textarea, .quick-form input[type=time]{
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px;
  font-family:inherit; font-size:14px; margin-bottom:10px; background:var(--paper);
}
.form-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
.inline-label{ font-size:13px; color:var(--ink-soft); font-weight:600; display:flex; align-items:center; gap:6px; }
.inline-label input{ margin-top:0; }
.checkbox-label{ font-size:13px; color:var(--ink-soft); font-weight:600; display:flex; align-items:center; gap:6px; }
.quick-form .btn-primary{ width:auto; padding:10px 18px; }

/* ---------- LIST TABS ---------- */
.list-tabs{ display:flex; gap:8px; margin-bottom:12px; }
.list-tab{
  border:1px solid var(--line); background:var(--paper-card); padding:7px 14px; border-radius:999px;
  font-size:13px; font-weight:700; color:var(--ink-soft); cursor:pointer;
}
.list-tab.active{ background:var(--teal); color:#fff; border-color:var(--teal); }

/* ---------- ITEM LIST ---------- */
.item-list{ display:flex; flex-direction:column; gap:10px; }
.item-card{
  background:var(--paper-card); border-radius:12px; padding:12px 14px; box-shadow:var(--shadow);
  display:flex; align-items:flex-start; gap:12px;
}
.item-check{
  width:24px; height:24px; border-radius:50%; border:2px solid var(--teal); background:none;
  flex-shrink:0; margin-top:2px; cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--teal);
}
.item-check.checked{ background:var(--teal); color:#fff; }
.item-body{ flex:1; min-width:0; }
.item-title{ font-weight:700; font-size:15px; word-break:break-word; }
.item-title.done{ text-decoration:line-through; color:var(--ink-soft); }
.item-desc{ font-size:13px; color:var(--ink-soft); margin-top:2px; }
.item-meta{ display:flex; gap:8px; margin-top:6px; flex-wrap:wrap; }
.badge{ font-size:11px; font-weight:700; padding:3px 8px; border-radius:999px; background:var(--gold-soft); color:#8A6412; }
.badge.routine{ background:var(--teal-soft); color:var(--teal); }
.badge.streak{ background:#FBE3D6; color:#B4552B; }
.item-actions{ display:flex; gap:6px; flex-shrink:0; }
.item-actions button{
  background:none; border:none; cursor:pointer; font-size:15px; color:var(--ink-soft); padding:4px;
}
.item-actions button:hover{ color:var(--danger); }
.progress-mini{ height:6px; background:var(--line); border-radius:4px; margin-top:8px; overflow:hidden; }
.progress-mini-fill{ height:100%; background:var(--gold); }
.empty-state{ color:var(--ink-soft); font-size:14px; text-align:center; padding:24px 10px; }

/* ---------- DASHBOARD ---------- */
.cards-row{ display:grid; grid-template-columns:repeat(auto-fit, minmax(90px, 1fr)); gap:10px; margin-bottom:20px; }
.stat-card{ background:var(--paper-card); border-radius:12px; padding:14px 10px; box-shadow:var(--shadow); text-align:center; }
.stat-label{ display:block; font-size:11px; color:var(--ink-soft); font-weight:700; margin-bottom:6px; }
.stat-value{ display:block; font-size:24px; font-weight:700; font-family:'Fraunces', serif; }
.stat-ideas .stat-value{ color:var(--gold); }
.stat-done .stat-value{ color:var(--teal); }
.stat-tasks .stat-value{ color:var(--ink); }
.stat-streak .stat-value{ color:#D9663B; }

.progress-list{ display:flex; flex-direction:column; gap:10px; }
.progress-item{ background:var(--paper-card); border-radius:12px; padding:12px 14px; box-shadow:var(--shadow); }
.progress-item-top{ display:flex; justify-content:space-between; font-size:13px; font-weight:700; margin-bottom:6px; }
.progress-item-top span:last-child{ color:var(--ink-soft); font-weight:600; }

.week-bars{ display:flex; gap:6px; align-items:flex-end; height:90px; background:var(--paper-card); border-radius:12px; padding:12px; box-shadow:var(--shadow); }
.week-bar-col{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:4px; }
.week-bar{ width:100%; background:var(--teal); border-radius:4px 4px 0 0; min-height:3px; }
.week-bar-label{ font-size:10px; color:var(--ink-soft); font-weight:700; }

/* ---------- DESKTOP ---------- */
@media (min-width: 860px){
  .app-shell{ flex-direction:row; }
  .bottom-nav{
    position:sticky; top:0; left:0; flex-direction:column; width:220px; height:100vh;
    border-top:none; border-right:1px solid var(--line); padding:20px 12px; gap:6px;
  }
  .nav-btn{ flex-direction:row; justify-content:flex-start; gap:10px; padding:10px 14px; font-size:14px; }
  .content{ padding:32px; padding-bottom:32px; max-width:760px; }
}
