:root {
  --bg: #edf7ef;
  --panel: rgba(250, 255, 251, 0.88);
  --panel-strong: #f8fffa;
  --text: #19251d;
  --muted: #69746d;
  --line: rgba(50, 90, 62, 0.14);
  --green: #2f9b63;
  --green-soft: #dff3e7;
  --gold: #c89533;
  --danger: #c95b50;
  --shadow: 0 18px 45px rgba(46, 82, 57, 0.13);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.8), transparent 28rem),
    linear-gradient(160deg, #f6fbf6 0%, var(--bg) 62%, #e4f2e8 100%);
}

button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }

.app-shell {
  position: relative;
  min-height: 100vh;
  max-width: 920px;
  margin: 0 auto;
  overflow-x: hidden;
}

.screen {
  min-height: 100vh;
  padding: max(20px, env(safe-area-inset-top)) 18px max(96px, env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 0 18px;
  background: linear-gradient(180deg, rgba(246, 251, 246, 0.96), rgba(246, 251, 246, 0.72));
  backdrop-filter: blur(18px);
}

.topbar h2, .brand h1, .page h3 { margin: 0; }
.topbar h2 { font-size: 28px; letter-spacing: 0; }
.topbar p, .brand p { margin: 5px 0 0; color: var(--muted); }

.icon-button {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  box-shadow: 0 10px 24px rgba(47, 155, 99, 0.13);
}

.menu-button span {
  display: block;
  width: 23px;
  height: 3px;
  margin: 3px 0;
  border-radius: 99px;
  background: #24342a;
}

.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: min(78vw, 360px);
  padding: max(36px, env(safe-area-inset-top)) 22px 26px;
  background: rgba(251, 255, 252, 0.96);
  transform: translateX(-104%);
  transition: transform 260ms ease;
  box-shadow: 22px 0 45px rgba(36, 58, 43, 0.12);
}

.drawer.open { transform: translateX(0); }
.brand { padding: 18px 8px 28px; }
.brand h1 { color: var(--green); font-size: 31px; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(26, 36, 29, 0.48);
  backdrop-filter: blur(2px);
}

.nav-list { display: grid; gap: 14px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 72px;
  padding: 12px 18px;
  border-radius: 20px;
  color: #3d4941;
  background: transparent;
  text-align: left;
  font-size: 22px;
  font-weight: 700;
}

.nav-item.active {
  color: var(--green);
  background: #e7f7ec;
  box-shadow: inset 5px 0 0 var(--green);
}

.nav-icon {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 22px;
  background: var(--green);
}

