/* ============================================================
   tokensilimitados.cloud — Design System
   Mobile-first, dark theme, glassmorphism, gradients
   ============================================================ */

:root {
  /* Palette */
  --bg-0: #060912;
  --bg-1: #0b1120;
  --bg-2: #111a2e;
  --bg-3: #18233d;
  --line: #1f2b48;
  --line-soft: #18223a;

  --text: #e7ecf6;
  --text-dim: #9aa6c0;
  --text-mute: #6c7791;

  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #22d3ee;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --accent-grad-soft: linear-gradient(135deg, rgba(99,102,241,.15), rgba(139,92,246,.10));
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 8px 24px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.04) inset;
  --shadow-lg: 0 24px 48px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05) inset;

  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  font: 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg-0);
  min-height: 100vh;
  background-image:
    radial-gradient(1200px 600px at -10% -10%, rgba(99,102,241,.20), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(139,92,246,.18), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(34,211,238,.10), transparent 60%);
  background-attachment: fixed;
  overflow-x: hidden;
}

a { color: var(--accent-3); text-decoration: none; }
a:hover { color: var(--text); }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 16px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
small, .muted { color: var(--text-mute); font-size: 12px; }
code { font-family: var(--mono); font-size: .9em; padding: 2px 6px; background: rgba(255,255,255,.06); border-radius: 6px; }
.mono { font-family: var(--mono); font-size: 12px; }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(11, 17, 32, 0.7);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -.02em;
  font-size: 16px;
}
.brand .logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(99,102,241,.5);
}
.brand .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.topbar nav {
  display: flex;
  gap: 4px;
  align-items: center;
}
.topbar nav a {
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s ease;
}
.topbar nav a:hover { background: rgba(255,255,255,.06); color: var(--text); }
.topbar nav a.active { background: var(--accent-grad-soft); color: var(--text); }
.topbar form button.link {
  background: none; border: 0; color: var(--text-dim);
  font: inherit; padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.topbar form button.link:hover { background: rgba(255,255,255,.06); color: var(--text); }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  position: relative;
}
.menu-toggle span::before,
.menu-toggle span::after {
  content: ""; position: absolute; left: 0;
  width: 18px; height: 2px; background: var(--text);
}
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }

/* Mobile drawer */
@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; }
  .topbar nav {
    position: fixed;
    top: 64px; right: 0; bottom: 0;
    width: 280px;
    flex-direction: column;
    align-items: stretch;
    background: rgba(11, 17, 32, 0.96);
    backdrop-filter: blur(20px);
    padding: 20px;
    gap: 4px;
    transform: translateX(100%);
    transition: transform .25s ease;
    border-left: 1px solid var(--line);
  }
  .topbar nav.open { transform: translateX(0); }
  .topbar nav a, .topbar form button.link {
    padding: 12px 14px;
    text-align: left;
    border-radius: 10px;
  }
  .topbar .nav-overlay {
    position: fixed; inset: 64px 0 0 0;
    background: rgba(0,0,0,.5);
    z-index: -1;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  .topbar .nav-overlay.open { opacity: 1; pointer-events: auto; }
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}
@media (max-width: 720px) {
  .container { padding: 20px 16px 80px; }
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header .lead { color: var(--text-dim); margin-top: 6px; }

/* ============================================================
   Buttons & inputs
   ============================================================ */
button, .btn {
  background: var(--accent-grad);
  color: white;
  border: 0;
  padding: 10px 16px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, opacity .15s ease;
  box-shadow: 0 6px 16px rgba(99,102,241,.35);
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(99,102,241,.45); }
button:active { transform: translateY(0); }
button[disabled], .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

button.ghost, .btn.ghost {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: none;
}
button.ghost:hover { background: rgba(255,255,255,.08); box-shadow: none; }

button.danger, .btn.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 6px 16px rgba(239,68,68,.35);
}

input, select, textarea {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 10px;
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.20);
}

