/* Diagrama Tracktor · base compartilhada (claro, mono metálico) */
/* tokens: claro é a base, escuro redefine (tema aplicado por tema.js antes de pintar) */
:root {
  --fundo: #f4f4f2;
  --ponto: #d9d9d4;
  --sup: #ffffff;
  --sup-2: #fafaf8;
  --fio: #e4e4e0;
  --fio-forte: #d2d2cd;
  --texto: #141414;
  --texto-2: #2b2b29;
  --apagado: #6b6b68;
  --fraco: #9a9a95;
  --acao: #141414;
  --acao-texto: #ffffff;
  --acao-hover: #2a2a2a;
  --ativo: #2f8a4f;
  --planejado: #b07a1c;
  --pausado: #8a8a86;
  --perigo: #a14d4d;
  --perigo-fundo: #fbf5f5;
  --perigo-fio: #e2c7c7;
  --tinta: 20, 20, 20;           /* rgb da tinta para véus e realces */
  --realce: rgba(var(--tinta), .05);
  --anel: rgba(var(--tinta), .07);
  --veu: rgba(20, 20, 20, .28);
  --veu-login: rgba(244, 244, 242, .82);
  --topo-fundo: rgba(255, 255, 255, .92);
  --area-fio: #cdcdc8;
  --area-fundo: rgba(255, 255, 255, .38);
  --lig: #b4b4af;
  --lig-hover: #8d8d88;
  --lig-ponta: #a8a8a3;
  --lig-acesa: #4a4a46;
  --fluxo: #4a5268;
  --fluxo-forte: #2f54d6;
  --halo: rgba(47, 84, 214, .22);
  --t-frontend: #4f6bd8;
  --t-backend: #3f7f6e;
  --t-database: #8a6a2f;
  --t-cloud: #5a7894;
  --t-security: #a14d4d;
  --t-messagebus: #7a5aa6;
  --t-external: #707070;
  --sombra: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px rgba(20, 20, 20, .08);
  --sombra-leve: 0 2px 10px rgba(20, 20, 20, .05);
  --sombra-forte: 0 2px 4px rgba(20, 20, 20, .04), 0 18px 48px rgba(20, 20, 20, .14);
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
/* escuro: instrumento de precisão */
:root[data-tema="escuro"] {
  --fundo: #0b0c0d;
  --ponto: #1d1f22;
  --sup: #131416;
  --sup-2: #191a1c;
  --fio: #26282c;
  --fio-forte: #34373c;
  --texto: #ecedee;
  --texto-2: #c9cbcf;
  --apagado: #8a8f98;
  --fraco: #62666e;
  --acao: #ecedee;
  --acao-texto: #0b0c0d;
  --acao-hover: #ffffff;
  --ativo: #5cc285;
  --planejado: #d9a952;
  --pausado: #8a8f98;
  --perigo: #e08585;
  --perigo-fundo: #2a1717;
  --perigo-fio: #5a2c2c;
  --tinta: 236, 237, 238;
  --realce: rgba(var(--tinta), .06);
  --anel: rgba(var(--tinta), .09);
  --veu: rgba(0, 0, 0, .55);
  --veu-login: rgba(11, 12, 13, .84);
  --topo-fundo: rgba(11, 12, 13, .86);
  --area-fio: #2c2f34;
  --area-fundo: rgba(255, 255, 255, .015);
  --lig: #3a3d43;
  --lig-hover: #5a5e66;
  --lig-ponta: #4a4e55;
  --lig-acesa: #9fb8d8;
  --fluxo: #7f9cc9;
  --fluxo-forte: #8fe0ff;
  --halo: rgba(143, 224, 255, .22);
  --t-frontend: #8b9eea;
  --t-backend: #6fb3a0;
  --t-database: #c9a467;
  --t-cloud: #8fabc6;
  --t-security: #d88a8a;
  --t-messagebus: #ad94d6;
  --t-external: #a3a3a3;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .45);
  --sombra-leve: 0 2px 10px rgba(0, 0, 0, .35);
  --sombra-forte: 0 2px 4px rgba(0, 0, 0, .4), 0 20px 56px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fundo); color: var(--texto);
  font: 13.5px/1.45 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 600; letter-spacing: -.01em; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0; }
[hidden] { display: none !important; }

/* botões */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid var(--fio); background: var(--sup); border-radius: var(--r-btn);
  font-size: 13px; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s, transform .12s;
}
.btn:hover { background: var(--sup-2); border-color: var(--fio-forte); }
.btn:active { transform: translateY(.5px); }
.btn.primario { background: var(--acao); border-color: var(--acao); color: var(--acao-texto); }
.btn.primario:hover { background: var(--acao-hover); }
.btn.perigo { color: var(--perigo); }
.btn.perigo:hover { border-color: var(--perigo-fio); background: var(--perigo-fundo); }
.btn.largo { width: 100%; justify-content: center; height: 36px; }
.btn:disabled, .btn-icone:disabled { opacity: .4; cursor: default; }
.btn-icone {
  display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid transparent; background: transparent; border-radius: var(--r-btn); color: var(--apagado);
  transition: background .12s, color .12s;
}
.btn-icone:hover:not(:disabled) { background: var(--realce); color: var(--texto); }
:focus-visible { outline: 2px solid var(--texto); outline-offset: 1px; }

