/* ══════════════════════════════════════════════════
   SentiMeter — style.css
   Professional Dual-Theme Design System
   ══════════════════════════════════════════════════ */

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

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 14px;
}

/* ══════════════════════════════════════════════════
   THEME TOKENS — DARK (default)
   ══════════════════════════════════════════════════ */
:root {
  /* Surfaces */
  --bg: #09090b;
  --bg-raised: #0f1015;
  --bg-card: #14151b;
  --bg-card2: #1a1c25;
  --bg-input: #1a1c25;

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-s: rgba(255, 255, 255, 0.04);
  --border-focus: rgba(108, 143, 255, 0.5);

  /* Text */
  --tx1: #f1f3f9;
  --tx2: #92a0b8;
  --tx3: #4a5568;
  --tx-inv: #09090b;

  /* Accent */
  --acc: #6c8fff;
  --acc-h: #567af5;
  --acc-d: rgba(108, 143, 255, 0.1);
  --acc-d2: rgba(108, 143, 255, 0.18);

  /* Sentiment */
  --pos: #34d399;
  --pos-d: rgba(52, 211, 153, 0.1);
  --neg: #f87171;
  --neg-d: rgba(248, 113, 113, 0.1);
  --neu: #fbbf24;
  --neu-d: rgba(251, 191, 36, 0.1);

  /* Extra palette */
  --pur: #a78bfa;
  --pur-d: rgba(167, 139, 250, 0.1);
  --cya: #38bdf8;
  --cya-d: rgba(56, 189, 248, 0.1);
  --pin: #f472b6;
  --pin-d: rgba(244, 114, 182, 0.1);
  --ora: #fb923c;
  --ora-d: rgba(251, 146, 60, 0.1);

  /* Sidebar */
  --sidebar-w: 232px;
  --sidebar-bg: #0c0d13;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --nav-active-bg: rgba(108, 143, 255, 0.12);
  --nav-active-tx: #6c8fff;
  --nav-hover-bg: rgba(255, 255, 255, 0.04);

  /* Topbar */
  --topbar-bg: rgba(9, 9, 11, 0.82);

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.035);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-glow: 0 0 0 3px rgba(108, 143, 255, 0.15);

  /* Radius */
  --r1: 6px;
  --r2: 10px;
  --r3: 14px;
  --r4: 20px;

  /* Font */
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /* Transitions */
  --t-fast: 120ms ease;
  --t-normal: 200ms ease;
  --t-slow: 350ms ease;

  /* Scrollbar */
  --sb-track: transparent;
  --sb-thumb: rgba(255, 255, 255, 0.09);
  --sb-thumb-h: rgba(255, 255, 255, 0.18);
}

/* ══════════════════════════════════════════════════
   THEME TOKENS — LIGHT
   ══════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg: #f8f9fc;
  --bg-raised: #ffffff;
  --bg-card: #ffffff;
  --bg-card2: #f1f4fa;
  --bg-input: #f1f4fa;

  --border: rgba(0, 0, 0, 0.08);
  --border-s: rgba(0, 0, 0, 0.05);
  --border-focus: rgba(79, 116, 255, 0.5);

  --tx1: #0f1117;
  --tx2: #4a5568;
  --tx3: #9aa3b2;
  --tx-inv: #ffffff;

  --acc: #4f74ff;
  --acc-h: #3b5df5;
  --acc-d: rgba(79, 116, 255, 0.08);
  --acc-d2: rgba(79, 116, 255, 0.15);

  --pos: #059669;
  --pos-d: rgba(5, 150, 105, 0.08);
  --neg: #dc2626;
  --neg-d: rgba(220, 38, 38, 0.08);
  --neu: #d97706;
  --neu-d: rgba(217, 119, 6, 0.08);

  --pur: #7c3aed;
  --pur-d: rgba(124, 58, 237, 0.08);
  --cya: #0284c7;
  --cya-d: rgba(2, 132, 199, 0.08);
  --pin: #db2777;
  --pin-d: rgba(219, 39, 119, 0.08);
  --ora: #ea580c;
  --ora-d: rgba(234, 88, 12, 0.08);

  --sidebar-w: 232px;
  --sidebar-bg: #ffffff;
  --sidebar-border: rgba(0, 0, 0, 0.08);
  --nav-active-bg: rgba(79, 116, 255, 0.08);
  --nav-active-tx: #4f74ff;
  --nav-hover-bg: rgba(0, 0, 0, 0.04);

  --topbar-bg: rgba(248, 249, 252, 0.88);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 0 3px rgba(79, 116, 255, 0.15);

  --sb-track: transparent;
  --sb-thumb: rgba(0, 0, 0, 0.09);
  --sb-thumb-h: rgba(0, 0, 0, 0.18);
}

/* ══════════════════════════════════════════════════
   BASE
   ══════════════════════════════════════════════════ */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--tx1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t-slow), color var(--t-slow);
  min-height: 100vh;
}

::selection {
  background: var(--acc-d2);
  color: var(--acc);
}

a {
  color: var(--acc);
  text-decoration: none;
}

a:hover {
  color: var(--acc-h);
}

code {
  font-size: 11.5px;
  background: var(--bg-card2);
  padding: 2px 7px;
  border-radius: var(--r1);
  color: var(--acc);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  border: 1px solid var(--border-s);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--sb-track);
}

::-webkit-scrollbar-thumb {
  background: var(--sb-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--sb-thumb-h);
}

/* ══════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════ */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  height: 100%;
  height: 100dvh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 0 10px;
  z-index: 300;
  transition: background var(--t-slow), border-color var(--t-slow), transform var(--t-slow);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  background-color: #6c8fff;
  -webkit-mask: url('../img/logo.svg') no-repeat center;
  mask: url('../img/logo.svg') no-repeat center;
  -webkit-mask-size: contain;
  mask-size: contain;
  flex-shrink: 0;
  transition: background-color var(--t-fast);
}

.nav-item.active .brand-mark {
  background-color: var(--acc);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  transition: opacity var(--t-fast);
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--tx1);
}

