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


/* ═══════════════════════════════════════════════════════════════════════════
   X AUTOMATION — Modern Glass Dashboard v2
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* ── Theme Variables ────────────────────────────────────────── */
:root {
  --bg-root:        #05070d;
  --bg-layer:       #0a0e17;
  --bg-surface:     #111827;
  --bg-card:        #151d2e;
  --bg-glass:       rgba(21, 29, 46, 0.7);
  --bg-hover:       #1a2540;
  --bg-input:       #0d1320;

  --border:         #1e2d47;
  --border-light:   #263654;
  --border-accent:  rgba(99, 102, 241, 0.3);

  --accent:         #6366f1;
  --accent-2:       #8b5cf6;
  --accent-glow:    rgba(99, 102, 241, 0.15);
  --accent-strong:  #818cf8;

  --cyan:           #22d3ee;
  --green:          #10b981;
  --green-soft:     #34d399;
  --yellow:         #f59e0b;
  --red:            #ef4444;
  --orange:         #f97316;
  --pink:           #ec4899;

  --text:           #e2e8f0;
  --text-dim:       #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #0f172a;

  --radius-sm:      8px;
  --radius:         14px;
  --radius-lg:      20px;
  --radius-xl:      24px;

  --shadow-sm:      0 1px 2px rgba(0,0,0,0.3);
  --shadow:         0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow:    0 0 30px var(--accent-glow);
  --shadow-green:   0 0 20px rgba(16, 185, 129, 0.15);

  --transition:     0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  --sidebar-w:      260px;
  --header-h:       0px;
}
[data-theme="light"] {
  --bg-root:        #f1f5f9;
  --bg-layer:       #f8fafc;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-glass:       rgba(255, 255, 255, 0.8);
  --bg-hover:       #f1f5f9;
  --bg-input:       #f8fafc;

  --border:         #e2e8f0;
  --border-light:   #cbd5e1;
  --border-accent:  rgba(99, 102, 241, 0.2);

  --text:           #0f172a;
  --text-dim:       #475569;
  --text-muted:     #94a3b8;

  --shadow-sm:      0 1px 2px rgba(0,0,0,0.05);
  --shadow:         0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:      0 8px 24px rgba(0,0,0,0.08);
  --shadow-glow:    0 0 20px rgba(99, 102, 241, 0.1);
  --shadow-green:   0 0 16px rgba(16, 185, 129, 0.1);
}
/* ── Base ──────────────────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-root);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-slow), color var(--transition-slow);
}
/* Subtle background mesh */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 50% 50%, rgba(34, 211, 238, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99, 102, 241, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.03) 0%, transparent 60%);
}
/* ── Layout ────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }
/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo h1 { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; margin-top: 6px; }
.logo-badge { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; margin: 1px 12px 1px 0;
  color: var(--text-dim); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  border-radius: 0 10px 10px 0;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}
.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active {
  background: var(--accent-glow);
  border-left-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}
[data-theme="light"] .nav-link.active {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}
.nav-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex-shrink: 0;
  transition: color var(--transition);
}
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.logout-btn, .theme-toggle {
  width: 100%; padding: 8px 12px; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-dim); cursor: pointer; font-size: 13px; font-family: inherit;
  transition: all var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); background: rgba(239, 68, 68, 0.05); }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-strong); }
/* ── Page Header ───────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h2 {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text), var(--text-dim));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-header p { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; }
/* ── Glass Card ────────────────────────────────────────────── */
.card, .stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.card { padding: 24px; }
.card:hover { border-color: var(--border-light); box-shadow: var(--shadow); }
/* ── Stat Cards Grid ───────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
  cursor: default;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 20px; right: 20px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.7;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--border-accent);
}
.stat-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 34px; font-weight: 900; letter-spacing: -1.5px;
  background: linear-gradient(135deg, var(--text), var(--accent-strong));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-sub {
  font-size: 12px; color: var(--text-dim); margin-top: 4px;
}
.stat-icon {
  position: absolute; right: 16px; top: 16px;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
}
/* ── Table (Modern) ────────────────────────────────────────── */
.table-wrap {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead { background: rgba(0,0,0,0.2); }
[data-theme="light"] thead { background: var(--bg-hover); }
th {
  padding: 12px 16px; text-align: left;
  font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); font-weight: 700;
}
td {
  padding: 12px 16px; font-size: 13.5px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr { transition: all var(--transition); }
tbody tr:hover { background: var(--bg-hover); }
/* ── Badges (pill style) ───────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
  transition: all var(--transition);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-draft      { background: rgba(245, 158, 11, 0.1); color: var(--yellow); }
.badge-draft::before      { background: var(--yellow); }
.badge-approved   { background: rgba(99, 102, 241, 0.1); color: var(--accent-strong); }
.badge-approved::before   { background: var(--accent); }
.badge-posted, .badge-replied, .badge-success, .badge-active, .badge-consumed
                  { background: rgba(16, 185, 129, 0.1); color: var(--green); }
.badge-posted::before, .badge-replied::before, .badge-success::before, .badge-active::before, .badge-consumed::before
                  { background: var(--green); }
.badge-failed, .badge-error, .badge-rejected, .badge-blocked
                  { background: rgba(239, 68, 68, 0.1); color: var(--red); }
.badge-failed::before, .badge-error::before, .badge-rejected::before, .badge-blocked::before
                  { background: var(--red); }
.badge-new        { background: rgba(148, 163, 184, 0.1); color: var(--text-dim); }
.badge-new::before        { background: var(--text-dim); }
.badge-inactive   { background: rgba(100, 116, 139, 0.08); color: var(--text-muted); }
.badge-inactive::before   { background: var(--text-muted); }
.badge-token      { background: rgba(34, 211, 238, 0.1); color: var(--cyan); }
.badge-token::before      { background: var(--cyan); }
/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  transition: all var(--transition); text-decoration: none; white-space: nowrap;
  font-family: inherit; position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
  opacity: 0; transition: opacity var(--transition);
}
.btn:hover::after { opacity: 1; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; border-color: transparent;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-ghost   { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-glow); }
.btn-danger  { background: transparent; color: var(--red); border-color: rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.08); border-color: var(--red); }
.btn-success { background: transparent; color: var(--green); border-color: rgba(16, 185, 129, 0.2); }
.btn-success:hover { background: rgba(16, 185, 129, 0.08); border-color: var(--green); }
.btn-warn    { background: transparent; color: var(--yellow); border-color: rgba(245, 158, 11, 0.2); }
.btn-warn:hover { background: rgba(245, 158, 11, 0.08); border-color: var(--yellow); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 10px 22px; font-size: 15px; border-radius: var(--radius); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-family: inherit;
  transition: all var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-glass);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl); padding: 28px;
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: slideUp 0.25s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 22px; transition: color var(--transition); }
.modal-close:hover { color: var(--text); }
.modal-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); justify-content: flex-end; }
/* ── Login ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 20% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 60%);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-glass);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl); padding: 40px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), 0 0 60px var(--accent-glow);
  position: relative; z-index: 1;
}
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 36px; }
.login-logo h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
/* ── Filters Bar ───────────────────────────────────────────── */
.filters {
  display: flex; gap: 10px; margin-bottom: 20px;
  flex-wrap: wrap; align-items: center;
}
.filters .form-select { width: auto; min-width: 140px; }
.filters .form-input  { width: auto; min-width: 160px; }
/* ── Alerts / Toasts ───────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  backdrop-filter: blur(10px);
}
.alert-error   { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2); color: var(--red); }
.alert-success { background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.2); color: var(--green); }
.alert-info    { background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.2); color: var(--accent-strong); }
/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  background: var(--bg-glass); border: 1px dashed var(--border);
  border-radius: var(--radius-lg); backdrop-filter: blur(20px);
}
.empty-state span { font-size: 48px; display: block; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 15px; color: var(--text-dim); }
.empty-state p + p { margin-top: 6px; font-size: 13px; color: var(--text-muted); }
/* ── Loading ───────────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 64px; color: var(--text-dim); gap: 12px; font-size: 14px;
}
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
/* ── Tweet Preview ─────────────────────────────────────────── */
.x-tweet-preview {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px;
  font-family: -apple-system, 'TwitterChirp', system-ui, sans-serif;
}
[data-theme="light"] .x-tweet-preview { background: #fff; }
.x-tweet-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.x-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: white; flex-shrink: 0;
}
.x-name { font-weight: 700; font-size: 15px; }
.x-handle { font-size: 13px; color: var(--text-muted); }
.x-tweet-body { font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.x-tweet-footer { display: flex; gap: 20px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.x-action { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 13px; }
.x-tweet-image-wrap { margin: 10px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.x-tweet-image { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.x-image-credit {
  position: absolute; bottom: 0; right: 0;
  background: rgba(0,0,0,0.5); color: rgba(255,255,255,0.8);
  font-size: 10px; padding: 3px 7px; border-top-left-radius: 8px;
}
/* ── Section Headers ───────────────────────────────────────── */
.section-title {
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
/* ── Action Strip ──────────────────────────────────────────── */
.action-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.cell-truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ── Chart ─────────────────────────────────────────────────── */
.chart-bars {
  display: flex; align-items: flex-end; gap: 10px;
  height: 130px; padding: 0 0 28px;
}
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart-bar {
  width: 100%; border-radius: 6px 6px 0 0; min-height: 4px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), filter var(--transition);
}
.chart-bar:hover { filter: brightness(1.3); box-shadow: 0 0 12px var(--accent-glow); }
.chart-bar-label { font-size: 10px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-header h2 { font-size: 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 26px; }
  .stat-icon { width: 34px; height: 34px; font-size: 18px; }

  .card { padding: 16px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  .filters { flex-direction: column; align-items: stretch; }
  .filters .form-select, .filters .form-input { width: 100% !important; min-width: 0; }

  .btn { padding: 10px 16px; min-height: 42px; }
  .btn-sm { padding: 8px 12px; min-height: 36px; }
  .nav-link { padding: 12px 20px; font-size: 15px; }
  .modal { margin: 12px; max-width: calc(100vw - 24px); padding: 20px; }
  .login-card { margin: 0 16px; padding: 28px 20px; }
}
@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
}
@supports (height: 100dvh) {
  .app-layout, .login-page { min-height: 100dvh; }
}
