:root {
  --bg-1: #e8eef8;
  --bg-2: #f5f0ff;
  --bg-3: #dff4f7;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.08);
  --text: #1a1f36;
  --muted: #5b6478;
  --primary: #5b6cff;
  --primary-2: #8b5cf6;
  --primary-glow: rgba(91, 108, 255, 0.35);
  --success: #0d9488;
  --error: #dc2626;
  --wa: #25d366;
  --radius: 20px;
  --radius-sm: 14px;
  --blur: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  line-height: 1.65;
  background: var(--bg-1);
  overflow-x: hidden;
}

input,
select,
button,
textarea {
  font-family: inherit;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 520px;
  height: 520px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 70%);
}

body::after {
  width: 480px;
  height: 480px;
  bottom: -100px;
  left: -60px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.28), transparent 70%);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  display: block;
}

.glass-icon.lg {
  width: 2rem;
  height: 2rem;
}

.glass-icon.xl {
  width: 2.75rem;
  height: 2.75rem;
}

.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.icon-wrap.lg {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 16px;
}

/* Header */
.hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
}

.hero-text h1 {
  margin: 0 0 0.2rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Main tabs */
.main-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.45rem;
  border-radius: calc(var(--radius) + 4px);
}

.main-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.main-tab:hover {
  background: rgba(255, 255, 255, 0.35);
  color: var(--text);
}

.main-tab.active {
  background: var(--glass-strong);
  border-color: rgba(255, 255, 255, 0.85);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(91, 108, 255, 0.12);
}

.panel.hidden {
  display: none;
}

.card {
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Mode tabs */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.mode-tab.active {
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(91, 108, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.12);
}

small {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0 1.25rem;
  align-items: center;
}

.presets-label {
  font-size: 0.82rem;
  color: var(--muted);
  width: 100%;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:not(:disabled):active {
  transform: scale(0.98);
}

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.95rem 1.2rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.primary:hover:not(:disabled) {
  box-shadow: 0 12px 32px rgba(91, 108, 255, 0.4);
}

.scrape-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.scrape-actions .primary {
  flex: 1 1 12rem;
  margin-top: 0;
}

.scrape-actions .danger {
  flex: 0 0 auto;
  min-width: 6.5rem;
  justify-content: center;
  padding: 0.95rem 1.1rem;
  font-size: 0.92rem;
}

.secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
}

.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.8);
}

.preset {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.65);
  color: var(--text);
  font-size: 0.8rem;
}

.preset:hover {
  background: rgba(255, 255, 255, 0.75);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.status {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
}

.status.loading {
  background: rgba(91, 108, 255, 0.1);
  border: 1px solid rgba(91, 108, 255, 0.2);
  color: #4338ca;
}

.status.success {
  background: rgba(13, 148, 136, 0.1);
  border: 1px solid rgba(13, 148, 136, 0.2);
  color: var(--success);
}

.status.error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.18);
  color: var(--error);
}

.hidden {
  display: none !important;
}

.progress-wrap {
  margin-top: 1rem;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #38bdf8);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-text {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.scrape-log-wrap {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.scrape-log-title {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.scrape-log-scroll {
  max-height: 14rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: 8px;
  padding-inline: 0.15rem;
}

