/* Euricio CRM — Admin LiveView Styles
   Minimales, funktionales Design für interne Admin-Oberflächen */

:root {
  --euricio-blue: #1a56db;
  --euricio-dark: #111827;
  --euricio-gray: #6b7280;
  --euricio-light: #f9fafb;
  --euricio-border: #e5e7eb;
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --info: #3b82f6;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--euricio-light);
  color: var(--euricio-dark);
  margin: 0;
}

/* Dashboard Grid */
.euricio-dashboard { padding: 1.5rem; }
.dashboard-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
}
.dashboard-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.live-badge {
  background: var(--error); color: white;
  padding: 0.25rem 0.75rem; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 600;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: white;
  border: 1px solid var(--euricio-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card h2 {
  font-size: 0.875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--euricio-gray); margin: 0 0 0.75rem;
}

.stat-number {
  font-size: 2.5rem; font-weight: 700;
  color: var(--euricio-blue); line-height: 1;
}
.stat-number.alert { color: var(--error); }

/* Call List */
.call-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.call-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; border-bottom: 1px solid var(--euricio-border);
  font-size: 0.875rem;
}
.call-item:last-child { border-bottom: none; }
.caller { font-weight: 500; }

/* Calls Table */
.calls-monitor { padding: 1.5rem; }
.calls-monitor header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
}
.calls-monitor h1 { font-size: 1.25rem; font-weight: 700; margin: 0; }

.filters { display: flex; gap: 0.5rem; }
.filters button {
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--euricio-border);
  border-radius: 0.5rem; background: white;
  font-size: 0.875rem; cursor: pointer;
  transition: all 0.15s;
}
.filters button.active, .filters button:hover {
  background: var(--euricio-blue); color: white; border-color: var(--euricio-blue);
}

.calls-table {
  width: 100%; border-collapse: collapse;
  background: white; border-radius: 0.75rem;
  overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 1.5rem;
}
.calls-table th {
  background: var(--euricio-light);
  padding: 0.75rem 1rem; text-align: left;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--euricio-gray);
  border-bottom: 1px solid var(--euricio-border);
}
.calls-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--euricio-border);
  font-size: 0.875rem;
}
.calls-table tr:last-child td { border-bottom: none; }
.calls-table tr:hover td { background: var(--euricio-light); }

