/* Desafio 30 · estilos (sempre em modo claro) */
:root {
  color-scheme: light;
  --bg: #F6F5FA;
  --card: #FFFFFF;
  --ink: #17161F;
  --muted: #5E5C6B;
  --line: #E9E7F0;
  --line-strong: #D9D7E3;
  --primary: #5B3DF5;
  --primary-dark: #4328D9;
  --primary-soft: #EDE9FF;
  --primary-ink: #3B22B8;
  --partial: #CFC6FF;
  --lime: #C6F432;
  --lime-soft: #ECF8C8;
  --lime-ink: #3F5A00;
  --water: #0A7CC2;
  --water-soft: #E0F1FB;
  --gray-soft: #EEEDF3;
  --danger: #B42318;
  --radius: 18px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: 28px 20px 110px; display: flex; flex-direction: column; gap: 22px; }
.screen.no-nav { padding-bottom: 32px; }

/* Tipografia */
h1 { margin: 2px 0 0; font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
h1.big { font-size: 34px; line-height: 1.1; letter-spacing: -0.8px; }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
p { margin: 0; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.pad { padding: 40px 0; }
.label-caps { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }

/* Estrutura */
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; align-items: baseline; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.dark { background: var(--ink); color: #FFFFFF; border-radius: 20px; padding: 16px; }
.dark .muted { color: #C9C7D6; }

/* Logo */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 18px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--lime); color: var(--ink); display: grid; place-items: center; font-size: 15px; }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }

/* Barras de progresso */
.bar { height: 8px; border-radius: 4px; background: #34323F; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--lime); }
.bar.water { height: 6px; background: var(--water-soft); }
.bar.water > span { background: var(--water); border-radius: 3px; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: none; background: var(--primary); color: #FFFFFF; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--gray-soft); }
.btn.done { background: var(--lime); color: var(--ink); }
.btn.small { min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 13px; }
.link-btn { background: none; border: none; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; min-height: 44px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-size: 20px; cursor: pointer; display: grid; place-items: center; }
.icon-btn.fill { border: none; background: var(--water); color: #FFFFFF; }

/* Checklist */
.check { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); text-align: left; cursor: pointer; }
.check:disabled { cursor: default; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #BDBAC9; background: #FFFFFF; display: grid; place-items: center; flex-shrink: 0; }
.dot svg { width: 14px; height: 14px; stroke: #FFFFFF; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.on .dot, .dot.on { border-color: var(--primary); background: var(--primary); }
.check-title { font-size: 15px; font-weight: 600; }
.check-sub { font-size: 13px; color: var(--muted); }

/* Fotos */
.thumb { aspect-ratio: 1; border-radius: 12px; background: #E4E0F2; overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-add { aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed #BDBAC9; background: var(--card); display: grid; place-items: center; cursor: pointer; padding: 0; }
.thumb-add svg { width: 22px; height: 22px; stroke: var(--muted); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.photo { border-radius: 14px; background: #E4E0F2; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.portrait { aspect-ratio: 3 / 4; border-radius: 20px; background: #D8D2EE; overflow: hidden; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait.empty { background: var(--card); border: 1.5px dashed #BDBAC9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; text-align: center; font-size: 13px; color: var(--muted); }

/* Selos */
.pill { display: inline-block; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gray-soft); color: var(--muted); }
.pill.ok { background: var(--lime-soft); color: var(--lime-ink); }
.pill.lime { background: var(--lime); color: var(--ink); font-size: 13px; font-weight: 700; padding: 6px 12px; }
.pill.violet { background: var(--primary-soft); color: var(--primary-ink); }

/* Lista de amigas */
.friend { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 60px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); text-decoration: none; color: var(--ink); }
.friend .chev { width: 18px; height: 18px; stroke: var(--muted); stroke-width: 2; fill: none; }

/* Calendário */
.cal { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.cal div { height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.cal .c { background: var(--primary); color: #FFFFFF; }
.cal .p { background: var(--partial); color: var(--primary-ink); }
.cal .x { background: var(--gray-soft); color: var(--muted); border: 1px solid var(--line-strong); }
.cal .t { background: #FFFFFF; color: var(--primary); border: 2px solid var(--primary); }
.cal .f { background: #FFFFFF; color: #8B8999; border: 1px dashed var(--line-strong); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Ranking */
.rank { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: var(--card); }
.rank.me { background: var(--primary-soft); font-weight: 600; }
.rank .pos { width: 18px; font-weight: 600; color: var(--muted); }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.input { height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: #FFFFFF; font-size: 16px; width: 100%; }
textarea.input { height: auto; min-height: 80px; padding: 12px 14px; resize: vertical; }
.input:focus, .btn:focus-visible, .check:focus-visible, .friend:focus-visible, .icon-btn:focus-visible, .thumb-add:focus-visible { outline: 3px solid var(--partial); outline-offset: 2px; }
.error { color: var(--danger); font-size: 13px; }

/* Abas segmentadas */
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--gray-soft); }
.segmented button { height: 44px; border: none; border-radius: 11px; background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: #FFFFFF; box-shadow: 0 1px 2px rgba(23, 22, 31, .08); }

/* Feed */
.post { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.post .photo { height: 220px; }
.btn.react[aria-pressed="true"] { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }

/* Comentários */
.comment { padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.comment strong { font-size: 13px; }
.comment p { font-size: 14px; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Navegação inferior */
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #FFFFFF; border-top: 1px solid var(--line); padding: 8px 8px calc(14px + env(safe-area-inset-bottom)); z-index: 10; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; }
.nav a[aria-current="page"] { color: var(--primary); font-weight: 600; }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Barra de ação fixa (tela da amiga) */
.actionbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; gap: 10px; padding: 12px 20px calc(18px + env(safe-area-inset-bottom)); background: #FFFFFF; border-top: 1px solid var(--line); z-index: 11; }
.actionbar .btn { min-height: 52px; border-radius: 16px; }

/* Janela para nova refeição */
dialog { border: none; border-radius: 22px; padding: 20px; width: min(92vw, 420px); box-shadow: 0 20px 60px rgba(23, 22, 31, .25); }
dialog::backdrop { background: rgba(23, 22, 31, .45); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #FFFFFF; font-size: 14px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }

/* Aviso rápido */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #FFFFFF; padding: 12px 16px; border-radius: 14px; font-size: 14px; max-width: 90vw; z-index: 20; }

.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; text-decoration: none; font-weight: 600; font-size: 15px; }
.back svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; fill: none; }
