/* =============================================================================
   A Vaca Malhada — app (versão simples)
   Mobile first. Ordem: tokens → base → layout → componentes → telas → utilitários
   ============================================================================= */

/* ---------- tokens ---------- */
:root {
  /* marca */
  --cream: #fff7ec;
  --milk: #ffffff;
  --ink: #2a211c;
  --ink-soft: #6b5d54;
  --ink-faint: #9c8b7e;
  --strawberry: #e8798f;
  --strawberry-deep: #b83e58;
  --pink-bg: #fde8ec;
  --line: #eadfd2;
  --paper-line: #f1e6da;

  /* fundos pastel dos cards (escolhidos pelo nome da receita) */
  --tile-1: #fde8ec;
  --tile-2: #fdf0d2;
  --tile-3: #e3f2e6;
  --tile-4: #e3eef8;
  --tile-5: #efe6f8;
  --tile-6: #f7e7d4;

  /* gráficos: ordem fixa, validada para daltonismo (scripts do dataviz) */
  --c1: #d6456a;
  --c2: #2a78d6;
  --c3: #eda100;
  --c4: #1baf7a;
  --c5: #6250d6;
  --c-other: #b5a99f;
  --c-cost: var(--c1);
  --c-tax: var(--c3);
  --c-profit: var(--c4);

  --success: #2f7a45;
  --success-bg: #e3f2e6;
  --danger: #b3261e;
  --danger-bg: #fbe4e2;
  --warn: #8a5a00;
  --warn-bg: #fdf0d2;

  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow: 0 2px 10px rgb(42 33 28 / 0.07);
  --shadow-lg: 0 10px 30px rgb(42 33 28 / 0.18);

  --gutter: 16px;
  --tap: 48px;
  --tab-bar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --max-w: 640px;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

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

a {
  color: var(--strawberry-deep);
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--strawberry);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 22px;
  height: 22px;
  flex: none;
}

/* ---------- layout ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 8px 0;
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.app-bar__logo {
  width: 34px;
  height: 34px;
  margin-left: 8px;
  border-radius: 50%;
}

.app-bar__title {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
  font-size: 1.3rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-bar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.app-main {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 8px var(--gutter) calc(var(--tab-bar-h) + var(--safe-bottom) + 96px);
}

.tab-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  height: calc(var(--tab-bar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--milk);
  border-top: 1px solid var(--line);
}

.tab-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-faint);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.tab-bar__item .icon {
  width: 26px;
  height: 26px;
}

.tab-bar__item.is-active {
  color: var(--strawberry-deep);
}

.fab {
  position: fixed;
  right: max(var(--gutter), calc((100vw - var(--max-w)) / 2 + var(--gutter)));
  bottom: calc(var(--tab-bar-h) + var(--safe-bottom) + 16px);
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 28px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
}

.offline-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 700;
}

/* tela de entrada (carregando, login) */
.splash {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px var(--gutter);
  text-align: center;
}

.splash__inner {
  width: 100%;
  max-width: 360px;
}

.brand-mark {
  width: 104px;
  height: 104px;
  margin: 0 auto 16px;
  border-radius: 50%;
}

.login__title {
  font-family: var(--font-hand);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
}

.login__subtitle {
  margin: 6px 0 24px;
}

.login__form {
  text-align: left;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 16px auto;
  border: 3px solid var(--line);
  border-top-color: var(--strawberry-deep);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- blocos ---------- */
.section {
  margin-top: 24px;
}

.section__title {
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

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

.notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.92rem;
  font-weight: 700;
}

.notice a {
  color: inherit;
}

.notice--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.notice--success {
  background: var(--success-bg);
  color: var(--success);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 16px;
  text-align: center;
  color: var(--ink-soft);
}

.empty-state__emoji {
  font-size: 3rem;
  line-height: 1;
}

.empty-state__title {
  color: var(--ink);
  font-weight: 800;
  font-size: 1.1rem;
}

/* emoji num quadradinho colorido */
.emoji-tile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--tile-1);
  font-size: 1.5rem;
  line-height: 1;
}

.emoji-tile--lg {
  width: 84px;
  height: 84px;
  border-radius: 26px;
  font-size: 3rem;
}

.emoji-tile--sm {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 1.1rem;
}

