/* ============================================
   Call Task Panel — Modern UI
   ============================================ */

:root {
  --bg: #0a0e17;
  --bg-gradient: radial-gradient(1200px 600px at 85% -10%, rgba(59, 130, 246, 0.14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(168, 85, 247, 0.10), transparent 55%),
    linear-gradient(180deg, #0a0e17 0%, #0d1220 100%);
  --surface: rgba(21, 28, 44, 0.72);
  --surface-solid: #151c2c;
  --surface-2: rgba(34, 44, 66, 0.65);
  --surface-2-solid: #222c42;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef2f8;
  --muted: #94a3bd;
  --primary: #4f8ef7;
  --primary-strong: #3b82f6;
  --primary-glow: rgba(79, 142, 247, 0.35);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
  --purple: #a78bfa;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.25);
  --ring: 0 0 0 3px rgba(79, 142, 247, 0.35);
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-color: #33415c var(--bg);
}

body {
  margin: 0;
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg-gradient), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

::selection {
  background: rgba(79, 142, 247, 0.35);
}

.hidden {
  display: none !important;
}

/* ---------- Header ---------- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 18, 32, 0.75);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #4f8ef7 0%, #7c5cf0 100%);
  box-shadow: 0 4px 18px var(--primary-glow);
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem 0.35rem 1rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7, #7c5cf0);
  color: #fff;
  flex-shrink: 0;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---------- Auth ---------- */

.auth-card {
  max-width: 400px;
  margin: 8vh auto 0;
  padding: 2.5rem 2.25rem 2rem;
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-logo {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 1.25rem;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #4f8ef7 0%, #7c5cf0 100%);
  box-shadow: 0 8px 30px var(--primary-glow);
}

.auth-card h2 {
  margin: 0 0 0.35rem;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
}

.auth-sub {
  margin: 0 0 1.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- Forms ---------- */

label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

label small {
  display: block;
  margin-top: 0.3rem;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.85;
}

input[type='email'],
input[type='password'],
input[type='text'],
input[type='search'],
input[type='number'],
input[type='file'],
select {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 23, 0.55);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input::placeholder {
  color: rgba(148, 163, 189, 0.55);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}

input[type='file'] {
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

input[type='file']::file-selector-button {
  margin-inline-end: 0.85rem;
  padding: 0.45rem 0.95rem;
  border: none;
  border-radius: 8px;
  background: var(--surface-2-solid);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
}

input[type='file']::file-selector-button:hover {
  background: #2c3a57;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.85rem center;
  padding-left: 2.4rem;
  cursor: pointer;
}

.auth-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #4f8ef7 0%, #6366f1 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(79, 142, 247, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 22px rgba(79, 142, 247, 0.45);
  filter: brightness(1.08);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
  filter: none;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.btn-danger-ghost:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--danger);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
}

/* ---------- Feedback ---------- */

.error,
.success {
  margin: 0.85rem 0 0;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  text-align: center;
}

.error {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.success {
  color: var(--success);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.4rem;
  margin-bottom: 1.25rem;
  position: sticky;
  top: 70px;
  z-index: 40;
}

.tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 11px;
  padding: 0.7rem 1rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.tab.active {
  background: linear-gradient(135deg, rgba(79, 142, 247, 0.18), rgba(124, 92, 240, 0.14));
  color: #cfe0ff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(79, 142, 247, 0.35);
}

.tab-panel {
  animation: fade 0.3s ease both;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-panel.hidden {
  display: none;
}

/* ---------- Admin cards ---------- */

.admin-card {
  padding: 1.5rem;
  margin-bottom: 1.15rem;
}

.admin-card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  font-size: 1.02rem;
  font-weight: 700;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(79, 142, 247, 0.14);
  color: var(--primary);
  flex-shrink: 0;
}

.card-icon-blue {
  background: rgba(56, 189, 248, 0.14);
  color: var(--info);
}

.card-icon-green {
  background: rgba(52, 211, 153, 0.14);
  color: var(--success);
}

.card-icon-purple {
  background: rgba(167, 139, 250, 0.14);
  color: var(--purple);
}

.card-icon-orange {
  background: rgba(251, 191, 36, 0.14);
  color: var(--warning);
}

.user-form {
  display: grid;
  gap: 0.85rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.section-header h2 {
  margin: 0;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.15rem;
  align-items: start;
  margin-bottom: 1.15rem;
}

.ai-grid .admin-card {
  margin-bottom: 0;
}

/* ---------- Switch (checkbox) ---------- */

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  white-space: nowrap;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 400;
}

.switch-label input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(148, 163, 189, 0.25);
  border: 1px solid var(--border-strong);
  transition: background var(--transition);
  flex-shrink: 0;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform var(--transition), background var(--transition);
}

.switch-label input:checked + .switch {
  background: linear-gradient(135deg, #4f8ef7, #6366f1);
  border-color: transparent;
}

.switch-label input:checked + .switch::after {
  transform: translateX(-18px);
  background: #fff;
}

.switch-label input:focus-visible + .switch {
  box-shadow: var(--ring);
}

/* ---------- Users ---------- */

.users-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color var(--transition), transform var(--transition);
}

.user-row:hover {
  border-color: var(--border-strong);
}

.user-row-email {
  font-weight: 600;
}

.user-row-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-admin {
  background: rgba(251, 191, 36, 0.14);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-user {
  background: rgba(148, 163, 189, 0.12);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 189, 0.22);
}

.badge-tag {
  background: rgba(13, 148, 136, 0.12);
  color: #2dd4bf;
  border: 1px solid rgba(13, 148, 136, 0.3);
}

.badge-repeat {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-assignee {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.ai-summary {
  margin: 0.6rem 0 0;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.2);
  font-size: 0.86rem;
  line-height: 1.7;
}

.badge-incoming {
  background: rgba(52, 211, 153, 0.13);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.28);
}

.badge-outgoing {
  background: rgba(79, 142, 247, 0.13);
  color: var(--primary);
  border: 1px solid rgba(79, 142, 247, 0.28);
}

.badge-missed {
  background: rgba(248, 113, 113, 0.13);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.28);
}

.badge-transcript-completed {
  background: rgba(52, 211, 153, 0.13);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.28);
}

.badge-transcript-processing,
.badge-transcript-pending {
  background: rgba(56, 189, 248, 0.13);
  color: var(--info);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.badge-transcript-failed {
  background: rgba(248, 113, 113, 0.13);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.28);
}

.badge-transcript-none {
  background: rgba(148, 163, 189, 0.12);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 189, 0.22);
}

