/* =========================================================
   LIGHTHOUSE · Estilo Noir
   Folha de estilos base. Tudo o que é cor, letra e espaço
   vem das variáveis em :root. Não usar cores soltas no código.
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;1,400;1,500&family=Instrument+Sans:wght@400;500;600&display=swap");

:root {
  /* Fundos */
  --bg: #000000;            /* fundo da app */
  --surface: #0B0B0A;       /* cartões e caixas, quando for mesmo preciso */
  --line: #1F1E1C;          /* divisórias entre linhas de lista */
  --line-strong: #2A2926;   /* contornos de botões e teclas */
  --line-input: #3A3833;    /* sublinhado de campos */

  /* Texto */
  --text: #EDEAE3;          /* texto principal (marfim) */
  --muted: #8C877E;         /* texto secundário, legendas */
  --faint: #4A4741;         /* elementos desligados */
  --done: #6A665F;          /* texto de tarefa terminada */

  /* Destaque (usar com moderação: traços, anéis, um botão por ecrã) */
  --gold: #B59A63;
  --gold-hover: #D4BC8A;

  /* Estados da checklist (funcionais, não decorativos) */
  --st-todo: #D0584A;       /* vermelho: por fazer */
  --st-doing: #E2B24C;      /* amarelo: em processo */
  --st-done: #7DBB88;       /* verde: terminada */

  /* Secções */
  --sec-bar: #8FAEDB;       /* azul */
  --sec-cozinha: #B7A3DE;   /* roxo */

  /* Letras */
  --font-display: "Cormorant Garamond", Georgia, serif;   /* títulos, nomes, números grandes */
  --font-body: "Instrument Sans", system-ui, sans-serif;  /* tudo o resto */

  /* Tamanhos */
  --fs-hero: 44px;          /* título de ecrã (ex.: Checklist) */
  --fs-name: 36px;          /* nome da pessoa no login */
  --fs-quote: 24px;         /* texto de aviso em itálico */
  --fs-body: 16px;
  --fs-small: 13px;
  --fs-label: 11px;         /* rótulos em maiúsculas */
  --tracking-label: 0.3em;  /* espaçamento das letras nos rótulos */

  /* Espaços */
  --pad-x: 24px;            /* margem lateral dos ecrãs */
  --gap-s: 8px;
  --gap-m: 16px;
  --gap-l: 24px;
  --gap-xl: 48px;

  /* Toque */
  --touch: 44px;            /* área mínima de toque */
  --radius: 0;              /* cantos retos por defeito */
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hover); }
button { font: inherit; color: inherit; }

/* ---------- Tipografia ---------- */
.t-hero  { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-hero); line-height: 1; margin: 0; }
.t-name  { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-name); line-height: 1.1; }
.t-quote { font-family: var(--font-display); font-style: italic; font-size: var(--fs-quote); line-height: 1.25; }
.t-label { font-size: var(--fs-label); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }
.t-label--gold { color: var(--gold); }
.t-muted { color: var(--muted); font-size: var(--fs-small); }
.t-num   { font-variant-numeric: tabular-nums; }

/* Rótulo entre dois traços dourados: ——— QUEM ESTÁ A ENTRAR ——— */
.t-ruled { display: flex; align-items: center; gap: 14px; }
.t-ruled::before, .t-ruled::after { content: ""; width: 32px; height: 1px; background: var(--gold); }

/* ---------- Estrutura de ecrã ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.screen__header { padding: 48px var(--pad-x) 18px; display: flex; flex-direction: column; gap: 4px; }
.screen__body { flex: 1; overflow-y: auto; padding: 8px var(--pad-x) 16px; display: flex; flex-direction: column; gap: 22px; }
.header-row { display: flex; justify-content: space-between; align-items: center; }

/* Pessoa com sessão aberta (canto superior direito) */
.user-chip { display: flex; align-items: center; gap: 8px; font-size: var(--fs-small); }
.user-chip__avatar {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--faint);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 14px;
}

/* ---------- Botões ---------- */
/* Principal: contorno marfim, texto em maiúsculas espaçadas */
.btn {
  min-height: 48px; padding: 0 20px; border: 1px solid var(--text); border-radius: var(--radius);
  background: transparent; color: var(--text); cursor: pointer;
  font-family: var(--font-body); font-size: var(--fs-label); font-weight: 600;
  letter-spacing: var(--tracking-label); text-transform: uppercase;
}
.btn:active { background: var(--text); color: var(--bg); }
/* Destaque dourado: no máximo um por ecrã */
.btn--gold { border-color: var(--gold); background: var(--gold); color: #000; }
.btn--gold:active { background: var(--gold-hover); }
/* Texto simples (ex.: Sair) */
.btn--text { min-height: var(--touch); border: none; padding: 0; background: transparent; color: var(--muted); font-size: var(--fs-small); letter-spacing: 0; text-transform: none; font-weight: 400; }
.btn--block { width: 100%; }

/* ---------- Campos ---------- */
/* Campos e listas pendentes: só sublinhado, sem caixa */
.field { display: flex; flex-direction: column; gap: 2px; }
.field > span { font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted); }
.input, .select {
  height: var(--touch); border: none; border-bottom: 1px solid var(--line-input); border-radius: 0;
  background: transparent; color: var(--text); font-family: var(--font-body); font-size: 15px; padding: 0;
  outline: none; -webkit-appearance: none; appearance: none;
}
.input:focus, .select:focus { border-bottom-color: var(--gold); }
.input::placeholder { color: var(--faint); }
.select {
  padding-right: 20px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 9px) 50%, calc(100% - 4px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.select option { background: #111; color: var(--text); }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

/* ---------- Aviso do gestor ---------- */
/* Sem caixa: traço dourado em cima, texto em itálico serifado */
.notice { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--gold); }

/* ---------- Listas (tarefas, produtos, notas…) ---------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; min-height: 62px; padding: 0;
  border: none; border-bottom: 1px solid var(--line); background: transparent;
  color: var(--text); text-align: left; cursor: pointer; width: 100%;
}
.row__time { width: 44px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row__title { flex: 1; font-size: var(--fs-body); }
.row__meta { font-family: var(--font-display); font-style: italic; font-size: 15px; }
.row--done .row__title { text-decoration: line-through; color: var(--done); }

/* Ponto de estado */
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot--todo  { background: var(--st-todo); }
.dot--doing { background: var(--st-doing); }
.dot--done  { background: var(--st-done); }

/* Secção (texto em itálico com a cor da secção) */
.sec--bar     { color: var(--sec-bar); }
.sec--cozinha { color: var(--sec-cozinha); }

/* ---------- Contador +/− (contagem, mínimos) ---------- */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper__btn {
  width: var(--touch); height: var(--touch); border-radius: 50%; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text); font-size: 20px; cursor: pointer;
}
.stepper__value {
  min-width: 52px; height: var(--touch); border: none; border-bottom: 1px solid var(--line-input);
  background: transparent; color: var(--text); font-family: var(--font-display); font-size: 26px; text-align: center; cursor: pointer;
}
.stepper__value--empty { color: var(--faint); }

