/* ══════════════════════════════════════════════════════════════════
   CLOUDPANEL — Professional hosting panel
   Mobile-first. Neutral dark. Vercel/Linear/Railway inspired.
   ══════════════════════════════════════════════════════════════════ */

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

:root {
  /* Neutral scale (Vercel-like) */
  --bg:         #0a0a0a;
  --bg-elev:    #111111;
  --bg-elev-2:  #161616;
  --bg-elev-3:  #1c1c1c;
  --card:       #111111;
  --card-hover: #161616;
  --card-alt:   #0e0e0e;

  /* Borders */
  --border:        rgba(255,255,255,0.08);
  --border2:       rgba(255,255,255,0.05);
  --border-strong: rgba(255,255,255,0.14);
  --border-accent: rgba(239,68,68,0.35);

  /* Text */
  --fg:       #ededed;
  --fg-dim:   #a1a1a1;
  --fg-muted: #666666;
  --fg-code:  #c9c9c9;

  /* Accents */
  --red:        #e5484d;
  --red-bright: #ef4444;
  --red-dim:    #c53030;
  --red-soft:   rgba(229,72,77,0.1);
  --red-glow:   rgba(229,72,77,0.25);
  --green:      #46a758;
  --green-dim:  rgba(70,167,88,0.12);
  --green-soft: rgba(70,167,88,0.08);
  --amber:      #f59e0b;
  --amber-dim:  rgba(245,158,11,0.12);
  --blue:       #3b82f6;
  --blue-dim:   rgba(59,130,246,0.12);
  --purple:     #a855f7;
  --gray:       #6b7280;

  /* Typography */
  --font:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --heading: var(--font);

  /* Radius */
  --r:  8px;
  --r2: 6px;
  --r3: 12px;
  --r4: 4px;

  /* Shadows */
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.4);
  --shadow:      0 4px 16px rgba(0,0,0,0.4);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.5);

  /* Motion */
  --ease: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: var(--ease);

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --container-max: 1200px;

  --accent: var(--red-bright);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11','ss01','ss03';
}
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--fg); }
code, pre, .mono { font-family: var(--mono); }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }
::selection { background: rgba(239,68,68,0.35); color: #fff; }

/* ─────────────── LAYOUT ─────────────── */
body.app-layout {
  display: block;
  padding-top: var(--topbar-h);
}
.page-wrap {
  min-height: calc(100vh - var(--topbar-h));
  padding: 20px 16px 48px;
}
.container {
  max-width: var(--container-max);
  margin: 0 auto;
}

/* ─────────────── TOPBAR / SIDEBAR (responsive) ─────────────── */
/* MOBILE: topbar with hamburger → drawer */
#topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  background: rgba(10,10,10,0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  display: flex;
  align-items: center;
}

.sidebar {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 16px;
  gap: 12px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.sidebar-logo {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--red-bright);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.sidebar-wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar-wordmark span { font-size: 10px; color: var(--fg-muted); font-weight: 500; letter-spacing: 0.02em; }

.sidebar-section-label { display: none; }

/* Nav on mobile = horizontal scroll chips */
.sidebar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--fg-dim);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--ease);
  border: 1px solid transparent;
}
.nav-item:hover { color: var(--fg); background: var(--bg-elev-2); }
.nav-item.active {
  color: var(--fg);
  background: var(--bg-elev-3);
  border-color: var(--border);
  box-shadow: 0 0 0 1px var(--red-bright) inset, 0 2px 8px rgba(255, 40, 60, 0.15);
}
.nav-item.active .nav-icon { color: var(--red-bright); opacity: 1; }
.nav-icon { display: inline-flex; width: 15px; height: 15px; opacity: 0.8; }
.nav-icon svg { width: 100%; height: 100%; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}
.user-info { display: none; }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-elev-3);
  color: var(--fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
}
.user-pill.warn {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--amber-dim);
  color: var(--amber);
  font-size: 11px;
  font-weight: 500;
}
.sidebar-logout {
  background: transparent;
  color: var(--fg-dim);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--ease);
}
.sidebar-logout:hover { color: var(--fg); background: var(--bg-elev-2); }

/* DESKTOP: sidebar vertical fixa */
@media (min-width: 1024px) {
  body.app-layout { padding-top: 0; padding-left: var(--sidebar-w); }
  #topbar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    height: 100vh;
    border-right: 1px solid var(--border);
    border-bottom: none;
    flex-direction: column;
    padding: 0;
    background: var(--bg-elev);
    backdrop-filter: none;
  }
  .sidebar {
    flex-direction: column;
    align-items: stretch;
    padding: 20px 12px;
    gap: 0;
    overflow-y: auto;
  }
  .sidebar-brand { padding: 4px 8px 20px; }
  .sidebar-section-label {
    display: block;
    font-size: 10px;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--fg-muted);
    text-transform: uppercase;
    padding: 12px 8px 6px;
  }
  .sidebar-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin-left: 0;
    overflow: visible;
  }
  .nav-item { width: 100%; padding: 8px 10px; }
  .sidebar-footer {
    margin-top: auto;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }
  .user-info {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px;
  }
  .user-details { min-width: 0; flex: 1; }
  .user-email { font-size: 12px; font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-plan { font-size: 10px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; }
  .sidebar-logout { width: 100%; text-align: left; padding: 8px 10px; }
  .page-wrap { padding: 28px 28px 56px; }
}

