@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;600;700&display=swap');

:root {
  --color-bg: #f5ead8;
  --color-surface: #ebddc5;
  --color-text: #201e1d;
  --color-accent: #c67139;
  --color-accent-2: #7a8a5e;
  --color-divider: rgba(32,30,29,0.16);

  --color-neutral-100: #f9f4ed;
  --color-neutral-200: #eee7db;
  --color-neutral-300: #dcd3c4;
  --color-neutral-400: #c0b6a5;
  --color-neutral-500: #a19786;
  --color-neutral-600: #82796a;
  --color-neutral-700: #645c50;
  --color-neutral-800: #474238;
  --color-neutral-900: #2e2b25;

  --color-accent-100: #fff2eb;
  --color-accent-200: #ffe1d0;
  --color-accent-300: #ffc6a5;
  --color-accent-400: #f6a06b;
  --color-accent-500: #d67f48;
  --color-accent-600: #b2622d;
  --color-accent-700: #8c491a;
  --color-accent-800: #643312;

  --color-accent-2-100: #f0fae1;
  --color-accent-2-200: #e1eecc;
  --color-accent-2-400: #aebf92;
  --color-accent-2-500: #8fa073;
  --color-accent-2-700: #56633f;
  --color-accent-2-800: #3d472b;

  --font-heading: "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 28px;

  --shadow-sm: 0 1px 2px rgba(46,43,37,0.14);
  --shadow-md: 0 3px 10px rgba(46,43,37,0.16);
  --shadow-lg: 0 12px 32px rgba(46,43,37,0.22);
}

html { touch-action: manipulation; }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--color-neutral-200); color: var(--color-text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
}
h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.15; margin: 0 0 8px; }
h1 { font-size: 32px; } h2 { font-size: 24px; } h3 { font-size: 18px; }
p { margin: 0 0 12px; }
a { color: var(--color-accent-700); text-decoration: none; }
a:hover { color: var(--color-accent-800); }
img { max-width: 100%; display: block; }

html, body { height: 100%; }
body { margin: 0; }

.app-shell {
  position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: var(--color-bg);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.topbar { flex-shrink: 0; }
.bottom-nav { flex-shrink: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px; border-bottom: 1px solid var(--color-neutral-300); flex-shrink: 0;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand img { width: 32px; height: 32px; border-radius: 999px; object-fit: cover; }
.topbar .brand-name { font-family: var(--font-heading); font-weight: 700; font-size: 17px; }

.content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }

.bottom-nav {
  display: flex; justify-content: space-around; padding: 8px 4px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-neutral-300); flex-shrink: 0; background: var(--color-bg);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--color-neutral-500); font-size: 11px; font-weight: 500; padding: 6px 10px;
}
.bottom-nav a.active { color: var(--color-accent-700); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; font-family: var(--font-heading); font-weight: 700;
  font-size: 14px; color: var(--color-text); background: transparent; border: 1px solid transparent;
  padding: 10px 18px; border-radius: 999px;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-600); }
.btn-accent2 { background: var(--color-accent-2); color: #fff; }
.btn-accent2:hover { background: var(--color-accent-2-700); }
.btn-secondary { border-color: var(--color-divider); background: var(--color-surface); }
.btn-secondary:hover { background: var(--color-neutral-300); }
.btn-ghost { color: var(--color-accent-700); padding-inline: 8px; background: none; }
.btn-ghost:hover { background: rgba(198,113,57,0.1); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px; font-size: 16px; }
.btn-icon { width: 36px; height: 36px; padding: 0; background: none; border: none; color: var(--color-neutral-700); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; margin-bottom: 5px; color: var(--color-neutral-700); }
.input {
  width: 100%; min-height: 40px; padding: 8px 14px; font: inherit; font-size: 14px;
  color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-divider);
  border-radius: 999px;
}
.input:focus { outline: none; border-color: var(--color-accent); }