/* ---------- formulários ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  font-size: 0.92rem;
  font-weight: 800;
}

.field__hint {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.field__error {
  min-height: 1em;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--milk);
  font-size: 16px; /* evita zoom no iPhone */
  appearance: none;
  -webkit-appearance: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--strawberry) 35%, transparent);
}

.input--big {
  min-height: 56px;
  font-size: 1.5rem;
  font-weight: 800;
}

.input--hand {
  font-family: var(--font-hand);
  font-size: 2rem;
  font-weight: 700;
  padding-top: 4px;
  padding-bottom: 4px;
}

.select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b5d54' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.input-group {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--milk);
  overflow: hidden;
}

.input-group:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--strawberry) 35%, transparent);
}

.input-group .input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
}

.input-group__addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--cream);
  color: var(--ink-soft);
  font-weight: 800;
  white-space: nowrap;
}

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

/* opções em "pílulas" (unidade da embalagem) */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pills label {
  position: relative;
}

.pills input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pills span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--milk);
  font-weight: 800;
}

.pills input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.pills input:focus-visible + span {
  outline: 3px solid var(--strawberry);
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--ink);
  color: var(--cream);
}

.btn--secondary {
  background: var(--milk);
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger-ghost {
  background: transparent;
  color: var(--danger);
}

.btn--dashed {
  width: 100%;
  border: 2px dashed var(--line);
  background: transparent;
  color: var(--strawberry-deep);
}

.btn--block {
  width: 100%;
}

.btn.is-busy {
  position: relative;
  color: transparent !important;
}

.btn.is-busy::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--line);
  border-top-color: var(--strawberry-deep);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
}

.icon-btn:active {
  background: var(--pink-bg);
}

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

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-row > * {
  flex: 1;
}

/* barra fixa de salvar (acima das abas) */
.save-bar {
  position: fixed;
  inset: auto 0 calc(var(--tab-bar-h) + var(--safe-bottom)) 0;
  z-index: 26;
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--cream) 94%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}

.save-bar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(var(--max-w) - 2 * var(--gutter));
  margin: 0 auto;
}

.save-bar__total {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.save-bar__total strong {
  font-size: 1.35rem;
}

/* ---------- listas (seletor, sheet) ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--milk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.list--sheet {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  text-decoration: none;
}

.list-item:active {
  background: var(--cream);
}

.list-item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-item__title {
  font-weight: 800;
}

.list-item__sub {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.list-item--create {
  color: var(--strawberry-deep);
  font-weight: 800;
}

.list__group {
  padding: 8px 14px 6px;
  background: var(--cream);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.list__empty {
  padding: 24px 14px;
  color: var(--ink-soft);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

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

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search > .icon {
  position: absolute;
  left: 14px;
  color: var(--ink-soft);
  pointer-events: none;
}

.search__input {
  padding-left: 44px;
  border-radius: 999px;
}

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

.chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--milk);
  font-weight: 700;
}

/* grade de emojis */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.emoji-grid button {
  aspect-ratio: 1;
  border: 0;
  border-radius: 14px;
  background: var(--cream);
  font-size: 1.6rem;
}

.emoji-grid button[aria-pressed='true'] {
  background: var(--pink-bg);
  outline: 2px solid var(--strawberry);
}

/* ---------- dialog / sheet / toast ---------- */
dialog {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: var(--milk);
}

dialog::backdrop {
  background: rgb(42 33 28 / 0.45);
}

.dialog {
  width: min(92vw, 400px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.dialog__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 20px 8px;
}

.dialog__title {
  font-size: 1.2rem;
  font-weight: 800;
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
}

.sheet {
  width: 100%;
  max-width: var(--max-w);
  max-height: 90dvh;
  margin: auto auto 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

.sheet[open] {
  display: flex;
  animation: sheet-up 0.22s ease-out;
}

@keyframes sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

.sheet__handle {
  width: 40px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 3px;
  background: var(--line);
}

.sheet__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 20px;
}

.sheet__title {
  flex: 1;
  font-size: 1.15rem;
  font-weight: 800;
}

.sheet__body {
  overflow-y: auto;
  padding: 4px var(--gutter) 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-bar-h) + var(--safe-bottom) + 20px);
  z-index: 100;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 700;
  white-space: pre-line;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-type='error'] {
  background: var(--danger);
  color: #fff;
}

