/* Tokens da marca. O Tailwind (views/partials/head.html) aponta para estas variáveis. */
:root {
  --c-ink-950: #0b0c0e;
  --c-ink-900: #111316;
  --c-ink-850: #16181c;
  --c-ink-800: #1d2025;
  --c-ink-700: #2a2e35;
  --c-ink-600: #3b4049;
  --c-ink-500: #5e6470;
  --c-ink-400: #8c929d;
  --c-ink-300: #b7bcc5;
  --c-ink-200: #d6d9df;
  --c-ink-100: #eceef1;

  --c-volt: #cdf349;
  --c-volt-dim: #a9cf2c;
  --c-cyan: #6fd2e6;
  --c-amber: #f4b752;
  --c-red: #ff6d5f;

  color-scheme: dark;
}

html { scroll-padding-top: 5rem; }
body { background: var(--c-ink-950); }

::selection { background: var(--c-volt); color: var(--c-ink-950); }

/* Grade técnica de fundo */
.bg-grid {
  background-image:
    linear-gradient(to right, rgb(255 255 255 / 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(255 255 255 / 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
}
.fade-b { mask-image: linear-gradient(to bottom, #000 40%, transparent); }
.fade-r { mask-image: radial-gradient(ellipse 70% 80% at 30% 0%, #000 40%, transparent 80%); }

/* Pontilhado de régua usado em divisórias */
.rule-dots {
  background-image: radial-gradient(circle, var(--c-ink-600) 1px, transparent 1.2px);
  background-size: 8px 8px;
  background-position: 0 center;
  background-repeat: repeat-x;
  height: 8px;
}

/* Tokens de "syntax highlight" escritos à mão */
.t-c { color: var(--c-ink-500); }   /* comentário / prompt */
.t-k { color: var(--c-cyan); }      /* chave / método */
.t-s { color: var(--c-volt); }      /* string */
.t-n { color: var(--c-amber); }     /* número */
.t-p { color: var(--c-ink-400); }   /* pontuação */

pre { tab-size: 2; }
.scroll-thin { scrollbar-width: thin; scrollbar-color: var(--c-ink-700) transparent; }

/* Fluxo animado do diagrama */
.flow { stroke-dasharray: 3 7; animation: flow 1.1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -20; } }

.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Olho da senha: o ícone segue o tipo do campo, então nunca fica fora de sincronia */
input[type="password"] + [data-reveal] [data-eye-open],
input:not([type="password"]) + [data-reveal] [data-eye-closed] { display: none; }

/* Conversa de tickets */
.ticket-msg { max-width: 78%; }
.ticket-msg[data-side="me"] { margin-left: auto; text-align: right; }
.ticket-msg-body {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--c-ink-700);
  border-radius: 3px;
  background: var(--c-ink-850);
  color: var(--c-ink-100);
  font-size: 0.875rem;
  line-height: 1.55;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ticket-msg[data-side="me"] .ticket-msg-body { border-color: color-mix(in srgb, var(--c-volt) 35%, transparent); background: color-mix(in srgb, var(--c-volt) 7%, var(--c-ink-900)); }
[data-ticket-live] > i { display: inline-block; width: 6px; height: 6px; border-radius: 999px; background: var(--c-ink-600); }
[data-ticket-live][data-online="true"] > i { background: var(--c-volt); }

/* Textos legais */
.legal h2 { margin-top: 3rem; scroll-margin-top: 6rem; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; color: var(--c-ink-100); }
.legal h2 > span { margin-right: 0.75rem; font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.75rem; font-weight: 400; color: var(--c-volt); }
.legal p, .legal ul { margin-top: 0.875rem; font-size: 0.9375rem; line-height: 1.75; color: var(--c-ink-300); }
.legal ul { padding-left: 1.125rem; list-style: square; }
.legal li { margin-top: 0.375rem; }
.legal li::marker { color: var(--c-ink-600); }
.legal strong { font-weight: 500; color: var(--c-ink-100); }
.legal a { color: var(--c-ink-100); text-decoration: underline; text-decoration-color: var(--c-ink-600); text-underline-offset: 4px; }
.legal a:hover { text-decoration-color: var(--c-volt); }
.legal code { font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.85em; color: var(--c-ink-200); }

/* Fundo quadriculado da construção da logo */
.bg-check {
  background-color: #fff;
  background-image: linear-gradient(45deg, #e8e9ec 25%, transparent 25% 75%, #e8e9ec 75%), linear-gradient(45deg, #e8e9ec 25%, transparent 25% 75%, #e8e9ec 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

/* Traçado do topo da página de status */
.trace { stroke-dasharray: 16 84; animation: trace 5s linear infinite; }
@keyframes trace { to { stroke-dashoffset: -100; } }

/* Histórico diário: a altura repete o estado, que não depende só da cor */
.tick { display: flex; flex: 1 1 0; min-width: 0; height: 100%; align-items: flex-end; }
.tick > i { display: block; width: 100%; transition: opacity 120ms; }
.tick:hover > i { opacity: 0.65; }
.tick-ok > i { height: 100%; background: var(--c-volt); }
.tick-degraded > i { height: 60%; background: var(--c-amber); }
.tick-down > i { height: 30%; background: var(--c-red); }
.tick-none > i { height: 100%; background: var(--c-ink-800); }
.legend-tick { flex: none; width: 6px; height: 12px; }

/* Modal de confirmação (<dialog>). A margem automática centraliza: o reset zera a do navegador. */
.modal {
  margin: auto; padding: 0; width: calc(100% - 2rem); max-width: 28rem;
  border: 1px solid var(--c-ink-700); border-radius: 4px; background: var(--c-ink-900); color: var(--c-ink-100);
  box-shadow: 0 24px 64px -12px rgb(0 0 0 / 0.7), 0 0 0 1px rgb(255 255 255 / 0.02) inset;
}
.modal::backdrop { background: rgb(5 6 8 / 0.72); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in 160ms cubic-bezier(0.2, 0.9, 0.3, 1); }
.modal[open]::backdrop { animation: modal-fade 160ms ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
@keyframes modal-fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .flow, .blink, .trace { animation: none; }
  .modal[open], .modal[open]::backdrop { animation: none; }
}

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

/* Comprovante: na impressão (ou "Salvar como PDF") sai só o papel, sem o painel em volta. */
@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; }
  body * { visibility: hidden; }
  .receipt, .receipt * { visibility: visible; }
  .receipt { position: absolute; inset: 0 auto auto 0; width: 100%; max-width: none; margin: 0; box-shadow: none; border-radius: 0; }
  [data-noprint] { display: none !important; }
}