.brand-sub {
  font-size: 10px;
  color: var(--tx3);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 1px;
  line-height: 1;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding-top: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--tx3);
  padding: 12px 12px 4px;
  white-space: nowrap;
  transition: opacity var(--t-fast);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r2);
  color: var(--tx2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.7;
  border-radius: 4px;
  border: 1px solid transparent;
  text-align: center;
  font-weight: 700;
}

.nav-item.active .nav-icon {
  opacity: 1;
  color: var(--acc);
  background: var(--bg-card);
  border-color: var(--border-s);
}

.nav-item:hover:not(.locked) {
  background: var(--nav-hover-bg);
  color: var(--tx1);
}

.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-tx);
  font-weight: 600;
}

.nav-item.locked {
  color: var(--tx3);
  cursor: not-allowed;
  opacity: 0.45;
}

.nav-lock {
  font-size: 11px;
  margin-left: auto;
  opacity: 0.6;
}

/* ── SIDEBAR TOGGLE BTN ── */
.sidebar-toggle-btn {
  transition: transform var(--t-normal) !important;
}

body.sidebar-collapsed .sidebar-toggle-btn {
  transform: rotate(0deg);
}

/* ── SIDEBAR OVERLAY ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 250;
  opacity: 0;
  visibility: hidden;
  transition: all var(--t-normal);
}

body.sidebar-mobile-open .sidebar-overlay {
  opacity: 1;
  visibility: visible;
}

/* ── SIDEBAR COLLAPSED STATE ── */
body.sidebar-collapsed #sidebar {
  width: 72px;
  padding: 0 8px;
}

body.sidebar-collapsed .main {
  margin-left: 72px;
}

body.sidebar-collapsed .brand-text-wrap,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-lock,
body.sidebar-collapsed .theme-text,
body.sidebar-collapsed .theme-toggle .toggle-track,
body.sidebar-collapsed .data-badge .badge-text {
  opacity: 0;
  pointer-events: none;
  display: none;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .nav-item {
  padding: 10px;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 4px;
  border-radius: 10px;
}

body.sidebar-collapsed .nav-icon {
  margin: 0;
  font-size: 18px;
  opacity: 0.8;
}

body.sidebar-collapsed .nav-item.active .nav-icon {
  background: transparent;
  border: none;
  opacity: 1;
}

body.sidebar-collapsed .theme-toggle {
  justify-content: center;
  padding: 0;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid var(--border-s);
}

body.sidebar-collapsed .theme-toggle .nav-icon {
  opacity: 0.8;
  font-size: 18px;
}

body.sidebar-collapsed .data-badge {
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 12px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-icon {
  display: none;
}

body.sidebar-collapsed .badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: inherit;
}

.sidebar-footer {
  padding: 12px 0 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--r2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--tx2);
  background: transparent;
  border: 1px solid var(--border);
  font-family: var(--font);
  width: 100%;
  transition: all var(--t-fast);
}

.theme-toggle:hover {
  color: var(--tx1);
  border-color: var(--border-focus);
  background: var(--nav-hover-bg);
}

.toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 100px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  position: relative;
  transition: background var(--t-normal);
  flex-shrink: 0;
}

.toggle-track.on {
  background: var(--acc);
  border-color: var(--acc);
}

.toggle-thumb {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform var(--t-normal);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-track.on .toggle-thumb {
  transform: translateX(14px);
}

.data-badge {
  font-size: 10px;
  padding: 5px 10px;
  border-radius: 100px;
  background: var(--pos-d);
  color: var(--pos);
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.data-badge.no-data {
  background: var(--bg-card2);
  color: var(--tx3);
}

/* ── MAIN ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  transition: margin-left var(--t-slow) ease;
}

/* ── TOPBAR ── */
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border-s);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 14px;
  position: sticky;
  top: 0;
  background: var(--topbar-bg);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  z-index: 100;
  transition: background var(--t-slow), border-color var(--t-slow);
}

.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx1);
  flex: 1;
  letter-spacing: -0.2px;
}

.topbar-sub {
  font-size: 12px;
  color: var(--tx3);
  font-weight: 400;
}

/* ── PAGE BODY ── */
.page-body {
  padding: 28px 32px 48px;
}

/* ══════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r2);
  border: none;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  line-height: 1;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

.btn::selection,
.btn *::selection {
  background: transparent !important;
  color: inherit !important;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--acc);
  color: #fff !important;
  box-shadow: 0 1px 3px rgba(108, 143, 255, 0.4);
}

.btn-primary:active,
.btn-primary:focus {
  color: #fff !important;
}

.btn-primary:hover {
  background: var(--acc-h);
  box-shadow: 0 3px 12px rgba(108, 143, 255, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--tx2);
}

.btn-outline:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: var(--acc-d);
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--tx3);
}

.btn-ghost:hover {
  color: var(--tx1);
  background: var(--nav-hover-bg);
}

.btn-sm {
  padding: 6px 13px;
  font-size: 12px;
  border-radius: var(--r1);
}

.btn-xs {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--r1);
}

/* ══════════════════════════════════════════════════
   CARD
   ══════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--shadow-md);
  transition: background var(--t-slow), border-color var(--t-slow), box-shadow var(--t-slow);
  overflow: hidden; /* Prevent content leakage */
}

.card-body {
  padding: 20px 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx1);
  letter-spacing: -0.1px;
}

.card-badge {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--bg-card2);
  color: var(--tx3);
  font-weight: 500;
  border: 1px solid var(--border-s);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════
   KPI GRID
   ══════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-slow);
}

.kpi::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r3);
  opacity: 0;
  transition: opacity var(--t-fast);
  box-shadow: var(--shadow-glow);
  pointer-events: none;
}

.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.kpi:hover::after {
  opacity: 1;
}

/* Accent lines dihilangkan atas permintaan pengguna */

.kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: var(--tx3);
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--tx1);
}

.kpi-sub {
  font-size: 11px;
  color: var(--tx3);
  margin-top: 5px;
}