/* ─────────────── TYPOGRAPHY ─────────────── */
h1, h2, h3, h4 { font-family: var(--heading); font-weight: 600; letter-spacing: -0.015em; color: var(--fg); }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 15px; line-height: 1.3; }
h3 { font-size: 14px; line-height: 1.3; }
p  { color: var(--fg-dim); }

.page-header { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; color: var(--fg); }
.page-subtitle { font-size: 13px; color: var(--fg-dim); margin-top: 4px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.section-head h2 { font-size: 14px; font-weight: 600; }
.section-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hint { color: var(--fg-muted); font-size: 12px; }

/* ─────────────── BUTTONS ─────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r2);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--fg);
  cursor: pointer;
  transition: var(--ease);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  min-height: 34px;
}
.btn:hover:not(:disabled) { background: var(--bg-elev-3); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.ico svg { width: 1em; height: 1em; }
.btn > .ico svg { width: 14px; height: 14px; }
.btn-small > .ico svg { width: 12px; height: 12px; }

.btn-red {
  background: var(--red-bright);
  color: #fff;
  border-color: var(--red-bright);
}
.btn-red:hover:not(:disabled) { background: var(--red-dim); border-color: var(--red-dim); }

.btn-green {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-green:hover:not(:disabled) { filter: brightness(1.08); }

.btn-blue {
  background: var(--bg-elev-2);
  color: var(--fg);
  border-color: var(--border);
}
.btn-blue:hover:not(:disabled) { background: var(--bg-elev-3); border-color: var(--border-strong); }

.btn-soft-red {
  background: var(--red-soft);
  color: var(--red-bright);
  border-color: var(--border-accent);
}
.btn-soft-red:hover:not(:disabled) { background: rgba(239,68,68,0.18); }

.btn-gray { background: transparent; color: var(--fg-dim); border-color: var(--border); }
.btn-gray:hover:not(:disabled) { background: var(--bg-elev-2); color: var(--fg); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-elev-2); color: var(--fg); }

.btn-small { padding: 6px 10px; font-size: 12px; min-height: 28px; }
.btn-block { width: 100%; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 4px;
  border-radius: 6px;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  transition: var(--ease);
  margin-bottom: 12px;
}
.btn-back:hover { color: var(--fg); background: var(--bg-elev-2); }

/* ─────────────── CARDS ─────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 16px;
  overflow: hidden;
  padding: 16px 18px;
}
.card > h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--fg); }
.card > h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--fg); }
.card-body { padding: 14px 16px; }
.card-pad-0 { padding: 0; }
/* When a card uses .section-head or .pairing-head as first child, escape padding so border-bottom goes edge-to-edge */
.card > .section-head:first-child,
.card > .pairing-head:first-child,
.card > .admin-tabs:first-child {
  margin: -16px -18px 16px;
  padding: 14px 18px;
}
.card > .card-body {
  margin: 0 -18px -16px;
  padding: 16px 18px;
}
.card > .section-head:first-child + .card-body,
.card > .admin-tabs:first-child + .card-body {
  margin-top: -16px;
}
.card.pairing-card { padding: 0; }
.card.pairing-card .pairing-head { padding: 14px 18px; }
/* pairing-card tem padding:0, então não precisa (e não deve) aplicar margem negativa
   para "escapar" do padding do card — senão o título vaza pra fora. */
.card.pairing-card > .pairing-head:first-child { margin: 0; padding: 12px 16px; }

/* ─────────────── TILES ─────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
@media (min-width: 640px) {
  .tile-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tile-grid.tile-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tile-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94, 0.6);
  animation: live-pulse 1.8s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94, 0.6); opacity: 1; }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94, 0); opacity: 0.7; }
}
.tile-pulse { animation: tile-flash 0.6s ease-out; }
@keyframes tile-flash {
  0% { border-color: var(--accent); background: rgba(229,72,77,0.04); }
  100% { border-color: var(--border); background: var(--card); }
}
.tile-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─────────────── HOST / INFRA ─────────────── */
.host-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 520px) {
  .host-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .host-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.host-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.host-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.host-tile-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.host-tile-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-top: 2px;
}
.host-tile-value.mono {
  font-family: var(--mono);
  font-size: 18px;
}
.host-tile-sub {
  font-size: 11px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}
