/* ==========================================================================
   AUDR_WATCH — Apple Design & Emil Kowalski Glassmorphism UI
   ========================================================================== */

:root {
  --font-sans: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette - Deep Slate / Premium Dark Mode */
  --bg-main: #0b0f19;
  --bg-surface: rgba(18, 24, 38, 0.75);
  --bg-surface-hover: rgba(28, 36, 56, 0.85);
  --bg-card: rgba(23, 31, 50, 0.6);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-modal: #111726;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #38bdf8;
  --accent-blue-glow: rgba(56, 189, 248, 0.25);
  --accent-indigo: #6366f1;

  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.15);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.15);
  --color-crit: #f43f5e;

  --radius-sm: 0.5rem;   /* 8px */
  --radius-md: 0.75rem;  /* 12px */
  --radius-lg: 1rem;     /* 16px */
  --radius-xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.7);

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 160ms;
  --duration-norm: 240ms;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

*:hover {
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* WebKit / Chromium / Safari custom scrollbar rules */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background-clip: padding-box;
  transition: background-color var(--duration-norm) var(--ease-spring);
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.35);
}

::-webkit-scrollbar-thumb:active {
  background-color: var(--accent-blue);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(99, 102, 241, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */

.app-layout {
  width: 100%;
  max-width: 1280px;
  padding: 1.5rem 1.5rem 4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Mobile Constraint: 90-95% screen width */
@media (max-width: 768px) {
  .app-layout {
    width: 95%;
    padding: 1rem 0.5rem 3rem 0.5rem;
    gap: 1rem;
  }
}

/* ==========================================================================
   Header Component
   ========================================================================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 1.75rem;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  border-radius: var(--radius-md);
  padding: 0.35rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--accent-blue-glow);
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--accent-blue);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.status-connected {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}
.status-connecting {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseAnim 2s infinite ease-in-out;
}

@keyframes pulseAnim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   Buttons & Interactive Elements (Emil Kowalski feedback rules)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  outline: none;
  transition: transform var(--duration-fast) var(--ease-spring),
              background var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-spring);
  min-height: 2.5rem;
}

@media (max-width: 768px) {
  .btn {
    min-height: 2.75rem; /* Touch target requirement: 44px */
    padding: 0.75rem 1rem;
  }
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--bg-card-border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--bg-card-border);
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   Stats Banner Grid
   ========================================================================== */

.stats-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .stats-banner {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 540px) {
  .stats-banner {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-subtle);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-icon {
  font-size: 1.125rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.highlight-card {
  border-color: rgba(56, 189, 248, 0.25);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08) 0%, rgba(18, 24, 38, 0.75) 100%);
}
.highlight-card .stat-value {
  color: var(--accent-blue);
}

.warning-card {
  border-color: rgba(244, 63, 94, 0.25);
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.08) 0%, rgba(18, 24, 38, 0.75) 100%);
}
.warning-card .stat-value {
  color: var(--color-crit);
}

/* ==========================================================================
   Feed Toolbar & Search
   ========================================================================== */

.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .feed-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.search-box input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.select-dropdown {
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
}

/* ==========================================================================
   Calls Feed Cards
   ========================================================================== */

.calls-feed {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-top: 0.5rem;
}

.call-item-card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: transform var(--duration-fast) var(--ease-spring),
              border-color var(--duration-fast) ease,
              background var(--duration-fast) ease;
}

.call-item-card:hover {
  transform: translateY(-2px);
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.16);
}

.call-item-card:active {
  transform: scale(0.99);
}

.call-item-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.score-badge-circle {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.score-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}
.score-yellow {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
}
.score-orange {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
}
.score-red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
}
.score-pending {
  background: #334155;
  color: #94a3b8;
}

