/* Lagoon · Fichas técnicas
   Layout: app shell — sticky top bar, one working column (max 1080px), bottom tab bar on phones, tabs in the top bar on desktop. */
:root {
  --bg: #F1F5F5;
  --surface: #FFFFFF;
  --surface-2: #E8EFF0;
  --ink: #1C2A2E;
  --muted: #5E7177;
  --line: #D6E0E2;
  --deep: #1B4D5C;
  --lake: #2F7F8A;
  --gold: #B9852E;
  --on-deep: #FFFFFF;
  --input: #FFF7DA;
  --ok: #1E7A44;  --ok-bg: #DDF0E3;
  --warn: #8A6100; --warn-bg: #FFF0C7;
  --bad: #B3261E; --bad-bg: #F9DDD9;
  --shadow: 0 1px 2px rgba(20,50,60,.06), 0 6px 20px rgba(20,50,60,.06);
  --f-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --f-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E191C; --surface: #15252A; --surface-2: #1C3036; --ink: #E4EEF0; --muted: #93A8AE; --line: #284047;
  --deep: #123A45; --lake: #62B4BF; --gold: #D9AE5F; --on-deep: #F2F7F8; --input: #2E2A1A;
  --ok: #7FD39C; --ok-bg: #173826; --warn: #F0C766; --warn-bg: #3A2F12; --bad: #F2938A; --bad-bg: #431C19;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0E191C; --surface: #15252A; --surface-2: #1C3036; --ink: #E4EEF0; --muted: #93A8AE; --line: #284047;
  --deep: #123A45; --lake: #62B4BF; --gold: #D9AE5F; --on-deep: #F2F7F8; --input: #2E2A1A;
  --ok: #7FD39C; --ok-bg: #173826; --warn: #F0C766; --warn-bg: #3A2F12; --bad: #F2938A; --bad-bg: #431C19;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--deep); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--deep); color: var(--on-deep);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 20px; min-height: 58px; }
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand b { font-family: var(--f-display); font-weight: 400; font-size: 24px; letter-spacing: .2px; }
.brand span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab { background: none; border: 0; color: var(--on-deep); opacity: .72; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.tab[aria-current="page"] { opacity: 1; background: rgba(255,255,255,.14); }
.who { font-size: 12px; opacity: .75; white-space: nowrap; }
.gold-rule { height: 3px; background: var(--gold); }

/* bottom bar (phones) */
.bottom { display: none; }
@media (max-width: 760px) {
  .tabs, .who { display: none; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .bottom .tab { flex: 1; color: var(--muted); opacity: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; padding: 6px 4px; border-radius: 10px; }
  .bottom .tab svg { width: 22px; height: 22px; }
  .bottom .tab[aria-current="page"] { color: var(--deep); background: var(--surface-2); }
  :root[data-theme="dark"] .bottom .tab[aria-current="page"] { color: var(--lake); }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (max-width: 760px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bottom .tab[aria-current="page"] { color: var(--lake); } }

main { max-width: 1080px; margin: 0 auto; padding-block: 22px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(26px, 4vw, 34px); line-height: 1.1; margin: 0; text-wrap: balance; }
h2 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

.btn { border: 1px solid var(--line); background: var(--surface); padding: 9px 16px; border-radius: 10px; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

/* filters */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.search { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: var(--on-deep); }

/* dish list */
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.dish { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow); }
.dish:hover { border-color: var(--lake); }
.thumb { width: 76px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-family: var(--f-display); font-size: 22px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dish-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.dish-meta .price { color: var(--ink); font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.pill.none { color: var(--muted); background: var(--surface-2); }
.cat-tag { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--lake); font-weight: 700; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 28px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border-radius: var(--r); padding: 14px 16px; border-top: 3px solid var(--gold); box-shadow: var(--shadow); min-width: 0; }
.kpi .lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi .val { font-family: var(--f-display); font-size: clamp(26px, 4vw, 34px); line-height: 1.15; margin-top: 4px; color: var(--deep); }
:root[data-theme="dark"] .kpi .val { color: var(--lake); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kpi .val { color: var(--lake); } }
.kpi .cap { font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border-radius: var(--r); padding: 16px; border: 1px solid var(--line); min-width: 0; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 128px 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .name { text-align: right; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { position: relative; height: 14px; background: var(--surface-2); border-radius: 4px; }
.fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--lake); }
.fill.warn { background: var(--gold); } .fill.bad { background: var(--bad); }
.meta-line { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .55; }
.bar-row .v { font-weight: 800; font-variant-numeric: tabular-nums; }
.legend { font-size: 12px; color: var(--muted); margin-top: 10px; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; }
.rank li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank .n { font-family: var(--f-display); color: var(--gold); font-size: 18px; text-align: center; }
.rank button { background: none; border: 0; padding: 0; text-align: left; font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.rank .r { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13.5px; text-align: right; }
.stack { display: grid; gap: 16px; }

/* tables (ingredients) */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 6px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.cell-in { width: 96px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); text-align: right; font-variant-numeric: tabular-nums; }
.cell-in.small { width: 70px; }
.saved { color: var(--ok); font-size: 12px; font-weight: 700; }

/* editor sheet */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10,25,30,.45); display: flex; justify-content: center; align-items: flex-start; overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet { width: 100%; max-width: 760px; background: var(--bg); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
@media (max-width: 600px) { .scrim { padding: env(safe-area-inset-top, 0px) 0 0; } .sheet { border-radius: 0; min-height: 100%; } }
.sheet-head { background: var(--deep); color: var(--on-deep); padding: 14px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 3px solid var(--gold); }
.sheet-head h3 { font-family: var(--f-display); font-weight: 400; font-size: 22px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x { background: rgba(255,255,255,.14); border: 0; color: var(--on-deep); width: 36px; height: 36px; border-radius: 10px; font-size: 20px; line-height: 1; }
.sheet-body { padding: 18px; display: grid; gap: 18px; }
.fields { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 520px) { .fields { grid-template-columns: minmax(0, 1fr); } }
.photo { width: 112px; height: 96px; border-radius: 10px; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; position: relative; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo label { position: absolute; inset: auto 0 0 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 4px; cursor: pointer; }
.photo input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 170px 130px; gap: 10px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .form-grid .full { grid-column: 1 / -1; } }
.fld { display: grid; gap: 4px; min-width: 0; }
.fld span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.fld input, .fld select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--input); min-width: 0; }
.ing-list { display: grid; gap: 8px; }
.ing { display: grid; grid-template-columns: minmax(0, 1fr) 92px 34px 92px 36px; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.ing select { width: 100%; min-width: 0; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--input); }
.ing input { width: 100%; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--input); text-align: right; font-variant-numeric: tabular-nums; }
.ing .u { font-size: 12px; color: var(--muted); }
.ing .c { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.ing .rm { background: none; border: 0; color: var(--muted); font-size: 18px; border-radius: 8px; height: 34px; }
.ing .rm:hover { color: var(--bad); background: var(--bad-bg); }
@media (max-width: 560px) { .ing { grid-template-columns: minmax(0, 1fr) 80px 30px 36px; } .ing select { grid-column: 1 / -1; } .ing .c { grid-column: 1 / 3; text-align: left; } .ing .u { grid-column: 3; } }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tot { background: var(--surface); border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); }
.tot .lbl { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tot .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sheet-foot { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.note { font-size: 12.5px; color: var(--muted); }
.err { color: var(--bad); font-size: 13px; font-weight: 600; }

.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.banner { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: 14px; }
@media (min-width: 761px) { .toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: no-preference) { .dish, .btn, .chip { transition: border-color .15s, background .15s; } }

/* ---------- site standalone ---------- */
html, body { margin: 0; }
body { min-height: 100%; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.top { padding-top: env(safe-area-inset-top, 0px); top: 0; }
.who { display: flex; align-items: center; gap: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--lake); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link.light { color: var(--on-deep); opacity: .85; font-size: 12px; }

/* ---------- entrada (login) ---------- */
.auth { min-height: 100%; display: grid; place-items: center; background: var(--deep);
  padding: calc(24px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); border-top: 4px solid var(--gold); }
.auth-brand { padding: 22px 24px 0; display: flex; align-items: baseline; gap: 10px; }
.auth-brand b { font-family: var(--f-display); font-weight: 400; font-size: 34px; color: var(--deep); }
:root[data-theme="dark"] .auth-brand b { color: var(--lake); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-brand b { color: var(--lake); } }
.auth-brand span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.auth-form { padding: 18px 24px 24px; display: grid; gap: 14px; }
.auth-form h1 { font-size: 26px; }
.auth-form p { margin: 0; }
.btn.big { justify-content: center; padding: 13px 16px; font-size: 16px; }
.auth-msg { font-size: 14px; font-weight: 600; min-height: 1.2em; }
.auth-msg.erro { color: var(--bad); }
.auth-msg.ok { color: var(--ok); }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- equipe ---------- */
.team { display: grid; gap: 10px; }
.member { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.member .nm { font-weight: 700; }
.member .em { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.member select { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--input); }
.member.pendente { border-color: var(--gold); background: var(--warn-bg); }
.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); margin-left: 6px; }
@media (max-width: 760px) { .tabs, .who { display: none; } }