.host-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  margin-top: 2px;
}
.host-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 600ms ease, background-color 300ms ease;
}
.host-bar-fill[data-tone="ok"]   { background: linear-gradient(90deg, #22c55e, #16a34a); }
.host-bar-fill[data-tone="warn"] { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.host-bar-fill[data-tone="crit"] { background: linear-gradient(90deg, #ef4444, #dc2626); }
.host-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.host-badge[data-tone="ok"]   { color: #4ade80; background: rgba(34,197,94,.12);  border-color: rgba(34,197,94,.3); }
.host-badge[data-tone="warn"] { color: #fbbf24; background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); }
.host-badge[data-tone="crit"] { color: #ff6b6b; background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.35); }
.host-warning {
  margin-top: 4px;
  font-size: 11px;
  color: #fca5a5;
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 1.4;
}

/* ─────────────── STATUS PILL ─────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--fg-dim);
  text-transform: uppercase;
  line-height: 1.4;
}
.status-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--fg-muted);
}
.status-pill[data-status="online"] { color: var(--green); border-color: rgba(70,167,88,0.4); background: var(--green-dim); }
.status-pill[data-status="online"]::before { background: var(--green); box-shadow: 0 0 0 3px rgba(70,167,88,0.2); animation: pulse 2s infinite; }
.status-pill[data-status="starting"], .status-pill[data-status="pairing"] { color: var(--amber); border-color: rgba(245,158,11,0.4); background: var(--amber-dim); }
.status-pill[data-status="starting"]::before, .status-pill[data-status="pairing"]::before { background: var(--amber); }
.status-pill[data-status="stopped"] { color: var(--red-bright); border-color: var(--border-accent); background: var(--red-soft); }
.status-pill[data-status="stopped"]::before { background: var(--red-bright); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─────────────── HERO (bot detail page) ─────────────── */
.bot-hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hero-left { min-width: 0; }
.hero-title h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
}
.hero-slug {
  font-family: var(--mono);
  color: var(--fg-muted);
  font-size: 12px;
}
.hero-dim { color: var(--fg-muted); font-size: 12px; }

/* Actions ALWAYS visible, horizontal on mobile, stretching */
.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  width: 100%;
}
.hero-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 9px 10px;
  font-size: 13px;
}

@media (min-width: 640px) {
  .bot-hero { flex-direction: row; align-items: center; justify-content: space-between; padding: 18px 20px; }
  .hero-actions { width: auto; grid-template-columns: auto auto auto; }
  .hero-actions .btn { width: auto; min-width: 100px; }
}

/* ─────────────── PAIRING CARD ─────────────── */
.pairing-card {
  background: var(--card);
  border: 1px solid var(--border-accent);
  border-radius: var(--r);
  margin-bottom: 16px;
  overflow: hidden;
}
.pairing-card.hidden { display: none; }
.pairing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.pairing-head h2 { color: var(--red-bright); }
.pairing-head .timer { font-family: var(--mono); font-size: 12px; color: var(--amber); }
.pairing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border2);
}
.pairing-label { font-size: 12px; color: var(--fg-muted); }
.pairing-number { font-family: var(--mono); font-size: 13px; color: var(--fg); }
.pairing-code-wrap { display: flex; align-items: center; gap: 8px; }
.pairing-code {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--red-bright);
  background: var(--red-soft);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-accent);
  letter-spacing: 0.08em;
}
.pairing-steps {
  padding: 14px 16px 14px 36px;
  color: var(--fg-dim);
  font-size: 12px;
}
.pairing-steps li { padding: 3px 0; }

/* ─────────────── SUBNAV (bot tabs) ─────────────── */
.subnav {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: var(--topbar-h);
  z-index: 50;
  box-shadow: 0 1px 0 var(--border2) inset;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 9px 14px;
  border-radius: calc(var(--r2) + 2px);
  white-space: nowrap;
  transition: var(--ease);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}
.subnav-btn .ico {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}
.subnav-btn .ico svg { width: 15px; height: 15px; }
.subnav-btn:hover {
  color: var(--fg);
  background: var(--bg-elev-2);
}
.subnav-btn:hover .ico { opacity: 1; }
.subnav-btn.active {
  background: var(--bg-elev-3);
  color: var(--fg);
  border-color: var(--border);
  box-shadow: 0 0 0 1px var(--red-bright) inset, 0 2px 8px rgba(255, 40, 60, 0.15);
}
.subnav-btn.active .ico { opacity: 1; color: var(--red-bright); }
@media (min-width: 1024px) {
  .subnav { top: 0; }
  .subnav-btn { font-size: 13px; padding: 10px 16px; }
}

.tab-pane { display: none; animation: fadein 160ms ease; }
.tab-pane.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ─────────────── DEF LIST (overview) ─────────────── */
.def-list { display: flex; flex-direction: column; }
.def-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border2);
  font-size: 13px;
}
.def-item:last-child { border-bottom: none; }
.def-label { color: var(--fg-muted); font-size: 12px; }
.def-value { color: var(--fg); font-family: var(--mono); font-size: 12px; word-break: break-word; }