.call-main-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.call-phone-line {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.call-phone-number {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-inbound { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.badge-outbound { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.badge-provider { background: rgba(255, 255, 255, 0.08); color: #cbd5e1; }

.call-meta-line {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.call-summary-preview {
  font-size: 0.875rem;
  color: #cbd5e1;
  max-width: 650px;
  line-height: 1.4;
  margin-top: 0.25rem;
}

.call-item-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.call-duration {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.arrow-action {
  font-size: 1.25rem;
  color: var(--accent-blue);
  transition: transform var(--duration-fast) ease;
}

.call-item-card:hover .arrow-action {
  transform: translateX(4px);
}

@media (max-width: 768px) {
  .call-item-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.75rem;
  }
  .call-item-right {
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.5rem;
  }
}

/* ==========================================================================
   Apple / Emil Native <dialog> Modal Architecture
   ========================================================================== */

dialog.apple-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 100vw;
  max-height: 100vh;
  margin: auto;
  outline: none;
  overflow: visible;
}

dialog.apple-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: backdropFadeIn 200ms ease-out forwards;
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-surface {
  background: var(--bg-modal);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 90vw;
  max-width: 1040px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPopIn 240ms var(--ease-spring) forwards;
}

.modal-surface.modal-wide {
  max-width: 1120px;
}

.modal-surface.modal-small {
  max-width: 520px;
}

@keyframes modalPopIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-phone {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.btn-close {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .modal-surface {
    width: 95%;
    max-height: 94vh;
    border-radius: var(--radius-lg);
  }
  .modal-header {
    padding: 1rem;
  }
  .modal-body {
    padding: 1rem;
    gap: 1rem;
  }
}

/* ==========================================================================
   CRM Banner
   ========================================================================== */

.crm-banner {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .crm-banner {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.crm-info-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.crm-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-name, .crm-manager, .crm-deal {
  font-size: 0.875rem;
  font-weight: 600;
  color: #e2e8f0;
}

/* ==========================================================================
   Audio Player Panel
   ========================================================================== */

.audio-player-panel {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-play {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue) 0%, #0284c7 100%);
  border: none;
  color: #ffffff;
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--accent-blue-glow);
  transition: transform var(--duration-fast) var(--ease-spring);
  flex-shrink: 0;
}

.btn-play:active {
  transform: scale(0.95);
}

.time-display {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.waveform-container {
  flex: 1;
  height: 2.25rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.waveform-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.4) 0%, rgba(99, 102, 241, 0.5) 100%);
  border-right: 2px solid var(--accent-blue);
  transition: width 100ms linear;
}

.btn-speed {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ==========================================================================
   Split View: Transcript & AI Score
   ========================================================================== */

.audit-split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 820px) {
  .audit-split-view {
    grid-template-columns: 1fr;
  }
}

.transcript-col, .score-col {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.75rem;
}

.col-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #ffffff;
}

.col-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.overall-score-pill {
  font-weight: 700;
  font-size: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

.transcript-scroll {
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.5rem;
}

.transcript-bubble {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.45;
  cursor: pointer;
  transition: transform var(--duration-fast) ease, background var(--duration-fast) ease;
}

.transcript-bubble:hover {
  transform: translateX(2px);
}

.bubble-operator {
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid var(--accent-blue);
  align-self: flex-start;
  width: 95%;
}

.bubble-client {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid #94a3b8;
  align-self: flex-start;
  width: 95%;
}

.bubble-active {
  background: rgba(56, 189, 248, 0.2) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.speaker-role {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--accent-blue);
}
.bubble-client .speaker-role {
  color: #cbd5e1;
}

.bubble-time {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* AI Assessment Elements */

.ai-assessment-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.criteria-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.criteria-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.criteria-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.criteria-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.criteria-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 300ms ease-out;
}

.highlights-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.highlight-block {
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

.positive-block {
  background: var(--color-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.positive-block .block-title { color: #34d399; font-weight: 600; margin-bottom: 0.35rem; }

.negative-block {
  background: var(--color-danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.negative-block .block-title { color: #f87171; font-weight: 600; margin-bottom: 0.35rem; }

.highlight-block ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 0.25rem;
}

.highlight-block li::before {
  content: "• ";
  color: currentColor;
}

.benchmark-matches {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.benchmark-matches .block-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 0.5rem;
}

.matched-cases-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.matched-case-pill {
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
}

.feedback-card {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08) 0%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 0.875rem;
}

.feedback-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 0.35rem;
}

.feedback-card p {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #f1f5f9;
}

/* ==========================================================================
   Thread History Timeline
   ========================================================================== */

.thread-history-section {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.thread-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #ffffff;
}

.thread-calls-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.timeline-call-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

/* ==========================================================================
   Knowledge Base Grid
   ========================================================================== */

.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.case-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.case-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #ffffff;
}

.case-good {
  font-size: 0.8125rem;
  background: var(--color-success-bg);
  border-left: 3px solid var(--color-success);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #34d399;
}

.case-bad {
  font-size: 0.8125rem;
  background: var(--color-danger-bg);
  border-left: 3px solid var(--color-danger);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #f87171;
}

.case-expl {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastEnter 240ms var(--ease-spring) forwards;
}

@keyframes toastEnter {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==========================================================================
   Loading & Empty states
   ========================================================================== */

.loading-state, .empty-hint {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: inherit;
  outline: none;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Mobile Adaptivity (< 768px) — 90-95% Width & Touch Target Rules
   ========================================================================== */

@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .app-layout {
    width: 95% !important;
    max-width: 95% !important;
    padding: 0.75rem 0.25rem 2.5rem 0.25rem !important;
    gap: 1rem !important;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-actions button {
    flex: 1 1 calc(50% - 0.5rem);
    min-height: 2.75rem;
    justify-content: center;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  .modal-dialog {
    width: 94vw !important;
    max-width: 94vw !important;
    max-height: 90vh !important;
    margin: auto !important;
  }

  .modal-body-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .call-item {
    padding: 1rem 0.75rem;
    min-height: 2.75rem;
  }

  .btn {
    min-height: 2.75rem;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    width: 100%;
  }
}