.kpi-delta {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 5px;
}

.kpi-delta.up {
  color: var(--pos);
}

.kpi-delta.down {
  color: var(--neg);
}

.kpi-delta.mid {
  color: var(--neu);
}

/* ══════════════════════════════════════════════════
   SECTION HEADER
   ══════════════════════════════════════════════════ */
.sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.sec-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--tx1);
}

.sec-sub {
  font-size: 12px;
  color: var(--tx3);
  margin-top: 3px;
  font-weight: 400;
}

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

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border-s);
  margin: 22px 0;
}

/* ══════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.badge-pos {
  background: var(--pos-d);
  color: var(--pos);
}

.badge-neg {
  background: var(--neg-d);
  color: var(--neg);
}

.badge-neu {
  background: var(--neu-d);
  color: var(--neu);
}

.badge-acc {
  background: var(--acc-d);
  color: var(--acc);
}

/* ══════════════════════════════════════════════════
   CHART GRID
   ══════════════════════════════════════════════════ */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.chart-grid > * {
  min-width: 0;
}

.chart-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-full {
  grid-column: 1 / -1;
}

.chart-wrap {
  position: relative;
  height: 260px;
}

.chart-wrap-sm {
  position: relative;
  height: 200px;
}

.chart-wrap-lg {
  position: relative;
  height: 320px;
}

.chart-wrap-xl {
  position: relative;
  height: 380px;
}

/* ── Legend ── */
.legend-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--tx2);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   UPLOAD PAGE
   ══════════════════════════════════════════════════ */
.upload-page-body {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 56px);
  /* subtract topbar */
  padding-top: 20px !important;
  padding-bottom: 40px !important;
}

.upload-hero {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.upload-headline {
  margin-bottom: 32px;
}

.upload-headline h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--tx1);
  margin: 0 0 10px;
  line-height: 1.2;
}

.upload-headline p {
  font-size: 14px;
  color: var(--tx2);
  line-height: 1.6;
  margin: 0;
}

/* Upload zone */
.upload-zone {
  border: 1.5px dashed var(--border-focus);
  border-radius: 20px;
  background: var(--bg-card);
  transition: all var(--t-normal);
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
}

.upload-zone:hover,
.upload-zone.drag {
  border-color: var(--acc);
  background: var(--nav-hover-bg);
  box-shadow: 0 8px 32px rgba(108, 143, 255, 0.06);
  transform: translateY(-2px);
}

.upload-zone input[type=file] {
  display: none;
}

.upload-inner {
  padding: 56px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.upload-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--acc-d);
  color: var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.upload-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--tx1);
  margin: 0 0 4px 0;
}

.upload-sub {
  font-size: 13.5px;
  color: var(--tx2);
  margin: 0 0 20px 0;
}

.btn-upload-trigger {
  margin-bottom: 24px;
}

.upload-hint {
  font-size: 12px;
  color: var(--tx3);
  margin: 0;
}

/* File preview */
.file-preview {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx1);
}

.file-meta {
  font-size: 11px;
  color: var(--tx3);
}

.file-actions {
  display: flex;
  gap: 8px;
}

/* Progress */
.progress-wrap {
  margin-top: 24px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--tx2);
  margin-bottom: 9px;
}

.progress-track {
  height: 5px;
  border-radius: 100px;
  background: var(--bg-card2);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--acc), var(--pur));
  transition: width 0.3s ease;
}

.progress-step {
  font-size: 11px;
  color: var(--tx3);
  margin-top: 8px;
  min-height: 16px;
  font-style: italic;
}

/* ══════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════ */
.gauge-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 0;
}

.tweet-card {
  background: var(--bg-card2);
  border-radius: var(--r2);
  padding: 12px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.tweet-card:hover {
  transform: translateX(2px);
}

.tweet-card.pos {
  border-left-color: var(--pos);
}

.tweet-card.neg {
  border-left-color: var(--neg);
}

.tweet-text {
  font-size: 12.5px;
  color: var(--tx2);
  line-height: 1.5;
  margin-bottom: 7px;
}

.tweet-meta {
  font-size: 10.5px;
  color: var(--tx3);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-s);
  font-size: 12.5px;
}

.leaderboard-row:last-child {
  border-bottom: none;
}

.lb-rank {
  color: var(--tx3);
  width: 22px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.lb-name {
  color: var(--tx1);
  font-weight: 500;
  flex: 1;
  padding: 0 10px;
}

.lb-val {
  color: var(--tx3);
  font-size: 11.5px;
  white-space: nowrap;
}

.insight-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.insight-item {
  display: flex;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-card2);
  border-radius: var(--r2);
  border: 1px solid var(--border-s);
  align-items: flex-start;
  transition: border-color var(--t-fast);
}

.insight-item:hover {
  border-color: var(--border);
}

.insight-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.insight-text {
  font-size: 12.5px;
  color: var(--tx2);
  line-height: 1.55;
}

/* ══════════════════════════════════════════════════
   TABLE & DATA PAGE OVERHAUL
   ══════════════════════════════════════════════════ */
/* ── Custom Number Input Wrapper ── */
.cni-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.cni-wrap input[type=number] {
  padding: 8px 32px 8px 12px;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--tx1);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 600;
  outline: none;
  transition: all var(--t-fast);
  height: 38px;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.cni-wrap input[type=number]:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-d);
  background: var(--bg-card2);
}

.cni-wrap input[type=number]::-webkit-inner-spin-button,
.cni-wrap input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.cni-arrows {
  position: absolute;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  opacity: 0.4;
  transition: opacity var(--t-fast);
}

.cni-wrap:hover .cni-arrows,
.cni-wrap:focus-within .cni-arrows {
  opacity: 1;
}

.cni-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 14px;
  background: transparent;
  border: none;
  color: var(--tx3);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--t-fast);
  padding: 0;
}

.cni-btn:hover {
  background: var(--nav-hover-bg);
  color: var(--tx1);
}

.cni-btn:active {
  background: var(--acc-d);
  color: var(--acc);
}

