/* Design system Escol.AI: tokens do tema escuro do portal (escolai.app src/index.css, .dark)
   e do painel da Conta. Topo e rodapé vêm do escolai-shell.js (shadow DOM, tema escuro). */
:root {
  --bg: hsl(240 10% 4%);
  --card: hsl(240 8% 8%);
  --card-2: hsl(240 6% 12%);
  --muted-bg: hsl(240 5% 14%);
  --borda: hsl(240 4% 18%);
  --txt: hsl(0 0% 98%);
  --sub: hsl(240 5% 70%);
  --pri: #a855f7;
  --pri-txt: #c084fc;
  --pri-claro: rgba(168, 85, 247, .14);
  --grad: linear-gradient(135deg, #a855f7, #3b82f6);
  --ring: hsl(271 91% 65%);
  --ok: #6fd3a0; --ok-claro: #173326;
  --erro: #ff8f84; --erro-claro: #3d1a17;
  --alerta: #f2c06b; --alerta-claro: #3a2c12;
  --info: #93c5fd; --info-claro: rgba(59, 130, 246, .14);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --raio: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--txt); display: flex; flex-direction: column; min-height: 100vh;
       font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
/* pontos do portal, apagando para baixo */
.fundo-pontos { position: fixed; inset: 0 0 auto; height: 520px; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%); }
escolai-nav { position: sticky; top: 0; z-index: 10; }
escolai-footer { margin-top: auto; position: relative; z-index: 1; }

a { color: var(--pri-txt); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 .25rem; }
h1 em, .serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
h1 em { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .08em; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--sub); margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1rem 0 .5rem; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--muted-bg); padding: .1em .35em; border-radius: 5px; }
small, .sub { color: var(--sub); }
::selection { background: var(--pri-claro); }

main { position: relative; z-index: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 2rem clamp(14px, 3vw, 28px) 4rem; }
.carregando { color: var(--sub); }

.card { background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1.25rem; }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.linha { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.entre { justify-content: space-between; }
.coluna { display: flex; flex-direction: column; gap: 1rem; }
.espaco { flex: 1; }
.mt { margin-top: 1rem; }
.oculto { display: none !important; }

.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--borda); background: var(--card); color: var(--txt);
       padding: .55rem 1rem; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
       transition: border-color .15s, background .15s, opacity .15s; }
.btn:hover { border-color: color-mix(in srgb, var(--pri) 45%, var(--borda)); background: var(--card-2); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.pri { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; }
.btn.pri:hover { opacity: .92; background: var(--grad); }
.btn.perigo { color: var(--erro); }
.btn.perigo.cheio { background: #b42318; border-color: #b42318; color: #fff; }
.btn.peq { padding: .3rem .65rem; font-size: .82rem; }
.btn.link { border: none; background: none; color: var(--pri-txt); padding: 0; }

.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: 12px; font-weight: 500; padding: 1px 9px; border-radius: 999px;
        background: var(--muted-bg); color: var(--sub); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no_ar, .pill.ok { background: var(--ok-claro); color: var(--ok); }
.pill.erro, .pill.falhou, .pill.timeout { background: var(--erro-claro); color: var(--erro); }
.pill.publicando, .pill.construindo, .pill.fila, .pill.rodando { background: var(--pri-claro); color: var(--pri-txt); }
.pill.publicando::before, .pill.construindo::before, .pill.rodando::before { animation: pulsar 1.2s ease-in-out infinite; }
.pill.pausado { background: var(--alerta-claro); color: var(--alerta); }
@keyframes pulsar { 50% { opacity: .25; } }
.tipo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--sub); }

.app-card { display: flex; flex-direction: column; gap: .5rem; color: var(--txt); position: relative; transition: border-color .2s, transform .2s; }
.app-card:hover { border-color: color-mix(in srgb, var(--pri) 45%, var(--borda)); text-decoration: none; transform: translateY(-2px); }
.app-card .nome { font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; }
.app-card .url { font-size: .86rem; word-break: break-all; color: var(--pri-txt); }

label { font-weight: 500; font-size: .9rem; display: block; margin-bottom: .35rem; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; padding: .55rem .75rem; border: 1px solid var(--borda); border-radius: 8px; font: inherit; font-size: 14px;
  background: var(--bg); color: var(--txt); }
input::placeholder, textarea::placeholder { color: hsl(240 4% 46%); }
input:focus, select:focus, textarea:focus { border-color: var(--ring); outline: none; box-shadow: 0 0 0 3px var(--pri-claro); }
input[type=checkbox] { accent-color: var(--pri); width: 16px; height: 16px; }
textarea { resize: vertical; }
.campo { margin-bottom: 1.1rem; }
.ajuda { font-size: .84rem; color: var(--sub); margin-top: .35rem; }
.erro-txt { color: var(--erro); font-size: .86rem; margin-top: .35rem; }
.ok-txt { color: var(--ok); font-size: .86rem; margin-top: .35rem; }

.opcoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.opcao { border: 1px solid var(--borda); border-radius: var(--raio); padding: .9rem 1rem; cursor: pointer; background: var(--bg);
         transition: border-color .15s, background .15s; margin: 0; }
.opcao:hover { border-color: color-mix(in srgb, var(--pri) 45%, var(--borda)); }
.opcao.sel { border-color: var(--pri); background: var(--pri-claro); box-shadow: inset 0 0 0 1px var(--pri); }
.opcao b { display: block; margin-bottom: .2rem; font-weight: 600; }
.opcao span { font-size: .84rem; color: var(--sub); font-weight: 400; }
.opcao input { display: none; }

.drop { border: 1px dashed hsl(240 4% 28%); border-radius: var(--raio); padding: 2.2rem 1rem; text-align: center; color: var(--sub);
        cursor: pointer; background: var(--bg); transition: border-color .15s, background .15s; }
.drop:hover, .drop.sobre { border-color: var(--pri); background: var(--pri-claro); }
.drop b { color: var(--txt); font-weight: 600; }

.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--borda); margin: 1.25rem 0 1.25rem; overflow-x: auto; }
.abas a { padding: .55rem .9rem; color: var(--sub); font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.abas a:hover { text-decoration: none; color: var(--txt); }
.abas a.ativo { color: var(--txt); border-color: var(--pri); }

.caixa { border-radius: 10px; padding: .8rem 1rem; margin: .75rem 0; font-size: .9rem; border: 1px solid transparent; }
.caixa.info { background: var(--info-claro); border-color: rgba(59, 130, 246, .25); }
.caixa.alerta { background: var(--alerta-claro); color: var(--alerta); }
.caixa.erro { background: var(--erro-claro); color: var(--erro); }
.caixa.ok { background: var(--ok-claro); color: var(--ok); }
.caixa ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.caixa code { background: rgba(0, 0, 0, .25); }

.log { background: #050507; color: #d6deeb; border: 1px solid var(--borda); font-family: var(--mono); font-size: .78rem; line-height: 1.5;
       padding: 1rem; border-radius: 10px; max-height: 480px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--borda); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--sub); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: var(--card-2); }
details summary { cursor: pointer; }

.editor { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; min-height: 520px; }
.arvore { border: 1px solid var(--borda); border-radius: 10px; overflow: auto; max-height: 640px; background: var(--card); padding: .4rem 0; }
.arvore button { display: block; width: 100%; text-align: left; border: none; background: none; padding: .3rem .8rem; font-size: .82rem;
                 color: var(--txt); cursor: pointer; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arvore button:hover { background: var(--card-2); }
.arvore button.sel { background: var(--pri-claro); color: var(--pri-txt); }
.arvore button.mudou::after { content: " ●"; color: var(--alerta); }
.arvore button:disabled { color: var(--sub); cursor: default; opacity: .6; }
.codigo { width: 100%; min-height: 560px; font-family: var(--mono); font-size: .82rem; line-height: 1.55; tab-size: 2; white-space: pre; background: #050507; }

.vars td input { font-family: var(--mono); font-size: .84rem; }
.vars td:last-child { width: 1%; }

.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--card-2); color: var(--txt);
         border: 1px solid var(--borda); padding: .7rem 1.2rem; border-radius: 10px; font-weight: 500; z-index: 60; max-width: 90vw;
         box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.toast.erro { background: var(--erro-claro); color: var(--erro); border-color: rgba(255, 143, 132, .3); }

.passos { counter-reset: p; list-style: none; padding: 0; }
.passos li { counter-increment: p; position: relative; padding-left: 2.4rem; margin-bottom: 1rem; }
.passos li::before { content: counter(p); position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%;
                     background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .8rem; }

.vazio { text-align: center; padding: 3rem 1rem; }
.vazio h1 { font-size: 2.4rem; }
.vazio .grade { text-align: left; margin-top: 2rem; }

@media (max-width: 760px) {
  main { padding: 1.25rem 14px 3rem; }
  .editor { grid-template-columns: 1fr; }
  .arvore { max-height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .pill::before { animation: none !important; }
  .app-card:hover { transform: none; }
}

/* auditoria */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio); padding: 18px 20px; }
.kpi b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--sub); font-size: 13px; }
.kpi.ok b { color: var(--ok); } .kpi.erro b { color: var(--erro); } .kpi.alerta b { color: var(--alerta); }
.filtros { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.filtros label { margin-bottom: .25rem; font-size: .82rem; }
.txt-erro { color: var(--erro); }
input[type=date] { width: 100%; padding: .55rem .75rem; border: 1px solid var(--borda); border-radius: 8px; font: inherit; font-size: 14px; background: var(--bg); color: var(--txt); }