/* ─────────────── LOGS (terminal) ─────────────── */
.logs-card { padding: 0; }
.logs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.logs-head h2 { font-size: 13px; }
.logs-actions { display: flex; gap: 6px; align-items: center; }
.logs {
  background: #050505;
  color: #d4d4d4;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  padding: 14px 16px;
  margin: 0;
  min-height: 280px;
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border-bottom: 1px solid var(--border);
}
.stdin-row {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-elev);
}
.stdin-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 8px 12px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12px;
}
.stdin-row input:focus { outline: none; border-color: var(--accent); }

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-dim);
  cursor: pointer;
}
.checkbox-inline input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--red-bright);
  cursor: pointer;
}

/* ─────────────── FILE MANAGER ─────────────── */
.fm-breadcrumb {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}
.fm-crumb-item { color: var(--fg-dim); cursor: pointer; }
.fm-crumb-item:hover { color: var(--fg); text-decoration: underline; }

.fm-toolbar {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.fm-toolbar::-webkit-scrollbar { display: none; }

.fm-grid { display: flex; flex-direction: column; }
@media (min-width: 900px) {
  .fm-grid.has-editor { flex-direction: row; }
  .fm-grid.has-editor .fm-list { width: 45%; border-right: 1px solid var(--border); }
  .fm-grid.has-editor .fm-editor { flex: 1; }
}

.fm-list { display: flex; flex-direction: column; }
.fm-entry {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border2);
  transition: var(--ease);
  cursor: pointer;
  font-size: 13px;
  min-width: 0;
}
.fm-entry:last-child { border-bottom: none; }
.fm-entry:hover { background: var(--bg-elev-2); }
.fm-name {
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fm-size { font-family: var(--mono); font-size: 11px; color: var(--fg-muted); white-space: nowrap; display: none; }
.fm-date { font-family: var(--mono); font-size: 11px; color: var(--fg-muted); white-space: nowrap; display: none; }
.fm-actions { display: flex; gap: 4px; }
.fm-actions .btn { padding: 4px 8px; font-size: 11px; min-height: 24px; }
.fm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  color: var(--fg-muted);
}
.fm-icon svg { width: 14px; height: 14px; }
.fm-entry[data-kind="dir"] .fm-icon { color: var(--amber); }
@media (min-width: 640px) {
  .fm-entry { grid-template-columns: 18px 1fr 80px 120px auto; }
  .fm-size, .fm-date { display: inline; }
}

.fm-root-info {
  padding: 10px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
}
.fm-root-info b { color: var(--fg); font-family: var(--mono); font-weight: 500; }

.fm-editor { display: flex; flex-direction: column; background: var(--bg); border-top: 1px solid var(--border); }
.fm-editor.hidden { display: none; }
.fm-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.fm-editor-head .mono { font-size: 12px; color: var(--fg-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-editor textarea {
  background: #050505;
  color: #d4d4d4;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 14px 16px;
  border: none;
  outline: none;
  resize: vertical;
  min-height: 320px;
  width: 100%;
}
.fm-code-view {
  margin: 0;
  padding: 0;
  background: #282c34;
  max-height: 520px;
  overflow: auto;
}
.fm-code-view.hidden { display: none; }
.fm-code-view code {
  display: block;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
  min-height: 320px;
}
.hidden { display: none !important; }

/* ─────────────── FORMS ─────────────── */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 12px; font-weight: 500; color: var(--fg-dim); }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row select,
.form-row textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 9px 12px;
  color: var(--fg);
  font-size: 13px;
  width: 100%;
  transition: var(--ease);
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--red-glow); }
.form-row input[type="file"] {
  background: transparent;
  color: var(--fg-dim);
  font-size: 12px;
  padding: 6px 0;
}
.form-help { font-size: 11px; color: var(--fg-muted); }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 16px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }

.config-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 16px 16px;
}

.env-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0 16px 14px;
}
.env-row input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 10px 12px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12px;
  min-width: 0;
  width: 100%;
}
.env-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--red-glow); }
.env-row .btn { width: 100%; justify-content: center; }
@media (min-width: 640px) {
  .env-row { grid-template-columns: 1fr 1fr auto; align-items: center; }
  .env-row .btn { width: auto; }
}
#envList .env-row { padding: 0 16px 8px; }
#envList .env-row input[readonly] { background: var(--bg-elev); color: var(--fg-dim); }
.env-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--r2);
  margin: 0 16px 14px;
  background: var(--bg);
}
.env-hint {
  padding: 0 16px 14px;
  margin: 0;
  line-height: 1.6;
}
.env-hint code {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}
.env-add {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 6px;
}

/* ─────────────── TABLES ─────────────── */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th, .table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border2);
  text-align: left;
  vertical-align: middle;
}
.table th {
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.table tbody tr:hover { background: var(--bg-elev-2); }
.table .mono { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); }