.cni-btn svg {
  width: 11px;
  height: 11px;
}

.tl-filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  margin-bottom: 24px;
  flex-wrap: wrap; /* Already wraps, but needs children to behave correctly */
  box-shadow: var(--shadow-sm);
}

.tl-filter-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tl-filter-tabs .tl-tab {
  white-space: nowrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

/* ── Select / Dropdown (shared) ── */
.tl-filter-bar select,
.tl-sort-sel,
.page-size-sel {
  -webkit-appearance: none;
  appearance: none;
  padding: 8px 36px 8px 12px;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2392a0b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  color: var(--tx1);
  font-size: 12.5px;
  font-weight: 600;
  height: 40px;
  min-width: 140px;
  transition: all var(--t-fast);
  cursor: pointer;
}

.tl-filter-bar select:focus,
.tl-sort-sel:focus,
.page-size-sel:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-d);
  outline: none;
  background-color: var(--bg-card2);
}

.filter-search-wrap {
  position: relative;
  flex: 2;
  min-width: 280px;
}

.filter-search-wrap input {
  width: 100%;
  padding-left: 42px !important;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--tx1);
  font-size: 13.5px;
  height: 40px;
  transition: all var(--t-fast);
}

.filter-search-wrap input:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-d);
  background: var(--bg-card2);
}

.tl-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--tx3);
  pointer-events: none;
  opacity: 0.6;
}

.mini-inputs {
  display: flex !important;
  gap: 12px;
}

.mini-inputs .cni-wrap input {
  width: 170px;
  height: 40px;
}

.btn-mini {
  padding: 6px 14px;
  font-size: 11px;
  height: 36px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Column Visibility */
.col-visibility-wrap {
  margin-bottom: 24px;
  padding: 0 4px;
}

.col-toggle-label {
  font-size: 10.5px;
  color: var(--tx3);
  margin-bottom: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.col-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.col-pill {
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-card2);
  font-size: 11px;
  font-weight: 600;
  color: var(--tx3);
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}

.col-pill:hover {
  border-color: var(--border-focus);
  color: var(--tx2);
}

.col-pill.on {
  background: var(--acc-d);
  border-color: var(--acc-d);
  color: var(--acc);
}

/* Table Card Area */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: var(--bg-card2);
}

.data-table th {
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--tx3);
  text-align: left;
  white-space: nowrap;
  user-select: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t-fast);
}

.data-table th:hover {
  color: var(--tx1);
  background: rgba(108, 143, 255, 0.05);
}

.data-table th.active-sort {
  color: var(--acc);
  background: var(--acc-d);
}

.data-table th.sort-asc::after {
  content: ' ↑';
  color: var(--acc);
}

.data-table th.sort-desc::after {
  content: ' ↓';
  color: var(--acc);
}

.data-table td {
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--tx2);
  border-bottom: 1px solid var(--border-s);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(108, 143, 255, 0.02);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}



.td-no {
  color: var(--tx3);
  font-weight: 600;
  width: 40px;
  font-variant-numeric: tabular-nums;
}

.td-trunc {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-trunc-sm {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Conf bar */
.conf-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.conf-num {
  font-size: 11.5px;
  min-width: 40px;
  font-variant-numeric: tabular-nums;
}

.conf-track {
  width: 56px;
  height: 4px;
  border-radius: 100px;
  background: var(--bg-card2);
  overflow: hidden;
}

.conf-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s ease;
}

.conf-pos {
  background: var(--pos);
}

.conf-neg {
  background: var(--neg);
}

.conf-neu {
  background: var(--neu);
}

/* Pagination */
.pagination,
.tl-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px; /* Slightly more gap */
  margin-top: 24px;
  flex-wrap: wrap;
}

.tl-pagination-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 40px;
  gap: 20px;
}

.pg-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 10px; /* More modern rounding */
  border: 1px solid transparent;
  background: transparent;
  color: var(--tx2);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}

.pg-btn:hover:not(:disabled):not(.dots) {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--tx1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pg-btn.active {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
  box-shadow: 0 8px 20px rgba(108, 143, 255, 0.35); /* More premium shadow */
  transform: translateY(-1px);
}

.pg-btn:disabled,
.pg-btn.dots {
  opacity: 0.3;
  cursor: default;
  background: transparent;
  border-color: transparent;
}

.tl-pagination-info {
  font-size: 13px;
  color: var(--tx3);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.tl-page-size-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.tl-page-size-label {
  font-size: 12.5px;
  color: var(--tx3);
  font-weight: 500;
}

.tl-page-size-sel {
  width: 80px;
}

.table-info,
.tl-info {
  text-align: center;
  font-size: 12px;
  color: var(--tx3);
  margin-top: 14px;
}

/* ══════════════════════════════════════════════════
   EMPTY STATES
   ══════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  border-radius: var(--r2);
  background: var(--bg-card2);
  border: 1px dashed var(--border);
  min-height: 120px;
  margin: 10px 0;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  color: var(--tx3);
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx2);
  margin-bottom: 4px;
}

.empty-state-desc {
  font-size: 12px;
  color: var(--tx3);
}

/* ══════════════════════════════════════════════════
   CLEANING LAB
   ══════════════════════════════════════════════════ */
.pipeline-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-s);
}

.pipeline-step:last-child {
  border-bottom: none;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--acc-d);
  color: var(--acc);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--acc-d2);
}

.step-info {
  flex: 1;
}

.step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx1);
  margin-bottom: 2px;
}

.step-desc {
  font-size: 11.5px;
  color: var(--tx3);
}

.step-toggle {
  width: 36px;
  height: 20px;
  border-radius: 100px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background var(--t-normal), border-color var(--t-normal);
  flex-shrink: 0;
}

.step-toggle.on {
  background: var(--acc);
  border-color: var(--acc);
}

.step-toggle::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform var(--t-normal);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.step-toggle.on::after {
  transform: translateX(16px);
}

.demo-area {
  margin-bottom: 16px;
}

.demo-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  font-weight: 600;
  color: var(--tx3);
  margin-bottom: 8px;
}

