/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-page:    #f1f5f9;
  --bg-card:    #ffffff;
  --bg-card2:   #f8fafc;
  --border:     rgba(148,163,184,0.35);
  --brand:      #ea580c;
  --brand-dim:  rgba(234,88,12,0.08);
  --brand-text: #c2410c;
  --text-1:     #0f172a;
  --text-2:     #475569;
  --text-3:     #94a3b8;
  --sky:        #0284c7;
  --sky-dim:    rgba(2,132,199,0.1);
  --rose:       #e11d48;
  --rose-dim:   rgba(225,29,72,0.1);
  --emerald:    #16a34a;
  --amber:      #d97706;
}

html, body {
  height: 100%;
  background: var(--bg-page);
  color: var(--text-1);
  font-family: 'Inter', 'SUIT Variable', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.page { min-height: 100vh; padding: 28px 32px; max-width: 1280px; margin: 0 auto; }

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.header { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 22px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-1);
}
.logo-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand);
}
.header-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.card-title {
  font-size: 15px; font-weight: 600; color: var(--text-1);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.card-title-icon {
  width: 20px; height: 20px; border-radius: 8px;
  background: var(--brand-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-text); font-size: 11px;
}

/* ─── Upload Zone ────────────────────────────────────────────────────────────── */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 720px) { .upload-grid { grid-template-columns: 1fr; } }

.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-height: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-dim);
}
.upload-zone-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.upload-zone-text { font-size: 13px; font-weight: 600; color: var(--text-1); }
.upload-zone-hint { font-size: 12px; color: var(--text-3); }

/* ─── Upload Queue ───────────────────────────────────────────────────────────── */
.queue-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 140px; gap: 8px;
  color: var(--text-3); font-size: 12px;
}
.queue-list { display: flex; flex-direction: column; gap: 10px; }
.queue-item {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.queue-item-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.queue-item-name {
  font-size: 12px; font-weight: 500; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.queue-item-status { font-size: 11px; font-weight: 500; }
.queue-item-status.uploading  { color: var(--brand-text); }
.queue-item-status.processing { color: var(--amber); }
.queue-item-status.completed  { color: var(--emerald); }
.queue-item-status.error      { color: #f87171; }

.progress-bar { height: 4px; border-radius: 2px; background: #e2e8f0; overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.3s ease;
  background: var(--brand);
}
.progress-fill.completed { background: var(--emerald); }
.progress-fill.processing { background: var(--amber); animation: pulse-bar 1.5s ease-in-out infinite; }

@keyframes pulse-bar {
  0%, 100% { opacity: 1; } 50% { opacity: 0.5; }
}

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: rgba(241,245,249,0.9);
}
tbody tr {
  border-bottom: 1px solid rgba(51,65,85,0.25);
  transition: background 0.15s;
}
tbody tr:hover { background: rgba(0,0,0,0.02); }
tbody td { padding: 16px 16px; font-size: 14px; }
.td-name { font-weight: 500; color: var(--text-1); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-date { color: var(--text-2); font-size: 12px; }
.td-action a {
  font-size: 12px; font-weight: 500; color: var(--brand-text);
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid rgba(234,88,12,0.3);
  transition: background 0.15s;
}
.td-action a:hover { background: var(--brand-dim); }
.td-action span { font-size: 12px; color: var(--text-3); }
.btn-delete {
  font-size: 12px; font-weight: 500; color: #ef4444;
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid rgba(239,68,68,0.3);
  background: transparent; margin-left: 6px;
  transition: background 0.15s;
}
.btn-delete:hover { background: rgba(239,68,68,0.08); }

/* ─── Status Chip ────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.chip-processing {
  background: rgba(251,191,36,0.1);
  color: var(--amber);
  border: 1px solid rgba(251,191,36,0.2);
}
.chip-completed {
  background: rgba(74,222,128,0.1);
  color: var(--emerald);
  border: 1px solid rgba(74,222,128,0.2);
}
.chip-error {
  background: rgba(248,113,113,0.1);
  color: #f87171;
  border: 1px solid rgba(248,113,113,0.2);
}
.chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.chip-dot.blink { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ─── Detail Page ────────────────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2);
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 24px;
}
.back-btn:hover { background: var(--bg-card2); color: var(--text-1); }

.meta-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 20px;
}
@media (max-width: 600px) { .meta-grid { grid-template-columns: 1fr; } }
.meta-item { display: flex; flex-direction: column; gap: 4px; }
.meta-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.meta-value { font-size: 14px; font-weight: 500; color: var(--text-1); }

.transcript-list {
  display: flex; flex-direction: column; gap: 16px;
  max-height: 520px; overflow-y: auto; padding-right: 4px;
}
.transcript-list::-webkit-scrollbar { width: 4px; }
.transcript-list::-webkit-scrollbar-track { background: transparent; }
.transcript-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.transcript-row { display: flex; gap: 12px; }
.speaker-badge {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.speaker-badge.consultant {
  background: var(--sky-dim); color: var(--sky);
  border: 1px solid rgba(14,165,233,0.25);
}
.speaker-badge.customer {
  background: var(--rose-dim); color: var(--rose);
  border: 1px solid rgba(244,63,94,0.25);
}
.transcript-body { flex: 1; }
.transcript-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.speaker-name { font-size: 12px; font-weight: 600; }
.speaker-name.consultant { color: var(--sky); }
.speaker-name.customer   { color: var(--rose); }
.transcript-time { font-size: 10px; color: var(--text-3); }
#audioPlayer {
  height: 36px;
  border-radius: 8px;
  outline: none;
  accent-color: var(--brand);
}
.emotion-chip {
  font-size: 10px; padding: 1px 6px; border-radius: 9999px;
  font-weight: 500; white-space: nowrap;
}
.emotion-positive { background: rgba(22,163,74,0.1);  color: #16a34a; }
.emotion-neutral  { background: rgba(148,163,184,0.2); color: #64748b; }
.emotion-negative { background: rgba(225,29,72,0.1);  color: #e11d48; }
.emotion-warning  { background: rgba(217,119,6,0.1);  color: #d97706; }
.transcript-bubble {
  font-size: 13px; color: var(--text-1);
  background: rgba(241,245,249,0.9);
  border-radius: 0 12px 12px 12px;
  padding: 10px 14px;
  line-height: 1.6;
  border: 1px solid var(--border);
}

.summary-card {
  background: linear-gradient(135deg, rgba(234,88,12,0.08), rgba(194,65,12,0.04));
  border: 1px solid rgba(234,88,12,0.18);
  border-radius: 16px;
  padding: 24px;
}
.summary-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.summary-icon {
  width: 24px; height: 24px; border-radius: 8px;
  background: rgba(234,88,12,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.summary-title { font-size: 13px; font-weight: 600; color: var(--brand-text); }
.summary-text { font-size: 13px; color: var(--text-2); line-height: 1.75; }

/* ─── Empty / Loading ────────────────────────────────────────────────────────── */
.empty-row td {
  text-align: center; padding: 48px 16px;
  color: var(--text-3); font-size: 13px;
}
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Detail Loading ─────────────────────────────────────────────────────────── */
.loading-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px; gap: 16px; color: var(--text-3); font-size: 13px;
}
.loading-spinner-lg {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
