/* ═══════════════════════════════════════════════════════════════
   RT SYSTEMS · MISSION CONTROL — design system
   Preto espacial + carmesim RT + vidro líquido (Apple) + telemetria NASA
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Espaço */
  --void:        #030305;
  --deep:        #07070c;
  --panel:       #0c0c13;
  --panel-2:     #12121b;
  --hair:        rgba(255, 255, 255, .075);
  --hair-strong: rgba(255, 255, 255, .14);

  /* Carmesim RT */
  --rt:          #ff2d4a;
  --rt-hot:      #ff5c72;
  --rt-deep:     #c41e3a;
  --rt-dark:     #7a0f22;
  --rt-glow:     rgba(255, 45, 74, .45);

  /* Telemetria */
  --ok:          #22e0a1;
  --ok-dim:      rgba(34, 224, 161, .16);
  --warn:        #ffb020;
  --info:        #4db8ff;
  --nasa-blue:   #0b3d91;

  /* Texto */
  --ink:         #f5f5f7;
  --ink-2:       #b8b8c4;
  --ink-3:       #74748a;
  --ink-4:       #4a4a5c;

  /* Geometria */
  --r-xs: 10px;  --r-sm: 14px;  --r-md: 20px;  --r-lg: 28px;  --r-xl: 36px;  --r-pill: 999px;
  --sp: 4px;

  /* Vidro */
  --glass-bg:    linear-gradient(160deg, rgba(255,255,255,.075), rgba(255,255,255,.018) 60%, rgba(255,255,255,.035));
  --glass-blur:  blur(28px) saturate(180%);
  --glass-edge:  inset 0 1px 0 rgba(255,255,255,.14), inset 0 -1px 0 rgba(0,0,0,.5);
  --glass-drop:  0 24px 70px -30px rgba(0,0,0,.95), 0 2px 14px -6px rgba(0,0,0,.7);

  --font: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--void);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'cv01';
}

img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--rt); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: #1e1e2a; border-radius: 99px; border: 2px solid var(--void); }
::-webkit-scrollbar-thumb:hover { background: var(--rt-dark); }

/* ── Fundo espacial ─────────────────────────────────────────── */
#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.space-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(255, 45, 74, .16), transparent 60%),
    radial-gradient(900px 600px at 92% 8%, rgba(11, 61, 145, .18), transparent 62%),
    radial-gradient(700px 500px at 50% 110%, rgba(255, 45, 74, .10), transparent 60%),
    var(--void);
}

/* Grade técnica */
.space-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 25%, transparent 75%);
}

/* Granulado de filme */
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(6) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0) } 17% { transform: translate(-3%,-2%) }
  33% { transform: translate(2%,-4%) } 50% { transform: translate(-2%,3%) }
  67% { transform: translate(3%,2%) } 83% { transform: translate(-1%,-3%) }
}

main, header, footer, .layer { position: relative; z-index: 2; }

/* ── Vidro líquido ──────────────────────────────────────────── */
.glass {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-edge), var(--glass-drop);
  isolation: isolate;
}

/* Reflexo especular que escorre no hover */
.glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.09) 45%, transparent 60%);
  background-size: 250% 100%; background-position: 150% 0;
  opacity: 0; transition: opacity .5s;
}
.glass:hover::before { opacity: 1; animation: sheen 1.1s var(--ease-out); }
@keyframes sheen { from { background-position: 150% 0 } to { background-position: -50% 0 } }

.glass-soft {
  background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.012));
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
}

/* Vidro com brilho carmesim na borda */
.glass-hot { box-shadow: var(--glass-edge), 0 0 0 1px rgba(255,45,74,.18), 0 30px 80px -40px var(--rt-glow); }

/* ── Tipografia ─────────────────────────────────────────────── */
.display {
  font-weight: 900; letter-spacing: -.045em; line-height: .94;
  font-size: clamp(2.6rem, 7.5vw, 5.4rem);
}
.display-sm { font-weight: 800; letter-spacing: -.035em; line-height: 1.04; font-size: clamp(1.7rem, 3.6vw, 2.6rem); }

.eyebrow {
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  letter-spacing: .32em; text-transform: uppercase; color: var(--ink-3);
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }

