/* Mobile-first. The phone is on the worktop; type is large and targets are big. */

/* "Midnight Herb" palette: green-tinted neutrals, mint accent, amber warnings.
   The light scheme is the same family in daylight. */
:root {
  --bg: #f2f6f3;
  --card: #ffffff;
  --ink: #1a231d;
  --muted: #64716a;
  --line: #dde5df;
  --field: #f9fcfa;
  --accent: #128a5e;
  --accent-ink: #ffffff;
  --error: #b3261e;
  --error-bg: #fdecea;
  --warn: #8a5f00;
  --warn-bg: #fdf3d5;
  --safety-bg: #e9f0fd;
  --safety: #1f4b99;
  --radius: 13px;
  --shadow: 0 1px 2px rgba(10, 40, 25, 0.06), 0 4px 12px rgba(10, 40, 25, 0.04);
  --glow: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d120f;
    --card: #161d18;
    --ink: #e9f1ea;
    --muted: #94a89a;
    --line: #26312a;
    --field: #0f1511;
    --accent: #34d399;
    --accent-ink: #06281a;
    --error: #ff9187;
    --error-bg: #33201d;
    --warn: #f3c64d;
    --warn-bg: #2c2410;
    --safety-bg: #182338;
    --safety: #a7c4f5;
    --shadow: none;
    --glow: 0 0 0 1px rgba(52, 211, 153, 0.35), 0 8px 24px -8px rgba(52, 211, 153, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

.app {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

.app-header h1 { margin: 0.5rem 0 0.25rem; font-size: 1.6rem; letter-spacing: -0.02em; }
.tagline { margin: 0 0 1rem; color: var(--muted); }

.banner {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.card h2 { margin: 0 0 0.25rem; font-size: 1.35rem; letter-spacing: -0.01em; }
.card h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }

.muted { color: var(--muted); }
.hint { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 0.3rem; }
.error-text { color: var(--error); }

/* ---------- forms ---------- */

.field { display: block; margin-bottom: 0.9rem; border: 0; padding: 0; }
.field-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
.row { display: flex; gap: 0.75rem; }
.compact { flex: 1; }

input, textarea, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea { resize: vertical; }

button { font: inherit; cursor: pointer; border-radius: 10px; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  padding: 0.85rem 1rem;
  font-weight: 600;
  margin-top: 0.4rem;
  box-shadow: var(--glow);
}

.secondary {
  width: 100%;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.7rem 1rem;
  margin-top: 0.5rem;
}

.link-button {
  background: none; border: 0; color: var(--accent);
  padding: 0.4rem 0; font-weight: 600;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  background: var(--bg); border: 1px solid var(--line);
  padding: 0.35rem 0.7rem; font-size: 0.88rem; color: var(--muted);
}
.chip-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.options { border-top: 1px solid var(--line); padding-top: 0.9rem; margin-top: 0.3rem; }

/* ---------- recipe ---------- */

.stats { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 0.9rem 0; padding: 0; }
.stats div { margin: 0; }
.stats dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.1rem; font-weight: 600; }

.draft-banner {
  background: var(--warn-bg); color: var(--warn);
  border-radius: 10px; padding: 0.7rem 0.85rem; font-size: 0.88rem; margin-bottom: 0.9rem;
}

.actions { display: flex; flex-direction: column; gap: 0.75rem; }
.scale { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.pill {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  min-width: 2.4rem; padding: 0.4rem 0.6rem;
}
.pill-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.issue ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.issue li { margin-bottom: 0.35rem; }
.issue-error { background: var(--error-bg); border-color: var(--error); }
.issue-error h3 { color: var(--error); }
.issue-warning { background: var(--warn-bg); border-color: var(--warn); }
.issue-warning h3 { color: var(--warn); display: inline; }
.issue-warning summary { cursor: pointer; list-style-position: inside; }
.issue-safety { background: var(--safety-bg); border-color: var(--safety); }
.issue-safety h3 { color: var(--safety); }
.issue-info { background: var(--bg); }

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.5rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--line);
}
.ingredients li:last-child { border-bottom: 0; }
.ingredients .qty { font-variant-numeric: tabular-nums; font-weight: 600; }
.ingredients .prep { color: var(--muted); font-weight: 400; }
.ingredients .note { grid-column: 2; color: var(--muted); font-size: 0.85rem; }
.ingredients .missing .name { color: var(--muted); }

.tag {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem;
  font-size: 0.72rem; border-radius: 6px; background: var(--bg);
  border: 1px solid var(--line); color: var(--muted); vertical-align: middle;
}
.tag-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }

