:root {
  --bg: #0a0e1a; --bg-card: #131829; --bg-elevated: #1a2035; --bg-hover: #222a45;
  --border: #2a3354; --border-light: #364070;
  --text: #e8ecf5; --text-secondary: #8b95b5; --text-muted: #5a6585;
  --primary: #00d9a3; --primary-hover: #00f5b8; --primary-glow: rgba(0, 217, 163, 0.15);
  --secondary: #3b82f6; --accent: #f59e0b; --success: #10b981; --warning: #f59e0b;
  --error: #ef4444; --info: #3b82f6; --teal: #14b8a6; --rose: #f43f5e; --amber: #f59e0b;
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 24px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4); --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
  --font-heading: 'Space Grotesk', sans-serif; --font-body: 'Inter', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }
body::before { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse 800px 600px at 20% 0%, rgba(0,217,163,0.08), transparent), radial-gradient(ellipse 600px 400px at 80% 100%, rgba(59,130,246,0.06), transparent); pointer-events: none; z-index: 0; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); font-weight: 600; }
code,pre { font-family: 'SF Mono','Fira Code',monospace; }
a { color: inherit; text-decoration: none; }

/* Auth */
.auth-wrapper { display: grid; grid-template-columns: 1fr 1fr; max-width: 1000px; width: 100%; background: var(--bg-card); border-radius: var(--radius-xl); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-lg); position: relative; z-index: 1; margin: 2rem auto; }
.auth-left { background: linear-gradient(135deg, #0d4a3a 0%, #0a2e23 100%); padding: 3rem; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.auth-left::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(0,217,163,0.1), transparent 50%); animation: float 8s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-20px,-20px) scale(1.05); } }
.auth-brand { position: relative; z-index: 1; text-align: center; }
.auth-logo { width: 80px; height: 80px; margin: 0 auto 1.5rem; background: rgba(0,217,163,0.1); border: 1px solid rgba(0,217,163,0.3); border-radius: 20px; display: flex; align-items: center; justify-content: center; color: var(--primary); animation: morphPulse 4s ease-in-out infinite; }
@keyframes morphPulse { 0%,100% { border-radius: 20px; transform: rotate(0deg); } 50% { border-radius: 30px; transform: rotate(3deg); } }
.auth-brand h1 { font-size: 2rem; margin-bottom: 0.5rem; color: #fff; }
.auth-brand p { color: rgba(255,255,255,0.7); font-size: 0.95rem; }
.auth-features { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 2rem; }
.feature-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.9rem; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); border-radius: 100px; font-size: 0.8rem; color: rgba(255,255,255,0.85); transition: var(--transition); }
.feature-pill:hover { background: rgba(255,255,255,0.15); }
.auth-right { padding: 3rem; display: flex; align-items: center; }
.auth-form-wrapper { width: 100%; }
.auth-form-header h2 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.auth-form-header p { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.95rem; }
.auth-footer-text { text-align: center; margin-top: 1.5rem; color: var(--text-secondary); font-size: 0.9rem; }
.auth-footer-text a { color: var(--primary); font-weight: 500; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.form-options { display: flex; align-items: center; justify-content: space-between; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; }
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--primary); }
.link-muted { color: var(--text-muted); font-size: 0.85rem; }
.link-muted:hover { color: var(--text); }

