/* ===== DASHBOARD LAYOUT ===== */
.dashboard-body { background: var(--bg); display: flex; min-height: 100vh; overflow-x: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; position: fixed; left: 0; top: 0; z-index: 200;
  transition: transform 0.3s ease;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
}
.sidebar-close {
  display: none; color: var(--text-muted); font-size: 1.1rem;
  padding: 4px; border-radius: 6px; transition: color 0.2s;
}
.sidebar-close:hover { color: var(--text); }
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.su-avatar {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 800; color: #fff;
}
.su-info { min-width: 0; }
.su-info strong { display: block; font-size: 0.88rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-plan {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 100px; margin-top: 2px;
}
.plan-pro { background: rgba(99,102,241,0.15); color: var(--primary-light); border: 1px solid rgba(99,102,241,0.3); }
.sidebar-nav { flex: 1; padding: 12px 12px; overflow-y: auto; }
.snav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500; color: var(--text-muted);
  transition: all 0.2s; margin-bottom: 2px;
}
.snav-item:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.snav-item.active { color: var(--text); background: rgba(99,102,241,0.12); }
.snav-item.active i { color: var(--primary); }
.snav-item i { font-size: 0.95rem; width: 18px; text-align: center; }
.snav-divider { height: 1px; background: var(--border); margin: 8px 0; }
.snav-upgrade { color: var(--primary-light) !important; }
.snav-upgrade:hover { background: rgba(99,102,241,0.1) !important; }
.snav-logout { color: var(--danger) !important; }
.snav-logout:hover { background: rgba(239,68,68,0.08) !important; }

/* CREDITS WIDGET */
.credits-widget {
  padding: 16px 20px; border-top: 1px solid var(--border);
  background: rgba(99,102,241,0.05);
}
.cw-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 0.8rem; }
.cw-header span:first-child { color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.cw-header i { color: var(--accent); }
.cw-reset { font-size: 0.72rem; color: var(--text-dim); }
.cw-reset strong { color: var(--primary-light); }
.cw-bar-wrap { margin-bottom: 8px; }
.cw-bar { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.cw-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 3px; transition: width 0.5s ease; }
.cw-nums { display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.78rem; color: var(--text-muted); }
.cw-remaining { margin-left: auto; font-weight: 600; color: var(--success); }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 199; backdrop-filter: blur(4px);
}
.sidebar-overlay.show { display: block; }

/* ===== MAIN ===== */
.dash-main { margin-left: 260px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* TOP BAR */
.dash-topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.85); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 64px;
  display: flex; align-items: center; gap: 16px;
}
.topbar-toggle { display: none; color: var(--text-muted); font-size: 1.2rem; padding: 8px; border-radius: 8px; }
.topbar-greeting { flex: 1; }
.topbar-greeting h1 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.topbar-greeting p { font-size: 0.78rem; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; position: relative; }
.topbar-notif {
  position: relative; width: 36px; height: 36px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.9rem; transition: all 0.2s;
}
.topbar-notif:hover { border-color: var(--border-hover); color: var(--text); }
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; background: var(--secondary);
  border-radius: 50%; border: 1.5px solid var(--bg);
}
.topbar-avatar {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800; color: #fff; cursor: pointer;
}
.topbar-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: rgba(20, 18, 30, 0.85); border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 12px; padding: 8px;
  min-width: 180px; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
  opacity: 0; pointer-events: none; transform: translateY(-8px);
  transition: all 0.2s; z-index: 200;
}
.topbar-dropdown.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.topbar-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 0.85rem; color: var(--text-muted); transition: all 0.2s;
}
.topbar-dropdown a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.topbar-dropdown a i { width: 16px; text-align: center; font-size: 0.85rem; }
.td-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== DASH CONTENT ===== */
.dash-content { flex: 1; padding: 28px; overflow-y: auto; }
.dash-page { display: none; animation: fadeInUp 0.35s ease; }
.dash-page.active { display: block; }

