/* =====================================================================
   OORT BRASIL · Planejador do céu — sistema visual compartilhado
   Edite as cores e fontes aqui; todas as páginas herdam.
   ===================================================================== */
:root{
  /* noite de carta celeste */
  --ink:#0C1424;        /* fundo — azul-prússia profundo */
  --ink-2:#121D33;      /* superfícies */
  --ink-3:#1A2944;      /* superfícies elevadas / campos */
  --rule:rgba(196,214,255,.13);
  --rule-2:rgba(196,214,255,.24);
  --text:#E8EDF7;
  --dim:#8E9BB4;
  --faint:#5B6884;

  /* cor de ação = lanterna vermelha (preserva a visão noturna) */
  --lamp:#FF5D4F;
  --lamp-ink:#2A0B08;

  /* astros */
  --moon:#F2E2A0;
  --moon-deep:#C9AE55;
  --sun:#FFA04A;
  --sky:#7DB8FF;
  --stand:#9FE7D9;      /* onde ficar (anti-azimute) */
  --ok:#5BE3A0;
  --warn:#FFC857;

  --f-ui:'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-tech:'Chakra Petch', 'Instrument Sans', system-ui, sans-serif;

  --safe-t:env(safe-area-inset-top,0px);
  --safe-b:env(safe-area-inset-bottom,0px);
  --bar-h:56px;
  --ease:cubic-bezier(.2,.7,.2,1);
}

*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
[hidden]{ display:none!important; }
html,body{ margin:0; min-height:100%; }
body{
  font-family:var(--f-ui); font-size:15px; line-height:1.45;
  background:var(--ink); color:var(--text);
  -webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;
}
body.full{ height:100dvh; overflow:hidden; }
button,input,select{ font:inherit; color:inherit; }
a{ color:var(--sky); }
:focus-visible{ outline:2px solid var(--lamp); outline-offset:2px; border-radius:6px; }
.num{ font-family:var(--f-tech); font-variant-numeric:tabular-nums; letter-spacing:.2px; }