/* ─────────────── DASHBOARD BOT CARD ─────────────── */
.grid { display: grid; gap: 12px; }
.grid-bots { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-bots { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-bots { grid-template-columns: repeat(3, 1fr); } }

.bot-card-pro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  transition: var(--ease);
  color: var(--fg);
}
.bot-card-pro:hover {
  border-color: var(--border-strong);
  background: var(--card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.bot-card-pro-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.bot-card-pro-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bot-card-pro-slug {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}
.bot-card-pro-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.bot-card-pro-tile {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 8px 10px;
}
.bot-card-pro-tile .tl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 2px;
}
.bot-card-pro-tile .tv {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.bot-card-pro-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--border2);
  font-size: 11px;
  color: var(--fg-muted);
}

.empty-state {
  padding: 40px 16px;
  text-align: center;
  color: var(--fg-dim);
  border: 1px dashed var(--border);
  border-radius: var(--r);
  background: var(--card);
}
.empty-state h3 { font-size: 15px; margin-bottom: 6px; color: var(--fg); }
.empty-state p { font-size: 13px; color: var(--fg-muted); }

/* ─────────────── AI TAB ─────────────── */
.ai-hero {
  display: flex;
  gap: 14px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(168,85,247,0.04));
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 16px;
}
.ai-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--red-bright);
}
.ai-icon svg { width: 20px; height: 20px; }
.ai-hero-body { flex: 1; min-width: 0; }
.ai-hero-body h2 { font-size: 15px; margin-bottom: 4px; }
.ai-hero-body p { font-size: 12px; color: var(--fg-dim); margin-bottom: 12px; line-height: 1.5; }

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.toggle-switch input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border);
  position: relative;
  transition: var(--ease);
  flex-shrink: 0;
}
.toggle-track::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--fg-muted);
  transition: var(--ease);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--red-bright);
  border-color: var(--red-bright);
}
.toggle-switch input:checked + .toggle-track::before {
  left: 16px;
  background: #fff;
}
.toggle-label { font-size: 13px; color: var(--fg); font-weight: 500; }

.ai-status-pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border);
}
.ai-status-pill.on { color: var(--green); background: var(--green-dim); border-color: rgba(70,167,88,0.35); }
.ai-status-pill.off { color: var(--fg-muted); background: var(--bg-elev-2); }
.ai-status-pill.warn { color: var(--amber); background: var(--amber-dim); border-color: rgba(245,158,11,0.35); }

.fix-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--fg-muted);
  border-radius: var(--r2);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: var(--ease);
}
.fix-card[data-status="pending"] { border-left-color: var(--amber); }
.fix-card[data-status="applied"] { border-left-color: var(--green); opacity: 0.75; }
.fix-card[data-status="dismissed"] { border-left-color: var(--fg-muted); opacity: 0.5; }
.fix-card[data-status="failed"] { border-left-color: var(--red-bright); }
.fix-card[data-status="no_fix"] { border-left-color: var(--amber); opacity: 0.7; }