.toast[data-type='success'] {
  background: var(--success);
  color: #fff;
}

/* ---------- gráficos ---------- */
/* barra segmentada alta (≤ 28px): um todo dividido em partes */
.seg-bar {
  display: flex;
  gap: 2px;
  height: 28px;
}

.seg-bar__part {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0;
  border-radius: 4px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.seg-bar__part--dark-text {
  color: #0b0b0b;
}

/* barra fina sem texto (a lista ao lado traz os números) */
.seg-bar--thin {
  height: 8px;
}

.seg-bar--thin .seg-bar__part {
  padding: 0;
  border-radius: 4px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c-other);
}

/* ---------- tela: lista de receitas ---------- */
.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.recipe-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 176px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--tile-1);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.recipe-card:active {
  transform: scale(0.98);
}

.recipe-card__emoji {
  font-size: 2.6rem;
  line-height: 1.1;
}

.recipe-card__name {
  margin-top: auto;
  font-family: var(--font-hand);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  overflow-wrap: anywhere;
}

.recipe-card__cost {
  font-size: 1.05rem;
  font-weight: 800;
}

.recipe-card__sub {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.recipe-card--new {
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--strawberry);
  background: transparent;
  box-shadow: none;
  color: var(--strawberry-deep);
  font-weight: 800;
}

.recipe-card--new .icon {
  width: 32px;
  height: 32px;
}

/* ---------- tela: receita ---------- */
.recipe-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
  text-align: center;
}

.recipe-head__name {
  font-family: var(--font-hand);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
}

.hero {
  margin-top: 14px;
  text-align: center;
}

.hero__value {
  font-size: 3.25rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero__label {
  color: var(--ink-soft);
  font-weight: 700;
}

.hero__per-unit {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--milk);
  border: 1px solid var(--line);
  font-weight: 800;
}

/* a receita como no papel */
.paper {
  position: relative;
  padding: 18px 16px 12px;
  border-radius: 6px;
  background:
    linear-gradient(var(--milk), var(--milk)) padding-box;
  box-shadow: 0 1px 2px rgb(42 33 28 / 0.08), 0 8px 24px rgb(42 33 28 / 0.08);
  transform: rotate(-0.4deg);
}

.paper__bar {
  margin-bottom: 12px;
}

.paper-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border-bottom: 1px solid var(--paper-line);
}