.steps { margin: 0; padding-left: 1.3rem; }
.steps li { margin-bottom: 1rem; }
.steps p { margin: 0 0 0.35rem; }
.step-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.settings {
  background: var(--accent); color: var(--accent-ink);
  padding: 0.2rem 0.55rem; border-radius: 6px;
  font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.manual {
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  padding: 0.2rem 0.55rem; border-radius: 6px; font-size: 0.85rem;
}

/* ---------- export ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.tab {
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  padding: 0.4rem 0.75rem; font-size: 0.88rem; text-transform: capitalize;
}
.tab-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.transfer-steps { padding-left: 1.2rem; font-size: 0.92rem; }
.transfer-steps li { margin-bottom: 0.4rem; }
.transfer-steps code {
  background: var(--bg); border: 1px solid var(--line);
  padding: 0.05rem 0.3rem; border-radius: 4px; font-size: 0.85em;
}
.split { display: flex; gap: 0.5rem; }
.split .secondary { margin-top: 0; }

.export-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem; line-height: 1.5; margin-top: 0.8rem;
}

/* ---------- history & notes ---------- */

.history-head { display: flex; justify-content: space-between; align-items: center; }
.toggle { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.toggle input { width: auto; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; align-items: center; gap: 0.25rem; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history-item {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start;
  background: none; border: 0; color: var(--ink); text-align: left; padding: 0.65rem 0;
}
.history-on .history-name { color: var(--accent); }
.history-name { font-weight: 600; }
.history-meta { font-size: 0.82rem; color: var(--muted); }
.icon {
  background: none; border: 0; color: var(--muted);
  font-size: 1.2rem; padding: 0.4rem 0.5rem; line-height: 1;
}

.rating { display: flex; gap: 0.15rem; margin-bottom: 0.6rem; }
.star { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--line); padding: 0 0.1rem; }
.star-on { color: var(--accent); }

.app-footer { margin-top: 2rem; color: var(--muted); font-size: 0.82rem; }

/* ---------- cooking view ---------- */

.cooking {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
}
.cooking-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; flex-shrink: 0;
}
.progress { color: var(--muted); font-size: 0.9rem; }
.cooking-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.cooking-bar div { height: 100%; background: var(--accent); transition: width 0.2s ease; }

.cooking-body {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  justify-content: center; gap: 1.2rem; padding: 1.5rem 0;
}
.cooking-adds {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.9rem;
}
.cooking-adds h3 {
  margin: 0 0 0.5rem; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.cooking-adds ul { list-style: none; margin: 0; padding: 0; }
.cooking-adds li { padding: 0.2rem 0; font-size: 1.05rem; }

.cooking-instruction { font-size: 1.5rem; line-height: 1.4; margin: 0; }
.cooking-manual { font-size: 1.05rem; color: var(--muted); margin: 0; }
.cooking-settings {
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius); padding: 1rem;
  font-size: 1.5rem; font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}

.cooking-nav { display: flex; gap: 0.75rem; padding: 0.75rem 0; flex-shrink: 0; }
.cooking-nav button { flex: 1; margin-top: 0; padding: 1rem; font-size: 1.05rem; }

@media (min-width: 40rem) {
  .app { padding: 2rem 1.5rem 4rem; }
  .actions { flex-direction: row; justify-content: space-between; align-items: center; }
  .actions .primary { width: auto; padding: 0.7rem 1.4rem; }
  .cooking-instruction { font-size: 1.9rem; }
}

/* ---------- Cookidoo push ---------- */

.push-ok {
  margin: 0.7rem 0 0;
  padding: 0.7rem 0.85rem;
  background: var(--safety-bg);
  color: var(--safety);
  border-radius: 10px;
  font-size: 0.9rem;
}
.push-ok a { color: inherit; display: inline-block; margin-top: 0.3rem; font-weight: 600; }
.push-manual { margin-top: 0.5rem; color: var(--warn); }

/* --- accounts, settings and the credential panels ------------------------- */

.account-bar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.75rem; padding-top: 0.5rem; font-size: 0.85rem;
}
.account-email { color: var(--muted); margin-right: auto; overflow: hidden; text-overflow: ellipsis; }

.fine { font-size: 0.78rem; color: var(--muted); }
.fine a, .app-footer a { color: inherit; }

.button-link {
  display: inline-block; text-align: center; text-decoration: none;
  padding: 0.85rem 1rem; border-radius: var(--radius); font-weight: 600;
}
.primary.button-link { background: var(--accent); color: var(--accent-ink); }
.secondary.button-link { background: transparent; color: var(--ink); border: 1px solid var(--line); }

/* Sign-in gate: one card, centred, nothing else on the page to do. */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.signin-card { max-width: 26rem; text-align: center; }
.signin-card h1 { margin: 0 0 0.25rem; font-size: 1.6rem; }
.signin-card .primary { display: block; margin: 1rem 0 0.75rem; }

/* Settings sits over the app rather than beside it: on a phone there is no
   beside, and on a laptop it is still one thing at a time. (.settings-panel,
   not .settings — that class belongs to the Thermomix settings chip above.) */
.settings-panel {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto;
  background: var(--bg); padding: 1rem 1rem 4rem;
}
.settings-header {
  display: flex; align-items: baseline; justify-content: space-between;
  max-width: 46rem; margin: 0 auto 0.5rem;
}
.settings-header h2 { margin: 0; font-size: 1.3rem; }
.settings-body { max-width: 46rem; margin: 0 auto; }
.settings-body input, .settings-body select { width: 100%; }

/* Model picker: a combobox — the input filters, the list floats below it. */
.combo { position: relative; }
.combo-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  margin: 0; padding: 0.3rem; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  max-height: 16rem; overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.combo-option { padding: 0.45rem 0.6rem; border-radius: 7px; cursor: pointer; font-size: 0.95rem; }
.combo-option:hover, .combo-active { background: var(--bg); }
.combo-current { color: var(--accent); font-weight: 600; }
.combo-empty { padding: 0.45rem 0.6rem; color: var(--muted); }

.tag-ok { background: var(--safety-bg); color: var(--safety); }
.connected-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0; }

.connect { margin: 0.5rem 0; }
.connect summary { cursor: pointer; font-weight: 600; padding: 0.35rem 0; }
.connect input { width: 100%; }

.devices { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.devices li {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--line);
}
.devices li:last-child { border-bottom: 0; }

.danger {
  background: var(--error-bg); color: var(--error);
  border: 1px solid currentColor;
}