.demo-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  color: var(--tx1);
  font-family: var(--font);
  font-size: 13px;
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-slow);
}

.demo-textarea:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-d);
}

.step-pipeline {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.step-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--r1);
  background: var(--bg-card2);
  border: 1px solid var(--border-s);
  transition: background var(--t-fast);
}

.step-line-num {
  color: var(--tx3);
  width: 18px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.step-line-name {
  color: var(--acc);
  width: 150px;
  flex-shrink: 0;
  font-weight: 500;
}

.step-line-text {
  color: var(--tx2);
  flex: 1;
  word-break: break-word;
}

.step-line.changed {
  background: var(--acc-d);
  border-color: var(--acc-d2);
}

.step-diff {
  color: var(--tx3);
  font-size: 10.5px;
  margin-left: auto;
  white-space: nowrap;
  padding-left: 10px;
  align-self: flex-start; /* Keep at top if row gets tall */
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--tx2);
}

.stat-pill strong {
  color: var(--tx1);
  font-weight: 700;
}

/* ══════════════════════════════════════════════════
   MISC
   ══════════════════════════════════════════════════ */
.empty-state {
  padding: 64px 20px;
  text-align: center;
  color: var(--tx3);
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--tx2);
}

.empty-desc {
  font-size: 13px;
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi {
  animation: fadeUp 0.35s ease both;
}

.kpi:nth-child(1) {
  animation-delay: .04s
}

.kpi:nth-child(2) {
  animation-delay: .07s
}

.kpi:nth-child(3) {
  animation-delay: .10s
}

.kpi:nth-child(4) {
  animation-delay: .13s
}

.kpi:nth-child(5) {
  animation-delay: .16s
}

.kpi:nth-child(6) {
  animation-delay: .19s
}

.kpi:nth-child(7) {
  animation-delay: .22s
}

.kpi:nth-child(8) {
  animation-delay: .25s
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.card {
  animation: fadeIn 0.3s ease both;
}

/* ── Transition for theme switch ── */
body,
.card,
.kpi,
#sidebar,
.topbar,
.filter-bar select,
.filter-bar input,
.data-table th,
.data-table td,
.pg-btn,
.badge,
.btn,
.nav-item,
.tweet-card,
.leaderboard-row,
.insight-item,
.step-line,
.upload-zone,
.theme-toggle {
  transition-property: background, color, border-color, box-shadow;
  transition-duration: var(--t-slow);
  transition-timing-function: ease;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */
@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1100px) {
  .chart-grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  #sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform var(--t-slow) cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.sidebar-mobile-open #sidebar {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.3);
  }

  .main {
    margin-left: 0;
  }

  /* Desktop toggle button hide on mobile */
  .sidebar-toggle-btn {
    display: none !important;
  }

  .topbar {
    padding: 0 16px;
    gap: 8px;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--tx2);
    padding: 8px;
    cursor: pointer;
    border-radius: var(--r1);
    margin-right: 4px;
  }

  .mobile-menu-btn:hover {
    background: var(--nav-hover-bg);
    color: var(--tx1);
  }

  .chart-grid,
  .chart-grid-3 {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    width: 100%;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .page-body {
    padding: 16px 12px 32px;
  }
  
  .card-body {
    padding: 16px;
  }


  .expand-content {
    grid-template-columns: 1fr;
  }

  .filter-bar, .tl-filter-bar {
    gap: 8px;
    flex-wrap: wrap; /* allow wrapping on small screens */
  }

  /* Specific fix for Tweet List filters overflow */
  .tl-filter-bar {
    padding: 12px 14px;
    gap: 12px;
  }

  .tl-filter-tabs {
    width: 100%; /* Force tabs to own row if needed, or wrap inside */
    justify-content: flex-start;
  }
  
  .tl-search-wrap {
    width: 100%;
    min-width: 100%;
    flex: none;
    margin-bottom: 4px;
  }

  .tl-sort-wrap {
    width: 100%;
    flex: none;
  }

  .tl-sort-sel {
    width: 100%;
  }

  .data-page-filters {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .data-page-filters .filter-group {
    width: 100%;
    max-width: none;
    justify-content: space-between;
  }

  .data-page-filters .filter-group select {
    flex: 1; /* Make select box take remaining space neatly */
    max-width: 65%;
  }

  .data-page-filters .filter-search-wrap,
  .data-page-filters .mini-inputs {
    width: 100%;
    min-width: 100%;
    max-width: none;
  }

  .mini-inputs {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .mini-inputs .cni-wrap {
    width: 100%;
  }

  .mini-inputs .cni-wrap input {
    width: 100% !important; /* Force override for mobile */
  }

  /* Reset button full width */
  #btnReset {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 4px;
    height: 40px;
  }

  .table-card {
    border-radius: var(--r2);
    overflow: hidden;
  }

  /* Table Horizontal Scrolling Support */
  .table-wrap, .analytics-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 0;
  }
  
  .data-table th, .data-table td, 
  .analytics-table th, .analytics-table td {
    white-space: nowrap; /* Prevent ugly wrapping inside tables */
  }
  
  .topbar-title {
    font-size: 13px;
  }
  
  /* ── Cleaning Lab Specific Mobile Overrides ── */
  .step-line {
    flex-wrap: wrap; /* allow text and status to wrap */
    gap: 6px;
    padding: 10px 12px;
  }

  .step-line-name {
    width: 100%; /* Force step name to take its own line */
    font-size: 13px;
  }

  .step-line-text {
    width: 100%;
    margin-left: 0;
  }

  .step-diff {
    margin-left: 0; /* Keep diff next to text or wrapped */
    padding-left: 0;
  }
  
  .topbar-sub {
    display: none;
  }

  /* ── Upload Page Mobile Refinements ── */
  .upload-headline {
    margin-bottom: 24px;
    text-align: center;
  }

  .upload-headline h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .upload-headline p {
    font-size: 13px;
    line-height: 1.6;
    padding: 0 4px;
  }

  .upload-inner {
    padding: 32px 16px;
  }

  .upload-title {
    font-size: 15px;
  }

  .upload-sub {
    font-size: 12.5px;
    margin-bottom: 16px;
  }

  .file-preview {
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    align-items: stretch;
    text-align: center;
  }

  .file-info {
    align-items: center;
    gap: 5px;
  }

  .file-name {
    font-size: 13.5px;
  }

  .file-actions {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .file-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .progress-wrap {
    margin-top: 32px;
  }

  /* ── Dashboard Mobile Refinements ── */
  .sec-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .sec-head .actions {
    width: 100%;
  }

  .sec-head .btn {
    width: 100%;
    justify-content: center;
  }

  .tweet-card {
    padding: 10px 12px;
  }

  .tweet-text {
    font-size: 12px;
    margin-bottom: 5px;
  }

  .insight-item {
    padding: 10px 12px;
    gap: 10px;
  }

  .insight-text {
    font-size: 12px;
  }

  .gauge-wrap {
    margin-bottom: 0;
  }

  .leaderboard-row {
    font-size: 11.5px;
    padding: 8px 0;
  }

  .lb-name {
    padding: 0 6px;
  }

  /* ── Analytics Mobile Refinements ── */
  .analytics-table {
    font-size: 11.5px;
  }

  .analytics-table th, 
  .analytics-table td {
    padding: 8px 10px;
  }

  .at-hashtag {
    padding: 1px 6px;
    font-size: 10.5px;
  }

  .word-tag-cloud {
    min-height: auto;
    gap: 4px;
    padding: 4px 0;
  }

  .card-badge {
    font-size: 9px;
    padding: 1px 6px;
  }

  .chart-wrap-sm {
    height: 180px;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr); 
    gap: 8px;
  }

  .kpi {
    padding: 14px 12px 12px;
  }

  .kpi-label {
    font-size: 9.5px;
    margin-bottom: 6px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .hero-title {
    font-size: 28px;
  }
  
  .btn {
    padding: 8px 14px;
    font-size: 12.5px;
  }

  /* Fix for Analytics Table Long Topics */
  .at-topic-text {
    max-width: 130px; /* Prevent text from crashing into columns */
  }

  .tl-page-size-row {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
  }
  .tl-pagination-stack {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
}

/* Hide mobile controls on desktop */
@media (min-width: 861px) {
  .mobile-menu-btn {
    display: none !important;
  }
}

/* ══════════════════════════════════════════════════
   CUSTOM SELECT / DROPDOWN COMPONENT
   ══════════════════════════════════════════════════ */

/* Wrapper replaces the native <select> in DOM flow */
.csd-wrap {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

/* The visible trigger button */
.csd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 34px;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--tx1);
  font-size: 12.5px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast), color var(--t-slow);
  outline: none;
  min-width: 130px;
}

.csd-trigger:hover {
  border-color: var(--border-focus);
  background: var(--bg-card2);
}

.csd-trigger.open {
  border-color: var(--acc);
  background: var(--bg-card2);
  box-shadow: 0 0 0 3px var(--acc-d);
}

/* Label text inside trigger */
.csd-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

/* Chevron SVG inside trigger */
.csd-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--tx3);
  transition: transform 220ms cubic-bezier(.4, 0, .2, 1), color var(--t-fast);
}