.paper-row__qty {
  min-width: 64px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.paper-row__name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.paper-row__name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-row__cost {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.paper-row__cost .badge {
  font-size: 0.72rem;
}

.paper-total {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  font-size: 1.1rem;
  font-weight: 800;
}

.paper-note {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* quanto sobra */
.sale-result {
  margin-top: 14px;
}

.sale-result__text {
  margin-top: 10px;
  font-weight: 700;
}

.sale-result__text strong {
  font-size: 1.15rem;
}

.text-profit {
  color: var(--success);
}

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

/* ---------- tela: editar receita ---------- */
.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.name-row .emoji-tile {
  border: 0;
  cursor: pointer;
}

.edit-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 8px;
  padding: 6px 6px 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--milk);
  border: 1px solid var(--line);
}

.edit-line__ing {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 800;
}

.edit-line__ing span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-line__amount {
  display: flex;
  gap: 6px;
}

.edit-line__amount .input {
  width: 92px;
  min-height: 44px;
  padding: 8px 10px;
  text-align: right;
  font-weight: 800;
}

.edit-line__amount .select {
  width: 72px;
  min-height: 44px;
  padding: 8px 26px 8px 12px;
  font-weight: 800;
  background-position: right 8px center;
}

.edit-line__cost {
  padding-right: 8px;
  font-weight: 800;
  text-align: right;
}

.edit-line__cost.is-problem {
  color: var(--warn);
  font-size: 0.85rem;
}

/* ---------- tela: ingredientes ---------- */
.ing-row__price {
  flex: none;
  text-align: right;
  line-height: 1.15;
}

.ing-row__price strong {
  display: block;
  font-size: 1.05rem;
}

.ing-row__price span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.price-preview {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  font-weight: 700;
}

.price-preview strong {
  font-size: 1.2rem;
}

/* ---------- utilitários ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.small {
  font-size: 0.86rem;
}

.strong {
  font-weight: 800;
}

.text-center {
  text-align: center;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* campo "rende": número curto + unidade (unidades, fatias…) */
.yield-group .input:first-child {
  flex: 0 0 56px;
  padding-right: 4px;
}

.yield-group .input + .input {
  padding-left: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.edit-line > .icon-btn {
  justify-self: end;
}

.seg-bar__label {
  padding-left: 8px;
}

/* =============================================================================
   v3: página do ingrediente, histórico, análise e gráficos
   ============================================================================= */

.ing-head__name {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.hero__unit {
  margin-left: 2px;
  color: var(--ink-soft);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0;
}

.ing-row__when {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

/* histórico de preço */
.log {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.log__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  border-top: 1px solid var(--paper-line);
}

.log__date {
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.log__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.log__change {
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.log__remove {
  width: 32px;
  height: 36px;
  color: var(--ink-faint);
}

/* análise */
.insight {
  margin-top: 16px;
  padding: 18px 16px;
  border-radius: var(--radius-lg);
  background: var(--milk);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.insight:first-child {
  margin-top: 4px;
}

.insight__q {
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.insight__a {
  margin-bottom: 14px;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.4;
}

.insight__note {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.pills--sm {
  margin-bottom: 14px;
}

.pills--sm span {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.88rem;
}

/* barras ranqueadas: ≤ 24px, ponta arredondada, base reta */
.rbars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rbars__row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 6px;
  margin: 0 -6px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}

a.rbars__row:active,
a.rbars__row:hover {
  background: var(--cream);
}

.rbars__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
}

.rbars__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rbars__value {
  flex: none;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.rbars__track {
  display: block;
  height: 12px;
  border-left: 1px solid var(--line);
}

.rbars__bar {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
}

.rbars__sub {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

/* linha no tempo */
.chart {
  position: relative;
  margin: 4px 0 0;
  outline-offset: 4px;
}

.chart__svg {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
  touch-action: pan-y;
  font-family: var(--font);
}

.chart__grid {
  stroke: var(--paper-line);
  stroke-width: 1;
}

.chart__tick {
  fill: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
}

.chart__end {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.chart__line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart__area {
  opacity: 0.1;
}

.chart__dot {
  stroke: var(--milk);
  stroke-width: 2;
}

.chart__crosshair {
  stroke: var(--ink-soft);
  stroke-width: 1;
}

.chart__tip {
  position: absolute;
  top: 0;
  z-index: 2;
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--cream);
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.chart__tip-date {
  color: color-mix(in srgb, var(--cream) 70%, transparent);
  font-weight: 700;
}

.chart__tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart__tip-row strong {
  font-size: 0.95rem;
}

.line-key {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

/* tabela equivalente */
.chart-table {
  margin-top: 12px;
  font-size: 0.86rem;
}

.chart-table summary {
  display: flex;
  align-items: center;
  min-height: 32px;
  color: var(--strawberry-deep);
  font-weight: 800;
  cursor: pointer;
}

.chart-table table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
}

.chart-table th,
.chart-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--paper-line);
  text-align: left;
}

.chart-table th {
  color: var(--ink-soft);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.chart-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* pequenos múltiplos: nome · mini linha · valor */
.multiples {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.multiples__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border-top: 1px solid var(--paper-line);
  color: inherit;
  text-decoration: none;
}

.multiples__name {
  min-width: 0;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.multiples__value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 78px;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}

.multiples__value strong {
  font-size: 0.95rem;
}

.spark {
  display: block;
}

/* segurar o cartão: sem a prévia de link do iPhone e sem selecionar texto */
.recipe-card[data-recipe] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.45s ease;
}

.recipe-card.is-pressing {
  transform: scale(0.95);
}

/* menu de ações (bottom sheet) */
.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--milk);
  color: var(--ink);
  text-align: left;
}

.menu__item > span {
  display: flex;
  flex-direction: column;
}

.menu__item--main {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--cream);
}

.menu__hint {
  font-size: 0.84rem;
  opacity: 0.8;
}

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

/* linha de campo: nome à esquerda, número à direita (como uma linha de planilha) */
.field-lines {
  display: flex;
  flex-direction: column;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--milk);
}

.field-lines--flat {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.field-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 0;
}

.field-line + .field-line {
  border-top: 1px solid var(--paper-line);
}

.field-line__label {
  font-weight: 800;
  line-height: 1.2;
}

.field-line__label small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.field-line__input {
  width: 168px;
}

.field-line__input--short {
  width: 112px;
}

.field-line__input .input {
  min-height: 46px;
  text-align: right;
  font-size: 1.1rem;
  font-weight: 800;
}

.field-line__input.yield-group .input + .input {
  text-align: left;
  font-size: 0.9rem;
}

.field-line__hint {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.login__eye {
  align-self: center;
  margin-right: 2px;
  color: var(--ink-soft);
}

.login__eye[aria-pressed='true'] {
  color: var(--strawberry-deep);
}

.import-notice {
  display: block;
  margin-bottom: 14px;
  text-decoration: none;
}

/* "+ Novo ingrediente" no topo do seletor */
.list-item--create {
  border-bottom: 1px solid var(--line);
}

.list-item--create .list-item__lead {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--pink-bg);
  color: var(--strawberry-deep);
}

/* =============================================================================
   Mensagem do dia: bolha de coração flutuando + cartão
   ============================================================================= */
.note-bubble {
  position: fixed;
  right: max(18px, calc((100vw - var(--max-w)) / 2 + 18px));
  bottom: calc(var(--tab-bar-h) + var(--safe-bottom) + 22px);
  z-index: 24;
  animation: note-float 4.5s ease-in-out infinite;
}

.note-bubble__heart {
  position: relative;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0, var(--pink-bg) 38%, var(--strawberry) 100%);
  box-shadow: 0 10px 26px rgb(232 121 143 / 0.45);
  font-size: 2rem;
  line-height: 1;
}

/* anel pulsando para chamar atenção */
.note-bubble__heart::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--strawberry);
  border-radius: 50%;
  opacity: 0;
  animation: note-pulse 2.4s ease-out infinite;
}

.note-bubble__dismiss {
  position: absolute;
  top: -8px;
  left: -8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--milk);
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}

