:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-border: #334155;
  --surface: #111c2e;
  --surface-2: #152235;
  --field: #0b1324;
  --chart-surface: #172437;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #7c6cff;
  --accent-soft: rgba(124, 108, 255, 0.14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --amber: #facc15;
  --amber-soft: rgba(250, 204, 21, 0.16);
  --shadow: 0 18px 40px rgba(2, 8, 23, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 48%, #111827 100%);
}

body[data-theme="light"] {
  --bg: #eef4fb;
  --panel: #ffffff;
  --panel-border: rgba(148, 163, 184, 0.45);
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --field: #f8fafc;
  --chart-surface: #f7fbff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.14);
  --shadow: 0 18px 40px rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, #f7fbff 0%, #eef4fb 48%, #e9f0f8 100%);
}

button,
input,
select {
  font: inherit;
}

.page {
  max-width: 1640px;
  margin: 0 auto;
  padding: 24px 28px 32px;
}

.top-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.top-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(71, 85, 105, 0.55);
  background: rgba(11, 19, 36, 0.82);
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.top-tab:hover {
  color: var(--text);
  border-color: rgba(124, 108, 255, 0.4);
}

.top-tab.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, #6c63ff 0%, #4f46e5 100%);
  border-color: rgba(124, 108, 255, 0.72);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.26);
}

.hero,
.panel {
  background: var(--surface);
  border: 1px solid rgba(71, 85, 105, 0.5);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(2, 8, 23, 0.24);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  margin-bottom: 18px;
}

.hero-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero h1,
.section-heading h2 {
  margin: 0;
}

.page-title {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.subtitle,
.last-updated,
.status-message {
  color: var(--muted);
}

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

.filters,
.panel {
  padding: 10px;
}

.filters {
  margin-bottom: 16px;
}

.quick-actions,
.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.filter-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--muted);
}

input,
select,
button {
  border-radius: 8px;
  border: 1px solid rgba(71, 85, 105, 0.55);
  background: var(--field);
  padding: 7px 9px;
  color: var(--text);
  font-size: 0.84rem;
  min-height: 25px;
}

button {
  cursor: pointer;
  color: var(--text);
}

.primary-button {
  border-color: rgba(124, 108, 255, 0.32);
  background: #6c63ff;
  color: #ffffff;
}

.ghost-button {
  background: var(--field);
}

.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.status-message {
  min-height: 22px;
  margin: 10px 4px 16px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(71, 85, 105, 0.5);
  background: var(--surface-2);
  box-shadow: 0 8px 18px rgba(2, 8, 23, 0.2);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: #7c6cff;
}

.metric-card .label {
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-card .value {
  margin-top: 8px;
  font-size: 1.8rem;
  font-weight: 700;
  color: #c7d2fe;
}

.metric-card.blue {
  background: var(--surface-2);
}

.metric-card.green {
  background: var(--surface-2);
}

.metric-card.red {
  background: var(--surface-2);
}

.metric-card.blue::before {
  background: #60a5fa;
}

.metric-card.green::before {
  background: #22c55e;
}

.metric-card.red::before {
  background: #ef4444;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.45fr) minmax(320px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

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

.wide {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: var(--text);
}

.chart-box {
  min-height: 320px;
}

.chart-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  border: 1px dashed var(--panel-border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--field) 80%, transparent);
}

.line-chart {
  width: 100%;
  height: 320px;
}

.stack-list,
.chart-box {
  background: var(--chart-surface);
  border: 1px solid rgba(71, 85, 105, 0.42);
  border-radius: 12px;
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(30, 41, 59, 0.2);
}

.stack-list {
  min-height: 320px;
}

.compact-bars {
  min-height: 270px;
}

.chart-large {
  min-height: 390px;
}

.pie-host {
  min-height: 280px;
  display: grid;
  align-items: center;
}

.pie-layout {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.pie-chart {
  width: 100%;
  max-width: 220px;
  height: 220px;
  filter: drop-shadow(0 12px 24px rgba(2, 8, 23, 0.35));
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 2px solid var(--legend-color, currentColor);
  background: var(--legend-fill, transparent);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15);
}

.legend-label {
  color: var(--muted);
}

.legend-value {
  color: var(--text);
  font-weight: 700;
}

/* ── AI Insight Grid (inside drawer) ── */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.42);
  background: var(--chart-surface);
  box-shadow: inset 0 0 0 1px rgba(30, 41, 59, 0.12);
}

.insight-card--wide {
  grid-column: 1 / -1;
}

.insight-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.insight-body {
  flex: 1;
  min-width: 0;
}

.insight-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.insight-title {
  margin-top: 10px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}

.insight-value {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.insight-copy {
  margin-top: 8px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
}

.insight-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.insight-tag {
  background: rgba(71, 85, 105, 0.35);
  color: var(--text);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
}

.insight-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

/* ── AI Insight Drawer ── */
.ai-insight-drawer {
  background: var(--surface);
  border: 1px solid rgba(71, 85, 105, 0.5);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(2, 8, 23, 0.24);
  margin-bottom: 18px;
  padding: 18px 22px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-insight-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(71, 85, 105, 0.42);
}

.bar-chart {
  width: 100%;
  height: 100%;
  min-height: 290px;
}

.compact-bars .bar-chart {
  min-height: 250px;
}

.chart-large .bar-chart {
  min-height: 340px;
}

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

.call-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
.actions-column {
  text-align: center;
  width: 60px;
  padding: 4px;
}

.duration-column {
  width: 30px;
  min-width: 30px;
  text-align: center;
}

.action-icons {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
}
.tooltip-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
  position: relative;  /* ← anchor for the tooltip */
}