/* ===== STATS ROW ===== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: rgba(20, 18, 30, 0.3); border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
}
.stat-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 25px rgba(99,102,241,0.1);
  transform: translateY(-3px);
}
.sc-icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.sc-blue { background: rgba(99,102,241,0.15); color: var(--primary); }
.sc-green { background: rgba(16,185,129,0.15); color: var(--success); }
.sc-purple { background: rgba(168,85,247,0.15); color: #a855f7; }
.sc-orange { background: rgba(245,158,11,0.15); color: var(--accent); }
.sc-val { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1; }
.sc-label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }

/* ===== DOWNLOAD BOX ===== */
.download-box {
  background: rgba(20, 18, 30, 0.3); border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-lg); padding: 28px; margin-bottom: 24px;
  backdrop-filter: blur(12px);
  transition: all 0.3s;
}
.download-box:hover { border-color: rgba(99, 102, 241, 0.3); }
.dlbox-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.dlbox-header h2 { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.dlbox-header h2 i { color: var(--primary); }
.dlbox-plan-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.25);
  color: var(--primary-light); font-size: 0.78rem; font-weight: 600;
  padding: 5px 12px; border-radius: 100px;
}
.dl-input-group { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.dl-input-wrap {
  flex: 1; position: relative; min-width: 280px;
  display: flex; align-items: center;
}
.dl-icon {
  position: absolute; left: 16px; color: var(--text-dim); font-size: 0.9rem; pointer-events: none;
}
.dl-input-wrap input {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 11px; padding: 13px 48px 13px 44px;
  color: var(--text); font-size: 0.9rem; outline: none; transition: all 0.2s;
}
.dl-input-wrap input::placeholder { color: var(--text-dim); }
.dl-input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.dl-paste-btn {
  position: absolute; right: 12px; color: var(--text-dim); font-size: 0.85rem;
  padding: 4px; border-radius: 6px; transition: color 0.2s;
}
.dl-paste-btn:hover { color: var(--primary); }
.btn-download {
  padding: 13px 24px; background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; font-size: 0.9rem; font-weight: 700; border-radius: 11px;
  display: flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35); transition: all 0.2s; white-space: nowrap;
}
.btn-download:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,102,241,0.5); }

/* Source detected */
.source-detected {
  display: flex; align-items: center; gap: 14px;
  background: rgba(16,185,129,0.06); border: 1px solid rgba(16,185,129,0.25);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 14px;
}
.source-detected.hidden { display: none; }
.sd-icon { font-size: 1.1rem; color: var(--success); }
.sd-info { flex: 1; }
.sd-info span:first-child { display: block; font-size: 0.85rem; font-weight: 600; }
.sd-info span:last-child { display: block; font-size: 0.75rem; color: var(--text-muted); }
.sd-credit { font-size: 0.8rem; font-weight: 600; color: var(--accent); display: flex; align-items: center; gap: 5px; white-space: nowrap; }

/* Quick sites */
.quick-sites { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qs-label { font-size: 0.78rem; color: var(--text-dim); white-space: nowrap; }
.qs-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--border);
  font-size: 0.78rem; color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.qs-btn:hover { border-color: var(--primary); color: var(--primary-light); background: rgba(99,102,241,0.06); }

