:root {
  --paper: #f7f2e8;
  --paper-deep: #eee5d5;
  --ink: #1e2927;
  --muted: #6b746f;
  --line: rgba(30, 41, 39, 0.12);
  --green: #204f43;
  --green-soft: #dce9df;
  --gold: #bc8f42;
  --gold-soft: #f3e5c8;
  --red: #a64e45;
  --white: #fffdf8;
  --shadow: 0 12px 30px rgba(41, 48, 43, 0.08);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { max-width: 720px; min-height: 100dvh; margin: 0 auto; padding: env(safe-area-inset-top) 18px calc(94px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 2px 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 8vw, 2.7rem); font-weight: 600; letter-spacing: -0.03em; }
h2 { margin-bottom: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
h3 { margin: 0; font-size: 1.05rem; }
.eyebrow { margin-bottom: 5px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.screen { display: none; animation: fadeIn .2s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: .4; transform: translateY(3px); } }

.hero-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 150px; padding: 26px; border-radius: 30px; color: white; background: linear-gradient(135deg, #173f36, #315f50); box-shadow: var(--shadow); }
.hero-card h2 { max-width: 360px; font-family: Georgia, "Times New Roman", serif; font-size: 1.65rem; line-height: 1.15; }
.hero-card .eyebrow { color: rgba(255,255,255,.7); }
.progress-ring { display: grid; flex: 0 0 76px; height: 76px; place-items: center; border-radius: 50%; background: conic-gradient(var(--gold-soft) 0deg, rgba(255,255,255,.14) 0deg); box-shadow: inset 0 0 0 8px rgba(255,255,255,.08); font-weight: 800; }

.section-block { margin-top: 30px; }
.section-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.page-heading { margin-top: 8px; margin-bottom: 22px; }

.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: rgba(255,255,255,.55); font-size: 1.3rem; }
.text-button { padding: 8px 0; border: 0; color: var(--green); background: transparent; font-size: .9rem; font-weight: 800; }
.primary-button, .secondary-button, .danger-button { min-height: 46px; padding: 12px 17px; border-radius: 14px; font-weight: 800; }
.primary-button { border: 1px solid var(--green); color: white; background: var(--green); }
.primary-button.small { min-height: 40px; padding: 8px 13px; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: var(--white); }
.danger-button { border: 1px solid rgba(166,78,69,.3); color: var(--red); background: #fff5f1; }
.full { width: 100%; text-align: center; }
.hidden { display: none !important; }

.timeline { display: grid; gap: 10px; }
.timeline-empty, .empty-state { padding: 24px; border: 1px dashed rgba(30,41,39,.22); border-radius: 20px; color: var(--muted); text-align: center; }
.timeline-item { display: grid; grid-template-columns: 66px 5px 1fr auto; align-items: stretch; gap: 12px; min-height: 72px; padding: 12px 13px; border: 1px solid rgba(30,41,39,.08); border-radius: 20px; background: rgba(255,253,248,.8); box-shadow: 0 5px 18px rgba(45,52,47,.04); }
.timeline-item.completed { opacity: .55; }
.timeline-item.completed .timeline-title { text-decoration: line-through; }
.timeline-time { padding-top: 5px; color: var(--muted); font-size: .76rem; font-weight: 800; line-height: 1.35; }
.timeline-accent { border-radius: 10px; background: var(--green); }
.timeline-accent.health { background: #7b9a65; }
.timeline-accent.family { background: #bd8648; }
.timeline-accent.spiritual { background: #8a729e; }
.timeline-accent.office { background: #647c8b; }
.timeline-accent.question-bank { background: #9b5d50; }
.timeline-accent.lecture-notes { background: #4e7b82; }
.timeline-accent.ignou { background: #7e7047; }
.timeline-accent.python-manim { background: #52649a; }
.timeline-content { padding: 3px 0; }
.timeline-title { font-weight: 850; line-height: 1.25; }
.timeline-note { margin: 5px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.timeline-actions { display: flex; align-items: center; }
.complete-toggle, .edit-block { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--green); background: var(--white); font-weight: 900; }
.edit-block { font-size: .9rem; }

.habit-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.habit-button { display: flex; min-height: 84px; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 19px; color: var(--ink); background: rgba(255,253,248,.78); text-align: left; }
.habit-button.done { border-color: rgba(32,79,67,.35); background: var(--green-soft); }
.habit-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 13px; background: var(--paper-deep); font-size: 1.1rem; }
.habit-button.done .habit-icon { background: var(--green); color: white; }
.habit-name { font-size: .86rem; font-weight: 850; }
.habit-target { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; }

.day-strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 18px; padding: 0 18px 6px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-pill { flex: 0 0 58px; min-height: 66px; padding: 9px 5px; border: 1px solid var(--line); border-radius: 18px; color: var(--muted); background: rgba(255,253,248,.75); }
.day-pill strong { display: block; margin-top: 6px; color: var(--ink); font-size: 1rem; }
.day-pill.active { border-color: var(--green); color: rgba(255,255,255,.76); background: var(--green); }
.day-pill.active strong { color: white; }
.day-summary-card { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 17px 18px; border-radius: 20px; background: var(--gold-soft); }
.floating-add { position: fixed; right: max(24px, calc((100vw - 720px)/2 + 24px)); bottom: calc(92px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border: 0; border-radius: 50%; color: white; background: var(--green); box-shadow: 0 12px 26px rgba(32,79,67,.28); font-size: 1.7rem; }

.filter-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 18px; padding: 0 18px 4px; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; padding: 10px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,253,248,.72); font-size: .78rem; font-weight: 800; }
.filter-chip.active { border-color: var(--green); color: white; background: var(--green); }
.task-list { display: grid; gap: 10px; }
.task-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,253,248,.8); }
.task-card.done { opacity: .55; }
.task-card.done .task-title { text-decoration: line-through; }
.task-check { width: 25px; height: 25px; accent-color: var(--green); }
.task-title { font-weight: 850; line-height: 1.25; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.meta-pill { padding: 4px 7px; border-radius: 999px; color: var(--muted); background: var(--paper-deep); font-size: .66rem; font-weight: 800; }
.priority-high { color: #8f3c34; background: #f5dcd7; }
.priority-medium { color: #7a5b23; background: #f2e4bd; }
.task-edit { border: 0; color: var(--muted); background: transparent; font-size: 1.15rem; }

.review-card { display: grid; gap: 10px; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,253,248,.84); box-shadow: var(--shadow); }
.review-card label, .app-dialog label { color: var(--ink); font-size: .82rem; font-weight: 850; }
input, select, textarea { width: 100%; margin-top: 7px; padding: 13px 14px; border: 1px solid rgba(30,41,39,.16); border-radius: 13px; outline: none; color: var(--ink); background: white; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(32,79,67,.08); }
.save-message { min-height: 20px; margin-bottom: 0; color: var(--green); font-size: .8rem; font-weight: 800; text-align: center; }

.bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 20; display: grid; grid-template-columns: repeat(4,1fr); max-width: 720px; margin: auto; padding: 9px 12px calc(9px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(30,41,39,.09); background: rgba(250,247,239,.94); box-shadow: 0 -10px 25px rgba(40,45,42,.05); backdrop-filter: blur(18px); }
.nav-item { display: grid; gap: 3px; place-items: center; padding: 6px; border: 0; color: var(--muted); background: transparent; font-size: .68rem; font-weight: 800; }
.nav-item span { font-size: 1.25rem; }
.nav-item.active { color: var(--green); }

.app-dialog { width: min(92vw, 520px); max-height: 88dvh; padding: 0; border: 0; border-radius: 26px; color: var(--ink); background: var(--paper); box-shadow: 0 28px 80px rgba(21,29,26,.3); }
.app-dialog::backdrop { background: rgba(21,29,26,.48); backdrop-filter: blur(4px); }
.app-dialog form { display: grid; gap: 15px; padding: 22px; overflow-y: auto; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.dialog-actions.split { justify-content: space-between; }
.dialog-actions > div { display: flex; gap: 9px; }
.checkbox-label { display: flex; align-items: center; gap: 9px; }
.checkbox-label input { width: auto; margin: 0; }
.compact-dialog { width: min(90vw, 400px); }
.helper-text { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.settings-stack { display: grid; gap: 10px; }
.file-label { display: block; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: calc(104px + env(safe-area-inset-bottom)); left: 24px; max-width: 420px; margin: auto; padding: 13px 16px; border-radius: 14px; color: white; background: var(--ink); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s ease; text-align: center; font-size: .82rem; font-weight: 800; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 640px) {
  .app-shell { padding-right: 28px; padding-left: 28px; }
  .habit-grid { grid-template-columns: repeat(4,1fr); }
  .day-strip, .filter-chips { margin-right: 0; margin-left: 0; padding-right: 0; padding-left: 0; }
}

@media (max-width: 380px) {
  .hero-card { padding: 21px; }
  .hero-card h2 { font-size: 1.4rem; }
  .progress-ring { flex-basis: 66px; height: 66px; }
  .timeline-item { grid-template-columns: 57px 4px 1fr auto; gap: 9px; }
}