/* dica (tooltip curto) */
[data-dica] { position: relative; }
@media (hover: hover) {
  [data-dica]:hover::after {
    content: attr(data-dica); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
    background: var(--acao); color: var(--acao-texto); font-size: 11.5px; font-weight: 500; line-height: 1; padding: 6px 7px;
    border-radius: 5px; white-space: nowrap; pointer-events: none; z-index: 80; animation: dica .14s .25s both;
  }
  .dica-cima[data-dica]:hover::after { top: auto; bottom: calc(100% + 6px); }
}
@keyframes dica { from { opacity: 0; } }

/* campos */
.campo { display: grid; gap: 5px; }
.campo > span { font-size: 12px; color: var(--apagado); }
.entrada, .campo input, .campo textarea {
  width: 100%; border: 1px solid var(--fio); background: var(--sup); border-radius: var(--r-btn);
  padding: 8px 10px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.entrada:focus, .campo input:focus, .campo textarea:focus { border-color: var(--texto); box-shadow: 0 0 0 3px var(--anel); }
textarea { resize: vertical; }

/* aviso */
.aviso {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 120;
  display: flex; align-items: center; gap: 14px; padding: 9px 10px 9px 14px; max-width: calc(100vw - 32px);
  background: var(--acao); color: var(--acao-texto); border-radius: 8px; font-size: 13px; box-shadow: var(--sombra);
  animation: sobe .2s var(--ease);
}
.aviso.saindo { opacity: 0; transition: opacity .18s; }
.aviso-acao { border: 0; background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; height: 26px; padding: 0 10px; border-radius: 5px; font-weight: 600; }
.aviso-acao:hover { background: color-mix(in srgb, currentColor 24%, transparent); }
@keyframes sobe { from { opacity: 0; transform: translate(-50%, 8px); } }

/* modal */
.modal-fundo {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: var(--veu); animation: aparece .16s;
}
.modal-fundo.saindo { opacity: 0; transition: opacity .16s; }
.modal {
  width: 100%; background: var(--sup); border: 1px solid var(--fio); border-radius: var(--r-caixa);
  box-shadow: var(--sombra); animation: modal .22s var(--ease); max-height: calc(100dvh - 32px); overflow: auto;
}
.modal-cabeca { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 18px; }
.modal-cabeca h2 { font-size: 15px; }
.modal > :nth-child(2) { padding: 10px 18px 4px; }
.modal-rodape { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px 16px; }
@keyframes aparece { from { opacity: 0; } }
@keyframes modal { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* entrar */
.login-fundo {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: var(--veu-login); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: aparece .2s;
}
.login-fundo.saindo { opacity: 0; transition: opacity .18s; }
.login-cartao {
  width: 100%; max-width: 340px; display: grid; gap: 14px; padding: 26px 24px 24px;
  background: var(--sup); border: 1px solid var(--fio); border-radius: var(--r-caixa); box-shadow: var(--sombra);
  animation: modal .26s var(--ease);
}
.login-cartao h1 { font-size: 20px; margin-bottom: 2px; }
.login-marca { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--apagado); font-weight: 500; }
.login-ponto { width: 8px; height: 8px; border-radius: 2px; background: var(--texto); }
.login-erro { margin: 0; min-height: 18px; color: var(--perigo); font-size: 12.5px; }

/* topo */
.topo {
  position: fixed; top: 0; left: 0; right: 0; height: 48px; z-index: 40;
  display: flex; align-items: center; gap: 6px; padding: 0 10px;
  background: var(--topo-fundo); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--fio);
}
.marca { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; padding-left: 6px; }

/* estados vazios ensinando com ícone */
.ensina { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; }
.ensina-item { display: grid; justify-items: center; gap: 10px; width: 112px; text-align: center; color: var(--apagado); font-size: 12.5px; font-weight: 500; }
.ensina-icone {
  width: 52px; height: 52px; display: grid; place-items: center; color: var(--texto);
  background: var(--sup); border: 1px solid var(--fio); border-radius: 12px;
}
.ensina-item:nth-child(1) svg { animation: mexe 2.6s var(--ease) infinite; }
.ensina-item:nth-child(2) svg { animation: pulsa 2.6s .4s var(--ease) infinite; }
.ensina-item:nth-child(3) svg { animation: toca 2.6s .8s var(--ease) infinite; }
@keyframes mexe { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(4px, -3px); } 60% { transform: translate(-3px, 2px); } }
@keyframes pulsa { 0%, 100% { transform: scaleX(1); } 40% { transform: scaleX(1.18); } }
@keyframes toca { 0%, 70%, 100% { transform: scale(1); } 35% { transform: scale(.82); } }

/* botão de tema */
.btn-tema svg { transition: transform .45s var(--ease); }
.btn-tema:active svg { transform: rotate(-30deg) scale(.9); }
.btn-tema .tema-entra { animation: temaEntra .42s var(--ease); }
@keyframes temaEntra { from { opacity: 0; transform: rotate(-90deg) scale(.5); } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; animation-timing-function: ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .08s !important; }
}
@media (max-width: 640px) {
  input, textarea, select { font-size: 16px; }
}
