:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #eef5f2;
  --ink: #172126;
  --muted: #637076;
  --line: #d9dedb;
  --primary: #1f5d58;
  --primary-ink: #ffffff;
  --accent: #b65d3b;
  --warning: #d89b3d;
  --danger: #9f403f;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(31, 50, 45, 0.08);
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -ms-overflow-style: none;
}

body {
  margin: 0;
  min-width: 320px;
  -ms-overflow-style: none;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 14px 14px 82px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--primary);
  border-radius: 8px;
  color: var(--primary-ink);
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
}

.icon-button,
.secondary,
.ghost,
.primary {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  text-decoration: none;
}

.primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: var(--primary-ink);
}

.secondary,
.icon-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  min-height: 34px;
  padding: 0 10px;
}

.danger {
  color: var(--danger);
}

.page-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 8px 0 16px;
}

.page-head h1,
.login-panel h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1;
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.date-switcher {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 38px minmax(120px, 1fr) 38px;
  min-height: 42px;
  overflow: hidden;
}

.date-switcher.single {
  grid-template-columns: minmax(150px, 1fr);
}

.date-switcher a {
  align-items: center;
  display: flex;
  font-size: 1.6rem;
  height: 42px;
  justify-content: center;
  text-decoration: none;
}

.date-switcher input {
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  height: 42px;
  padding: 0 8px;
  width: 100%;
}

.hero-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.progress-card,
.metric-card,
.section-block,
.day-card,
.chart-card,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.progress-card {
  align-items: center;
  display: flex;
  gap: 14px;
  grid-column: 1 / -1;
  padding: 14px;
}

.progress-card h2 {
  font-size: 1.25rem;
  margin: 0 0 4px;
}

.progress-card p {
  margin: 0;
}

.progress-ring {
  --progress: 0;
  align-items: center;
  aspect-ratio: 1;
  background: conic-gradient(var(--primary) calc(var(--progress) * 1%), #e7ece9 0);
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 76px;
  justify-content: center;
  position: relative;
}

.progress-ring::after {
  background: var(--surface);
  border-radius: 50%;
  content: "";
  inset: 9px;
  position: absolute;
}

.progress-ring span {
  font-size: 1rem;
  font-weight: 850;
  position: relative;
  z-index: 1;
}

.metric-card {
  min-height: 92px;
  padding: 14px;
}

.metric-card span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 750;
  margin-bottom: 8px;
}

.metric-card strong {
  display: block;
  font-size: clamp(1.35rem, 7vw, 2.25rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.section-block {
  margin: 14px 0;
  padding: 14px;
}

.section-title {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title h2,
.chart-card h2,
.task-group h3,
.day-card h2 {
  margin: 0;
}

.section-title span,
.pill {
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--primary);
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.task-group + .task-group {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 14px;
}

.task-group h3 {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.task-row {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  margin: 8px 0;
  padding: 10px;
}

.task-check {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 50%;
  height: 28px;
  width: 28px;
}

.task-check.mini {
  height: 24px;
  min-height: 24px;
  width: 24px;
}

.done .task-check {
  background: var(--primary);
  box-shadow: inset 0 0 0 5px var(--surface);
}

.done .task-copy strong,
.compact-task.done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.task-copy strong {
  display: inline;
  line-height: 1.25;
}

.task-copy p,
.compact-task p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  margin: 3px 0 0;
}

.task-meta {
  text-align: right;
}

.task-meta span,
.task-meta small {
  display: block;
}

.task-meta span {
  font-weight: 800;
}

.task-meta small {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 4px;
}

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

label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 5px;
}

input,
select,
textarea {
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.check-field {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
}

.check-field input {
  min-height: auto;
  width: auto;
}

.week-list,
.charts-grid {
  display: grid;
  gap: 14px;
}

.day-card,
.chart-card {
  padding: 14px;
}

.day-card header {
  align-items: start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.compact-task {
  align-items: start;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  padding: 10px 0;
}

.compact-task:first-of-type {
  border-top: 0;
}

.chart-card canvas {
  height: 210px;
  margin-top: 8px;
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 620px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.login-panel {
  margin: 12vh auto 0;
  max-width: 420px;
  padding: 20px;
}

.stack {
  display: grid;
  gap: 12px;
}

.alert {
  background: #f8e7e4;
  border: 1px solid #e4bbb4;
  border-radius: 8px;
  color: var(--danger);
  font-weight: 800;
  padding: 10px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty-state {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  bottom: 0;
  box-shadow: 0 -10px 24px rgba(31, 50, 45, 0.12);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  left: 50%;
  max-width: 980px;
  padding: 6px;
  position: fixed;
  transform: translateX(-50%);
  width: min(100%, 980px);
  z-index: 10;
}

.bottom-nav a {
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  min-height: 38px;
  padding: 11px 4px 0;
  text-align: center;
  text-decoration: none;
}

.bottom-nav a.active {
  background: var(--primary);
  color: var(--primary-ink);
}

code {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 5px;
}

@media (min-width: 760px) {
  .app-shell {
    padding-bottom: 96px;
  }

  .hero-grid {
    grid-template-columns: 1.6fr repeat(3, 1fr);
  }

  .progress-card {
    grid-column: auto;
  }

  .charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .task-row,
  .compact-task {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .task-meta,
  .compact-task form:last-child {
    grid-column: 2;
    text-align: left;
  }
}