/* Progress */
.dl-progress-section {
  margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px;
}
.dl-progress-section.hidden { display: none; }
.dlp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dlp-file { display: flex; align-items: center; gap: 12px; }
.dlp-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(99,102,241,0.1); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.dlp-name { display: block; font-size: 0.88rem; font-weight: 600; }
.dlp-source { display: block; font-size: 0.75rem; color: var(--text-muted); }
.dlp-pct { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.dlp-bar-wrap { margin-bottom: 10px; }
.dlp-bar { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.dlp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 4px; transition: width 0.4s ease; }
.dlp-status { font-size: 0.82rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }

/* Success */
.dl-success {
  display: flex; align-items: center; gap: 16px;
  margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px;
}
.dl-success.hidden { display: none; }
.dls-icon { font-size: 2rem; color: var(--success); flex-shrink: 0; }
.dls-info { flex: 1; }
.dls-info h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 2px; }
.dls-info p { font-size: 0.82rem; color: var(--text-muted); }
.dls-expire { color: var(--text-dim) !important; font-size: 0.75rem !important; }
.btn-dl-file {
  padding: 10px 18px; background: var(--success);
  color: #fff; font-size: 0.85rem; font-weight: 700; border-radius: 10px;
  display: flex; align-items: center; gap: 8px; transition: all 0.2s; white-space: nowrap;
}
.btn-dl-file:hover { background: #0ea572; transform: translateY(-1px); }

/* ===== QUEUE ===== */
.queue-section {
  background: rgba(20, 18, 30, 0.3); border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-lg); padding: 24px;
  backdrop-filter: blur(12px);
  transition: all 0.3s;
}
.queue-section:hover { border-color: rgba(99, 102, 241, 0.3); }
.qs-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.qs-header h3 { font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.qs-header h3 i { color: var(--primary); }
.btn-clear-queue {
  font-size: 0.78rem; color: var(--text-dim); padding: 4px 10px;
  border-radius: 6px; border: 1px solid var(--border); transition: all 0.2s;
}
.btn-clear-queue:hover { color: var(--danger); border-color: var(--danger); }
.queue-empty { text-align: center; padding: 32px 0; color: var(--text-dim); }
.queue-empty i { font-size: 2rem; margin-bottom: 12px; opacity: 0.4; }
.queue-empty p { font-size: 0.85rem; }
.queue-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 10px;
  border: 1px solid var(--border); margin-bottom: 8px; background: var(--bg-3);
}
.qi-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.qi-info { flex: 1; min-width: 0; }
.qi-name { display: block; font-size: 0.83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qi-source { display: block; font-size: 0.73rem; color: var(--text-muted); }
.qi-status { font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 100px; white-space: nowrap; }
.qi-status.done { background: rgba(16,185,129,0.12); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.qi-status.processing { background: rgba(245,158,11,0.12); color: var(--accent); border: 1px solid rgba(245,158,11,0.3); }
.qi-status.error { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }

/* ===== HISTORY ===== */
.history-filters { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.history-search, .history-filter-select {
  background: rgba(20, 18, 30, 0.4); border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 10px; padding: 10px 16px;
  color: var(--text); font-size: 0.875rem; outline: none; transition: all 0.2s;
}
.history-search { flex: 1; min-width: 200px; }
.history-search::placeholder { color: var(--text-dim); }
.history-search:focus, .history-filter-select:focus { border-color: var(--primary); }
.history-filter-select { background: var(--bg-card); }
.history-table-wrap { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.history-table th { padding: 14px 18px; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-align: left; background: var(--bg-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.history-table td { padding: 13px 18px; font-size: 0.83rem; color: var(--text-muted); border-bottom: 1px solid rgba(255,255,255,0.04); }
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: rgba(255,255,255,0.02); }
.hist-file-name { color: var(--text); font-weight: 500; display: block; }
.hist-file-type { font-size: 0.72rem; color: var(--text-dim); }
.hist-bank { display: flex; align-items: center; gap: 6px; }
.hist-bank-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.hist-status-ok { color: var(--success); font-size: 0.75rem; font-weight: 600; background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); padding: 3px 8px; border-radius: 100px; }
.hist-dl-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 7px; font-size: 0.75rem; font-weight: 600;
  background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.25);
  color: var(--primary-light); transition: all 0.2s;
}
.hist-dl-btn:hover { background: rgba(99,102,241,0.2); }
.hist-expired { font-size: 0.75rem; color: var(--text-dim); }

/* ===== SOURCES DASH ===== */
.sources-search-wrap {
  position: relative; margin-bottom: 24px;
  display: flex; align-items: center;
}
.sources-search-wrap i { position: absolute; left: 16px; color: var(--text-dim); font-size: 0.9rem; }
.sources-search-wrap input {
  width: 100%; max-width: 400px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 16px 11px 44px;
  color: var(--text); font-size: 0.875rem; outline: none; transition: all 0.2s;
}
.sources-search-wrap input::placeholder { color: var(--text-dim); }
.sources-search-wrap input:focus { border-color: var(--primary); }
.sources-dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.src-dash-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; transition: all 0.2s; cursor: default;
}
.src-dash-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.src-logo-dash {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; margin-bottom: 12px;
}
.src-dash-card h5 { font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; }
.src-dash-card p { font-size: 0.75rem; color: var(--text-muted); }
.src-dash-tag { display: inline-block; font-size: 0.68rem; font-weight: 600; margin-top: 8px; color: var(--primary-light); background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.2); padding: 2px 8px; border-radius: 100px; }