/* Form */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea { padding: 0.75rem 1rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-body); font-size: 0.95rem; transition: var(--transition); outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper svg { position: absolute; left: 0.75rem; color: var(--text-muted); pointer-events: none; }
.input-wrapper input { padding-left: 2.5rem; width: 100%; }
.modal-form { display: flex; flex-direction: column; gap: 1rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.4rem; border: none; border-radius: var(--radius-sm); font-family: var(--font-body); font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: var(--transition); white-space: nowrap; text-decoration: none; position: relative; overflow: hidden; }
.btn-primary { background: var(--primary); color: #001a13; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 16px var(--primary-glow); }
.btn-primary:active { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--error); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success { background: var(--success); color: #001a13; }
.btn-success:hover { filter: brightness(1.1); }
.btn-warning { background: var(--warning); color: #1a1100; }
.btn-warning:hover { filter: brightness(1.1); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-icon.btn-danger:hover { color: var(--error); border-color: var(--error); }

/* Alerts */
.alert { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 1rem; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar { width: 260px; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.sidebar-overlay.active { display: block; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; color: var(--primary); }
.sidebar-logo-text { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; color: var(--text); }
.sidebar-logo-text .version { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }
.sidebar-nav { flex: 1; padding: 1rem; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; margin-bottom: 0.3rem; transition: var(--transition); position: relative; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--primary-glow); color: var(--primary); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 60%; background: var(--primary); border-radius: 0 3px 3px 0; }
.nav-badge { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: var(--error); color: #fff; font-size: 0.65rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 100px; min-width: 18px; text-align: center; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 0.75rem; }
.user-avatar { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0; }
.user-details { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); transition: var(--transition); flex-shrink: 0; }
.logout-btn:hover { color: var(--error); border-color: var(--error); }
.main-content { flex: 1; margin-left: 260px; min-height: 100vh; }
.mobile-menu-btn { display: none; position: fixed; top: 1rem; left: 1rem; z-index: 99; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem; color: var(--text); cursor: pointer; }
.content-area { padding: 2rem; max-width: 1400px; width: 100%; margin: 0 auto; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }
.page-title { font-size: 1.75rem; font-weight: 700; }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.3rem; }
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.breadcrumb a:hover { color: var(--primary); }
.action-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.card-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; transition: var(--transition); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: var(--radius-md) var(--radius-md) 0 0; }
.stat-teal::before { background: var(--teal); }
.stat-green::before { background: var(--success); }
.stat-amber::before { background: var(--amber); }
.stat-blue::before { background: var(--secondary); }
.stat-rose::before { background: var(--rose); }
.stat-card:hover { border-color: var(--border-light); box-shadow: var(--shadow); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-teal .stat-icon { background: rgba(20,184,166,0.1); color: var(--teal); }
.stat-green .stat-icon { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-amber .stat-icon { background: rgba(245,158,11,0.1); color: var(--amber); }
.stat-blue .stat-icon { background: rgba(59,130,246,0.1); color: var(--secondary); }
.stat-rose .stat-icon { background: rgba(244,63,94,0.1); color: var(--rose); }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-family: var(--font-heading); font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); }
.stat-trend { font-size: 0.75rem; font-weight: 600; margin-top: 0.2rem; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--error); }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 1.5rem; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); gap: 1rem; flex-wrap: wrap; }
.card-title { font-size: 1.1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.search-box { display: flex; align-items: center; gap: 0.5rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 1rem; flex: 1; min-width: 200px; }
.search-box input { background: transparent; border: none; color: var(--text); font-size: 0.9rem; outline: none; flex: 1; }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.form-select { padding: 0.5rem 1rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.85rem; outline: none; cursor: pointer; }

/* Table */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 0.75rem 1.5rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 0.85rem 1.5rem; font-size: 0.9rem; border-bottom: 1px solid var(--border); color: var(--text); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-hover); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-name { display: flex; align-items: center; gap: 0.5rem; }
.cell-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; color: #fff; flex-shrink: 0; }

