:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.dash-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.dash-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
}

.dash-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: #0a0a0a;
}

.dash-brand img {
  height: 32px;
  width: auto;
  display: block;
}

.dash-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: #374151;
}

.dash-nav a svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.dash-nav a.hidden,
.dash-nav a[hidden] {
  display: none !important;
}

.dash-nav a.active {
  background: #111827;
  color: #ffffff;
}

.dash-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.minutes-pill {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
}

.minutes-pill strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
}

.user-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-link {
  border: none;
  background: transparent;
  color: #64748b;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
}

.ghost-link:hover {
  color: #0f172a;
}

.dash-main,
.page-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.welcome h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
}

.welcome-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.welcome p {
  margin: 8px 0 0;
  color: var(--muted);
}

.period-wrap select {
  min-width: 160px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 22px;
}

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

.panel h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.info-dot {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  font-size: 0.65rem;
  color: #64748b;
  vertical-align: middle;
  margin-left: 4px;
}

.select-wrap select,
.form-grid select,
.form-grid input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  background: #fff;
  min-width: 180px;
}

.stat-grid {
  display: grid;
  gap: 14px;
}

.stat-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card,
.quality-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.stat-card p,
.quality-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.stat-card strong,
.quality-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
  line-height: 1.1;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.stat-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.stat-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.chart-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.chart-panel h2 {
  margin: 0 0 12px;
}

.status-banner {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.status-banner.error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.status-banner.success {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.hidden {
  display: none;
}

.page-title {
  margin: 0;
  font-size: 1.8rem;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.form-panel {
  margin-top: 22px;
}

.form-grid {
  display: grid;
  gap: 14px;
  max-width: 520px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

.primary-btn {
  border: none;
  border-radius: 10px;
  background: #0a0a0a;
  color: #fff;
  padding: 11px 18px;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.primary-btn:hover {
  background: #1a1a1a;
}

.secondary-btn {
  border: 1px solid #111;
  border-radius: 10px;
  background: #fff;
  color: #111;
  padding: 11px 18px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.summary-strip {
  margin-top: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.summary-strip.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.summary-strip .summary-item {
  padding: 18px 16px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.summary-strip .summary-item:last-child {
  border-right: none;
}

.summary-item span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.summary-item strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
  color: #0a0a0a;
}

.metric-cards {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.metric-card span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.8rem;
}

.agent-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.agent-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.agent-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-identity {
  display: flex;
  gap: 12px;
  align-items: center;
}

.agent-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.agent-avatar.inbound {
  background: #2563eb;
}

.agent-identity h3 {
  margin: 0;
  font-size: 1.05rem;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.84rem;
  color: #6b7280;
}

.agent-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
}

.agent-status.active {
  color: #15803d;
}

.agent-status.active .dot {
  background: #22c55e;
}

.agent-tools {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #4b5563;
}

.agent-desc {
  margin: 12px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.agent-stats {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 14px 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  text-align: center;
  gap: 8px;
}

.agent-stats span {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
}

.agent-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
}

.agent-breakdown {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: #6b7280;
}

.agent-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.agent-contacts {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: #4b5563;
  font-weight: 500;
}

.upload-btn {
  border: 1px solid #111;
  border-radius: 10px;
  background: #fff;
  color: #111;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.upload-btn:hover {
  background: #f9fafb;
}

.start-btn {
  border: none;
  border-radius: 10px;
  background: #0a0a0a;
  color: #fff;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.select-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #374151;
}

.empty-state {
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: #4b5563;
  background: #fff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
}

.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
}

.table-card {
  margin-top: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.table-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.table-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .summary-strip,
  .summary-strip.five,
  .agent-grid,
  .metric-cards {
    grid-template-columns: 1fr;
  }

  .summary-strip .summary-item {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.provider-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fafafa;
}

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

.provider-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.provider-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.provider-status.connected {
  color: #15803d;
}

.provider-status.muted {
  color: #b45309;
}

.provider-email {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.2em;
}

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

.muted-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.calendar-pref {
  display: grid;
  gap: 6px;
  margin: 12px 0 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.calendar-pref select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: #fff;
}

.calendar-pref-warn {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: #b45309;
}

.calendar-pref-warn a {
  color: #92400e;
  text-decoration: underline;
}

.agent-contacts-row {
  margin: 10px 0 4px;
}

.upload-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px 10px;
}

.upload-chip-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-remove-btn {
  padding: 7px 12px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

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

@media (max-width: 800px) {
  .provider-grid {
    grid-template-columns: 1fr;
  }
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 1100px) {
  .stat-grid.five,
  .stat-grid.four,
  .chart-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .dash-header-inner {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .stat-grid.five,
  .stat-grid.four,
  .chart-row {
    grid-template-columns: 1fr;
  }
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  position: relative;
  width: min(820px, 100%);
  max-height: min(85vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-body {
  display: grid;
  gap: 10px;
}

.batch-row,
.call-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.batch-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.batch-row:hover {
  background: #f8fafc;
}

.batch-row-top,
.call-row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.batch-row strong,
.call-row strong {
  font-size: 0.98rem;
}

.batch-meta,
.call-meta {
  margin-top: 6px;
  color: #64748b;
  font-size: 0.84rem;
}

.batch-stats {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.batch-chip {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
}

.batch-chip.answered { background: #dcfce7; color: #166534; }
.batch-chip.declined { background: #ffedd5; color: #9a3412; }
.batch-chip.failed { background: #fee2e2; color: #991b1b; }
.batch-chip.partial { background: #e0e7ff; color: #3730a3; }
.batch-chip.in-progress { background: #e2e8f0; color: #334155; }

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

.outcome-pill.answered { background: #dcfce7; color: #166534; }
.outcome-pill.declined { background: #ffedd5; color: #9a3412; }
.outcome-pill.failed { background: #fee2e2; color: #991b1b; }
.outcome-pill.partial { background: #e0e7ff; color: #3730a3; }
.outcome-pill.in-progress { background: #e2e8f0; color: #334155; }

.modal-back {
  border: none;
  background: transparent;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 8px;
  width: fit-content;
}