.csd-trigger.open .csd-chevron {
  transform: rotate(180deg);
  color: var(--acc);
}

/* ── Floating panel ── */
.csd-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
  z-index: 5000;
  overflow: hidden;
  /* Animation */
  transform-origin: top center;
  animation: csdDrop 180ms cubic-bezier(.16, 1, .3, 1) both;
}

@media (max-width: 768px) {
  .csd-panel {
    left: auto;
    right: 0;
    transform-origin: top right;
  }
}

[data-theme="light"] .csd-panel {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

@keyframes csdDrop {
  from {
    opacity: 0;
    transform: scaleY(0.88) translateY(-6px);
  }

  to {
    opacity: 1;
    transform: scaleY(1) translateY(0);
  }
}

/* Panel header (search box) */
.csd-search-wrap {
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--border-s);
}

.csd-search {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--r1);
  color: var(--tx1);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--t-fast);
}

.csd-search:focus {
  border-color: var(--acc);
}

.csd-search::placeholder {
  color: var(--tx3);
}

/* Options list */
.csd-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

/* Custom scrollbar inside panel */
.csd-list::-webkit-scrollbar {
  width: 4px;
}

.csd-list::-webkit-scrollbar-track {
  background: transparent;
}

.csd-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

/* Single option row */
.csd-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r1);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tx2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  user-select: none;
  white-space: nowrap;
}

.csd-option:hover {
  background: var(--nav-hover-bg);
  color: var(--tx1);
}

.csd-option.selected {
  background: var(--acc-d);
  color: var(--acc);
  font-weight: 600;
}

.csd-option.focused {
  background: var(--nav-hover-bg);
  color: var(--tx1);
}

/* Check icon on selected */
.csd-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0;
  color: var(--acc);
  margin-left: auto;
}

.csd-option.selected .csd-check {
  opacity: 1;
}

/* Sentiment dot indicators */
.csd-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Empty state inside list */
.csd-empty {
  padding: 14px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--tx3);
  font-style: italic;
}

/* ── Page-size variant (compact, no search) ── */
.csd-wrap.csd-compact .csd-trigger {
  min-width: 80px;
}

.csd-wrap.csd-compact .csd-panel {
  min-width: 100px;
}

.csd-wrap.csd-compact .csd-search-wrap {
  display: none;
}