label { display: block; font-size: 13px; color: var(--text-dim); margin: 12px 0 6px; font-weight: 500; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: linear-gradient(180deg, rgba(17,26,46,.7), rgba(11,17,32,.6));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card.glow {
  position: relative;
  overflow: hidden;
}
.card.glow::before {
  content: ""; position: absolute; inset: -1px;
  background: var(--accent-grad);
  opacity: .15; z-index: -1;
  filter: blur(40px);
}
.card h2 { margin-bottom: 12px; }
.card + .card { margin-top: 18px; }

.cards-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stat {
  background: linear-gradient(180deg, rgba(17,26,46,.85), rgba(11,17,32,.6));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-mute); margin-bottom: 8px; }
.stat .value { font-size: 32px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat .delta { font-size: 12px; margin-top: 6px; color: var(--success); }
.stat .delta.warn { color: var(--warn); }
.stat .delta.danger { color: var(--danger); }
.stat::after {
  content: ""; position: absolute;
  width: 80px; height: 80px;
  border-radius: 50%;
  right: -20px; top: -20px;
  background: var(--accent-grad);
  opacity: .08;
}

/* ============================================================
   Tables (responsive)
   ============================================================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-1); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-mute); font-weight: 600; background: rgba(255,255,255,.02);
}
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.06); color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .04em;
}
.badge.ok { background: rgba(34,197,94,.15); color: #4ade80; }
.badge.warn { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge.bad { background: rgba(239,68,68,.15); color: #f87171; }
.badge.info { background: rgba(56,189,248,.15); color: #7dd3fc; }
.badge.purple { background: rgba(139,92,246,.18); color: #c4b5fd; }

.row-actions { display: inline-flex; gap: 6px; }
.row-actions button { padding: 6px 10px; font-size: 12px; box-shadow: none; }

/* ============================================================
   Forms (modern)
   ============================================================ */
.field { margin-bottom: 14px; }
.field-help { color: var(--text-mute); font-size: 12px; margin-top: 4px; }

.split-form {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ============================================================
   Auth pages (split-screen on desktop, single on mobile)
   ============================================================ */
.auth-wrap {
  min-height: 100vh; display: grid;
  grid-template-columns: 1.05fr 1fr;
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
}

.auth-hero {
  position: relative;
  padding: 56px 56px;
  background:
    radial-gradient(800px 500px at 20% 20%, rgba(139,92,246,.35), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(34,211,238,.20), transparent 60%),
    linear-gradient(135deg, #0a0f1e 0%, #1a0f2e 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 80%);
  opacity: .5;
}
.auth-hero .brand-big { display: flex; align-items: center; gap: 14px; font-size: 22px; font-weight: 800; position: relative; }
.auth-hero .brand-big .logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 900; font-size: 18px;
  box-shadow: 0 8px 24px rgba(99,102,241,.5);
}
.auth-hero h1 { font-size: 44px; line-height: 1.1; margin: 32px 0 16px; letter-spacing: -.03em; max-width: 540px; position: relative; }
.auth-hero h1 span { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { color: var(--text-dim); font-size: 16px; max-width: 480px; line-height: 1.6; position: relative; }
.auth-hero .features { display: grid; gap: 14px; margin-top: 32px; position: relative; max-width: 480px; }
.auth-hero .feat { display: flex; gap: 12px; align-items: start; }
.auth-hero .feat .ico {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--accent-3);
}
.auth-hero .feat h4 { font-size: 15px; margin-bottom: 2px; }
.auth-hero .feat p { font-size: 13px; color: var(--text-mute); margin: 0; }
.auth-hero .footer-line { color: var(--text-mute); font-size: 12px; position: relative; }

@media (max-width: 900px) {
  .auth-hero { padding: 32px 24px; min-height: 280px; }
  .auth-hero h1 { font-size: 28px; }
  .auth-hero .features { display: none; }
}

.auth-form-side {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  background: var(--bg-0);
}
.auth-form {
  width: 100%; max-width: 380px;
}
.auth-form h2 { font-size: 26px; margin-bottom: 6px; }
.auth-form .sub { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }
.auth-form .alt { text-align: center; margin-top: 22px; color: var(--text-dim); font-size: 14px; }
.auth-form button[type=submit] { width: 100%; padding: 13px; margin-top: 18px; font-size: 15px; }

.alert { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); padding: 10px 14px; border-radius: 10px; color: #fca5a5; font-size: 13px; margin: 12px 0; }
.alert.success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert.info { background: rgba(56,189,248,.12); border-color: rgba(56,189,248,.3); color: #7dd3fc; }

/* ============================================================
   Modal (key generated)
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 720px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: inherit; z-index: 1; }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: transparent; border: 0; color: var(--text-dim); font-size: 24px; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; box-shadow: none; }
.modal-close:hover { background: rgba(255,255,255,.06); color: var(--text); box-shadow: none; }

.key-display {
  background: rgba(0,0,0,.3);
  border: 1px dashed var(--accent);
  padding: 16px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
  color: #fbbf24;
  position: relative;
}

.tabs { display: flex; gap: 2px; padding: 4px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow-x: auto; }
.tab {
  flex: 1; min-width: max-content;
  background: transparent; color: var(--text-dim);
  padding: 8px 14px; border-radius: 7px; cursor: pointer; box-shadow: none;
  font-size: 13px; font-weight: 600;
}
.tab:hover { color: var(--text); box-shadow: none; }
.tab.active { background: var(--accent-grad); color: white; }
.code-block {
  position: relative;
  background: #04070f;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
}
.code-block .copy-fab {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 4px 10px; font-size: 11px;
  border-radius: 6px; cursor: pointer; box-shadow: none;
}
.code-block .copy-fab:hover { background: rgba(255,255,255,.14); box-shadow: none; }
.code-block .copy-fab.copied { background: var(--success); border-color: var(--success); }

/* ============================================================
   Chips & tags
   ============================================================ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  background: var(--bg-1); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; color: var(--text-dim);
}
.chip.clickable { cursor: pointer; transition: all .15s ease; }
.chip.clickable:hover { background: var(--accent); border-color: var(--accent); color: white; transform: translateY(-1px); }
.chip.gradient { background: var(--accent-grad-soft); border-color: var(--accent); color: var(--text); }

/* ============================================================
   Misc
   ============================================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }

.footer-note { text-align: center; padding: 32px; color: var(--text-mute); font-size: 12px; }

.empty {
  text-align: center; padding: 48px 20px;
  color: var(--text-mute);
}
.empty .icon { font-size: 36px; opacity: .4; margin-bottom: 12px; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 280px; max-width: 360px;
  font-size: 14px;
  animation: slideIn .25s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Sticky actions on mobile */
.sticky-bottom {
  position: sticky; bottom: 16px;
  background: rgba(11,17,32,.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 24px;
  display: flex; gap: 10px; justify-content: flex-end;
  box-shadow: var(--shadow-lg);
}

/* Decorative grid for hero */
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.06) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

/* Skeleton loader */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--bg-1) 25%, var(--bg-2) 50%, var(--bg-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  height: 16px;
}

/* User avatar */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 12px;
  text-transform: uppercase;
}

/* Code preview pre line numbers */
.code-block pre.line-num { padding-left: 50px; position: relative; }


/* Confirm dialog overlay */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.confirm-dialog {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
.confirm-dialog h3 { margin-bottom: 8px; }
.confirm-dialog p { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }


.toast-close:hover { opacity:1 !important; }
.strength-bar { transition: width .2s ease; }
.info-grid { display: grid; gap: 10px; }

/* Mobile bottom bar */
@media (max-width: 720px) {
  .mobile-bottom-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(11,17,32,.94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    display: flex; z-index: 25;
  }
  .mobile-bottom-bar a {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 8px 4px 6px; color: var(--text-dim); font-size: 10px;
    text-decoration: none; gap: 2px;
  }
  .mobile-bottom-bar a.active { color: var(--accent-3); }
  .mobile-bottom-bar a svg { width: 20px; height: 20px; }
}

/* Tooltip for shortcuts */
kbd {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; font-size: 11px;
  font-family: var(--mono); color: var(--text-dim);
}

/* Responsive cards-grid improvement */
@media (max-width: 500px) {
  .cards-grid { grid-template-columns: 1fr 1fr !important; }
}
