/* styles.css — Painel do Dono LUNE · Tropical Luminosa
   Mobile-first. Fraunces (display) + Inter (UI/corpo). Fonte canônica:
   ~/LUNE_CENTRAL/Lygia/brand-system/ (M2 Identidade Visual + Brand Book v6). */
:root {
  --fundo: #FAF6ED;
  --texto: #593622;
  --brasa: #EC6F3C;
  --sol: #FFB81E;
  --cangiante: #F2548F;
  --lagoa: #00BFB8;
  --buganvilia: #AE4BDB;
  --carnauba: #3CB874;
  --framboesa: #92374D;
  --card: #FFFFFF;
  --linha: #EDE3D2;
  --muted: #9C8A76;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(89, 54, 34, .06), 0 6px 20px -8px rgba(89, 54, 34, .12);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: .8rem; }

/* ícones */
.ic { width: 16px; height: 16px; vertical-align: -2px; }
.ic-inline { margin-right: .3rem; color: var(--brasa); }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(250, 246, 237, .92); backdrop-filter: saturate(140%) blur(6px); border-bottom: 1px solid var(--linha); }
.topbar-in { display: flex; align-items: center; gap: .6rem; padding: .65rem 1rem; max-width: 1000px; margin: 0 auto; }
.brand-mark { height: 16px; width: auto; display: block; flex: none; }
.brand-sub { font-size: .78rem; color: var(--muted); padding-left: .55rem; border-left: 1px solid var(--linha); line-height: 1; white-space: nowrap; }
.spacer { flex: 1; }
.atualizado { font-size: .68rem; color: var(--muted); text-align: right; line-height: 1.2; white-space: nowrap; }
.btn-refresh { border: 1px solid var(--linha); background: var(--card); color: var(--brasa); border-radius: 9px; width: 32px; height: 32px; font-size: 1.05rem; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s ease; flex: none; }
.btn-refresh:active { transform: rotate(140deg); }
@media (max-width: 480px) {
  .topbar-in { flex-wrap: wrap; row-gap: .35rem; }
  .spacer { flex-basis: 100%; height: 0; }
  .atualizado { text-align: left; flex: 1; }
}

/* layout */
.app { max-width: 1000px; margin: 0 auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--linha); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; }
.card h2 { margin: 0 0 .8rem; font-size: 1.02rem; font-family: var(--font-ui); font-weight: 600; display: flex; align-items: center; }
.card h3 { margin: 1.1rem 0 .55rem; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.card h3 small, .card h2 small { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: .74rem; margin-left: .4rem; }
.fonte { font-style: italic; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 680px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* --- HERO: faturamento (profundidade Framboesa · a cor de drama que faz o solar saltar) --- */
.hero {
  background: linear-gradient(135deg, var(--framboesa), #7a2c40 130%);
  color: #FBEFE8;
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; right: -30px; top: -40px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,184,30,.28), transparent 70%);
  pointer-events: none;
}
.hero-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; opacity: .85; display: flex; align-items: center; gap: .35rem; }
.hero-label .ic { color: var(--sol); }
.hero-value { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.9rem, 6vw, 2.6rem); line-height: 1.1; margin: .3rem 0 .15rem; }
.hero-sub { font-size: .82rem; opacity: .85; }
.hero-empty { font-size: .95rem; opacity: .9; }

/* --- KPIs secundários --- */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.kpi {
  background: var(--card); border: 1px solid var(--linha); border-radius: var(--radius);
  padding: .75rem .6rem .65rem; box-shadow: var(--shadow); text-align: left;
  border-bottom: 3px solid var(--tone, var(--brasa));
}
.kpi-badge {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--tone, var(--brasa)); color: #fff; margin-bottom: .5rem;
}
.kpi-badge .ic { width: 14px; height: 14px; }
.kpi-value { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.05; color: var(--texto); }
.kpi-label { font-size: .68rem; color: var(--muted); margin-top: .2rem; }
.kpi-lagoa { --tone: var(--lagoa); }
.kpi-sol { --tone: var(--sol); }
.kpi-cangiante { --tone: var(--cangiante); }
.kpi-carnauba { --tone: var(--carnauba); }
.kpi-buganvilia { --tone: var(--buganvilia); }

/* mini stats */
.mini-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.mini { background: var(--fundo); border-radius: var(--radius-sm); padding: .5rem .7rem; flex: 1; min-width: 70px; text-align: center; }
.mini-v { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.mini-l { font-size: .66rem; color: var(--muted); margin-top: .1rem; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { background: var(--fundo); border-radius: 999px; padding: .32rem .75rem; font-size: .76rem; display: inline-flex; align-items: center; gap: .3rem; }
.chip b { color: var(--brasa); font-weight: 700; }
.chip-uf { font-weight: 700; color: var(--framboesa); }

/* financeiro resumo */
.fin-resumo { font-size: .92rem; margin-bottom: .7rem; }
.fin-resumo strong { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--framboesa); display: block; margin-bottom: .1rem; }

/* bar list (horizontal) */
.barlist { display: flex; flex-direction: column; gap: .5rem; }
.bar-row { display: grid; grid-template-columns: minmax(78px, 42%) 1fr auto; align-items: center; gap: .55rem; font-size: .8rem; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: .4rem; }
.bar-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dot, var(--brasa)); }
.bar-track { background: var(--fundo); border-radius: 999px; height: 9px; overflow: hidden; }
.bar-fill { background: var(--fill, var(--brasa)); height: 100%; border-radius: 999px; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .78rem; }