/* área de toque maior que o botãozinho */
.note-bubble__dismiss::before {
  content: '';
  position: absolute;
  inset: -9px;
}

.note-bubble__dismiss .icon {
  width: 14px;
  height: 14px;
}

.note-bubble.is-leaving {
  animation: note-leave 0.45s ease-in forwards;
}

@keyframes note-float {
  0%,
  100% {
    transform: translate(0, 0) rotate(-4deg);
  }
  50% {
    transform: translate(-8px, -12px) rotate(4deg);
  }
}

@keyframes note-pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes note-leave {
  to {
    transform: translate(70px, -30px) scale(0.3) rotate(25deg);
    opacity: 0;
  }
}

/* cartão da mensagem */
dialog.note-card {
  width: min(90vw, 380px);
  overflow: visible;
  background: transparent;
}

.note-card__paper {
  position: relative;
  padding: 34px 22px 18px;
  border-radius: 24px;
  background: var(--milk);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: note-open 0.35s ease-out;
}

.note-card__heart {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.6rem;
  line-height: 1;
}

.note-card__kicker {
  color: var(--strawberry-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.note-card__text {
  margin: 12px 0 10px;
  font-family: var(--font-hand);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.note-card__date {
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

@keyframes note-open {
  from {
    transform: scale(0.85) translateY(20px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .note-bubble,
  .note-bubble__heart::after {
    animation: none;
  }
}

/* bolha da autora (escrever) */
.note-bubble--author .note-bubble__heart {
  background: radial-gradient(circle at 32% 28%, #fff 0, var(--tile-2) 40%, var(--caramel) 100%);
  box-shadow: 0 10px 26px rgb(217 160 102 / 0.45);
}

.note-bubble--author .note-bubble__heart::after {
  display: none;
}

.note-compose__text {
  font-family: var(--font-hand);
  font-size: 1.6rem;
  line-height: 1.2;
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note-list__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--paper-line);
}

.note-list__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.note-list__text {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-weight: 700;
  white-space: pre-line;
}

.note-list__status {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.note-list__status--read {
  color: var(--strawberry-deep);
}
