/* Central da Regallo. Paleta e fontes do design system (anuncie.regallo.com.br). */
:root {
  --gold: #C9A84C; --gold-dark: #9c7a25; --gold-light: #e8d49a; --gold-bright: #f4e0a8;
  --gold-glow: rgba(201, 168, 76, .18);
  --ink: #15130f; --ink-mid: #56524a; --ink-soft: #857f74;
  --cream: #faf8f3; --cream-2: #f1ede3; --border: #e8e1d2; --card: #ffffff;
  --green: #3b6d11; --green-bg: #eaf3de;
  --yellow: #8a6100; --yellow-bg: #fbf0d0;
  --red: #a3261b; --red-bg: #fbe4e0;
  --gray: #857f74; --gray-bg: #efebe3;
  --radius: 16px; --ease: cubic-bezier(.22, 1, .36, 1);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f3efe6; --ink-mid: #c9c2b4; --ink-soft: #9a9385;
    --cream: #13110d; --cream-2: #1c1914; --border: #332e25; --card: #1f1b16;
    --green: #9fd36a; --green-bg: #22301a; --yellow: #f0c55a; --yellow-bg: #362b12;
    --red: #ff8c7d; --red-bg: #3a1c18; --gray: #9a9385; --gray-bg: #29251e;
    --gold-glow: rgba(201, 168, 76, .12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #f3efe6; --ink-mid: #c9c2b4; --ink-soft: #9a9385;
  --cream: #13110d; --cream-2: #1c1914; --border: #332e25; --card: #1f1b16;
  --green: #9fd36a; --green-bg: #22301a; --yellow: #f0c55a; --yellow-bg: #362b12;
  --red: #ff8c7d; --red-bg: #3a1c18; --gray: #9a9385; --gray-bg: #29251e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 400 16px/1.5 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--gold-dark); }
h1, h2, h3 { font-family: 'Playfair Display', Georgia, serif; letter-spacing: -.3px; line-height: 1.2; margin: 0; }
[hidden] { display: none !important; }

/* ── Topo ── */
.topo { position: sticky; top: 0; z-index: 20; background: #15130f; color: #f6f1e6; padding-top: env(safe-area-inset-top); }
.topo-in { max-width: 920px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca img { border-radius: 8px; }
.marca-nome { font: 900 20px/1 'Playfair Display', Georgia, serif; color: var(--gold-bright); }
.marca { min-width: 0; }
.marca > div { min-width: 0; }
.marca-sub { font-size: 12px; color: #bdb5a4; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-acoes { display: flex; gap: 4px; }
.icone-btn { position: relative; background: none; border: 0; color: #f6f1e6; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.icone-btn:hover { background: rgba(255, 255, 255, .08); }
.icone-btn .ponto { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px #15130f; }
.icone-btn.ativo { color: var(--gold-bright); }
.menu { position: absolute; right: 12px; top: calc(100% - 4px); background: var(--card); color: var(--ink); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); min-width: 200px; padding: 6px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 12px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; }
.menu button:hover { background: var(--cream-2); }

/* ── Conteúdo ── */
.conteudo { max-width: 920px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); outline: none; }
.titulo-tela { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.titulo-tela h1 { font-size: clamp(26px, 7vw, 34px); font-weight: 900; }
.titulo-tela .meta { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.voltar { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-mid); text-decoration: none; font-weight: 500; font-size: 14px; margin: 2px 0 8px; padding: 6px 0; }

/* ── Abas de baixo ── */
.abas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.abas a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h); color: var(--ink-soft); text-decoration: none; font-size: 12px; font-weight: 500; }
.abas a svg { width: 24px; height: 24px; }
.abas a.ativa { color: var(--ink); font-weight: 700; }
.abas a.ativa svg { color: var(--gold-dark); }
.abas a.ativa::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
.badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; line-height: 19px; text-align: center; font-weight: 700; }
.badge.amarelo { background: var(--gold-dark); }

/* ── Segmentos ── */
.segmentos { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 2px; scrollbar-width: none; }
.segmentos::-webkit-scrollbar { display: none; }
.segmentos button { flex: none; border: 1px solid var(--border); background: var(--card); color: var(--ink-mid); padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; cursor: pointer; }
.segmentos button.ativo { background: var(--ink); color: var(--cream); border-color: var(--ink); }

/* ── Cartões ── */
.cartao { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(21, 19, 15, .04); }
.cartao.urgente { border-left: 4px solid var(--red); }
.cartao h2 { font-size: 19px; font-weight: 700; margin-bottom: 6px; overflow-wrap: anywhere; }
.etiquetas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.etq { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--gray-bg); color: var(--ink-mid); }
.etq.vermelho { background: var(--red-bg); color: var(--red); font-weight: 700; }
.etq.amarelo { background: var(--yellow-bg); color: var(--yellow); }
.etq.verde { background: var(--green-bg); color: var(--green); }
.etq.ouro { background: var(--gold-glow); color: var(--gold-dark); }
.md { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { font-size: 17px; margin: 16px 0 6px; }
.md h1 { font-size: 22px; }
.md ul, .md ol { padding-left: 20px; margin: 0 0 10px; }
.md blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--gold); background: var(--cream-2); border-radius: 0 10px 10px 0; color: var(--ink-mid); }
.md blockquote p { margin: 0 0 6px; }
.md code { font-size: 13px; background: var(--cream-2); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--cream-2); padding: 10px 12px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: 14px; margin: 0 0 10px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--cream-2); }
.md img { max-width: 100%; border-radius: 10px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
details.mais { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
details.mais summary { cursor: pointer; color: var(--gold-dark); font-weight: 700; font-size: 14px; list-style: none; padding: 4px 0; }
details.mais summary::-webkit-details-marker { display: none; }
details.mais summary::before { content: '+ '; }
details.mais[open] summary::before { content: '− '; }
details.mais .md { margin-top: 8px; }
.historico { margin-top: 10px; display: grid; gap: 8px; }
.hist-item { background: var(--cream-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.hist-item .quem { font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }

/* ── Botões ── */
.botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.btn { appearance: none; border: 1px solid var(--border); background: var(--card); color: var(--ink); padding: 12px 14px; min-height: 46px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.principal { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #fff; border: 0; box-shadow: 0 6px 22px rgba(201, 168, 76, .35); }
.btn.sim { background: var(--green-bg); color: var(--green); border-color: transparent; }
.btn.nao { background: var(--red-bg); color: var(--red); border-color: transparent; }
.btn.leve { background: var(--cream-2); color: var(--ink-mid); border-color: transparent; font-weight: 500; }
.btn.largo { width: 100%; }
.campo-texto { margin-top: 12px; }
.campo-texto label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.campo-texto textarea { width: 100%; min-height: 96px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--cream); resize: vertical; }
.campo-texto textarea:focus, .login input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.campo-texto .linha { display: flex; gap: 8px; margin-top: 8px; }
.campo-texto .linha .btn { flex: 1; }
.respondido { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--gold-glow); font-size: 14px; }
.respondido b { font-weight: 700; }
.respondido .acoes { margin-top: 8px; }

/* ── Avisos ── */
.faixa { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #15130f; border: 1px solid #332e25; color: #f6f1e6; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.faixa p { margin: 0; font-size: 14px; flex: 1 1 200px; }
.faixa .btn { flex: none; }
.erro-box { background: var(--red-bg); color: var(--red); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.info-box { background: var(--cream-2); color: var(--ink-mid); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.vazio { text-align: center; padding: 40px 16px; color: var(--ink-soft); }
.vazio .grande { font: 700 20px/1.3 'Playfair Display', Georgia, serif; color: var(--ink); margin-bottom: 6px; }
.carregando { padding: 30px 0; text-align: center; color: var(--ink-soft); }
.aviso-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); background: #15130f; color: #f6f1e6; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); border: 1px solid #332e25; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }

/* ── Rotinas ── */
.resumo-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.chip { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px 8px; text-align: center; }
.chip b { display: block; font: 900 24px/1.1 'Playfair Display', Georgia, serif; }
.chip span { font-size: 12px; color: var(--ink-soft); }
.chip.vermelho b { color: var(--red); } .chip.amarelo b { color: var(--yellow); } .chip.verde b { color: var(--green); } .chip.cinza b { color: var(--gray); }
.lista { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.linha-rotina { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.linha-rotina:last-child { border-bottom: 0; }
.linha-rotina:hover { background: var(--cream-2); }
.bolinha { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; background: var(--gray); }
.bolinha.verde { background: #4c9a1b; } .bolinha.amarelo { background: #e0a91a; } .bolinha.vermelho { background: #d23a2a; box-shadow: 0 0 0 4px var(--red-bg); }
.linha-rotina .corpo { flex: 1; min-width: 0; }
.linha-rotina .nome { font-weight: 700; overflow-wrap: anywhere; }
.linha-rotina .sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.linha-rotina .resumo { font-size: 14px; color: var(--ink-mid); margin-top: 4px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.linha-rotina .seta { color: var(--ink-soft); margin-top: 2px; }
.grupo-titulo { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 18px 0 8px; }
.ficha { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.ficha dt { color: var(--ink-soft); }
.ficha dd { margin: 0; overflow-wrap: anywhere; }
.exec { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.exec:last-child { border-bottom: 0; }
.exec .cab { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.exec .cab .quando { font-weight: 700; }
.exec .texto { color: var(--ink-mid); margin-top: 4px; overflow-wrap: anywhere; white-space: pre-line; }
.exec .links { margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }

/* ── Métricas (painel antigo dentro do app) ── */
.metricas-caixa { position: fixed; left: 0; right: 0; top: calc(64px + env(safe-area-inset-top)); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.metricas-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--cream); }
body.tela-metricas .conteudo { padding: 0; }

/* ── Relatórios ── */
.linha-rel { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.linha-rel:last-child { border-bottom: 0; }
.linha-rel:hover { background: var(--cream-2); }
.linha-rel .nome { font-weight: 700; overflow-wrap: anywhere; }
.linha-rel .sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.relatorio { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px; }
.relatorio h1.titulo-rel { font-size: clamp(22px, 6vw, 28px); font-weight: 900; margin-bottom: 4px; }

/* ── Login ── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(180deg, var(--cream-2), var(--cream)); }
.login form { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 28px 22px; box-shadow: 0 20px 50px rgba(21, 19, 15, .08); text-align: center; }
.login img { border-radius: 16px; margin-bottom: 14px; }
.login h1 { font-size: clamp(30px, 7.5vw, 38px); font-weight: 900; margin-bottom: 6px; }
.login p { color: var(--ink-mid); margin: 0 0 20px; font-size: 15px; }
.login label { display: block; text-align: left; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.login input { width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--cream); font-size: 16px; margin-bottom: 14px; }
.login .erro-box { text-align: left; }

/* ── Computador ── */
@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  .conteudo { padding-bottom: 40px; }
  .abas { position: sticky; top: 64px; left: auto; width: auto; max-width: 920px; margin: 0 auto; display: flex; gap: 4px; padding: 10px 16px 0; background: var(--cream); }
  .abas a { flex-direction: row; height: 42px; padding: 0 16px; gap: 8px; font-size: 15px; border-radius: 12px; }
  .abas a.ativa { background: var(--card); box-shadow: inset 0 0 0 1px var(--border); }
  .abas a.ativa::before { display: none; }
  .badge { position: static; margin-left: 2px; }
  #app { display: flex; flex-direction: column; }
  #topo { order: 0; } #abas { order: 1; } #conteudo { order: 2; width: 100%; }
  .metricas-caixa { position: static; height: calc(100vh - 140px); }
  .metricas-frame { border: 1px solid var(--border); border-radius: var(--radius); }
  body.tela-metricas .conteudo { padding: 12px 16px 16px; }
  .aviso-toast { bottom: 24px; }
  .botoes { grid-template-columns: repeat(4, 1fr); }
}