/* ---------- Barra de navegação inferior ---------- */
.tabbar {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line); padding: 10px 0 calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 6px 0; min-height: var(--touch); color: var(--muted);
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1; fill: none; }
.tab--active { color: var(--text); }
.badge {
  position: absolute; top: 2px; left: 58%; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--gold); color: #000; font-size: 10px; font-weight: 600; letter-spacing: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Avatar ---------- */
.avatar {
  width: 84px; height: 84px; border-radius: 50%; border: 1px solid var(--line-input);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 32px; font-weight: 500; color: var(--text);
}
.avatar--gestor { border-color: var(--gold); }
.avatar--lg { width: 88px; height: 88px; font-size: 34px; }

/* ---------- Ecrã de entrada (escolher pessoa) ---------- */
.entry { align-items: center; padding: 64px 28px 40px; }
.people { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 8px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text); font-size: 14px; letter-spacing: 0.04em; }
.clock { font-family: var(--font-display); font-size: 64px; line-height: 1; }

/* ---------- PIN ---------- */
.pin-dots { display: flex; gap: 18px; }
.pin-dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--faint); }
.pin-dot--on { background: var(--text); border-color: var(--text); }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 16px 30px; justify-content: center; }
.key {
  width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text); cursor: pointer;
  font-family: var(--font-display); font-size: 34px; font-weight: 400;
  transition: background .15s, color .15s;
}
.key:active { background: var(--text); color: var(--bg); }
.key--ghost { border-color: transparent; }   /* tecla apagar */
.key--empty { visibility: hidden; }
/* PIN errado: abanar os pontos */
@keyframes pin-shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-6px)} 40%,80%{transform:translateX(6px)} }
.pin-dots--error { animation: pin-shake .35s; }
.pin-dots--error .pin-dot { border-color: var(--st-todo); }

/* ---------- Logo com luz do farol ---------- */
/* Estrutura HTML:
   <div class="lh-logo" style="--logo-w: 310px">
     <span class="lh-beam" aria-hidden="true"></span>
     <span class="lh-glow" aria-hidden="true"></span>
     <img src="/logo-noir.png" alt="Lighthouse">
   </div>
   --logo-w: 310px na entrada, 250px no login, 120px em cabeçalhos.
   A lanterna fica a 50% da largura e 19,5% da altura do logo.
   O contentor pai deve ter overflow: hidden. */
.lh-logo { position: relative; width: var(--logo-w, 310px); }
.lh-logo img { position: relative; z-index: 1; display: block; width: 100%; height: auto; }

@keyframes lh-rotate { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes lh-pulse  { 0%, 100% { opacity: .45; } 50% { opacity: .9; } }

.lh-beam {
  position: absolute; left: 50%; top: 19.5%; z-index: 0; pointer-events: none;
  width: calc(var(--logo-w, 310px) * 2); height: calc(var(--logo-w, 310px) * 2);
  transform: translate(-50%, -50%);
  background: conic-gradient(from 0deg,
    transparent 0deg 78deg, rgba(240,226,196,.13) 90deg, transparent 102deg 258deg,
    rgba(240,226,196,.13) 270deg, transparent 282deg 360deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,.6) 30%, transparent 68%);
          mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,.6) 30%, transparent 68%);
  animation: lh-rotate 14s linear infinite;
}
.lh-glow {
  position: absolute; left: 50%; top: 19.5%; z-index: 0; pointer-events: none;
  width: calc(var(--logo-w, 310px) * .23); height: calc(var(--logo-w, 310px) * .23);
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(240,220,170,.35) 0%, transparent 70%);
  animation: lh-pulse 4s ease-in-out infinite;
}
/* Logo pequeno em cabeçalhos: só o brilho, sem feixes */
.lh-logo--small .lh-beam { display: none; }

/* ---------- Teclado numérico em folha (contagem) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; flex-direction: column; justify-content: flex-end; z-index: 50; }
.sheet { background: #0B0B0A; border-top: 1px solid var(--gold); padding: 20px var(--pad-x) calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet { animation: sheet-up .25s ease-out; }

/* ---------- Transições suaves ---------- */
.fade-in { animation: fade-in .3s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  .lh-beam, .lh-glow, .sheet, .fade-in, .pin-dots--error { animation: none; }
}