.fix-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.fix-title { font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 2px; }
.fix-date { font-size: 11px; color: var(--fg-muted); font-family: var(--mono); }
.fix-diagnosis { font-size: 12px; color: var(--fg-dim); line-height: 1.55; margin-bottom: 10px; }
.fix-error {
  font-size: 12px;
  color: var(--red-bright);
  background: var(--red-soft);
  border: 1px solid var(--border-accent);
  border-radius: var(--r4);
  padding: 6px 10px;
  margin-bottom: 8px;
  font-family: var(--mono);
}
.fix-status {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.fix-status[data-s="pending"] { color: var(--amber); background: var(--amber-dim); border-color: rgba(245,158,11,0.35); }
.fix-status[data-s="applied"] { color: var(--green); background: var(--green-dim); border-color: rgba(70,167,88,0.35); }
.fix-status[data-s="dismissed"] { color: var(--fg-muted); background: var(--bg-elev-2); }
.fix-status[data-s="failed"], .fix-status[data-s="no_fix"] { color: var(--red-bright); background: var(--red-soft); border-color: var(--border-accent); }

.fix-patches { margin-bottom: 10px; }
.fix-patch {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  overflow: hidden;
  margin-bottom: 6px;
}
.fix-patch-head {
  padding: 6px 10px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 11px;
}
.fix-patch-head .file { font-family: var(--mono); color: var(--fg); font-weight: 600; }
.fix-patch-head .reason { color: var(--fg-dim); font-size: 11px; }
.fix-patch-diff { padding: 8px; display: flex; flex-direction: column; gap: 3px; }
.fix-patch-diff span {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}
.fix-patch-diff .del { background: rgba(239,68,68,0.08); color: #ff8a8a; border-left: 2px solid var(--red-bright); }
.fix-patch-diff .add { background: rgba(70,167,88,0.1); color: #86efac; border-left: 2px solid var(--green); }
.fix-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─────────────── MODAL ─────────────── */
.modal-backdrop,
.cp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
}
.cp-modal-backdrop > .cp-modal { pointer-events: auto; }
.cp-modal-backdrop { pointer-events: auto; }
.modal-backdrop.show { display: flex; }
.cp-modal-backdrop[style*="flex"] { display: flex !important; }

.modal, .cp-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  padding: 22px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modal-in 180ms ease;
}
@keyframes modal-in {
  from { transform: scale(0.96) translateY(6px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal h3, .cp-modal-title { font-size: 16px; margin-bottom: 10px; color: var(--fg); display: flex; align-items: center; gap: 8px; }
.cp-modal-icon { color: var(--amber); display: inline-flex; width: 18px; height: 18px; }
.cp-modal-icon svg { width: 100%; height: 100%; }
.modal .form-row { margin-bottom: 12px; }
.cp-modal-body, .modal p { font-size: 13px; color: var(--fg-dim); margin-bottom: 16px; line-height: 1.55; }
.modal-actions, .cp-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ─────────────── TOAST ─────────────── */
.toast {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elev-3);
  color: var(--fg);
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r2);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: var(--ease);
  z-index: 2000;
  max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { border-color: var(--border-accent); background: linear-gradient(180deg, var(--red-soft), var(--bg-elev-3)); color: #ff8a8a; }

/* ─────────────── UTILS ─────────────── */
.hidden { display: none !important; }
code {
  font-family: var(--mono);
  background: var(--bg-elev-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--fg-code);
  border: 1px solid var(--border);
}

/* Plans/billing */
.plans {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 768px) {
  .plans { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
.plan-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plan-card .btn { margin-top: auto; }
.plan-card.current { border-color: var(--border-accent); box-shadow: 0 0 0 1px var(--border-accent); }
.plan-name { font-size: 16px; font-weight: 600; color: var(--fg); }
.plan-price { font-size: 22px; font-weight: 700; color: var(--fg); }
.plan-price small { font-size: 12px; font-weight: 500; color: var(--fg-muted); margin-left: 2px; }
.plan-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--fg-dim); }
.plan-features li { padding-left: 16px; position: relative; }
.plan-features li::before { content: ''; position: absolute; left: 0; top: 7px; width: 8px; height: 2px; background: var(--green); }

/* ─────────────── ADMIN ─────────────── */
.admin-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.admin-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--ease);
  white-space: nowrap;
}
.admin-tab:hover { color: var(--fg); background: var(--bg-elev-2); }
.admin-tab.active {
  background: var(--bg-elev-3);
  color: var(--fg);
  border-color: var(--border);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(6, 1fr); } }
.stat-box {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 12px 14px;
  min-width: 0;
}
.stat-box .label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.stat-box .value {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-dim);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-elev-2); }
.admin-plan-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.admin-plan-card h3 { margin-bottom: 12px; }
.plan-editor {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) { .plan-editor { grid-template-columns: repeat(2, 1fr); } }

