/* ==========================================================
   SHELBY SYSTEMS — Painel Premium
   Paleta: azul-marinho, dourado e ciano neon
   ========================================================== */
:root {
  --bg: #050b18;
  --bg-2: #0a1428;
  --card: rgba(14, 26, 52, 0.72);
  --card-solid: #0e1a34;
  --border: rgba(120, 160, 255, 0.12);
  --border-strong: rgba(212, 175, 55, 0.35);
  --text: #e8eefc;
  --muted: #8a9bc2;
  --gold: #d4af37;
  --gold-2: #f3d27a;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --glow: 0 0 24px rgba(34, 211, 238, 0.25);
  --sidebar: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
h1, h2, h3, .brand-font { font-family: 'Orbitron', 'Inter', sans-serif; letter-spacing: 0.5px; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.cyan { color: var(--cyan); }
.hidden { display: none !important; }

/* ---------------------------- LAYOUT ---------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  position: fixed; inset: 0 auto 0 0;
  background: linear-gradient(180deg, rgba(10, 20, 40, 0.95), rgba(5, 11, 24, 0.98));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  z-index: 40;
  transition: transform 0.25s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.brand img { width: 44px; height: 44px; border-radius: 12px; box-shadow: var(--glow); }
.brand .name { font-family: 'Orbitron', sans-serif; font-weight: 800; font-size: 17px; color: var(--gold-2); line-height: 1; }
.brand .sub { font-family: 'Orbitron', sans-serif; font-size: 10px; letter-spacing: 4px; color: var(--cyan); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav .section { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav a:hover { color: var(--text); background: rgba(34, 211, 238, 0.06); }
.nav a.active {
  color: var(--gold-2);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.14), rgba(34, 211, 238, 0.04));
  border-color: var(--border-strong);
}
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--violet)); color: #0a1428;
}
.sidebar-footer .who { flex: 1; min-width: 0; }
.sidebar-footer .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .who span { font-size: 12px; color: var(--muted); }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px;
  background: rgba(5, 11, 24, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; flex: 1; }
.btn.menu-btn { display: none; }
.status-pills { display: flex; gap: 8px; }
.content { padding: 28px; max-width: 1400px; margin: 0 auto; }

/* ---------------------------- CARDS ----------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.card + .card { margin-top: 18px; }
.grid > .card + .card, .lp-grid > .card + .card, .lp-steps > .card + .card, .lp-plans > .card + .card { margin-top: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-header h2 { font-size: 16px; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat { position: relative; overflow: hidden; }
.stat::after {
  content: ''; position: absolute; inset: auto -40px -40px auto; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.18), transparent 70%);
}
.stat .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .value { font-family: 'Orbitron', sans-serif; font-size: 30px; font-weight: 700; margin-top: 8px; color: var(--gold-2); }
.stat .icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(34, 211, 238, 0.1); color: var(--cyan); }
.stat .icon svg { width: 18px; height: 18px; }

.hero {
  border-radius: var(--radius); overflow: hidden; margin-bottom: 22px; border: 1px solid var(--border-strong);
  background: url('/img/banner.jpg') center top/cover; aspect-ratio: 1280 / 573; max-height: 260px; width: 100%;
  box-shadow: var(--shadow);
}

/* ---------------------------- BADGES ---------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(138, 155, 194, 0.12); color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--success); background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.25); }
.pill.ok .dot { box-shadow: 0 0 10px var(--success); }
.pill.warn { color: var(--warn); background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.25); }
.pill.err { color: var(--danger); background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.25); }
.pill.gold { color: var(--gold-2); background: rgba(212, 175, 55, 0.1); border-color: var(--border-strong); }
.pill.cyan { color: var(--cyan); background: rgba(34, 211, 238, 0.08); border-color: rgba(34, 211, 238, 0.25); }

/* ---------------------------- BUTTONS --------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px;
  font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); color: var(--text);
  cursor: pointer; transition: all 0.15s ease; white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { border-color: rgba(34, 211, 238, 0.4); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #b8901f);
  color: #0a1428; border-color: transparent;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.25);
}
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn-cyan { background: linear-gradient(135deg, var(--cyan), #0891b2); color: #04111f; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); border-color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ----------------------------- FORMS ---------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { font-size: 12px; color: var(--muted); }
.input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: rgba(5, 11, 24, 0.7);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 84px; resize: vertical; }
.input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 180px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { display: none; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: rgba(138, 155, 194, 0.25); position: relative; transition: 0.2s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: 0.2s; }
.switch input:checked + .track { background: linear-gradient(135deg, var(--cyan), var(--violet)); }
.switch input:checked + .track::after { left: 21px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { display: inline-flex; }
.chip-check input { display: none; }
.chip-check span {
  padding: 7px 13px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); color: var(--muted); transition: 0.15s;
}
.chip-check input:checked + span { color: var(--gold-2); border-color: var(--border-strong); background: rgba(212, 175, 55, 0.1); }

/* ----------------------------- TABLE ---------------------------- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(34, 211, 238, 0.03); }

/* ----------------------------- RULES ---------------------------- */
.rule-card { display: flex; flex-direction: column; gap: 14px; transition: border-color 0.2s, transform 0.2s; }
.rule-card:hover { border-color: rgba(34, 211, 238, 0.3); transform: translateY(-2px); }
.rule-card.off { opacity: 0.6; }
.rule-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rule-top h3 { font-size: 15px; }
.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flow .arrow { color: var(--gold); font-weight: 700; }
.rule-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; gap: 10px; flex-wrap: wrap; }
.rule-actions { display: flex; gap: 6px; }

/* --------------------------- PICKER LIST ------------------------ */
.picker { border: 1px solid var(--border); border-radius: 12px; max-height: 260px; overflow-y: auto; background: rgba(5, 11, 24, 0.5); }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: rgba(34, 211, 238, 0.06); }
.picker-item.selected { background: rgba(212, 175, 55, 0.1); }
.picker-item .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item input { accent-color: var(--gold); width: 16px; height: 16px; }
.picker-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 6px; padding: 4px; background: rgba(5, 11, 24, 0.6); border-radius: 12px; border: 1px solid var(--border); width: fit-content; margin-bottom: 12px; }
.tabs button { background: none; border: none; color: var(--muted); padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.tabs button.active { background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(34, 211, 238, 0.1)); color: var(--gold-2); }