.custom-tooltip {
  visibility: hidden;
  opacity: 0;
  width: 280px;
  background: #1e293b;
  color: #fff;
  text-align: left;
  border-radius: 10px;
  padding: 12px;
  position: absolute;       /* ← changed from fixed */
  bottom: calc(100% + 8px); /* ← appears above the icon */
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  white-space: normal;
  word-break: break-word;
}

.tooltip-container:hover .custom-tooltip {
  visibility: visible;
  opacity: 1;
}
tr:first-child .tooltip-container .custom-tooltip {
  bottom: auto;
  top: calc(100% + 8px);
}
.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.35);
    background: rgba(255, 255, 255, 0.02);
    transition: 0.2s ease;
}

.logout-btn:hover {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.6);
}

.logout-icon {
    font-size: 15px;
}
.action-icons span,
.action-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 4px;
}

.action-icons span:hover,
.action-icons a:hover {
  transform: scale(1.15);
}

/* Tooltip style */
.action-icons span[title],
.action-icons a[title] {
  position: relative;
}
/* Name Shared by User */
.call-table th:nth-child(6),
.call-table td:nth-child(6) {
  width: 14%;
  min-width: 180px;
}

/* Mobile Number Shared → reduce width */
.call-table th:nth-child(7),
.call-table td:nth-child(7) {
  width: 10%;
  min-width: 140px;
}

/* Summary → increase width */
.call-table th:nth-child(13),
.call-table td:nth-child(13) {
  width: 24%;
  min-width: 300px;
}

/* Allow wrapping for text-heavy columns */
.call-table td:nth-child(6),
.call-table td:nth-child(13) {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chart-shell {
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.42);
  background: linear-gradient(180deg, color-mix(in srgb, var(--chart-surface) 96%, white 4%) 0%, var(--chart-surface) 100%);
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(30, 41, 59, 0.18);
}

.chart-shell .chart-legend {
  margin-bottom: 14px;
}

.chart-shell .legend-item {
  background: transparent;
}

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

th,
td {
  text-align: right;
  padding: 12px 10px;
  border-bottom: 1px solid var(--panel-border);
}

th {
  color: var(--muted);
  font-size: 0.88rem;
}

td {
  color: var(--text);
}

/* ── Light mode overrides ── */
body[data-theme="light"] .top-tab {
  background: rgba(255, 255, 255, 0.8);
}

body[data-theme="light"] .top-tab.is-active {
  color: #ffffff;
}

body[data-theme="light"] .hero,
body[data-theme="light"] .panel,
body[data-theme="light"] .metric-card {
  box-shadow: 0 10px 24px rgba(148, 163, 184, 0.15);
}

body[data-theme="light"] .metric-card .value {
  color: #1d4ed8;
}

body[data-theme="light"] .legend-dot {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

body[data-theme="light"] .ai-insight-drawer {
  background: var(--surface);
  border-color: var(--panel-border);
}

body[data-theme="light"] .insight-card {
  background: var(--chart-surface);
  border-color: var(--panel-border);
}

body[data-theme="light"] .insight-tag {
  background: rgba(148, 163, 184, 0.25);
  color: var(--text);
}

body[data-theme="light"] .ghost-button {
  background: var(--field);
  color: var(--text);
  border-color: var(--panel-border);
}

body[data-theme="light"] input,
body[data-theme="light"] select {
  background: var(--field);
  color: var(--text);
  border-color: var(--panel-border);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
}

.pill.answered,
.pill.positive {
  color: var(--green);
  background: var(--green-soft);
}

.pill.unanswered,
.pill.negative {
  color: var(--red);
  background: var(--red-soft);
}

.pill.neutral,
.pill.unknown {
  color: var(--amber);
  background: var(--amber-soft);
}

@media (max-width: 1100px) {
  .filter-grid,
  .metrics-grid,
  .content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .page {
    padding: 16px;
  }

  .top-tab {
    flex: 1 1 calc(50% - 5px);
  }

  .chart-shell .chart-legend {
    gap: 10px;
  }

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

  .filter-grid,
  .metrics-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }


}
/* Pagination Wrapper - Right Side */
.pagination-wrapper {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Pagination Controls */
#paginationControls {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

/* Only arrows */
#paginationControls button {
  width: 36px;
  height: 36px;
  border: 1px solid #334155;
  background: #0f172a;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
}

/* Hover */
#paginationControls button:hover:not(:disabled) {
  background: #1e293b;
}

/* Disabled */
#paginationControls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.table-wrapper {
  margin-bottom: 0;
  padding-bottom: 0;
}

.call-table {
  margin-bottom: 0;
}
.call-table td,
.call-table th {
  padding: 10px 8px;
}