.drawer-actions {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ghost-button, .text-button {
  color: var(--green);
  background: #e9f7ee;
  border-radius: 15px;
  min-height: 42px;
  font-weight: 700;
}

.back-button {
  display: inline-grid;
  place-items: center;
  min-width: 96px;
  padding: 0 16px;
  margin: 4px 0 18px;
}

.import-button { display: grid; place-items: center; }
#importFile { display: none; }

.page { display: none; animation: rise 220ms ease; }
.page.active { display: block; }

.hero-card, .milestone-card, .card, .placeholder-page, .stat-row article {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 134px;
  padding: 24px;
}

.compact-hero { min-height: 110px; margin-bottom: 18px; }
.compact-hero .hero-mark { font-size: 24px; }

.eyebrow {
  margin: 0 0 9px;
  color: var(--green);
  font-weight: 800;
}

.hero-card h3 { font-size: 34px; }
.hero-mark {
  width: 66px;
  height: 66px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
  font-size: 36px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 28px 0 14px;
}

.section-head h3 { font-size: 23px; }
.text-button { padding: 0 15px; }

.list-stack { display: grid; gap: 16px; }

.card {
  padding: 20px;
  text-align: left;
  color: inherit;
}

button.card {
  width: 100%;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

button.card:active { transform: scale(0.985); }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.card h4 { margin: 0; font-size: 22px; }
.meta, .card p { color: var(--muted); }
.meta { margin-top: 8px; }

.days {
  min-width: 86px;
  text-align: center;
  color: var(--gold);
  font-size: 44px;
  font-weight: 800;
}

.days.small {
  min-width: auto;
  font-size: 28px;
  white-space: nowrap;
}

.days span {
  display: block;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.chip {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  color: #31523d;
  background: #ebf7ef;
  font-weight: 700;
}

.chip.danger { color: var(--danger); background: #fff0ee; }
.chip.done { color: white; background: var(--green); }

.milestone-card { padding: 22px; margin-bottom: 28px; }
.milestone-card ul { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 15px; }
.milestone-card li { color: var(--muted); }
.milestone-card li.active { color: var(--gold); font-weight: 800; }
.milestone-card li::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 14px;
  border-radius: 50%;
  background: #dfece3;
}
.milestone-card li.active::before { background: var(--gold); box-shadow: 0 0 0 5px rgba(200, 149, 51, 0.14); }

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.module-card {
  min-height: 156px;
  padding: 20px;
  border-top: 5px solid var(--green);
}

.module-card h3 { color: var(--module-color); font-size: 20px; }
.module-card strong { display: block; margin: 22px 0 10px; font-size: 25px; }
.module-card p { margin: 0 0 8px; }

.detail-view { animation: rise 220ms ease; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border-radius: 17px;
  background: rgba(47, 155, 99, 0.1);
}

.segmented button {
  min-height: 42px;
  border-radius: 13px;
  color: #42604d;
  background: transparent;
  font-weight: 800;
}

.segmented button.active {
  color: white;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(47, 155, 99, 0.2);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.stat-row article { padding: 20px; }
.stat-row span, .stat-row small { display: block; color: var(--muted); }
.stat-row strong { display: block; margin: 16px 0 9px; color: var(--green); font-size: 38px; }

.category-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.category-strip span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(250, 255, 251, 0.78);
}

.category-strip b {
  color: var(--green);
  font-weight: 800;
}

.placeholder-page {
  min-height: 220px;
  padding: 28px;
}

.placeholder-page p {
  color: var(--muted);
  line-height: 1.7;
}

.fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(26px, env(safe-area-inset-bottom));
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: white;
  background: var(--green);
  box-shadow: 0 18px 35px rgba(47, 155, 99, 0.33);
  font-size: 42px;
}

.modal {
  width: min(92vw, 500px);
  border: 0;
  border-radius: 28px;
  padding: 0;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal::backdrop { background: rgba(21, 31, 24, 0.45); backdrop-filter: blur(3px); }
.modal form { padding: 24px; display: grid; gap: 17px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.round-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #4a5a50;
  background: #edf6ef;
  font-size: 25px;
}

label { display: grid; gap: 8px; color: #425047; font-weight: 700; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  color: var(--text);
  background: #fbfffc;
  outline: none;
}

input:focus, textarea:focus, select:focus { border-color: rgba(47, 155, 99, 0.5); box-shadow: 0 0 0 4px rgba(47, 155, 99, 0.11); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-button {
  min-height: 50px;
  border-radius: 17px;
  color: white;
  background: var(--green);
  font-weight: 800;
}

toast-message {
  position: fixed;
  left: 50%;
  bottom: 110px;
  z-index: 50;
  transform: translate(-50%, 18px);
  padding: 12px 18px;
  border-radius: 999px;
  color: white;
  background: rgba(31, 46, 36, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

toast-message.show { opacity: 1; transform: translate(-50%, 0); }

.empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--muted);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 760px) {
  .screen { padding-left: 34px; padding-right: 34px; }
  .drawer {
    position: fixed;
    width: 330px;
  }
}

@media (max-width: 390px) {
  .topbar h2 { font-size: 24px; }
  .module-grid, .stat-row, .category-strip, .form-grid { grid-template-columns: 1fr; }
  .hero-card h3 { font-size: 29px; }
  .days { font-size: 36px; }
}