/* Status Badges */
.badge-in-progress { background: #dbeafe; color: #1e40af; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; }
.badge-completed { background: #d1fae5; color: #065f46; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; }
.badge-no-answer, .badge-busy { background: #fee2e2; color: #991b1b; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; }
.badge-failed { background: #fef3c7; color: #92400e; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; }

/* Direction labels */
.direction-inbound { color: var(--success); font-weight: 500; }
.direction-outbound { color: var(--info); font-weight: 500; }

/* Health */
.health-ok { color: var(--success); font-weight: 600; }
.health-error { color: var(--error); font-weight: 600; }

/* Pipeline stats */
.pipeline-stats, .oban-stats, .health-stats { margin: 0; padding: 0; }
.pipeline-row, .queue-row, .health-stats > div {
  display: flex; justify-content: space-between;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--euricio-border);
  font-size: 0.875rem;
}
.pipeline-row dt, .queue-row dt { color: var(--euricio-gray); }
.pipeline-row dd, .queue-row dd, .health-stats dd { margin: 0; font-weight: 500; }

.available { color: var(--success); margin-right: 0.5rem; }
.executing { color: var(--info); margin-right: 0.5rem; }
.failed { color: var(--error); }

.empty-state {
  text-align: center; padding: 1.5rem;
  color: var(--euricio-gray); font-size: 0.875rem;
}
.alert-text { color: var(--error); font-size: 0.875rem; margin: 0.25rem 0 0; }

/* ─── Pipeline Board ───────────────────────────────────────────── */
.pipeline-board {
  padding: 24px;
  background: #f4f5f7;
  min-height: 100vh;
}

.pipeline-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 20px;
}

.pipeline-stages {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.pipeline-column {
  background: #ebecf0;
  border-radius: 8px;
  min-width: 240px;
  max-width: 280px;
  flex-shrink: 0;
  padding: 8px;
}

.pipeline-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 8px 12px;
}

.stage-label {
  font-size: 13px;
  font-weight: 600;
  color: #5e6c84;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stage-count {
  background: rgba(9, 30, 66, 0.08);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #5e6c84;
}

.pipeline-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.pipeline-card {
  background: white;
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(9, 30, 66, 0.12);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.pipeline-card:hover {
  box-shadow: 0 4px 8px rgba(9, 30, 66, 0.2);
}

.lead-name {
  font-size: 14px;
  font-weight: 600;
  color: #172b4d;
  margin-bottom: 4px;
}

.lead-email {
  font-size: 12px;
  color: #5e6c84;
  margin-bottom: 6px;
}

.lead-priority {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.priority-low { background: #e3fcef; color: #006644; }
.priority-medium { background: #fff0b3; color: #172b4d; }
.priority-high { background: #ffe2d6; color: #bf2600; }
.priority-urgent { background: #ffbdad; color: #bf2600; }

.lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.btn-move {
  background: #f4f5f7;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: #5e6c84;
  cursor: pointer;
  transition: background 0.1s;
}

.btn-move:hover {
  background: #dfe1e6;
  color: #172b4d;
}

/* ── Broker Activity Dashboard (Phase 4C) ─────────────────────────────────── */
.cc-dashboard { padding: 24px; }

.cc-dashboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #28251D;
  margin-bottom: 20px;
}

.cc-section { margin-bottom: 24px; }

.cc-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #28251D;
  margin-bottom: 12px;
}

/* KPI cards */
.cc-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.cc-kpi-card {
  background: white;
  border: 1px solid #D4D1CA;
  border-left: 4px solid #01696F;
  border-radius: 8px;
  padding: 20px 24px;
}

.cc-kpi-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: #28251D;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cc-kpi-label {
  font-size: 0.85rem;
  color: #7A7974;
  margin-top: 4px;
}

.cc-kpi-delta {
  font-size: 0.8rem;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.cc-kpi-delta.up { color: #437A22; }
.cc-kpi-delta.down { color: #A12C7B; }
.cc-kpi-delta.flat { color: #7A7974; }

/* Chart container */
.cc-chart-container {
  background: white;
  border: 1px solid #D4D1CA;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.cc-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding: 0 8px;
}

.cc-bar-group {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  height: 100%;
  position: relative;
}

.cc-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: opacity 0.15s;
}

.cc-bar:hover { opacity: 0.8; }
.cc-bar-submitted { background: #20808D; }
.cc-bar-approved { background: #437A22; }
.cc-bar-rejected { background: #A13544; }

.cc-chart-labels {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.cc-chart-label {
  flex: 1;
  font-size: 0.65rem;
  color: #7A7974;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

.cc-chart-legend {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #7A7974;
}

.cc-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
}

/* Workspace cards grid */
.cc-workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.cc-workspace-card {
  background: white;
  border: 1px solid #D4D1CA;
  border-radius: 8px;
  padding: 16px 20px;
}

.cc-workspace-name {
  font-size: 1rem;
  font-weight: 600;
  color: #28251D;
  margin: 0 0 12px 0;
}

.cc-workspace-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
}

.cc-workspace-stat-label { color: #7A7974; }
.cc-workspace-stat-value { color: #28251D; font-weight: 600; }

.cc-workspace-link {
  display: inline-block;
  margin-top: 12px;
  color: #01696F;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.cc-workspace-link:hover { text-decoration: underline; }

/* Agent table */
.cc-agent-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid #D4D1CA;
  border-radius: 8px;
}

.cc-agent-table th {
  text-align: left;
  font-size: 0.75rem;
  color: #7A7974;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 2px solid #D4D1CA;
}

.cc-agent-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #D4D1CA;
  font-size: 0.9rem;
  color: #28251D;
}

.cc-num { font-variant-numeric: tabular-nums; }

.cc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.cc-badge-active { background: #E3F1DA; color: #437A22; }
.cc-badge-suspended { background: #F7E3D4; color: #A84B2F; }
.cc-badge-revoked, .cc-badge-expired { background: #EEE; color: #7A7974; }
.cc-badge-invited { background: #E0EEF0; color: #01696F; }

/* Recent compliance events */
.cc-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: white;
  border: 1px solid #D4D1CA;
  border-radius: 8px;
}

.cc-event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #EDEBE6;
  font-size: 0.85rem;
}

.cc-event-item:last-child { border-bottom: none; }
.cc-event-type { font-weight: 600; color: #28251D; }
.cc-event-actor { color: #7A7974; font-family: monospace; font-size: 0.78rem; }
.cc-event-time { margin-left: auto; color: #7A7974; font-size: 0.78rem; }

.cc-empty {
  padding: 16px;
  color: #7A7974;
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 768px) {
  .cc-dashboard-grid { grid-template-columns: 1fr 1fr; }
  .cc-workspace-grid { grid-template-columns: 1fr; }
  .cc-chart-label { display: none; }
  .cc-chart-label:nth-child(7n) { display: block; }
/* ── Call Center — Auto-Approve Rules (Phase 4A) ── */
.cc-auto-approve-warning {
  margin: 12px 0;
  padding: 10px 14px;
  border: 1px solid #f0b429;
  border-left: 4px solid #f0b429;
  border-radius: 4px;
  background: #fff8e1;
  color: #8a6d00;
  font-weight: 500;
}

.cc-auto-approve-intro {
  color: #5e6c84;
  margin: 4px 0 12px;
}

.cc-auto-approve-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.cc-auto-approve-table th,
.cc-auto-approve-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #ebecf0;
}

.cc-auto-approve-empty {
  color: #97a0af;
  font-style: italic;
}

.cc-toggle-on {
  color: #006644;
  font-weight: 600;
}

.cc-toggle-off {
  color: #97a0af;
}

.cc-auto-approve-form {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px;
  background: #f4f5f7;
  border-radius: 4px;
}

.cc-queue-auto-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: #e3fcef;
  color: #006644;
  border: 1px solid #57d9a3;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.cc-queue-auto-heading {
  margin-top: 24px;
  font-size: 1rem;
  color: #5e6c84;
}
}

/* ── App Layout: Sidebar + Main Content ── */
body {
  display: flex;
  min-height: 100vh;
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #F7F6F2;
  color: #28251D;
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: #0C4E54;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 0 0 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar .brand {
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: white;
  padding: 22px 20px 18px;
  letter-spacing: -0.3px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 8px;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

.sidebar ul li a,
.sidebar ul li .nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.sidebar ul li a:hover,
.sidebar ul li .nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar ul li a.active,
.sidebar ul li .nav-link.active {
  background: rgba(255,255,255,0.15);
  color: white;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

.badge-danger { background: #ef4444; color: white; }

.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
  box-sizing: border-box;
}

.locale-switcher-wrap {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

/* Flash messages */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-info { background: #E0EEF0; color: #0C4E54; border: 1px solid #B0D8DC; }
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }

/* Page headings */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 {
  font-family: 'DM Sans', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #28251D;
  margin: 0;
}

/* Buttons */
.btn-primary {
  background: #01696F;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
}
.btn-primary:hover { background: #0C4E54; }

.btn-secondary {
  background: white;
  color: #28251D;
  border: 1.5px solid #D4D1CA;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { border-color: #01696F; color: #01696F; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 100%; min-width: unset; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; }
  .main-content { margin-left: 0; padding: 16px; }
}
