/* Painel da loja · grafite da SH Veículos, pensado primeiro para o celular. */
:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #16171b;
  --muted: #646876;
  --line: #e3e5ea;
  --forte: #16171b;
  --azul: #2f5bd3;
  --verde: #16a34a;
  --vermelho: #c62828;
  --raio: 12px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); }
h1, h2, p { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; font-size: 0.92rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9bdc7; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn--forte { background: var(--forte); border-color: var(--forte); color: #fff; }
.btn--forte:hover { background: #2c2e35; }
.btn--leve { background: transparent; }
.btn--perigo { color: var(--vermelho); }
.btn--perigo:hover { border-color: var(--vermelho); }

.erro { padding: 10px 14px; border-radius: 10px; background: #fdecec; color: var(--vermelho); font-weight: 600; }
.vazio { color: var(--muted); padding: 12px 0; }

/* ---------- Entrada (login / primeiro acesso) ---------- */
body.entrada { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 0, #2b2d33, #121317 70%); }
.cartao { width: min(420px, 100%); padding: 32px 28px; border-radius: 18px; background: #fff; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); display: grid; gap: 16px; }
.cartao .logo { width: 170px; filter: invert(1) grayscale(1) contrast(1.4); }
.cartao h1 { font-size: 1.4rem; }
.cartao p { color: var(--muted); }
.cartao form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 0.86rem; font-weight: 600; color: #3a3d46; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cfd3dc; border-radius: 10px; font: inherit; font-size: 1rem; color: var(--text); background: #fff; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--azul); outline-offset: 0; border-color: var(--azul); }
.ajuda { font-size: .85rem; }

/* ---------- Topo ---------- */
.topo { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px clamp(12px, 3vw, 28px); background: var(--forte); color: #fff; }
.topo__marca { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topo__marca img { width: 110px; }
.topo__marca span { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.topo__nav { display: flex; gap: 4px; margin-left: 18px; }
.topo__nav a, .topo__fim a, .topo__fim button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 9px; color: #d9dbe1; text-decoration: none; font: inherit; font-size: .92rem; font-weight: 600; background: none; border: 0; cursor: pointer; }
.topo__nav a[aria-current="page"], .topo__nav a:hover, .topo__fim a:hover, .topo__fim button:hover { background: rgba(255,255,255,.1); color: #fff; }
.topo__novo { background: #fff !important; color: var(--forte) !important; }
.topo__fim { display: flex; gap: 2px; margin-left: auto; }
.topo__fim form { margin: 0; }

.conteudo { max-width: 1180px; margin: 0 auto; padding: 22px clamp(12px, 3vw, 28px) 80px; }
.titulo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.titulo h1 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
.periodo { display: inline-flex; padding: 3px; border-radius: 10px; background: #e6e8ec; }
.periodo a { padding: 7px 12px; border-radius: 8px; font-size: .88rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.periodo a[aria-current="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- Desempenho ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.cards--estoque { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.cards article { padding: 16px 18px; border-radius: var(--raio); background: var(--card); border: 1px solid var(--line); }
.cards span { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cards b { display: block; margin-top: 4px; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.1; }
.cards small { display: block; margin-top: 4px; font-size: .8rem; color: var(--muted); }
.cards__destaque { background: var(--forte) !important; color: #fff; border-color: var(--forte) !important; }
.cards__destaque span, .cards__destaque small { color: #b9bcc6; }
.bloco { padding: 18px 20px; border-radius: var(--raio); background: var(--card); border: 1px solid var(--line); margin-bottom: 14px; }
.bloco h2 { font-size: 1rem; margin-bottom: 10px; }
.bloco h2.mt { margin-top: 20px; }
.legenda { font-size: .82rem; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.leg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.leg--v { background: #c3c9d8; }
.leg--c { background: var(--verde); margin-left: 10px; }
.duas { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.duas .bloco { margin-bottom: 0; }
.tabela { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabela th { text-align: left; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; }
.tabela td { padding: 8px; border-top: 1px solid var(--line); }
.tabela td:not(:first-child), .tabela th:not(:first-child) { text-align: right; width: 80px; }
.tabela__carro { display: flex; align-items: center; gap: 10px; }
.tabela__carro img { width: 36px; height: 48px; object-fit: cover; border-radius: 6px; }
.tabela em { font-style: normal; font-size: .72rem; padding: 2px 6px; border-radius: 5px; background: #eceef1; color: var(--muted); }
.barras { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.barras li { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 8px; overflow: hidden; font-size: .9rem; isolation: isolate; }
.barras i { position: absolute; inset: 0 auto 0 0; width: var(--p); background: #eef0f5; z-index: -1; }
.nota { font-size: .82rem; color: var(--muted); }

/* ---------- Estoque ---------- */
.ferramentas { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.ferramentas input { flex: 1 1 260px; }
.abas { display: inline-flex; padding: 3px; border-radius: 10px; background: #e6e8ec; }
.abas button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.abas button[aria-selected="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: var(--raio); background: var(--card); border: 1px solid var(--line); }
.item img, .item__semfoto { width: 60px; height: 80px; object-fit: cover; border-radius: 8px; background: #eceef1; }
.item__semfoto { display: grid; place-items: center; font-size: .65rem; color: var(--muted); text-align: center; }
.item__info { display: grid; min-width: 0; }
.item__info b { font-size: 1rem; }
.item__info span { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__info strong { font-size: .92rem; margin-top: 2px; }
.item__acoes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ---------- Formulário ---------- */
.form { padding: 20px; border-radius: var(--raio); background: var(--card); border: 1px solid var(--line); display: grid; gap: 16px; margin-bottom: 14px; }
.form.estreito { max-width: 460px; }
.grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grade .largo { grid-column: 1 / -1; }
.form > .btn { justify-self: start; }
.fotos__grade { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.fotos__grade li { position: relative; border-radius: 10px; overflow: hidden; background: #eceef1; }
.fotos__grade li:first-child::before { content: "Capa"; position: absolute; top: 6px; left: 6px; z-index: 1; padding: 2px 7px; border-radius: 6px; background: var(--forte); color: #fff; font-size: .7rem; font-weight: 700; }
.fotos__grade img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.fotos__grade div { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.fotos__grade button { width: 32px; height: 32px; border-radius: 8px; border: 0; background: rgba(255,255,255,.92); font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.fotos__grade [data-tirar] { color: var(--vermelho); }
.fotos__acoes { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.progresso { font-size: .9rem; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--forte); color: #fff; font-weight: 600; box-shadow: 0 14px 30px -12px rgba(0,0,0,.5); z-index: 50; }
.toast--erro { background: var(--vermelho); }

/* ---------- Celular ---------- */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cards--estoque { grid-template-columns: 1fr 1fr; }
  .duas { grid-template-columns: 1fr; }
  .grade { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .topo { flex-wrap: wrap; padding-bottom: 6px; }
  .topo__marca img { width: 92px; }
  .topo__nav { order: 3; width: 100%; margin: 4px 0 0; justify-content: space-between; }
  .topo__nav a { flex: 1; justify-content: center; padding: 0 6px; font-size: .84rem; }
  .topo__fim span { display: none; }
  .item { grid-template-columns: 52px 1fr; }
  .item img, .item__semfoto { width: 52px; height: 70px; }
  .item__acoes { grid-column: 1 / -1; justify-content: stretch; }
  .item__acoes .btn { flex: 1; }
  .grade { grid-template-columns: 1fr; }
}

/* ---------- Agora / hoje ---------- */
.agora { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 12px 18px; margin-bottom: 14px; border-radius: var(--raio); background: #fff; border: 1px solid var(--line); font-size: .92rem; }
.agora p span { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 8px; }
.agora__online { display: flex; align-items: center; gap: 8px; }
.agora__online small { color: var(--muted); }
.agora__atual { margin-left: auto; font-size: .8rem; color: var(--muted); }
.pulso { width: 10px; height: 10px; border-radius: 50%; background: #c3c9d8; }
.pulso--on { background: var(--verde); box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: pulso 1.8s infinite; }
@keyframes pulso { 70% { box-shadow: 0 0 0 9px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
@media (prefers-reduced-motion: reduce) { .pulso--on { animation: none; } }

/* variação vs. período anterior */
.var { display: block; margin-top: 4px; font-style: normal; font-size: .78rem; font-weight: 700; }
.var--sobe { color: var(--verde); }
.var--desce { color: var(--vermelho); }
.var--igual, .var--nova { color: var(--muted); font-weight: 600; }
.cards__destaque .var--sobe { color: #4ade80; }
.cards__destaque .var--desce { color: #f87171; }
.cards__destaque .var--igual, .cards__destaque .var--nova { color: #9ea2ad; }

.bloco__topo { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 10px; }
.bloco__topo h2, .bloco__topo .legenda { margin-bottom: 0; }
.vazio--grande { padding: 36px 12px; text-align: center; background: var(--bg); border-radius: 10px; }

/* ---------- Gráficos em HTML ---------- */
.graf { display: grid; grid-template-columns: auto 1fr; gap: 8px; height: 240px; }
.graf--horas { height: 180px; }
.graf__eixo { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; font-size: .72rem; color: var(--muted); text-align: right; }
.graf__area { display: flex; align-items: stretch; gap: 2px; padding-bottom: 22px; position: relative; background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 25%) top / 100% calc(100% - 22px) no-repeat; border-bottom: 1px solid #c9cdd6; }
.graf__col { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.graf__col:hover { background: rgba(47,91,211,.06); border-radius: 4px 4px 0 0; }
.graf__barras { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.graf__barras i { display: block; width: min(42%, 16px); border-radius: 3px 3px 0 0; min-height: 0; }
.graf--horas .graf__barras i { width: min(70%, 18px); }
.graf__v { background: #c3c9d8; }
.graf__c { background: var(--verde); }
.graf__col--hoje .graf__v { background: #8f99b3; }
.graf__col--pico .graf__v { background: var(--azul); }
.graf__rot { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.graf__col--hoje .graf__rot { font-weight: 700; color: var(--text); }

/* ---------- Funil ---------- */
.funil { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: f; }
.funil li { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; overflow: hidden; isolation: isolate; background: var(--bg); }
.funil li i { position: absolute; inset: 0 auto 0 0; width: var(--p); background: #dfe5f5; z-index: -1; transition: width .6s; }
.funil li:last-child i { background: #c8efd6; }
.funil b { font-size: 1.1rem; }
.funil small { font-size: .78rem; color: var(--muted); font-weight: 600; margin-left: 4px; }

/* ---------- Saúde do estoque ---------- */
.alerta { border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; background: #fffaf0; }
.alerta[open] { background: #fff; }
.alerta summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.alerta summary::-webkit-details-marker { display: none; }
.alerta summary > b { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: #fde9c8; color: #8a5300; font-size: 1.05rem; }
.alerta__txt { display: grid; font-weight: 700; }
.alerta__txt small { font-weight: 400; color: var(--muted); font-size: .84rem; }
.alerta summary::after { content: "Ver"; margin-left: auto; font-size: .85rem; font-weight: 700; color: var(--azul); }
.alerta[open] summary::after { content: "Fechar"; }
.lista--compacta { padding: 0 10px 10px; }
.lista--compacta .item { box-shadow: none; }
.tabela a { color: var(--azul); font-weight: 600; text-decoration: none; }
.tabela a:hover { text-decoration: underline; }
@media (max-width: 720px) {
  .agora__atual { margin-left: 0; width: 100%; }
  .graf { height: 200px; }
  .graf__rot { font-size: .62rem; }
  .tabela th:nth-child(4), .tabela td:nth-child(4) { display: none; }
}