/* ══════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: none;
  border-radius: 100px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.toast-success {
  box-shadow: 0 8px 32px var(--acc-d2);
}

.toast-success .toast-icon {
  color: var(--acc);
}

.toast-error {
  border-color: var(--neg);
}

.toast-error .toast-icon {
  color: var(--neg);
}

.toast-icon {
  display: flex;
}

.toast-icon svg {
  width: 18px;
  height: 18px;
}

.toast-message {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tx1);
}

.toast-persist {
  align-items: flex-start;
  padding: 16px 20px;
  border-radius: 16px;
  border: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  background: var(--bg-card);
}

.toast-persist .toast-icon svg {
  width: 24px;
  height: 24px;
}

@keyframes toastSwipeIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastSwipeOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
}

.toast-enter {
  opacity: 0;
  transform: translateY(20px) scale(0.9);
}

.toast-exit {
  opacity: 0;
  transform: translateY(-10px) scale(0.9);
}

/* ══════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 24px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-card);
  border: none;
  border-radius: 24px; /* More compact rounding */
  padding: 32px 24px 28px; /* Balanced paddings */
  width: 100%;
  max-width: 360px; /* Thinner modal */
  margin: auto; /* Force centering within flex */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-icon-wrap {
  width: 48px; /* Smaller icon container */
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-icon-wrap svg {
  width: 24px; /* Smaller icon */
  height: 24px;
}

.modal-success .modal-icon-wrap {
  background: var(--acc-d);
  color: var(--acc);
}

.modal-error .modal-icon-wrap {
  background: var(--neg-d);
  color: var(--neg);
  border: 1px solid var(--neg-dim);
}

.modal-title {
  font-size: 19px; /* Neater, smaller title */
  font-weight: 800;
  color: var(--tx1);
  margin: 0 0 10px;
  letter-spacing: -0.5px;
  line-height: 1.3;
}

.modal-desc {
  font-size: 13.5px; /* Compact description */
  color: var(--tx2);
  line-height: 1.6;
  margin: 0 0 24px;
}

.modal-btns {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 10px 18px; /* Tighter padding */
  font-size: 13.5px; /* Smaller button text */
  font-weight: 600;
  justify-content: center;
  border-radius: 12px;
}

.modal-btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--tx2);
}

.modal-btn-cancel:hover {
  background: var(--nav-hover-bg);
  color: var(--tx1);
  border-color: var(--border-focus);
}

.modal-btn-danger {
  background: var(--neg);
  color: #fff;
  border: none;
}

.modal-btn-danger:hover {
  background: #ef4444;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* ══════════════════════════════════════════════════
   EMPTY STATE (NO DATA)
   ══════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  flex: 1;
  height: 100%;
  min-height: 180px;
  width: 100%;
  background: var(--bg-card2);
  border-radius: var(--r2);
  border: 1px dashed var(--border);
  margin-top: auto;
  margin-bottom: auto;
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx1);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 13px;
  color: var(--tx3);
}

/* ══════════════════════════════════════════════════
   ANALYTICS PAGE — TABLES
   ══════════════════════════════════════════════════ */
.analytics-table-wrap {
  overflow-x: auto;
  border-radius: var(--r2);
  max-height: 340px;
  overflow-y: auto;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.analytics-table thead tr {
  position: sticky;
  top: 0;
  background: var(--bg-card2);
  z-index: 1;
}

.analytics-table th {
  text-align: center;
  /* Changed from left to center */
  padding: 9px 12px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--tx3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.analytics-table th:nth-child(2) {
  text-align: left;
  /* Keep Label/Hashtag/Topic name column left-aligned */
}

.analytics-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-s);
  color: var(--tx1);
  vertical-align: middle;
  text-align: center;
  /* Center all column contents by default */
}

.analytics-table td.at-label {
  text-align: left;
  /* Override for text labels */
}

.analytics-table tr:last-child td {
  border-bottom: none;
}

.analytics-table tr:hover td {
  background: var(--nav-hover-bg);
}

.analytics-table .tc-pos {
  color: var(--pos);
}

.analytics-table .tc-neg {
  color: var(--neg);
}

.analytics-table .tc-neu {
  color: var(--neu);
}

.at-rank {
  color: var(--tx3);
  font-size: 11px;
  font-weight: 600;
  width: 28px;
  min-width: 28px;
  text-align: center;
}

.at-num {
  text-align: center;
  /* Changed from right to center */
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
}

.at-label {
  font-weight: 500;
}

.at-topic-text {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.at-hashtag {
  display: inline-flex;
  padding: 2px 8px;
  background: var(--acc-d);
  color: var(--acc);
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
}

.at-bar-cell {
  min-width: 100px;
  padding-right: 16px;
}

.at-bar-track {
  height: 6px;
  border-radius: 100px;
  background: var(--bg-card2);
  overflow: hidden;
}

.at-bar-multi {
  display: flex;
  height: 6px;
}

.at-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width .4s ease;
}

.analytics-table-empty {
  display: none;
  padding: 24px;
  text-align: center;
  color: var(--tx3);
  font-size: 12.5px;
  font-style: italic;
}

/* ══════════════════════════════════════════════════
   ANALYTICS PAGE — WORD TAGS
   ══════════════════════════════════════════════════ */
.word-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
  min-height: 140px;
  align-content: flex-start;
}

.word-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: default;
  transition: transform var(--t-fast), opacity var(--t-fast);
  line-height: 1;
  white-space: nowrap;
}

.word-tag:hover {
  transform: scale(1.08);
  opacity: 1 !important;
}

/* ══════════════════════════════════════════════════
   TWEET LIST PAGE  (tl-*)
   ══════════════════════════════════════════════════ */

/* ── Filter bar ── */
.tl-filter-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.tl-filter-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 380px;
}

#btnAll {
  grid-column: span 3;
}

.tl-filter-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

.tl-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card2);
  font-size: 13px;
  font-weight: 600;
  color: var(--tx2);
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--t-fast);
  min-width: 80px;
  height: auto;
}

.tl-tab-label-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--tx1);
  opacity: 0.9;
}

.tl-tab:hover {
  background: var(--nav-hover-bg);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.tl-tab.active {
  background: var(--acc-d2);
  color: var(--acc);
  border-color: var(--acc);
  box-shadow: 0 4px 12px var(--acc-d);
}

.tl-tab.active .tl-tab-label-group {
  color: var(--acc);
}

.tl-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tl-tab-count {
  font-size: 15px;
  font-weight: 800;
  color: var(--tx1);
  line-height: 1;
}

.tl-tab.active .tl-tab-count {
  color: var(--acc);
}

/* ── Search ── */
.tl-search-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
}