.scrape-log {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

.scrape-log li {
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  word-break: break-word;
}

.scrape-log li:last-child {
  border-bottom: none;
}

.scrape-log time {
  color: var(--muted);
  font-size: 0.72rem;
  margin-inline-end: 0.45rem;
  font-variant-numeric: tabular-nums;
}

.scrape-log .log-info { color: var(--text); }
.scrape-log .log-warn { color: #b45309; }
.scrape-log .log-error { color: var(--error); font-weight: 600; }
.scrape-log .log-ok { color: var(--success); font-weight: 600; }

/* Results */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stats-line {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.stat-card {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.stat-card strong {
  display: block;
  font-size: 1.25rem;
  margin-top: 0.25rem;
}

.stat-card span {
  font-size: 0.78rem;
  color: var(--muted);
}

.analytics-section {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.62);
}

.analytics-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
}

.analytics-note {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.analytics-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.analytics-row {
  display: grid;
  grid-template-columns: minmax(7rem, 1.3fr) repeat(5, minmax(3.5rem, 1fr));
  gap: 0.35rem 0.5rem;
  align-items: center;
}

.analytics-periods {
  display: contents;
}

.period-tag {
  display: none;
}

.analytics-cell {
  text-align: center;
  padding: 0.55rem 0.35rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.35);
}

.analytics-cell strong {
  font-size: 1.15rem;
  font-weight: 700;
}

.analytics-head {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  padding: 0.25rem;
}

.analytics-label {
  text-align: right;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.5);
}

.analytics-label-shared {
  color: #15803d;
}

.analytics-shared {
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.analytics-shared strong {
  color: #15803d;
}

@media (max-width: 720px) {
  .analytics-row {
    grid-template-columns: minmax(5.5rem, 1fr) repeat(5, minmax(2.5rem, 1fr));
    gap: 0.25rem;
    font-size: 0.85rem;
  }

  .analytics-cell strong {
    font-size: 0.95rem;
  }

  .analytics-head {
    font-size: 0.62rem;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.18);
}

.bulk-bar.hidden {
  display: none;
}

.bulk-count {
  font-weight: 700;
  font-size: 0.88rem;
  color: #991b1b;
  margin-inline-end: auto;
}

.danger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.14);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #991b1b;
  font-weight: 700;
  font-size: 0.82rem;
}

.danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.22);
}

.col-check {
  width: 2.5rem;
  text-align: center;
  padding-inline: 0.45rem !important;
}

.col-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

tbody tr.row-selected {
  background: rgba(91, 108, 255, 0.08);
}

tbody tr.row-selected:hover {
  background: rgba(91, 108, 255, 0.12);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  vertical-align: middle;
}

th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.25);
  white-space: nowrap;
}

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

tbody tr:hover {
  background: rgba(255, 255, 255, 0.35);
}

.cell-name {
  max-width: 14rem;
  word-break: break-word;
}

.cell-phone,
.cell-email {
  max-width: 10rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}

.tag-shared {
  background: rgba(13, 148, 136, 0.12);
  color: var(--success);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.tag-pending {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.35);
  color: #128c7e;
  font-weight: 700;
  font-size: 0.78rem;
}

.wa-btn:hover {
  background: rgba(37, 211, 102, 0.28);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.icon-btn .glass-icon {
  width: 1rem;
  height: 1rem;
}

.icon-btn:hover {
  transform: translateY(-1px);
}

.icon-btn-edit:hover {
  background: rgba(91, 108, 255, 0.18);
  border-color: rgba(91, 108, 255, 0.35);
}

.icon-btn-delete {
  color: #b91c1c;
}

.icon-btn-delete:hover {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.3);
  color: #991b1b;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 31, 54, 0.35);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 1.25rem;
  border-radius: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-header h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  flex-shrink: 0;
}

#edit-form label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
}

#edit-form input[type="text"],
#edit-form textarea,
#edit-form select {
  width: 100%;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.row-shared {
  background: rgba(13, 148, 136, 0.06);
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem !important;
}

.muted {
  color: var(--muted);
  font-size: 0.82rem;
}

td[dir="ltr"] {
  text-align: left;
  direction: ltr;
}

.cell-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 12rem;
}

footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