/* modo lanterna: tudo em vermelho para uso no campo */
html.redmode{ filter:url(#oort-red); background:#000; }
html.redmode body{ background:#000; }

/* ---------- BARRA SUPERIOR ---------- */
.topbar{
  position:fixed; z-index:1500; top:0; left:0; right:0;
  height:calc(var(--bar-h) + var(--safe-t)); padding:var(--safe-t) 8px 0;
  display:flex; align-items:center; gap:4px;
  background:linear-gradient(180deg, rgba(12,20,36,.96), rgba(12,20,36,.78));
  border-bottom:1px solid var(--rule);
  backdrop-filter:blur(14px) saturate(140%); -webkit-backdrop-filter:blur(14px) saturate(140%);
}
.topbar .tb-btn{
  width:44px; height:44px; border:0; background:none; border-radius:12px;
  display:grid; place-items:center; cursor:pointer; color:var(--text);
}
.topbar .tb-btn:active{ background:var(--ink-3); }
.topbar .tb-btn svg{ width:22px; height:22px; }
.topbar .tb-title{ flex:1; min-width:0; padding-left:2px; }
.topbar .tb-title b{ display:block; font-family:var(--f-tech); font-weight:600; font-size:17px; line-height:1.1; letter-spacing:.3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar .tb-title span{ display:block; font-size:11.5px; color:var(--dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar .tb-btn.on{ color:var(--lamp); }

/* ---------- MENU RETRÁTIL ---------- */
.scrim{
  position:fixed; inset:0; z-index:1900; background:rgba(4,8,16,.6);
  opacity:0; pointer-events:none; transition:opacity .25s;
}
.scrim.show{ opacity:1; pointer-events:auto; }
.drawer{
  position:fixed; z-index:1950; top:0; bottom:0; left:0; width:min(84vw,330px);
  background:var(--ink-2); border-right:1px solid var(--rule-2);
  transform:translateX(-102%); transition:transform .3s var(--ease);
  display:flex; flex-direction:column;
  padding:calc(14px + var(--safe-t)) 0 calc(14px + var(--safe-b));
  touch-action:pan-y;
}
.drawer.open{ transform:none; }
.drawer .dr-brand{ display:flex; align-items:center; gap:12px; padding:4px 20px 18px; }
.drawer .dr-brand img{ height:34px; width:auto; }
.drawer .dr-mark{
  width:40px; height:40px; border-radius:50%; display:grid; place-items:center;
  background:radial-gradient(circle at 35% 35%, var(--moon), var(--moon-deep) 70%);
  color:var(--ink); font-family:var(--f-tech); font-weight:700; font-size:14px;
}
.drawer .dr-brand b{ font-family:var(--f-tech); font-size:18px; font-weight:600; display:block; line-height:1.1; }
.drawer .dr-brand small{ color:var(--dim); font-size:12px; }
.drawer nav{ flex:1; overflow-y:auto; padding:4px 10px; }
.drawer nav a{
  display:flex; align-items:center; gap:14px; padding:12px 12px; border-radius:14px;
  color:var(--text); text-decoration:none; position:relative;
}
.drawer nav a + a{ margin-top:2px; }
.drawer nav a .ic{ width:38px; height:38px; flex:0 0 38px; display:grid; place-items:center; border-radius:11px; border:1px solid var(--rule); color:var(--dim); }
.drawer nav a .ic svg{ width:20px; height:20px; }
.drawer nav a b{ display:block; font-weight:600; font-size:15.5px; }
.drawer nav a span{ display:block; font-size:12.5px; color:var(--dim); }
.drawer nav a:active{ background:var(--ink-3); }
.drawer nav a.here{ background:var(--ink-3); }
.drawer nav a.here .ic{ color:var(--lamp); border-color:rgba(255,93,79,.45); }
.drawer nav a.here::before{ content:''; position:absolute; left:-10px; top:14px; bottom:14px; width:3px; border-radius:3px; background:var(--lamp); }
.drawer .dr-foot{ padding:12px 20px 0; border-top:1px solid var(--rule); margin:0 10px; display:flex; flex-direction:column; gap:10px; }
.drawer .dr-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:14px; }
.drawer .dr-row small{ display:block; color:var(--dim); font-size:12px; }
.drawer .dr-credit{ font-size:12px; color:var(--faint); padding-top:4px; }
.drawer .dr-credit b{ color:var(--moon); font-weight:600; }

/* interruptor */
.switch{ position:relative; width:46px; height:28px; flex:0 0 46px; }
.switch input{ position:absolute; opacity:0; inset:0; margin:0; cursor:pointer; z-index:1; }
.switch i{ position:absolute; inset:0; border-radius:99px; background:var(--ink-3); border:1px solid var(--rule-2); transition:.2s; }
.switch i::after{ content:''; position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%; background:var(--dim); transition:.2s var(--ease); }
.switch input:checked + i{ background:rgba(255,93,79,.25); border-color:var(--lamp); }
.switch input:checked + i::after{ transform:translateX(18px); background:var(--lamp); }

/* ---------- PÁGINAS DE CALCULADORA ---------- */
.page{
  padding:calc(var(--bar-h) + var(--safe-t) + 8px) 16px calc(32px + var(--safe-b));
  max-width:720px; margin:0 auto;
}
.hero-canvas{ display:block; width:100%; border-radius:18px; background:#060B16; border:1px solid var(--rule); touch-action:none; }
.block{ margin-top:22px; }
.block > h2{ font-family:var(--f-tech); font-weight:600; font-size:16px; margin:0 0 10px; letter-spacing:.2px; }
.block > p.lead{ color:var(--dim); margin:-4px 0 12px; font-size:13.5px; }

/* grupos de campos estilo instrumento: linhas separadas por fio */
.panel{ background:var(--ink-2); border:1px solid var(--rule); border-radius:18px; overflow:hidden; }
.row{ display:flex; align-items:center; gap:12px; padding:12px 14px; min-height:54px; }
.row + .row{ border-top:1px solid var(--rule); }
.row > label, .row > .lbl{ flex:1; min-width:0; font-size:14.5px; }
.row > label small, .row > .lbl small{ display:block; color:var(--dim); font-size:12px; }
.row .val{ font-family:var(--f-tech); font-size:17px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.row .val small{ color:var(--dim); font-size:12px; margin-left:2px; }
.row.col{ flex-direction:column; align-items:stretch; gap:8px; }
.row.col .head{ display:flex; justify-content:space-between; align-items:baseline; }

.field{
  background:var(--ink-3); border:1px solid var(--rule); border-radius:11px;
  padding:9px 11px; min-width:0; font-size:15px; font-family:var(--f-tech);
  font-variant-numeric:tabular-nums; text-align:right; width:96px;
}
.field.wide{ width:100%; text-align:left; font-family:var(--f-ui); }
select.field{ text-align:left; appearance:none; -webkit-appearance:none; padding-right:28px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238E9BB4' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 10px center; }
.field:focus{ outline:none; border-color:var(--lamp); }

input[type=range]{ -webkit-appearance:none; appearance:none; width:100%; height:32px; background:transparent; margin:0; }
input[type=range]::-webkit-slider-runnable-track{ height:4px; border-radius:4px; background:var(--ink-3); }
input[type=range]::-moz-range-track{ height:4px; border-radius:4px; background:var(--ink-3); }
input[type=range]::-webkit-slider-thumb{ -webkit-appearance:none; width:24px; height:24px; margin-top:-10px; border-radius:50%; background:var(--text); border:5px solid var(--lamp); box-shadow:0 2px 8px rgba(0,0,0,.5); }
input[type=range]::-moz-range-thumb{ width:16px; height:16px; border-radius:50%; background:var(--text); border:5px solid var(--lamp); }

/* segmentado */
.seg{ display:flex; background:var(--ink-3); border:1px solid var(--rule); border-radius:12px; padding:3px; gap:2px; }
.seg button{ flex:1; border:0; background:none; padding:8px 6px; border-radius:9px; font-size:13.5px; font-weight:600; color:var(--dim); cursor:pointer; white-space:nowrap; }
.seg button.on{ background:var(--text); color:var(--ink); }

/* botões */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:48px; padding:0 18px; border-radius:14px; border:1px solid var(--rule-2);
  background:var(--ink-3); font-weight:600; font-size:15px; cursor:pointer; text-decoration:none; color:var(--text);
  transition:transform .12s;
}
.btn:active{ transform:scale(.97); }
.btn.lamp{ background:var(--lamp); border-color:var(--lamp); color:#fff; }
.btn.ghost{ background:none; }
.btn.block{ width:100%; }
.btn svg{ width:19px; height:19px; }
.btn[disabled]{ opacity:.45; pointer-events:none; }
.btns{ display:flex; gap:8px; }
.btns .btn{ flex:1; }

/* leitura grande — resultado principal */
.readout{ display:flex; align-items:flex-end; gap:16px; flex-wrap:wrap; }
.readout .big{ font-family:var(--f-tech); font-weight:600; font-size:56px; line-height:.95; font-variant-numeric:tabular-nums; letter-spacing:-1px; }
.readout .big small{ font-size:20px; color:var(--dim); margin-left:4px; letter-spacing:0; }
.readout .aside{ color:var(--dim); font-size:13px; padding-bottom:6px; }

/* lista de métricas em linha, sem cartões */
.metrics{ display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); border-top:1px solid var(--rule); }
.metrics > div{ padding:11px 0 10px; border-bottom:1px solid var(--rule); }
.metrics > div:nth-child(odd){ padding-right:12px; }
.metrics dt{ font-size:12.5px; color:var(--dim); }
.metrics dd{ margin:2px 0 0; font-family:var(--f-tech); font-size:20px; font-variant-numeric:tabular-nums; }
.metrics dd small{ font-size:12px; color:var(--dim); margin-left:2px; }

.note{ font-size:12.5px; color:var(--dim); line-height:1.55; margin:10px 2px 0; }
.chip{ display:inline-flex; align-items:center; gap:6px; padding:5px 10px; border-radius:99px; border:1px solid var(--rule-2); font-size:12.5px; color:var(--dim); }
.chip.ok{ color:var(--ok); border-color:rgba(91,227,160,.45); }
.chip.warn{ color:var(--warn); border-color:rgba(255,200,87,.45); }
.chip.bad{ color:var(--lamp); border-color:rgba(255,93,79,.5); }

/* ---------- FOLHA / MODAL ---------- */
.sheet-ov{ position:fixed; inset:0; z-index:2100; background:rgba(4,8,16,.62); display:none; align-items:flex-end; justify-content:center; }
.sheet-ov.show{ display:flex; animation:ovIn .2s; }
@keyframes ovIn{ from{opacity:0} to{opacity:1} }
.sheet-card{
  width:100%; max-width:560px; max-height:88dvh; overflow-y:auto;
  background:var(--ink-2); border:1px solid var(--rule-2); border-bottom:0; border-radius:22px 22px 0 0;
  padding:8px 16px calc(18px + var(--safe-b)); animation:cardIn .28s var(--ease);
}
@keyframes cardIn{ from{ transform:translateY(40px) } to{ transform:none } }
.sheet-card .grab{ width:40px; height:4px; border-radius:4px; background:var(--rule-2); margin:4px auto 10px; }
.sheet-card .sc-head{ display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.sheet-card .sc-head h3{ flex:1; margin:0; font-family:var(--f-tech); font-weight:600; font-size:19px; }
.sheet-card .sc-x{ width:40px; height:40px; border-radius:12px; border:1px solid var(--rule); background:var(--ink-3); cursor:pointer; font-size:18px; }
@media (min-width:620px){ .sheet-ov{ align-items:center; } .sheet-card{ border-radius:22px; border-bottom:1px solid var(--rule-2); } }

/* lista de ações */
.alist{ display:flex; flex-direction:column; }
.alist button, .alist a{
  display:flex; align-items:center; gap:14px; padding:13px 6px; border:0; background:none; text-align:left; cursor:pointer;
  color:var(--text); text-decoration:none; font-size:15px; border-bottom:1px solid var(--rule);
}
.alist button:last-child, .alist a:last-child{ border-bottom:0; }
.alist .ai{ width:36px; height:36px; display:grid; place-items:center; border-radius:10px; background:var(--ink-3); flex:0 0 36px; font-size:18px; }
.alist small{ display:block; color:var(--dim); font-size:12px; }

/* ---------- AVISO ---------- */
.toast{
  position:fixed; left:50%; z-index:3000; bottom:calc(24px + var(--safe-b));
  transform:translate(-50%,16px); opacity:0; pointer-events:none; transition:.25s var(--ease);
  background:var(--text); color:var(--ink); font-weight:600; font-size:14px;
  padding:11px 16px; border-radius:12px; max-width:88vw; text-align:center; box-shadow:0 10px 30px rgba(0,0,0,.45);
}
.toast.show{ opacity:1; transform:translate(-50%,0); }

.install{ display:none; }
.install.show{ display:flex; }

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