.grad-text {
  background: linear-gradient(100deg, #fff 10%, var(--rt-hot) 45%, var(--rt) 70%, #fff 96%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradmove 9s linear infinite;
}
@keyframes gradmove { to { background-position: 220% 0 } }

/* ── Botões ─────────────────────────────────────────────────── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 26px; border: 0; border-radius: var(--r-pill);
  font-weight: 700; font-size: .95rem; letter-spacing: -.01em;
  cursor: pointer; overflow: hidden; white-space: nowrap;
  transition: transform .35s var(--ease-spring), box-shadow .35s var(--ease-out), filter .25s;
}
.btn:active { transform: scale(.965); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--rt) 0%, var(--rt-deep) 60%, #8f1428 100%);
  color: #fff;
  box-shadow: 0 10px 40px -12px var(--rt-glow), inset 0 1px 0 rgba(255,255,255,.28), inset 0 -2px 8px rgba(0,0,0,.35);
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
  background-size: 250% 100%; background-position: 160% 0;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 55px -14px var(--rt-glow), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:hover:not(:disabled)::after { animation: sheen .9s var(--ease-out); }

.btn-glass {
  background: rgba(255,255,255,.055);
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--hair-strong); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-glass:hover:not(:disabled) { background: rgba(255,255,255,.1); transform: translateY(-2px); }

.btn-ghost { background: transparent; border: 1px solid var(--hair); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--rt); color: var(--ink); }

.btn-ok { background: linear-gradient(135deg, #22e0a1, #0f9d6f); color: #04150f; box-shadow: 0 10px 34px -14px rgba(34,224,161,.6); }
.btn-wa { background: linear-gradient(135deg, #25d366, #128c7e); color: #04150f; box-shadow: 0 10px 34px -14px rgba(37,211,102,.55); }

.btn-sm { padding: 10px 16px; font-size: .84rem; }
.btn-lg { padding: 18px 34px; font-size: 1.02rem; }
.btn-block { width: 100%; }

.btn-icon {
  width: 42px; height: 42px; padding: 0; border-radius: 14px;
  background: rgba(255,255,255,.05); border: 1px solid var(--hair);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--ink-2); transition: all .25s var(--ease-out);
}
.btn-icon:hover { background: rgba(255,45,74,.14); border-color: var(--rt); color: var(--ink); }

/* ── Formulários ────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.label {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-3);
}
.input, .select, .textarea {
  width: 100%; padding: 15px 18px;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--hair); border-radius: var(--r-sm);
  color: var(--ink); font-size: .98rem; outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--rt);
  background: rgba(255,45,74,.05);
  box-shadow: 0 0 0 4px rgba(255,45,74,.11);
}
.input.err, .select.err { border-color: var(--rt); box-shadow: 0 0 0 4px rgba(255,45,74,.14); }
.textarea { resize: vertical; min-height: 96px; }
.select {
  appearance: none; cursor: pointer; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374748a' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center; background-size: 17px;
}
.select option { background: var(--panel); color: var(--ink); }

.input-money { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track {
  width: 46px; height: 27px; border-radius: 99px; flex: none;
  background: rgba(255,255,255,.08); border: 1px solid var(--hair);
  position: relative; transition: all .3s var(--ease-spring);
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--ink-3);
  transition: all .3s var(--ease-spring);
}
.switch input:checked + .switch-track { background: rgba(255,45,74,.28); border-color: var(--rt); }
.switch input:checked + .switch-track::after { left: 21px; background: var(--rt); box-shadow: 0 0 12px var(--rt-glow); }

/* Segmented control (vidro líquido) */
.seg {
  display: inline-flex; padding: 4px; gap: 2px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.04); border: 1px solid var(--hair);
  position: relative; overflow: hidden;
}
.seg button {
  position: relative; z-index: 2; padding: 9px 18px; border: 0; background: none;
  border-radius: var(--r-pill); color: var(--ink-3); cursor: pointer;
  font-size: .82rem; font-weight: 600; transition: color .3s;
}
.seg button.on { color: #fff; }
.seg-thumb {
  position: absolute; z-index: 1; top: 4px; bottom: 4px; border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--rt), var(--rt-deep));
  box-shadow: 0 4px 18px -6px var(--rt-glow);
  transition: transform .45s var(--ease-spring), width .45s var(--ease-spring);
}

/* ── Selos / tags ───────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: var(--r-pill);
  font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase;
  border: 1px solid var(--hair); background: rgba(255,255,255,.04); color: var(--ink-2);
}
.tag-ok   { color: var(--ok); border-color: rgba(34,224,161,.35); background: var(--ok-dim); }
.tag-pend { color: var(--warn); border-color: rgba(255,176,32,.32); background: rgba(255,176,32,.1); }
.tag-off  { color: var(--ink-3); }
.tag-hot  { color: var(--rt-hot); border-color: rgba(255,45,74,.4); background: rgba(255,45,74,.11); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.dot-live { animation: pulse 1.8s ease-in-out infinite; box-shadow: 0 0 0 0 currentColor; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,224,161,.55) } 70% { box-shadow: 0 0 0 9px rgba(34,224,161,0) }
  100% { box-shadow: 0 0 0 0 rgba(34,224,161,0) }
}

/* ── Layout ─────────────────────────────────────────────────── */
.wrap { width: min(1240px, 100% - 40px); margin-inline: auto; }
.wrap-sm { width: min(760px, 100% - 32px); margin-inline: auto; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap-1 { gap: 8px } .gap-2 { gap: 14px } .gap-3 { gap: 22px } .gap-4 { gap: 34px }
.grid { display: grid; gap: 20px; }
.wrapflex { flex-wrap: wrap; }

/* ── Revelação no scroll ────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* ── Toast ──────────────────────────────────────────────────── */
#toasts {
  position: fixed; z-index: 999; left: 50%; transform: translateX(-50%);
  top: 20px; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
  width: min(440px, calc(100% - 24px));
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-radius: var(--r-md); font-size: .9rem; font-weight: 600;
  background: rgba(18,18,27,.86); backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--hair-strong);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.9);
  animation: toastIn .55s var(--ease-spring);
}
.toast.out { animation: toastOut .35s var(--ease-out) forwards; }
.toast-ok  { border-color: rgba(34,224,161,.4); }
.toast-err { border-color: rgba(255,45,74,.45); }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--rt); flex: none; }
.toast-ok i { background: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-24px) scale(.94) } to { opacity: 1; transform: none } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-16px) scale(.96) } }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; z-index: 900; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(3,3,5,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: fade .3s;
}
.modal-bg.on { display: flex; }
.modal {
  width: min(680px, 100%); max-height: 90vh; overflow-y: auto; padding: 30px;
  animation: modalIn .5s var(--ease-spring);
}
@keyframes fade { from { opacity: 0 } }
@keyframes modalIn { from { opacity: 0; transform: translateY(40px) scale(.95) } }

/* ── Skeleton ───────────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: 8px;
}
@keyframes skel { to { background-position: -200% 0 } }

/* ── Utilidades ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.center { text-align: center; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.float { animation: float 6s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-12px) } }

.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--hair-strong), transparent); }

.copyable { cursor: pointer; transition: color .2s; }
.copyable:hover { color: var(--rt-hot); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