.card {
  background: var(--color-surface); border-radius: var(--radius-lg); padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.card.elev { box-shadow: var(--shadow-sm); }
.card-kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent-700); font-weight: 700; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.row-line { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
.row-line:last-child { border-bottom: none; }
.muted { color: var(--color-neutral-600); }
.small { font-size: 12px; }

.tag {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; border: none; cursor: pointer; text-decoration: none;
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-accent2 { background: var(--color-accent-2-100); color: var(--color-accent-2-800); }
.tag-neutral { background: var(--color-neutral-100); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent-700); background: none; }

.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.calendar-weekday { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--color-neutral-500); }
.calendar-cell {
  aspect-ratio: 1; border-radius: 12px; border: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; cursor: pointer; background: var(--color-neutral-100);
  color: var(--color-text); font-family: var(--font-body);
}
.calendar-cell.done { background: var(--color-accent-2-700); color: #fff; }
.calendar-cell.missing { border: 2px dashed var(--color-accent-600); background: none; color: var(--color-accent-700); }
.calendar-cell.future { background: none; color: var(--color-neutral-400); }
.calendar-cell.today { outline: 2px solid var(--color-accent-700); outline-offset: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--color-neutral-600); }
.legend .dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; margin-right: 6px; }

.stat-headline { text-align: center; padding: 20px 0 6px; }
.stat-headline .value { font-family: var(--font-heading); font-size: 44px; font-weight: 700; color: var(--color-accent-700); }
.stat-headline .label { color: var(--color-neutral-600); font-size: 13px; }
.metric-row { display: flex; gap: 10px; }
.metric { flex: 1; background: var(--color-neutral-100); border-radius: var(--radius-md); padding: 12px; text-align: center; }
.metric .value { font-size: 20px; font-weight: 700; font-family: var(--font-heading); }
.metric .label { font-size: 11px; color: var(--color-neutral-600); }
.bars { display: flex; align-items: flex-end; gap: 10px; }
.bars .bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-track { position: relative; width: 100%; height: 96px; }
.bars .bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--color-accent-2-400); border-radius: 8px 8px 3px 3px; box-sizing: border-box;
}
.bar-value { position: absolute; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 700; }
.bar-value-inside { top: 6px; color: #fff; }
.bar-value-zero { top: 0; color: var(--color-neutral-600); }
.bars .bar-label { font-size: 10px; color: var(--color-neutral-600); }
.userbar-row { margin-bottom: 10px; }
.userbar-track { background: var(--color-neutral-100); border-radius: 999px; height: 8px; overflow: hidden; }
.userbar-fill { background: var(--color-accent-500); height: 100%; border-radius: 999px; }

table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--color-neutral-600); padding: 8px; border-bottom: 1px solid var(--color-divider); }
table.table td { padding: 8px; border-bottom: 1px solid rgba(0,0,0,0.06); }

.wizard-dots { display: flex; gap: 6px; }
.wizard-dots span { width: 8px; height: 8px; border-radius: 999px; background: var(--color-neutral-300); display: inline-block; }
.wizard-dots span.active { background: var(--color-accent-600); }
.wizard-step { display: none; }
.wizard-step.active { display: flex; flex-direction: column; gap: 16px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 20px 0; }
.stepper .stepper-val { font-family: var(--font-heading); font-size: 48px; font-weight: 700; min-width: 70px; text-align: center; transition: transform 0.09s ease; }
.stepper button {
  width: 52px; height: 52px; border-radius: 999px; border: none; background: var(--color-accent);
  color: #fff; font-size: 24px; cursor: pointer; touch-action: manipulation;
  transition: transform 0.08s ease, background 0.08s ease;
}
.stepper button:active { transform: scale(0.88); background: var(--color-accent-700); }
.choice-row { display: flex; gap: 10px; }
.choice-btn {
  flex: 1; padding: 16px; border-radius: var(--radius-lg); font-size: 15px; font-weight: 700;
  cursor: pointer; border: 2px solid transparent; background: var(--color-neutral-100); color: var(--color-neutral-600);
}
.choice-btn.yes.active { background: var(--color-accent-2-200); color: var(--color-accent-2-800); border-color: var(--color-accent-2-500); }
.choice-btn.no.active { background: var(--color-accent-100); color: var(--color-accent-700); border-color: var(--color-accent-500); }

.center-pane { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 24px; }
.icon-circle { width: 64px; height: 64px; border-radius: 999px; background: var(--color-accent-2-200); display: flex; align-items: center; justify-content: center; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }

.flash { padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 12px; }
.flash-error { background: var(--color-accent-100); color: var(--color-accent-800); }
.flash-ok { background: var(--color-accent-2-100); color: var(--color-accent-2-800); }
