:root {
  color-scheme: light;
  --bg: #f5f7f2;
  --surface: #ffffff;
  --surface-soft: #eaf0e5;
  --text: #172018;
  --muted: #667365;
  --line: #d7dfd1;
  --accent: #2f6b3f;
  --accent-strong: #235431;
  --accent-soft: #ddecce;
  --warning: #a25d10;
  --danger: #b7392e;
  --shadow: 0 20px 48px rgba(27, 48, 29, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111511;
  --surface: #1b211b;
  --surface-soft: #252d24;
  --text: #eef4ea;
  --muted: #a8b3a4;
  --line: #344033;
  --accent: #8bc16e;
  --accent-strong: #a6d987;
  --accent-soft: #23331f;
  --warning: #e3ae62;
  --danger: #ee756b;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
}

.auth-view,
.main-view {
  min-height: calc(100vh - 40px);
}

.auth-view {
  display: grid;
  align-content: center;
  gap: 22px;
}

.brand-block,
.topbar,
.section-header,
.top-actions,
.form-actions {
  display: flex;
  align-items: center;
}

.brand-block,
.topbar,
.section-header {
  justify-content: space-between;
  gap: 16px;
}

.brand-block {
  justify-content: flex-start;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.1rem, 9vw, 3.6rem);
}

h2 {
  font-size: clamp(1.75rem, 7vw, 2.6rem);
}

h3 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.panel,
.hero,
.weather-strip,
.activity-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.auth-panel,
.entry-form,
.field-grid,
.user-list,
.activity-list,
.forecast-list {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

.primary-action,
.secondary-action,
.danger-action,
.timer-button,
.home-tile,
.icon-button,
.back-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action,
.timer-button {
  min-height: 52px;
  background: var(--accent);
  color: #fff;
}

.secondary-action {
  min-height: 42px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 0 14px;
}

.danger-action {
  min-height: 52px;
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
  padding: 0 16px;
}

.form-message,
.muted {
  color: var(--muted);
}

.form-message {
  min-height: 1.4em;
  margin: 0;
}

.topbar {
  padding: 8px 0 18px;
}

.top-actions {
  gap: 8px;
}

.icon-button,
.back-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 1.25rem;
}

.screen {
  display: none;
}

.screen.active {
  display: grid;
  gap: 16px;
}

.hero {
  display: grid;
  gap: 16px;
  padding: 22px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    var(--surface);
}

.timer-display {
  font-size: clamp(2.4rem, 16vw, 5rem);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timer-button.running {
  background: var(--warning);
}

.weather-strip {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

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

.forecast-day {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.forecast-day strong {
  display: block;
  margin-bottom: 7px;
}

.forecast-day span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.home-tile {
  display: grid;
  min-height: 96px;
  place-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.home-tile span {
  font-size: 1.8rem;
  line-height: 1;
}

.home-tile.disabled {
  opacity: 0.7;
}

.section-header {
  justify-content: flex-start;
  padding-bottom: 6px;
}

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

.duration-label {
  margin: 12px 0 0;
  color: var(--accent-strong);
  font-weight: 800;
}

.switch-line {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
}

.switch-line input {
  width: 22px;
  min-height: 22px;
}

.photo-preview {
  overflow: hidden;
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.photo-preview img,
.activity-photo {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.form-actions {
  justify-content: flex-end;
  gap: 10px;
}

.activity-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  text-align: left;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.account-row:last-child {
  border-bottom: 0;
}

.account-row p {
  margin-bottom: 0;
}

.activity-card button {
  text-align: left;
}

.activity-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.pill {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

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

.empty-state p {
  margin-bottom: 0;
}

@media (min-width: 560px) {
  .time-grid,
  .field-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .field-grid .switch-line {
    align-self: end;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding-inline: 12px;
  }

  .weather-strip,
  .activity-main {
    align-items: stretch;
    flex-direction: column;
  }

  .forecast-list,
  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-tile {
    min-height: 74px;
    grid-template-columns: 34px 1fr;
    justify-items: start;
    padding: 0 16px;
  }
}