/* line/area chart (financeiro) */
.chart { margin: .2rem 0 .4rem; }
.svg-line { width: 100%; height: 132px; overflow: visible; }
.svg-line .area { fill: url(#finGrad); }
.svg-line .line { fill: none; stroke: var(--brasa); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.svg-line .dot { fill: var(--card); stroke: var(--brasa); stroke-width: 1.6; }
.svg-line .dot-last { fill: var(--brasa); }
.svg-x { font-size: 3.1px; fill: var(--muted); text-anchor: middle; font-family: var(--font-ui); }

/* operação recuperação — banner de lançamento */
.recup {
  margin-top: 1rem; border-radius: var(--radius); padding: .9rem 1rem;
  background: linear-gradient(120deg, rgba(255,184,30,.16), rgba(236,111,60,.10));
  border: 1px dashed rgba(236,111,60,.45);
  display: flex; align-items: center; gap: .8rem;
}
.recup .ic { width: 20px; height: 20px; color: var(--brasa); flex: none; }
.recup-title { font-weight: 700; font-size: .84rem; color: var(--texto); }
.recup-desc { font-size: .76rem; color: var(--muted); margin-top: .1rem; }
.recup-nums { margin-left: auto; text-align: right; font-family: var(--font-display); font-weight: 600; color: var(--brasa); font-size: 1.05rem; white-space: nowrap; }
.recup-nums small { display: block; font-family: var(--font-ui); font-weight: 400; color: var(--muted); font-size: .64rem; }

/* atendimento */
.atend-grid { display: grid; grid-template-columns: 1fr; gap: .8rem; }
@media (min-width: 520px) { .atend-grid { grid-template-columns: 1fr 1fr; } }
.atend-card { background: var(--fundo); border-radius: var(--radius); padding: .9rem; border-top: 3px solid var(--tone, var(--lagoa)); }
.atend-head { display: flex; justify-content: space-between; align-items: baseline; }
.atend-head b { font-family: var(--font-display); font-size: 1rem; }
.atend-head span { font-size: .68rem; color: var(--tone, var(--lagoa)); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.atend-big { font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; line-height: 1.05; margin: .3rem 0; color: var(--texto); }
.atend-big small { display: block; font-size: .66rem; color: var(--muted); font-weight: 400; font-family: var(--font-ui); }
.atend-foot { font-size: .7rem; color: var(--muted); margin-top: .55rem; padding-top: .5rem; border-top: 1px solid var(--linha); }

/* catálogo — anel de cobertura */
.cat-row { display: flex; align-items: center; gap: 1rem; }
.ring-wrap { position: relative; width: 64px; height: 64px; flex: none; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-wrap .ring-bg { fill: none; stroke: var(--fundo); stroke-width: 6; }
.ring-wrap .ring-fg { fill: none; stroke: var(--carnauba); stroke-width: 6; stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.ring-value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; font-size: .92rem; }
.cat-total { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.cat-total small { display: block; font-size: .66rem; color: var(--muted); font-weight: 400; font-family: var(--font-ui); margin-top: .1rem; }

/* redes */
.rede-plat { margin-bottom: .7rem; }
.rede-nome { font-weight: 600; text-transform: capitalize; margin-bottom: .3rem; font-family: var(--font-display); }
.rede-metric { display: flex; justify-content: space-between; font-size: .82rem; padding: .25rem 0; border-bottom: 1px solid var(--linha); }
.empty-state { font-size: .82rem; color: var(--muted); background: var(--fundo); border-radius: var(--radius-sm); padding: .8rem .9rem; line-height: 1.5; }
.empty-state .ic { color: var(--muted); width: 14px; height: 14px; margin-right: .3rem; }

/* footer */
.footer { max-width: 1000px; margin: 0 auto; padding: 1.2rem 1rem 2.5rem; font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.footer a { color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.dot-ok { background: var(--carnauba); box-shadow: 0 0 0 3px rgba(60,184,116,.18); }
.dot-down { background: var(--cangiante); box-shadow: 0 0 0 3px rgba(242,84,143,.18); }
.erro-global { background: var(--cangiante); color: #fff; padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }

/* login */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem;
  background:
    radial-gradient(circle at 15% 10%, rgba(255,184,30,.25), transparent 42%),
    radial-gradient(circle at 90% 85%, rgba(0,191,184,.16), transparent 45%),
    var(--fundo);
}
.login-card { background: var(--card); border: 1px solid var(--linha); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2.1rem 1.6rem 1.8rem; width: 100%; max-width: 340px; text-align: center; }
.login-caju { width: 44px; height: auto; margin: 0 auto .6rem; display: block; }
.login-mark { height: 22px; width: auto; margin: 0 auto; display: block; }
.login-sub { color: var(--muted); margin: .35rem 0 1.6rem; font-size: .85rem; }
.login-card input { width: 100%; padding: .8rem .9rem; border: 1px solid var(--linha); border-radius: var(--radius-sm); font-size: 1rem; margin-bottom: .8rem; font-family: var(--font-ui); background: var(--fundo); color: var(--texto); }
.login-card input:focus { outline: 2px solid var(--brasa); outline-offset: 1px; }
.login-card button { width: 100%; padding: .8rem; border: none; border-radius: var(--radius-sm); background: var(--brasa); color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer; font-family: var(--font-ui); transition: filter .15s ease; }
.login-card button:hover { filter: brightness(1.06); }
.login-card button:disabled { opacity: .6; }
.login-erro { color: var(--framboesa); font-size: .85rem; margin: .6rem 0 0; }