.tl-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--tx3);
  pointer-events: none;
}

.tl-search {
  width: 100%;
  padding: 7px 34px 7px 32px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  color: var(--tx1);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--t-fast);
}

.tl-search:focus {
  border-color: var(--border-focus);
}

.tl-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card2);
  color: var(--tx3);
  font-size: 10px;
  cursor: pointer;
  transition: background var(--t-fast);
}

.tl-search-clear:hover {
  background: var(--neg-d);
  color: var(--neg);
}

/* ── Sort (inherits shared select styles above) ── */
.tl-sort-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
}

.tl-sort-sel {
  white-space: nowrap;
  min-width: 150px;
}

/* ── Stat Pills ── */
.tl-stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
}

/* ── Feed grid ── */
.tl-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

/* ── Tweet Card ── */
.tl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 14px 16px 10px;
  box-shadow: none;
  transition: border-color var(--t-fast);
  border-left: 3px solid transparent;
  position: relative;
}

.tl-card:hover {
  border-color: var(--border-s);
}

.tl-card-pos {
  border-left-color: var(--pos);
}

.tl-card-neg {
  border-left-color: var(--neg);
}

.tl-card-neu {
  border-left-color: var(--neu);
}

/* Card Header */
.tl-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap; /* allow wrapping if deeply compressed */
}

.tl-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.2px;
}

.tl-user-info {
  display: flex;
  flex-direction: column;
  /* Changed back to column for safe stacking over locations */
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.tl-user-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* wrap date next to name if needed */
  gap: 6px;
}

.tl-username {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tx1);
  word-break: break-all;
}

.tl-date {
  font-size: 11.5px;
  color: var(--tx3);
  white-space: nowrap;
}

.tl-date-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--t-fast);
}

.tl-date-link:hover {
  color: var(--acc);
  text-decoration: underline;
}

.tl-date-link svg {
  width: 12px;
  height: 12px;
}

.tl-location {
  font-size: 11px;
  color: var(--tx3);
}

.tl-header-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  align-self: flex-start; /* keep badges Top-Right */
}

.tl-sent-badge {
  font-size: 10px;
  padding: 2px 8px;
}

.tl-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--tx3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: all var(--t-fast);
}

.tl-link-btn:hover {
  color: var(--tx1);
  background: var(--bg-input);
}

.tl-link-btn svg {
  width: 12px;
  height: 12px;
}

/* Tweet text */
.tl-tweet-text {
  font-size: 13.5px;
  color: var(--tx1);
  line-height: 1.45;
  margin-bottom: 8px;
  word-break: break-word;
}

.tl-highlight {
  background: var(--neu-d);
  color: var(--neu);
  border-radius: 3px;
  padding: 0 2px;
}

/* Hashtag tags */
.tl-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.tl-hashtag {
  display: inline-flex;
  padding: 2px 8px;
  background: var(--acc-d);
  color: var(--acc);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  transition: background var(--t-fast);
}

.tl-hashtag:hover {
  background: var(--acc-d2);
}

/* Media */
.tl-media {
  margin-top: 6px;
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card2);
  display: inline-flex;
  /* Changed so it doesn't span full width if image is small */
  align-items: flex-start;
  justify-content: flex-start;
}

.tl-media-img {
  max-width: 100%;
  max-height: 280px;
  /* Slightly shorter */
  object-fit: contain;
  display: block;
  transition: opacity var(--t-fast);
}

.tl-media-img:hover {
  opacity: 0.95;
}

/* Card Footer */
.tl-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border-s);
  flex-wrap: wrap;
}

.tl-engage-row {
  display: flex;
  gap: 16px;
}

.tl-engage-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--tx3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: color var(--t-fast);
}

.tl-engage-item:hover {
  color: var(--tx2);
}

.tl-engage-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Confidence */
.tl-conf-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tl-conf-label {
  font-size: 10.5px;
  color: var(--tx3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.tl-conf-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tl-conf-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--tx1);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}

.tl-conf-track {
  width: 80px;
  height: 5px;
  border-radius: 100px;
  background: var(--bg-card2);
  overflow: hidden;
}

.tl-conf-fill {
  height: 100%;
  border-radius: 100px;
  transition: width .4s ease;
}

.conf-fill-pos {
  background: var(--pos);
}

.conf-fill-neg {
  background: var(--neg);
}

.conf-fill-neu {
  background: var(--neu);
}

/* ── Pagination ── */
.tl-pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 8px;
}

.tl-info {
  font-size: 12px;
  color: var(--tx3);
}

.tl-pagination {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── Empty state ── */
.tl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--r3);
}

.tl-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.tl-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx1);
  margin-bottom: 4px;
}

.tl-empty-sub {
  font-size: 12.5px;
  color: var(--tx3);
}
/* -- Desktop Optimization -- */
@media (min-width: 1025px) {
  .tl-filter-bar {
    flex-direction: row;
    justify-content: space-between;
    padding: 16px 20px;
    text-align: left;
    gap: 12px;
  }

  .tl-filter-tabs {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: auto;
    max-width: none;
    gap: 6px;
  }

  #btnAll {
    grid-column: auto;
    min-width: 80px;
  }

  .tl-tab {
    flex-direction: row;
    padding: 6px 14px;
    height: 38px;
    min-width: auto;
    gap: 10px;
  }

  .tl-tab-label-group {
    order: 1;
  }

  .tl-tab-count {
    order: 2;
    font-size: 13px;
    margin-left: 4px;
  }

  .tl-tab-label {
    font-size: 13px;
    font-weight: 600;
  }

  .tl-filter-actions {
    flex-direction: row;
    width: auto;
    max-width: none;
    align-items: center;
    gap: 10px;
  }

  .tl-search-wrap {
    width: 240px;
    max-width: none;
  }

  .tl-sort-wrap {
    width: auto;
    min-width: 160px;
  }
}