/* ─────────────── AUTH (login / signup / mock-checkout) ─────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(800px 400px at 50% -10%, rgba(239,68,68,0.06), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red-bright), transparent);
  opacity: 0.7;
}
.auth-logo {
  text-align: center;
  margin-bottom: 22px;
}
.auth-logo .logo {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--bg-elev-2), var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--red-bright);
  font-family: var(--heading);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.auth-logo .logo svg { width: 22px; height: 22px; }
.auth-logo h1 {
  font-family: var(--heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin: 0;
}
.auth-logo p {
  color: var(--fg-muted);
  font-size: 12px;
  margin: 4px 0 0;
}
.auth-card .form-row { margin-bottom: 14px; }
.auth-card label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.auth-card input[type=email],
.auth-card input[type=password],
.auth-card input[type=text] {
  width: 100%;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 10px 12px;
  font-size: 14px;
  transition: var(--ease);
}
.auth-card input:focus {
  outline: none;
  border-color: var(--red-bright);
  box-shadow: 0 0 0 3px var(--red-soft);
}
.auth-card .hint {
  color: var(--fg-muted);
  font-size: 12px;
  text-align: center;
  margin: 14px 0 0;
}
.auth-card .hint a { color: var(--red-bright); font-weight: 600; }
.auth-card .hint a:hover { text-decoration: underline; }

/* ─────────────── CLOUD BOT (floating chat) ─────────────── */
#__cloudbot { position: fixed; z-index: 9999; bottom: 16px; right: 16px; font-family: inherit; }
.cb-fab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--red-bright) 0%, #c81e2c 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(255, 40, 60, 0.35), 0 0 0 1px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: var(--ease);
}
.cb-fab:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(255, 40, 60, 0.45), 0 0 0 1px rgba(0,0,0,0.4); }
.cb-fab .cb-fab-ico { display: inline-flex; width: 18px; height: 18px; }
.cb-fab .cb-fab-ico svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  #__cloudbot { bottom: 12px; right: 12px; }
  .cb-fab .cb-fab-label { display: none; }
  .cb-fab { padding: 14px; border-radius: 50%; }
}
.cb-panel {
  position: fixed; z-index: 9999;
  bottom: 78px; right: 16px;
  width: 360px; max-width: calc(100vw - 24px);
  height: 520px; max-height: calc(100vh - 100px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,40,60,0.15);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: cbpop 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cbpop { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.cb-panel.hidden { display: none; }
@media (max-width: 640px) {
  .cb-panel { bottom: 74px; right: 12px; left: 12px; width: auto; height: 70vh; }
}
.cb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255,40,60,0.18), rgba(255,40,60,0.05));
  border-bottom: 1px solid var(--border);
}
.cb-head-title { display: flex; align-items: center; gap: 10px; }
.cb-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red-bright), #c81e2c);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.cb-avatar svg { width: 18px; height: 18px; }
.cb-head-name { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--fg); }
.cb-head-sub { font-size: 11px; color: var(--fg-muted); margin-top: 2px; }
.cb-close {
  background: transparent; border: none; color: var(--fg-dim);
  cursor: pointer; padding: 6px; border-radius: 6px;
  display: inline-flex; align-items: center;
}
.cb-close:hover { color: var(--fg); background: var(--bg-elev-2); }
.cb-close svg { width: 18px; height: 18px; }
.cb-messages {
  flex: 1; overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
  font-size: 13px; line-height: 1.5;
}
.cb-msg {
  max-width: 85%; padding: 10px 12px; border-radius: 12px;
  white-space: pre-wrap; word-wrap: break-word;
}
.cb-msg-bot {
  align-self: flex-start;
  background: var(--bg-elev-2); color: var(--fg);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.cb-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--red-bright), #c81e2c); color: #fff;
  border-top-right-radius: 4px;
}
.cb-msg.cb-typing { opacity: 0.65; font-style: italic; }
.cb-msg.cb-err { background: rgba(255,40,60,0.12); border-color: rgba(255,40,60,0.35); color: #ffb4bc; }
.cb-input-row {
  display: flex; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.cb-input-row input {
  flex: 1; background: var(--bg); color: var(--fg);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 14px; font-size: 13px;
}
.cb-input-row input:focus { outline: none; border-color: var(--red-bright); box-shadow: 0 0 0 3px var(--red-soft); }
.cb-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red-bright), #c81e2c);
  color: #fff; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--ease);
}
.cb-send:hover:not(:disabled) { transform: scale(1.05); }
.cb-send:disabled { opacity: 0.5; cursor: wait; }
.cb-send svg { width: 16px; height: 16px; }
.cb-hint { font-size: 10px; color: var(--fg-muted); text-align: center; padding: 6px 0 8px; background: var(--bg-elev); letter-spacing: 0.04em; }

/* ─────────────── MODAL HELPERS (head/body/foot) ─────────────── */
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: -4px 0 12px;
}
.modal-head h3 { margin: 0; }
.modal-close {
  background: transparent; border: none; color: var(--fg-dim);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: var(--bg-elev-2); color: var(--fg); }
.modal-body { font-size: 13px; color: var(--fg); margin-bottom: 16px; }
.modal-body .lbl {
  display: block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--fg-muted); margin-bottom: 5px;
}
.modal-body input[type=text],
.modal-body .fm-sel {
  width: 100%; background: var(--bg-elev); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--r2);
  padding: 8px 10px; font-size: 13px;
}
.modal-body input[type=text]:focus,
.modal-body .fm-sel:focus {
  outline: none; border-color: var(--red-bright); box-shadow: 0 0 0 3px var(--red-soft);
}
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; }

/* ─────────────── ADMIN TOOLS ─────────────── */
.admin-tools {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.admin-search {
  flex: 1; min-width: 180px;
  background: var(--bg-elev); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--r2);
  padding: 8px 12px; font-size: 13px;
}
.admin-search:focus {
  outline: none; border-color: var(--red-bright); box-shadow: 0 0 0 3px var(--red-soft);
}
.new-user-form {
  background: var(--bg-elev);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  padding: 14px;
  margin-bottom: 14px;
  display: grid; gap: 10px;
}
.new-user-form.hidden { display: none; }
.new-user-form .form-row {
  display: flex; flex-direction: column; gap: 6px; margin: 0;
}
.new-user-form label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--fg-muted);
}
.new-user-form input[type=text],
.new-user-form input[type=email],
.new-user-form select {
  background: var(--bg-elev-2); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--r2);
  padding: 7px 10px; font-size: 13px;
}
.tbl-sel {
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--r2); color: var(--fg);
  padding: 4px 8px; font-size: 12px;
}

