/*
 * Design tokens and components from the screen designs (see CLAUDE.md).
 * Mobile first: 390px is the primary layout. Class names are BEM.
 */

:root {
  /* Colours */
  --ground: #F4F1EA;
  --card: #FBFAF6;
  --border: #E0DBCF;
  --border-strong: #CFC8B8;
  --divider: #E9E4D8;
  --chip: #EFE9DD;
  --supplies: #EAE3D3;
  --ink: #1F2A22;
  --ink-soft: #3E473F;
  --muted: #5B6358;
  --primary: #2F4A36;
  --primary-dark: #1F3326;
  --open-bg: #E3EBDD;
  --warn: #8E4322;
  --warn-bg: #F6E1D3;

  /* Shapes and touch targets */
  --radius-card: 16px;
  --radius-control: 12px;
  --touch: 44px;
  --tab-bar: 76px;

  /* Type */
  --font-heading: "Fraunces", "Georgia", serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.has-nav { padding-bottom: calc(var(--tab-bar) + env(safe-area-inset-bottom)); }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.15;
}

h1 { font-size: 2rem; }

a { color: var(--primary); }

a:hover { color: var(--primary-dark); }

.page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 24px;
}

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

/* Page and section headings */

.page-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-header--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stack-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-heading__count {
  color: var(--muted);
  font-size: 13px;
}

.section-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  min-height: var(--touch);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

/* Cards, chips and badges */

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--card);
}

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

.card__title { font-size: 21px; }

.card__subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card__link {
  color: inherit;
  text-decoration: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}

.chip--warn {
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 600;
}

.chip--link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}

.badge {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--small { padding: 3px 9px; }

.badge--open {
  background: var(--open-bg);
  color: var(--primary);
}

.badge--warn {
  background: var(--warn-bg);
  color: var(--warn);
}

/* Bundle card on the home screen */

.bundle__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.instructions {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  color: var(--ink-soft);
  font-size: 14px;
  list-style: none;
}

.bundle__supplies {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.bundle__actions {
  display: flex;
  gap: 8px;
}

.bundle__form { display: flex; }

.bundle__form--grow { flex-grow: 1; }

.bundle__done { flex-grow: 1; }

/* Lists: Binnenkort, Gepland, Planten */

.list-card {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--card);
  list-style: none;
}

.list-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--touch);
  padding: 14px 16px;
  color: var(--ink);
  text-decoration: none;
}

.list-card > li + li { border-top: 1px solid var(--divider); }

.list-card__title {
  font-size: 16px;
  font-weight: 600;
}

.list-card__meta {
  color: var(--muted);
  font-size: 13px;
}

.list-card__date {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.supplies {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--supplies);
}

.supplies__title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.supplies__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.supplies__name { font-weight: 600; }

.supplies__for { color: #4F574E; }

.supplies__date {
  color: var(--ink-soft);
  white-space: nowrap;
}

.section-card__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.unplanted summary {
  min-height: var(--touch);
  padding: 10px 0;
  color: var(--muted);
  cursor: pointer;
}

/* Forms */

.field {
  display: grid;
  gap: 6px;
}

.field label,
.field__label,
.fieldset legend {
  font-size: 14px;
  font-weight: 600;
}

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

.fieldset {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}

.fieldset legend {
  margin-bottom: 6px;
  padding: 0;
}

.care-task__legend {
  padding: 0 4px;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

input.input--inline {
  display: inline-block;
  width: 5em;
  min-height: var(--touch);
  margin: 0 4px;
}

input[type="checkbox"],
input[type="radio"] {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.check-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--card);
}

.check-list__row,
.radio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  font-size: 15px;
}

.radio-row { padding: 0; }

.check-list > .check-list__row + .check-list__row { border-top: 1px solid var(--divider); }

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #FFF;
  font-weight: 600;
}

.button--outline { background: transparent; }

.button--large {
  min-height: 52px;
  border-radius: 14px;
  font-size: 16px;
}

.button--ghost,
.button--danger {
  border-color: transparent;
  background: transparent;
}

.button--ghost { color: var(--primary); }

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

.logout { align-self: center; }

/* Flash messages */

.flash {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: var(--radius-control);
}

.flash p,
.flash ul { margin: 0; }

.flash--alert {
  background: var(--warn-bg);
  color: var(--warn);
}

.flash--notice {
  background: var(--open-bg);
  color: var(--primary);
}

#flash:empty { display: none; }

/* Bottom tab bar */

.tab-bar {
  display: grid;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  height: calc(var(--tab-bar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
  background: var(--card);
}

.tab-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.tab-bar__item[aria-current="page"] {
  color: var(--primary);
  font-weight: 600;
}

/* Focus styles come last so they win over the component rules above. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.button:focus-visible,
.tab-bar__item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
