*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #6366f1; --primary-hover: #818cf8;
  --bg: #0f172a; --bg-card: #1e293b; --bg-input: #334155;
  --text: #e2e8f0; --text-muted: #94a3b8;
  --success: #22c55e; --danger: #ef4444; --warning: #f59e0b;
  --radius: 12px; --shadow: 0 4px 24px rgba(0,0,0,0.3);
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; border: none; font: inherit; }
input, textarea, select {
  background: var(--bg-input); color: var(--text); border: 1px solid #475569;
  border-radius: 8px; padding: 10px 14px; font: inherit; width: 100%;
  transition: border-color .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px; font-weight: 600;
  transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-sm { padding: 6px 14px; font-size: .875rem; }

.card { background: var(--bg-card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-online { background: rgba(34,197,94,.15); color: var(--success); }
.badge-offline { background: rgba(148,163,184,.15); color: var(--text-muted); }
.badge-expired { background: rgba(239,68,68,.15); color: var(--danger); }

/* Nav */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 32px; background: rgba(15,23,42,.9); backdrop-filter: blur(10px); border-bottom: 1px solid #1e293b; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.nav-links { display: flex; gap: 16px; align-items: center; }

/* Hero */
.hero { text-align: center; padding: 80px 24px 60px; }
.hero h1 { font-size: 2.5rem; margin-bottom: 16px; }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto 32px; }

/* Auth forms */
.auth-container { max-width: 400px; margin: 0 auto; padding: 24px; }
.auth-container .card { display: flex; flex-direction: column; gap: 16px; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 8px; }
.auth-tabs button { flex: 1; padding: 10px; background: transparent; color: var(--text-muted); border-bottom: 2px solid transparent; }
.auth-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .875rem; color: var(--text-muted); }

/* Dashboard layout */
.dashboard { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 65px); }
.sidebar { background: var(--bg-card); padding: 24px 16px; border-right: 1px solid #334155; }
.sidebar-item { display: block; padding: 10px 16px; border-radius: 8px; color: var(--text-muted); margin-bottom: 4px; transition: all .2s; }
.sidebar-item:hover, .sidebar-item.active { background: rgba(99,102,241,.1); color: var(--primary); }
.main-content { padding: 32px; overflow-y: auto; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.section-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 20px; }

/* Bot card */
.bot-card { display: flex; flex-direction: column; gap: 12px; }
.bot-card-header { display: flex; justify-content: space-between; align-items: center; }
.bot-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* QR code */
.qr-container { text-align: center; padding: 20px; }
.qr-container img { max-width: 256px; border-radius: 8px; background: #fff; padding: 8px; }
.qr-status { margin-top: 12px; color: var(--text-muted); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #334155; font-size: .875rem; }
th { color: var(--text-muted); font-weight: 600; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--bg-card); border-radius: var(--radius); padding: 32px; max-width: 480px; width: 90%; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* Toast */
.toast { position: fixed; top: 80px; right: 24px; padding: 12px 20px; border-radius: 8px; color: #fff; font-weight: 500; z-index: 300; animation: slideIn .3s; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Responsive */
@media (max-width: 768px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .hero h1 { font-size: 1.75rem; }
  .nav { padding: 12px 16px; }
  .main-content { padding: 16px; }
}

/* Toggle switch */
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #475569; border-radius: 24px; cursor: pointer; transition: .3s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.hidden { display: none !important; }

/* Plugin Store */
.plugin-store-hero { text-align: center; padding: 60px 24px 40px; }
.plugin-store-hero h1 { font-size: 2rem; margin-bottom: 12px; }
.plugin-store-hero h1 span { color: var(--primary); }
.plugin-store-hero p { color: var(--text-muted); margin-bottom: 24px; }
.plugin-search-bar { max-width: 480px; margin: 0 auto; }
.plugin-search-bar input { padding: 12px 20px; font-size: 1rem; border-radius: 24px; }
.plugin-store-container { max-width: 1100px; margin: 0 auto; padding: 0 24px 60px; }
.plugin-categories { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.plugin-cat-btn { padding: 8px 18px; border-radius: 20px; background: var(--bg-card); color: var(--text-muted); border: 1px solid #334155; font-size: .875rem; transition: all .2s; }
.plugin-cat-btn:hover, .plugin-cat-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.plugin-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; gap: 16px; cursor: pointer; transition: transform .2s, box-shadow .2s; border: 1px solid transparent; }
.plugin-card:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 8px 32px rgba(99,102,241,.15); }
.plugin-card-icon { font-size: 2.5rem; flex-shrink: 0; }
.plugin-card-body { flex: 1; min-width: 0; }
.plugin-card-name { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.plugin-card-desc { font-size: .85rem; color: var(--text-muted); margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plugin-card-meta { display: flex; gap: 12px; font-size: .75rem; color: var(--text-muted); }
.plugin-cat-tag { background: rgba(99,102,241,.15); color: var(--primary); padding: 2px 8px; border-radius: 10px; }

/* Dashboard plugin cards */
.plugin-installed-card { margin-bottom: 12px; }
.plugin-installed-header { display: flex; align-items: center; gap: 12px; }
.plugin-installed-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.plugin-install-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #334155; }

/* Plugin source tabs */
.plugin-source-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #334155; }
.plugin-source-btn { padding: 10px 20px; background: transparent; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: .9rem; transition: all .2s; }
.plugin-source-btn:hover, .plugin-source-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