/* ---------- Toolbar / Stats ---------- */

.toolbar {
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.15rem;
}

.stats,
.ai-output-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 23, 0.4);
  border: 1px solid var(--border);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
}

.stat-primary .stat-icon { background: rgba(79, 142, 247, 0.14); color: var(--primary); }
.stat-warning .stat-icon { background: rgba(251, 191, 36, 0.14); color: var(--warning); }
.stat-success .stat-icon { background: rgba(52, 211, 153, 0.14); color: var(--success); }
.stat-info .stat-icon { background: rgba(56, 189, 248, 0.14); color: var(--info); }
.stat-danger .stat-icon { background: rgba(248, 113, 113, 0.14); color: var(--danger); }

.stat-value {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
}

.stat-label {
  font-size: 0.76rem;
  color: var(--muted);
}

/* ---------- Filters / Search ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap .search-icon {
  position: absolute;
  inset-inline-start: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-wrap input[type='search'] {
  margin: 0;
  padding-inline-start: 2.5rem;
}

.filters input[type='search'] {
  margin: 0;
}

.ai-output-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.ai-output-filters select {
  min-width: 170px;
  width: auto;
  margin: 0;
}

/* ---------- Tasks ---------- */

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.task-card {
  padding: 1.2rem 1.35rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.task-card:hover {
  border-color: rgba(79, 142, 247, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.task-title {
  font-weight: 700;
  font-size: 1.03rem;
}

.task-phone {
  direction: ltr;
  text-align: left;
  color: var(--muted);
  font-size: 0.88rem;
  font-family: ui-monospace, 'SF Mono', monospace;
}

.task-desc {
  margin: 0.5rem 0;
  color: var(--text);
  line-height: 1.65;
}

.task-transcript {
  margin: 0.7rem 0;
  padding: 0.85rem 1rem;
  background: rgba(10, 14, 23, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.7;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.task-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.task-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.badge-priority-low { background: rgba(148, 163, 184, 0.18); color: #94a3b8; }
.badge-priority-medium { background: rgba(56, 189, 248, 0.18); color: var(--info); }
.badge-priority-high { background: rgba(251, 191, 36, 0.18); color: var(--warning); }
.badge-priority-urgent { background: rgba(248, 113, 113, 0.18); color: var(--danger); }
.badge-status-todo { background: rgba(148, 163, 184, 0.18); color: #94a3b8; }
.badge-status-inProgress { background: rgba(56, 189, 248, 0.18); color: var(--info); }
.badge-status-done { background: rgba(52, 211, 153, 0.18); color: var(--success); }
.badge-status-cancelled { background: rgba(248, 113, 113, 0.18); color: var(--danger); }

.task-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(520px, calc(100vw - 2rem));
  box-shadow: var(--shadow-lg);
}

.task-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.task-dialog form {
  padding: 1.25rem 1.35rem 1.35rem;
}

.task-dialog h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.task-dialog textarea {
  resize: vertical;
  min-height: 96px;
}

.reminder-soon {
  color: var(--warning);
  font-weight: 700;
}

.reminder-overdue {
  color: var(--danger);
  font-weight: 700;
}

/* ---------- Misc ---------- */

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.help-text {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
  margin: -0.35rem 0 1.1rem;
}

.voice-profile-status {
  margin: 0 0 1rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: rgba(148, 163, 189, 0.08);
  border: 1px solid var(--border);
}

.success-text {
  color: var(--success);
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.25);
}

.muted-text {
  color: var(--muted);
}

.error-text {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.25);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 3.5rem 1rem;
  font-size: 0.92rem;
}

/* ---------- AI outputs ---------- */

.ai-outputs-card {
  margin-top: 0;
}

.ai-outputs-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.ai-output-card {
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(10, 14, 23, 0.35);
  transition: border-color var(--transition);
}

.ai-output-card:hover {
  border-color: var(--border-strong);
}

.ai-output-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.ai-output-title {
  font-weight: 700;
  font-size: 1rem;
}

.ai-output-sub {
  color: var(--muted);
  font-size: 0.83rem;
  margin-top: 0.15rem;
}

.ai-output-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

.ai-transcript-text {
  margin: 0;
  padding: 0.9rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.75;
  direction: rtl;
  max-height: 320px;
  overflow: auto;
}

.ai-no-transcript {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.5rem 0;
}

.ai-segments {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.85rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.ai-segment {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  align-items: baseline;
  font-size: 0.87rem;
  line-height: 1.55;
}

.ai-segment-time {
  color: var(--primary);
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.8rem;
  direction: ltr;
  text-align: left;
}

.ai-segment-speaker {
  color: var(--warning);
  font-weight: 700;
  white-space: nowrap;
}

.ai-segment-tone {
  color: var(--purple);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(167, 139, 250, 0.13);
  border: 1px solid rgba(167, 139, 250, 0.28);
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
}

.ai-segment-text {
  color: var(--text);
  flex: 1;
  min-width: 200px;
}

.ai-json-details {
  margin: 0.85rem 0 0;
}

.ai-json-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0.5rem;
  user-select: none;
}

.ai-json-details summary:hover {
  color: var(--text);
}

.ai-json-preview {
  margin: 0;
  padding: 0.85rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  line-height: 1.55;
  direction: ltr;
  text-align: left;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

/* ---------- Scrollbars ---------- */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #33415c;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #43547a;
  background-clip: content-box;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  main {
    padding: 1.15rem 0.85rem 3rem;
  }

  .header {
    padding: 0.75rem 1rem;
  }

  .subtitle {
    display: none;
  }

  .user-chip span:not(.user-avatar) {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tabs {
    top: 62px;
  }

  .tab span {
    display: none;
  }

  .tab {
    padding: 0.7rem 0.5rem;
  }

  .auth-card {
    margin: 4vh auto 0;
    padding: 1.75rem 1.4rem 1.5rem;
  }

  .admin-card,
  .toolbar {
    padding: 1.15rem;
  }

  .ai-segment {
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border);
  }

  .ai-segment-text {
    min-width: 100%;
  }

  .ai-segment:last-child {
    border-bottom: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