/* ─────────────── SMART PAIRING IA BADGE ─────────────── */
.pairing-ia-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  margin: 14px 18px 0;
  background: linear-gradient(90deg, rgba(255,40,60,0.10), rgba(255,40,60,0.02));
  border: 1px solid rgba(255,40,60,0.35);
  border-radius: var(--r2);
  font-size: 12.5px; font-weight: 600;
  color: var(--red-bright);
  line-height: 1.4;
}
.pairing-ia-badge.hidden { display: none; }
.pairing-ia-badge[data-mode="qr"] {
  color: #4ade80;
  border-color: rgba(74,222,128,0.3);
  background: linear-gradient(90deg, rgba(74,222,128,0.08), rgba(74,222,128,0.02));
}
.pairing-ia-badge[data-mode="number"] {
  color: #60a5fa;
  border-color: rgba(96,165,250,0.3);
  background: linear-gradient(90deg, rgba(96,165,250,0.08), rgba(96,165,250,0.02));
}
.pairing-ia-badge .ico { width: 14px; height: 14px; }
.pairing-qr-note {
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px dashed var(--border2);
  border-radius: var(--r2);
  margin: 10px 18px;
}
.pairing-qr-note.hidden { display: none; }
/* steps mais arejado */
.pairing-card .pairing-steps { padding: 10px 16px 12px 32px; line-height: 1.55; font-size: 12px; }
.pairing-card .pairing-row { padding: 10px 16px; }
.pairing-card .pairing-head { padding: 10px 16px !important; }
.pairing-card .pairing-head h2 { font-size: 14px; margin: 0; }

/* ─────────────── DEPLOY INFO + PROGRESS ─────────────── */
.deploy-info {
  display: grid; gap: 8px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red-bright);
  border-radius: var(--r2);
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg-muted);
}
.deploy-info-item b { color: var(--fg); font-weight: 600; }
.deploy-info-item code {
  background: var(--bg-elev-2);
  padding: 1px 6px; border-radius: 4px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--red-bright);
}
.deploy-progress {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r2);
}
.deploy-progress.hidden { display: none; }
.deploy-progress-bar {
  height: 8px;
  background: var(--bg-elev-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.deploy-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red-bright), #ff6b7a);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.deploy-progress-label {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--fg-muted);
}

/* ─────────────── IA PROFUNDA (Devin) ─────────────── */
.ia-deep-card { border-color: rgba(255, 40, 60, 0.25); }
.badge-pro {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 7px; border-radius: 4px;
  background: linear-gradient(90deg, #ff283c, #ff6b7a);
  color: white;
  vertical-align: middle;
}
.ia-deep-sessions { display: grid; gap: 10px; margin-top: 14px; }
.ia-deep-session {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 12px 14px;
}
.ia-deep-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; flex-wrap: wrap;
}
.ia-deep-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.ia-deep-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ia-deep-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ia-deep-msg {
  background: var(--bg-elev-2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--fg-muted);
  max-height: 260px;
  overflow-y: auto;
}
.hint.err { color: var(--red-bright); }

/* ---- Localidade (cosmético) ---- */
.loc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg4);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  white-space: nowrap;
}
.loc-badge .loc-flag {
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  color: var(--fg);
  letter-spacing: 0.5px;
}
.loc-badge .loc-txt { color: var(--fg); font-weight: 600; }
.loc-badge .loc-ping { opacity: 0.8; }

/* Seletor radio-grid de localidades (modal criar bot) */
.loc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.loc-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 11.5px;
  transition: border-color 0.12s, background 0.12s;
}
.loc-grid label:hover { border-color: var(--border-strong, #444); }
.loc-grid label.active { border-color: var(--red-bright); background: rgba(220,38,38,0.08); }
.loc-grid label input[type="radio"] { display: none; }
.loc-grid label .loc-name { font-weight: 600; color: var(--fg); }
.loc-grid label .loc-pingv { font-family: var(--mono); font-size: 10px; color: var(--fg-muted); }

/* ---- Pedidos de acesso (dono aprova/nega) ---- */
.access-req-banner {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.access-req-banner .arb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #fbbf24;
  font-size: 12px;
}
.access-req-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
}
.access-req-item .ari-line1 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--fg);
}
.access-req-item .ari-email { font-family: var(--mono); color: var(--red-bright); }
.access-req-item .ari-bot { font-weight: 600; }
.access-req-item .ari-reason {
  color: var(--fg-muted);
  font-size: 11px;
  font-style: italic;
  word-break: break-word;
}
.access-req-item .ari-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ---- Toggle "permitir admins" na config ---- */
.admin-access-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.admin-access-row .aar-text { flex: 1; min-width: 0; }
.admin-access-row .aar-text strong { display: block; font-size: 12.5px; color: var(--fg); margin-bottom: 2px; }
.admin-access-row .aar-text span { font-size: 11px; color: var(--fg-muted); }

/* Ban pill na tabela admin */
.badge-banned {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(220,38,38,0.18);
  color: var(--red-bright);
  border: 1px solid rgba(220,38,38,0.4);
  text-transform: uppercase;
}