/* ------------------------------ LOGS ---------------------------- */
.log-list { display: flex; flex-direction: column; gap: 2px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.log { display: flex; gap: 12px; padding: 9px 12px; border-radius: 10px; align-items: flex-start; }
.log:hover { background: rgba(255, 255, 255, 0.03); }
.log time { color: var(--muted); white-space: nowrap; }
.log .lvl { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; background: var(--muted); }
.log.success .lvl { background: var(--success); box-shadow: 0 0 8px var(--success); }
.log.error .lvl { background: var(--danger); }
.log.warn .lvl { background: var(--warn); }
.log.info .lvl { background: var(--cyan); }
.log .msg { word-break: break-word; }

/* --------------------------- CONNECTIONS ------------------------ */
.conn-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.conn-logo { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; }
.conn-logo svg { width: 28px; height: 28px; }
.conn-logo.tg { background: linear-gradient(135deg, #2aabee, #1e88d1); }
.conn-logo.wa { background: linear-gradient(135deg, #25d366, #128c7e); }
.qr-box { display: grid; place-items: center; padding: 18px; background: #fff; border-radius: 16px; width: fit-content; margin: 10px auto; box-shadow: 0 0 40px rgba(34, 211, 238, 0.3); }
.qr-box img { width: 240px; height: 240px; display: block; }
.steps { padding-left: 18px; color: var(--muted); font-size: 14px; }
.steps li { margin: 4px 0; }

/* ------------------------------ MODAL --------------------------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(2, 6, 14, 0.75); backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto;
  animation: fade 0.15s ease;
}
.modal { width: 100%; max-width: 760px; background: var(--card-solid); border: 1px solid var(--border-strong); border-radius: 20px; box-shadow: var(--shadow); animation: up 0.2s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }
.form-section { font-family: 'Orbitron', sans-serif; font-size: 12px; letter-spacing: 2px; color: var(--cyan); text-transform: uppercase; margin: 20px 0 12px; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.form-section:first-child { margin-top: 0; }

/* ------------------------------ TOAST --------------------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  min-width: 260px; max-width: 380px; padding: 13px 16px; border-radius: 12px;
  background: var(--card-solid); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 14px; display: flex; gap: 10px; align-items: flex-start; animation: up 0.2s ease;
}
.toast.ok { border-left: 4px solid var(--success); }
.toast.err { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--cyan); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg { width: 56px; height: 56px; color: var(--gold); opacity: 0.7; margin-bottom: 12px; }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 16px; }
.banner-alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 18px; border: 1px solid rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.08); color: var(--warn); font-weight: 500; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar div { width: 100%; max-width: 42px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--cyan), var(--violet)); min-height: 4px; box-shadow: var(--glow); }
.chart .bar span { font-size: 11px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 35; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

/* --------------------------- RESPONSIVO ------------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .main { margin-left: 0; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 17px; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .status-pills .pill .txt { display: none; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat .value { font-size: 24px; }
  .card { padding: 16px; }
  .modal-bg { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .toasts { left: 12px; right: 12px; }
  .toast { max-width: none; }
}

/* ------------------------------ LOGIN --------------------------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(5, 11, 24, 0.2), rgba(5, 11, 24, 0.85)), url('/img/banner.jpg') left center/cover;
  display: flex; align-items: flex-end; padding: 48px;
  border-right: 1px solid var(--border-strong);
}
.login-art h2 { font-size: 30px; line-height: 1.25; max-width: 460px; }
.login-art p { color: var(--muted); margin-top: 12px; max-width: 440px; }
.login-box { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .logo { width: 84px; height: 84px; border-radius: 22px; display: block; margin: 0 auto 18px; box-shadow: 0 0 40px rgba(34, 211, 238, 0.35); }
.login-card h1 { text-align: center; font-size: 22px; color: var(--gold-2); }
.login-card .tag { text-align: center; color: var(--cyan); letter-spacing: 5px; font-size: 11px; font-family: 'Orbitron', sans-serif; margin-bottom: 26px; }
.pass-wrap { position: relative; }
.pass-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; }
.secure-note { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.error-msg { color: var(--danger); font-size: 14px; min-height: 20px; margin-bottom: 8px; text-align: center; }
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