/* Status badges */
.status-badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.65rem; border-radius: 100px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.status-badge .status-dot { width: 8px; height: 8px; border-radius: 50; }
.status-connected { background: rgba(16,185,129,0.1); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.status-connected .status-dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-disconnected { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.status-disconnected .status-dot { background: var(--error); box-shadow: 0 0 8px var(--error); }
.status-connecting { background: rgba(245,158,11,0.1); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }
.status-connecting .status-dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: pulse 1s ease-in-out infinite; }
.status-pending { background: rgba(245,158,11,0.1); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }
.status-pending .status-dot { background: var(--amber); }
.status-sent { background: rgba(16,185,129,0.1); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.status-failed { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.status-cancelled { background: rgba(139,149,181,0.1); color: var(--text-secondary); border: 1px solid rgba(139,149,181,0.2); }
.status-running { background: rgba(59,130,246,0.1); color: #93c5fd; border: 1px solid rgba(59,130,246,0.2); }
.status-running .status-dot { background: var(--secondary); animation: pulse 1s ease-in-out infinite; }
.status-paused { background: rgba(245,158,11,0.1); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }
.status-completed { background: rgba(16,185,129,0.1); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.status-partial { background: rgba(245,158,11,0.1); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }
.status-logged_out { background: rgba(139,149,181,0.1); color: var(--text-secondary); border: 1px solid rgba(139,149,181,0.2); }
.status-logged_out .status-dot { background: var(--text-muted); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.65rem; border-radius: 100px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: rgba(16,185,129,0.1); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.badge-blue { background: rgba(59,130,246,0.1); color: #93c5fd; border: 1px solid rgba(59,130,246,0.2); }
.badge-gray { background: rgba(139,149,181,0.1); color: var(--text-secondary); border: 1px solid rgba(139,149,181,0.2); }
.badge-red { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.badge-amber { background: rgba(245,158,11,0.1); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }
.badge-info { background: rgba(59,130,246,0.1); color: #93c5fd; border: 1px solid rgba(59,130,246,0.2); }
.badge-ai { background: linear-gradient(135deg, rgba(0,217,163,0.15), rgba(59,130,246,0.15)); color: var(--primary); border: 1px solid rgba(0,217,163,0.3); }

/* Toggle */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 24px; transition: var(--transition); }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 2px; top: 2px; background: var(--text-muted); border-radius: 50%; transition: var(--transition); }
.toggle input:checked + .toggle-slider { background: var(--primary-glow); border-color: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--primary); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 200; padding: 1rem; }
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes modalIn { from { opacity: 0; transform: scale(0.92) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-header h2, .modal-header h3 { font-size: 1.15rem; }
.modal-close { width: 32px; height: 32px; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; border-radius: var(--radius-sm); transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer { display: flex; gap: 0.5rem; justify-content: flex-end; padding-top: 1rem; }

/* Tabs */
.tabs { display: flex; gap: 0.5rem; }
.tab, .tab-btn { padding: 0.6rem 1.2rem; background: transparent; border: none; color: var(--text-secondary); font-family: var(--font-body); font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: var(--transition); border-radius: var(--radius-sm); border: 1px solid transparent; }
.tab.active, .tab-btn.active { color: var(--primary); background: var(--primary-glow); border-color: rgba(0,217,163,0.2); }
.tab:hover, .tab-btn:hover { color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* QR */
.qr-wrapper, .qr-container { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.qr-display { width: 300px; height: 300px; background: #fff; border-radius: 0; display: flex; align-items: center; justify-content: center; padding: 0; overflow: hidden; }
.qr-display img { width: 300px; height: 300px; border-radius: 0; display: block; image-rendering: pixelated; }
.qr-hint, .qr-info p { color: var(--text-secondary); font-size: 0.9rem; }
.qr-timer { color: var(--text-muted); font-size: 0.85rem; }
.pairing-wrapper, .pairing-container { max-width: 500px; margin: 0 auto; }
.pairing-code-display { background: var(--bg-elevated); border: 1px solid var(--primary); border-radius: var(--radius-md); padding: 1.5rem 2rem; margin: 1rem 0; text-align: center; }
.pairing-code { font-family: var(--font-heading); font-size: 2.5rem; font-weight: 700; color: var(--primary); letter-spacing: 0.3em; }
.pairing-countdown { font-size: 0.9rem; color: var(--text-secondary); margin-top: 0.5rem; }
.pairing-result { text-align: center; margin-top: 1.5rem; }

/* Connected banner */
.connected-banner { display: flex; align-items: center; gap: 1rem; background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(20,184,166,0.05)); border: 1px solid rgba(16,185,129,0.3); border-radius: var(--radius-md); padding: 1.5rem; margin-bottom: 1.5rem; }
.connected-banner svg { color: var(--success); flex-shrink: 0; }
.connected-banner strong { display: block; margin-bottom: 0.2rem; }
.connected-banner p { color: var(--text-secondary); font-size: 0.9rem; }

/* Info grid */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.info-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; }
.info-item .info-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }
.info-item .info-value { font-size: 0.95rem; font-weight: 500; }

/* Progress */
.progress-bar-wrapper { position: relative; width: 100%; height: 20px; background: var(--bg-elevated); border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--teal)); border-radius: 10px; transition: width 0.3s ease; }
.progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 0.75rem; font-weight: 600; color: var(--text); }
.progress-bar-wrapper .progress-bar { width: 0; }

/* Toast */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 300; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.75rem 1.25rem; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1); max-width: 350px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--error); }
.toast-info { border-color: var(--secondary); }

/* Charts */
.chart-container { position: relative; height: 250px; margin-top: 1rem; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }

/* Filter */
.filter-bar, .filter-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.filter-btn { padding: 0.4rem 0.9rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; transition: var(--transition); }
.filter-btn:hover { background: var(--bg-hover); color: var(--text); }
.filter-btn.active { background: var(--primary-glow); color: var(--primary); border-color: var(--primary); }

/* Notifications */
.notification-list { display: flex; flex-direction: column; }
.notification-item { display: flex; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); transition: var(--transition); }
.notification-item:hover { background: var(--bg-hover); }
.notification-item.unread { background: rgba(0,217,163,0.03); }
.notif-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-icon-success, .notif-icon-broadcast_success, .notif-icon-scheduler_success { background: rgba(16,185,129,0.1); color: var(--success); }
.notif-icon-error, .notif-icon-broadcast_failed, .notif-icon-scheduler_failed { background: rgba(239,68,68,0.1); color: var(--error); }
.notif-icon-warning, .notif-icon-auto_reply_error { background: rgba(245,158,11,0.1); color: var(--amber); }
.notif-icon-info, .notif-icon-session_disconnect { background: rgba(59,130,246,0.1); color: var(--secondary); }
.notif-content { flex: 1; }
.notif-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.notif-message { font-size: 0.85rem; color: var(--text-secondary); }
.notif-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.notif-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 0.5rem; }

/* Logs */
.log-table th, .log-table td { font-size: 0.85rem; }
.log-time { white-space: nowrap; color: var(--text-muted); font-family: 'SF Mono', monospace; font-size: 0.8rem; }
.log-level { padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.log-level-info { background: rgba(59,130,246,0.1); color: #93c5fd; }
.log-level-warn { background: rgba(245,158,11,0.1); color: #fcd34d; }
.log-level-error { background: rgba(239,68,68,0.1); color: #fca5a5; }
.log-level-debug { background: rgba(139,149,181,0.1); color: var(--text-secondary); }
.log-message { max-width: 400px; overflow: hidden; text-overflow: ellipsis; }

/* API Keys */
.api-key-display { font-family: 'SF Mono', monospace; font-size: 0.85rem; color: var(--primary); background: rgba(0,217,163,0.05); padding: 0.2rem 0.5rem; border-radius: 4px; }

/* Settings */
.settings-form { max-width: 800px; }
.form-actions { display: flex; gap: 0.5rem; padding-top: 1rem; }

/* Backup */
.backup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.backup-card { text-align: center; }
.backup-card .card-body { padding: 2rem; }
.backup-icon { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.backup-icon-teal { background: rgba(20,184,166,0.1); color: var(--teal); }
.backup-icon-amber { background: rgba(245,158,11,0.1); color: var(--amber); }
.backup-icon-blue { background: rgba(59,130,246,0.1); color: var(--secondary); }
.backup-icon-rose { background: rgba(244,63,94,0.1); color: var(--rose); }
.backup-card h3 { margin-bottom: 0.5rem; }
.backup-card p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.5rem; }
.file-upload-wrapper { position: relative; margin-bottom: 1rem; }
.file-upload-wrapper input[type="file"] { position: absolute; width: 0; height: 0; opacity: 0; }
.file-name { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }

/* Error page */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; }
.error-container { text-align: center; max-width: 500px; }
.error-icon { color: var(--text-muted); margin-bottom: 1rem; }
.error-code { font-size: 5rem; font-weight: 700; color: var(--primary); }
.error-title { font-size: 1.5rem; margin-bottom: 0.5rem; }
.error-message { color: var(--text-secondary); margin-bottom: 2rem; }
.error-actions { display: flex; gap: 1rem; justify-content: center; }

/* Empty state */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; color: var(--text-muted); }
.empty-state svg { color: var(--text-muted); margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 1024px) { .charts-grid, .card-grid { grid-template-columns: 1fr; } .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) {
  .auth-wrapper { grid-template-columns: 1fr; margin: 1rem; }
  .auth-left { display: none; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: block; }
  .content-area { padding: 1rem; padding-top: 3.5rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 1.4rem; }
  .form-row { flex-direction: column; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) { .stat-grid { grid-template-columns: 1fr; } .page-header { flex-direction: column; align-items: flex-start; } .info-grid { grid-template-columns: 1fr; } .qr-display, .qr-display img { width: 240px; height: 240px; } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Language switcher */
.lang-switcher { position: relative; }
.lang-btn { display: flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.8rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.8rem; cursor: pointer; transition: var(--transition); }
.lang-btn:hover { background: var(--bg-hover); color: var(--text); }
.lang-dropdown { display: none; position: absolute; bottom: 100%; left: 0; margin-bottom: 0.5rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); min-width: 160px; z-index: 150; overflow: hidden; }
.lang-dropdown.open { display: block; }
.lang-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem; color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; transition: var(--transition); }
.lang-option:hover { background: var(--bg-hover); color: var(--text); }
.lang-option.active { color: var(--primary); background: var(--primary-glow); }
.lang-flag { font-size: 1.1rem; }

/* AI settings */
.ai-settings { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.5rem; margin-bottom: 1.5rem; }
.ai-settings h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--primary); }
.ai-settings .form-group { margin-bottom: 1rem; }
.ai-badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border-radius: 100px; font-size: 0.7rem; font-weight: 600; background: linear-gradient(135deg, rgba(0,217,163,0.15), rgba(59,130,246,0.15)); color: var(--primary); border: 1px solid rgba(0,217,163,0.3); }

/* Morph animations - super lightweight, GPU-accelerated only */

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