/* ===== ACCOUNT ===== */
.account-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.account-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.account-card h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.account-card h3 i { color: var(--primary); }
.account-form .form-group label { font-size: 0.82rem; }
.account-form .input-wrapper input { padding: 11px 16px 11px 44px; font-size: 0.875rem; }
.btn-save {
  width: 100%; padding: 12px; background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; font-size: 0.875rem; font-weight: 700; border: none; border-radius: 10px;
  cursor: pointer; transition: all 0.2s; margin-top: 4px; text-align: center; display: block;
}
.btn-save:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }
.current-plan-display { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.cpd-badge {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: rgba(99,102,241,0.12); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  border: 1px solid rgba(99,102,241,0.25);
}
.cpd-info p { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 4px; }
.cpd-info p:last-child { margin: 0; }
.cpd-info strong { color: var(--text); }
.account-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.as-item { background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.as-val { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1; }
.as-label { display: block; font-size: 0.73rem; color: var(--text-muted); margin-top: 4px; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 12px; min-width: 280px; max-width: 360px;
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease;
}
@keyframes toastIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
.toast.out { animation: toastOut 0.3s ease both; }
@keyframes toastOut { to{opacity:0;transform:translateX(60px)} }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--primary); }
.toast-msg { flex: 1; font-size: 0.85rem; }
.toast-msg strong { display: block; font-size: 0.88rem; }
.toast-msg span { color: var(--text-muted); font-size: 0.8rem; }
.toast-close { color: var(--text-dim); font-size: 0.8rem; cursor: pointer; padding: 2px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .account-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .dash-main { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dl-input-group { flex-direction: column; }
  .btn-download { width: 100%; justify-content: center; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .dash-content { padding: 16px; }
}

/* ===========================
   SUPPORT PAGE
=========================== */
.support-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; height: calc(100vh - 130px); min-height: 500px; }
.support-chat-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-agent-info { display: flex; align-items: center; gap: 12px; }
.agent-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; font-size: 1rem; color: #fff; flex-shrink: 0; position: relative; }
.agent-avatar.human-mode { background: linear-gradient(135deg, #10b981, #0ea572); }
.agent-avatar::after { content:''; position:absolute; bottom:1px; right:1px; width:9px; height:9px; background:var(--success); border-radius:50%; border:2px solid var(--bg-card); }
.chat-agent-info strong { display: block; font-size: 0.88rem; font-weight: 700; }
.agent-status { display: flex; align-items: center; gap: 5px; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.agent-status .status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse-dot 2s infinite; }
.agent-status.busy .status-dot { background: var(--accent); }
.chat-header-actions { display: flex; gap: 8px; }
.chat-action-btn { display: flex; align-items: center; gap: 7px; padding: 7px 14px; background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.25); border-radius: 9px; color: var(--primary-light); font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.chat-action-btn:hover { background: rgba(99,102,241,0.2); }
.chat-action-btn.human-requested { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); color: var(--success); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-msg { display: flex; gap: 10px; max-width: 85%; animation: fadeInUp 0.25s ease; }
.chat-msg.user-msg { flex-direction: row-reverse; align-self: flex-end; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 800; }
.msg-avatar.ai-av { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; font-size: 0.75rem; }
.msg-avatar.user-av { background: var(--bg-3); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.65rem; }
.msg-avatar.human-av { background: linear-gradient(135deg, #10b981, #0ea572); color: #fff; font-size: 0.75rem; }
.msg-bubble { padding: 11px 15px; border-radius: 14px; font-size: 0.875rem; line-height: 1.6; max-width: 100%; }
.ai-msg .msg-bubble { background: var(--bg-3); border: 1px solid var(--border); border-bottom-left-radius: 4px; color: var(--text); }
.human-msg .msg-bubble { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); border-bottom-left-radius: 4px; color: var(--text); }
.user-msg .msg-bubble { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; border-bottom-right-radius: 4px; }
.msg-time { font-size: 0.65rem; color: var(--text-dim); margin-top: 5px; display: block; }
.user-msg .msg-time { text-align: right; }
.msg-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.msg-option-btn { padding: 7px 14px; background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.25); border-radius: 100px; color: var(--primary-light); font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.msg-option-btn:hover { background: rgba(99,102,241,0.2); transform: translateY(-1px); }
.typing-indicator { display: flex; align-items: center; gap: 10px; padding: 12px 20px; flex-shrink: 0; }
.typing-indicator.hidden { display: none; }
.agent-avatar-sm { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; font-size: 0.6rem; color: #fff; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots span { width: 6px; height: 6px; background: var(--text-dim); border-radius: 50%; animation: typingBounce 1.2s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }
.typing-label { font-size: 0.72rem; color: var(--text-dim); }
.chat-input-bar { padding: 16px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.chat-input-wrap { display: flex; align-items: flex-end; gap: 8px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; transition: border-color 0.2s; }
.chat-input-wrap:focus-within { border-color: var(--primary); }
.chat-input-wrap textarea { flex: 1; background: none; border: none; color: var(--text); font-size: 0.875rem; resize: none; outline: none; max-height: 100px; line-height: 1.5; }
.chat-input-wrap textarea::placeholder { color: var(--text-dim); }
.chat-input-actions { display: flex; align-items: center; gap: 4px; }
.ci-attach { color: var(--text-dim); font-size: 0.9rem; padding: 4px; transition: color 0.2s; }
.ci-attach:hover { color: var(--text); }
.ci-send { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; transition: all 0.2s; border: none; cursor: pointer; }
.ci-send:hover { transform: scale(1.1); }
.chat-disclaimer { font-size: 0.68rem; color: var(--text-dim); margin-top: 8px; display: flex; align-items: center; gap: 5px; }
.chat-disclaimer i { color: var(--success); }
.support-sidebar { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.support-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.sc-title { font-size: 0.82rem; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.sc-title i { color: var(--primary); }
.ticket-status-display { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ticket-id { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.ticket-badge { font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: 100px; }
.ticket-badge.waiting { background: rgba(245,158,11,0.12); color: var(--accent); border: 1px solid rgba(245,158,11,0.3); }
.ticket-badge.assigned { background: rgba(99,102,241,0.12); color: var(--primary-light); border: 1px solid rgba(99,102,241,0.3); }
.ticket-badge.resolved { background: rgba(16,185,129,0.12); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.ticket-note { font-size: 0.75rem; color: var(--text-muted); }
.quick-topics { display: flex; flex-direction: column; gap: 6px; }
.qt-btn { text-align: left; padding: 9px 12px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 9px; color: var(--text-muted); font-size: 0.78rem; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; }
.qt-btn:hover { border-color: var(--primary); color: var(--primary-light); background: rgba(99,102,241,0.06); }
.qt-btn i { color: var(--primary); font-size: 0.8rem; width: 14px; }
.support-hours { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.sh-item { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; }
.sh-item span:first-child { color: var(--text-muted); }
.sh-time { color: var(--text); font-weight: 600; font-size: 0.75rem; }
.always-on { color: var(--success) !important; }
.btn-whatsapp { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; background: #25d366; color: #fff; border-radius: 10px; font-size: 0.82rem; font-weight: 700; transition: all 0.2s; }
.btn-whatsapp:hover { background: #1eb955; transform: translateY(-1px); }

/* Human request banner */
.human-request-banner { background: rgba(16,185,129,0.07); border: 1px solid rgba(16,185,129,0.25); border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.hrb-icon { font-size: 1.4rem; color: var(--success); flex-shrink: 0; }
.hrb-info strong { display: block; font-size: 0.85rem; }
.hrb-info span { font-size: 0.75rem; color: var(--text-muted); }
.hrb-cancel { font-size: 0.75rem; color: var(--text-dim); cursor: pointer; margin-left: auto; white-space: nowrap; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); transition: all 0.2s; }
.hrb-cancel:hover { color: var(--danger); border-color: var(--danger); }

@media (max-width: 900px) { .support-layout { grid-template-columns: 1fr; height: auto; } .support-sidebar { display: none; } }