label span[data-icon],
.mode-tab span[data-icon],
.main-tab span[data-icon],
.preset span[data-icon],
.secondary span[data-icon],
.primary span[data-icon] {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

label span[data-icon] .glass-icon,
.mode-tab span[data-icon] .glass-icon,
.main-tab span[data-icon] .glass-icon,
.preset span[data-icon] .glass-icon,
.secondary span[data-icon] .glass-icon {
  width: 1rem;
  height: 1rem;
}

.wa-btn .glass-icon {
  width: 1rem;
  height: 1rem;
}

.tag .glass-icon {
  width: 0.85rem;
  height: 0.85rem;
}

@media (max-width: 768px) {
  .page {
    padding: 1rem 0.75rem 2.5rem;
  }

  .card {
    padding: 1rem;
  }

  .hero {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }

  .hero-text h1 {
    font-size: 1.25rem;
  }

  .main-tab,
  .mode-tab {
    font-size: 0.82rem;
    padding: 0.75rem 0.5rem;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-header {
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .actions .secondary {
    flex: 1 1 calc(50% - 0.25rem);
    justify-content: center;
    min-width: 0;
  }

  .analytics-header {
    display: none;
  }

  .analytics-row:not(.analytics-header) {
    display: block;
    padding: 0.85rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.55);
  }

  .analytics-row + .analytics-row:not(.analytics-header) {
    margin-top: 0.35rem;
  }

  .analytics-periods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-top: 0.5rem;
  }

  .period-tag {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.15rem;
  }

  .analytics-label {
    margin-bottom: 0;
    padding: 0;
    background: transparent;
  }

  .pagination-bar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem;
  }

  .page-btn {
    min-width: 0;
    flex: 1;
  }

  .page-info {
    width: 100%;
    order: -1;
    font-size: 0.8rem;
  }

  /* Mobile card layout for results table */
  .table-wrap {
    overflow-x: visible;
    background: transparent;
    border: none;
  }

  #saved-table {
    font-size: 0.88rem;
  }

  #saved-table thead {
    display: none;
  }

  #saved-table tbody tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75rem;
    padding: 0.85rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.62);
  }

  #saved-table tbody td.col-check { order: 1; }
  #saved-table tbody td.cell-name { order: 2; }
  #saved-table tbody td.cell-status { order: 3; }
  #saved-table tbody td.cell-phone { order: 4; }
  #saved-table tbody td.cell-email { order: 5; }
  #saved-table tbody td.cell-city { order: 6; }
  #saved-table tbody td.cell-wa { order: 7; }
  #saved-table tbody td.cell-actions { order: 8; }

  #saved-table tbody tr:last-child {
    margin-bottom: 0;
  }

  #saved-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.48);
  }

  #saved-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    max-width: 100%;
  }

  #saved-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  #saved-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--muted);
    flex-shrink: 0;
  }

  #saved-table tbody td.col-check {
    justify-content: flex-start;
    padding-top: 0;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  }

  #saved-table tbody td.col-check::before {
    display: none;
  }

  #saved-table tbody td.cell-name {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding-top: 0;
    border-bottom: none;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
    white-space: normal;
  }

  #saved-table tbody td.cell-name::before {
    display: none;
  }

  #saved-table tbody td.cell-status {
    justify-content: flex-start;
    border-bottom: none;
    padding-bottom: 0.35rem;
  }

  #saved-table tbody td.cell-status::before {
    display: none;
  }

  #saved-table tbody td.cell-phone,
  #saved-table tbody td.cell-email {
    word-break: break-all;
    white-space: normal;
    text-align: end;
  }

  #saved-table tbody td.cell-wa {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding-top: 0.65rem;
    border-bottom: none;
  }

  #saved-table tbody td.cell-wa::before {
    display: none;
  }

  #saved-table tbody td.cell-actions {
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
  }

  #saved-table tbody td.cell-actions::before {
    display: none;
  }

  #saved-table .wa-btn {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1rem;
    font-size: 0.92rem;
    min-height: 2.75rem;
  }

  #saved-table .row-actions .icon-btn {
    width: 2.5rem;
    height: 2.5rem;
  }

  #saved-table .empty-row {
    display: block !important;
    text-align: center;
    padding: 2rem 1rem !important;
    border: none;
  }

  #saved-table .empty-row::before {
    display: none;
  }

  .cell-truncate {
    max-width: none;
    white-space: normal;
    word-break: break-word;
  }
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.page-info {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  flex: 1;
  text-align: center;
}

.page-btn {
  min-width: 5.5rem;
}

.live-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  background: rgba(26, 31, 54, 0.92);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

tr.row-just-shared {
  animation: flashShared 0.6s ease;
}

@keyframes flashShared {
  from { background: rgba(34, 197, 94, 0.25); }
  to { background: rgba(13, 148, 136, 0.06); }
}
