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

:root {
  --bg-page: #f9fafb;
  --bg-surface: #ffffff;
  --bg-subtle: #f3f4f6;
  --bg-hover: #f9fafb;

  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --border-dark: #111827;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-light: #9ca3af;

  --accent-black: #000000;
  --accent-white: #ffffff;

  --status-green: #16a34a;
  --status-green-bg: #f0fdf4;
  --status-green-border: #bbf7d0;

  --status-yellow: #ca8a04;
  --status-yellow-bg: #fefce8;
  --status-yellow-border: #fef08a;

  --status-red: #dc2626;
  --status-red-bg: #fef2f2;
  --status-red-border: #fecaca;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.app-header {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-black);
  color: var(--accent-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.brand-title h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent-black);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title p {
  font-size: 11px;
  color: var(--text-muted);
}

.badge-phase {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Compliance Pill */
.compliance-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
}

.compliance-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-black);
}

.compliance-time {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-black);
}

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

.btn-agent-app {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-black);
  color: var(--accent-white);
  border: 1px solid var(--accent-black);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-agent-app:hover {
  background: #262626;
  color: var(--accent-white);
}

/* Nav Tabs */
.nav-bar {
  display: flex;
  gap: 4px;
  padding: 8px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
}

.tab-btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.tab-btn.active {
  color: var(--accent-white);
  background: var(--accent-black);
}

/* Main Container */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Cards */
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

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

.card-title-row h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-black);
  letter-spacing: -0.01em;
}

/* Grid Layouts */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* KPI Cards */
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.kpi-label span {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-light);
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-sans);
  color: var(--accent-black);
  letter-spacing: -0.02em;
}

.kpi-subtext {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Buttons */
.btn-primary {
  background: var(--accent-black);
  color: var(--accent-white);
  border: 1px solid var(--accent-black);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary:hover {
  background: #262626;
  border-color: #262626;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-dark);
}

.btn-secondary.active {
  background: var(--accent-black);
  color: var(--accent-white);
  border-color: var(--accent-black);
}

.btn-danger {
  background: var(--bg-surface);
  color: var(--status-red);
  border: 1px solid var(--status-red-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger:hover {
  background: var(--status-red-bg);
  border-color: var(--status-red);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #fafafa;
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-family: var(--font-mono);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-secondary);
}

.badge-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-light);
}

.badge-available, .state-idle {
  background: var(--status-green-bg);
  color: var(--status-green);
  border-color: var(--status-green-border);
}
.badge-available::before, .state-idle::before {
  background: var(--status-green);
}

.badge-on_call, .state-in_call {
  background: var(--accent-black);
  color: var(--accent-white);
  border-color: var(--accent-black);
}
.badge-on_call::before, .state-in_call::before {
  background: #22c55e;
}

.badge-wrap_up, .state-cooldown {
  background: var(--status-yellow-bg);
  color: var(--status-yellow);
  border-color: var(--status-yellow-border);
}
.badge-wrap_up::before, .state-cooldown::before {
  background: var(--status-yellow);
}

.badge-break, .state-paused, .state-disconnected {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-color: var(--border-light);
}
.badge-break::before, .state-paused::before, .state-disconnected::before {
  background: var(--text-muted);
}

/* Agent Cards */
.agent-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--accent-black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.agent-meta h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-black);
}

.agent-meta p {
  font-size: 11px;
  color: var(--text-muted);
}

/* Live Call HUD */
.live-call-hud {
  background: var(--bg-surface);
  border: 1px solid var(--accent-black);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.call-timer {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-black);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-modal);
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-black);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
}

.modal-close:hover {
  color: var(--accent-black);
  background: var(--bg-subtle);
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-black);
  box-shadow: 0 0 0 1px var(--accent-black);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent-black);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Customer Status & Sentiment System */
.badge-sentiment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}
.badge-sentiment:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.sentiment-extremely_positive {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.25);
}
.sentiment-positive {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border-color: #bbf7d0 !important;
}
.sentiment-neutral {
  background: #f8fafc !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}
.sentiment-negative {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border-color: #fecaca !important;
}

/* Sentiment Picker Buttons */
.sentiment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.btn-sentiment-option {
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-sentiment-option:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.btn-sentiment-option.selected {
  border-color: #059669;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 700;
  box-shadow: 0 0 0 1px #059669;
}
