/* ==========================================================================
   MeetAI design system — tokens and shared components (RTL first)
   ========================================================================== */
:root {
  color-scheme: dark;

  --bg-900: #05070f;
  --bg-800: #080b16;
  --bg-700: #0c1020;
  --surface: rgba(19, 24, 43, 0.72);
  --surface-solid: #121729;
  --surface-2: rgba(30, 37, 62, 0.6);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --text: #eef1f9;
  --text-dim: #a7b0c6;
  --text-mute: #7c8699;

  --brand-1: #6a5cff;
  --brand-2: #22d3ee;
  --brand-3: #f472b6;
  --brand-grad: linear-gradient(135deg, #6a5cff 0%, #22d3ee 100%);
  --brand-grad-soft: linear-gradient(135deg, rgba(106, 92, 255, 0.22), rgba(34, 211, 238, 0.16));

  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --info: #60a5fa;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  --shadow-sm: 0 6px 18px rgba(2, 4, 12, 0.35);
  --shadow-md: 0 18px 44px rgba(2, 4, 12, 0.45);
  --shadow-glow: 0 10px 40px rgba(106, 92, 255, 0.35);

  --ease: cubic-bezier(0.22, 0.68, 0.32, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Vazirmatn", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg-900);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}

/* Ambient background used by all standard pages */
body.page-bg {
  min-height: 100vh;
  background-image:
    radial-gradient(1100px 620px at 88% -12%, rgba(106, 92, 255, 0.24), transparent 62%),
    radial-gradient(900px 520px at 4% 6%, rgba(34, 211, 238, 0.16), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(244, 114, 182, 0.12), transparent 65%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 10px;
  line-height: 1.45;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
}
h2 {
  font-size: 1.18rem;
}
h3 {
  font-size: 1rem;
}

p {
  margin: 0 0 10px;
}

code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  direction: ltr;
  display: inline-block;
}

.muted {
  color: var(--text-dim);
}
.dim {
  color: var(--text-mute);
}
.tiny {
  font-size: 0.78rem;
}
.nowrap {
  white-space: nowrap;
}
.mono {
  font-family: ui-monospace, monospace;
  direction: ltr;
  unicode-bidi: plaintext;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
.stack {
  display: grid;
  gap: 12px;
}
.hidden {
  display: none !important;
}

/* ── scrollbars ────────────────────────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
  background-clip: content-box;
}

/* ── surfaces ──────────────────────────────────────────────────────────────── */
.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}

.panel-lift {
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.panel-lift:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 18px 0;
}

/* ── buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.16s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--brand-grad);
  border-color: transparent;
  color: #05070f;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  background: var(--brand-grad);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.4);
  color: #ffc2cc;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(251, 113, 133, 0.2);
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.79rem;
}
.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ── forms ─────────────────────────────────────────────────────────────────── */
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
}

input,
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: rgba(6, 9, 18, 0.6);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input::placeholder,
textarea::placeholder {
  color: var(--text-mute);
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(106, 92, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(106, 92, 255, 0.16);
}
textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.8;
}
select option {
  background: var(--surface-solid);
  color: var(--text);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 14px;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--text-dim);
  transition: border-color 0.2s var(--ease);
}
.checkbox-row:hover {
  border-color: var(--line-strong);
}
.checkbox-row input {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
  accent-color: var(--brand-1);
}

.hint {
  font-size: 0.78rem;
  color: var(--text-mute);
}

/* ── badges & chips ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: var(--r-full);
  font-size: 0.73rem;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge.live,
.badge.approved,
.badge.ready {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.4);
  color: #9df3d0;
}
.badge.processing,
.badge.pending,
.badge.transcribing {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.4);
  color: #ffe0a3;
}
.badge.failed,
.badge.rejected {
  background: rgba(251, 113, 133, 0.14);
  border-color: rgba(251, 113, 133, 0.4);
  color: #ffc2cc;
}
.badge.accent {
  background: var(--brand-grad-soft);
  border-color: rgba(106, 92, 255, 0.45);
  color: #cfd3ff;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.79rem;
  color: var(--text-dim);
}
.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.16);
}

.pill-group {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.pill-group button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.pill-group button.active {
  background: var(--brand-grad);
  color: #05070f;
}

/* ── avatars ───────────────────────────────────────────────────────────────── */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-grad-soft);
  border: 1px solid var(--line-strong);
  color: #dfe3ff;
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-align: center;
  padding: 2px;
  unicode-bidi: plaintext;
}
.avatar.avatar-mid {
  font-size: 0.62rem;
}
.avatar.avatar-long {
  font-size: 0.52rem;
  letter-spacing: -0.04em;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 0.58rem;
  padding: 1px;
}
.avatar.sm.avatar-mid {
  font-size: 0.5rem;
}
.avatar.sm.avatar-long {
  font-size: 0.42rem;
}
.avatar.lg {
  width: 68px;
  height: 68px;
  font-size: 1rem;
}
.avatar.lg.avatar-mid {
  font-size: 0.88rem;
}
.avatar.lg.avatar-long {
  font-size: 0.72rem;
}
.avatar.xl {
  width: 96px;
  height: 96px;
  font-size: 1.25rem;
}
.avatar.xl.avatar-mid {
  font-size: 1.05rem;
}
.avatar.xl.avatar-long {
  font-size: 0.88rem;
}

/* ── top bar ───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(10, 13, 26, 0.72);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--brand-grad);
  box-shadow: var(--shadow-glow);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px 8px auto 8px;
  height: 3px;
  border-radius: 3px;
  background: rgba(5, 7, 15, 0.75);
}
.brand-text b {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: auto;
}
.nav a {
  padding: 8px 14px;
  border-radius: var(--r-full);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-dim);
  transition: all 0.2s var(--ease);
}
.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.nav a.active {
  color: var(--text);
  background: var(--brand-grad-soft);
  border: 1px solid rgba(106, 92, 255, 0.35);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline-start: 14px;
  border-inline-start: 1px solid var(--line);
}
.topbar-user-text {
  display: grid;
  line-height: 1.35;
}
.topbar-user-text strong {
  font-size: 0.85rem;
}
.topbar-user-text small {
  font-size: 0.72rem;
  color: var(--text-mute);
}

/* ── tables ────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
th,
td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 700;
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* ── feedback ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.86rem;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}
.alert.error {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.4);
  color: #ffc9d1;
}
.alert.success {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.4);
  color: #b6f5dc;
}
.alert.warn {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.4);
  color: #ffe6b0;
}

.app-toast {
  position: fixed;
  inset-inline: 0;
  bottom: 28px;
  margin: 0 auto;
  width: max-content;
  max-width: min(92vw, 520px);
  padding: 12px 22px;
  border-radius: var(--r-full);
  background: rgba(8, 11, 22, 0.94);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: all 0.25s var(--ease);
  z-index: 999;
}
.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.app-toast.error {
  border-color: rgba(251, 113, 133, 0.5);
  color: #ffc9d1;
}
.app-toast.success {
  border-color: rgba(52, 211, 153, 0.5);
  color: #b6f5dc;
}

.empty {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  padding: 34px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text-mute);
  font-size: 0.88rem;
}

.skeleton {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--brand-2);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── speaker timeline bar ──────────────────────────────────────────────────── */
.timeline {
  display: grid;
  gap: 10px;
}
.timeline-row {
  display: grid;
  grid-template-columns: minmax(120px, 168px) 1fr auto;
  align-items: center;
  gap: 12px;
}
.timeline-who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.timeline-who strong {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-track {
  position: relative;
  height: 18px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
}
.timeline-span {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 3px;
  border-radius: var(--r-full);
  background: var(--brand-grad);
  opacity: 0.92;
  transition: filter 0.15s var(--ease);
}
.timeline-span.pending {
  background: repeating-linear-gradient(
    -45deg,
    rgba(251, 191, 36, 0.85) 0 6px,
    rgba(251, 191, 36, 0.45) 6px 12px
  );
}
.timeline-span.failed {
  background: rgba(251, 113, 133, 0.8);
}
.timeline-span:hover {
  filter: brightness(1.2);
}
.timeline-cursor {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  pointer-events: none;
}
.timeline-meta {
  font-size: 0.74rem;
  color: var(--text-mute);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.timeline-ruler {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}

/* ── rich text output (summaries) ──────────────────────────────────────────── */
.prose {
  font-size: 0.94rem;
  line-height: 2;
  color: #dfe4f2;
}
.prose h2,
.prose h3,
.prose h4 {
  margin: 20px 0 8px;
  color: #fff;
}
.prose h2 {
  font-size: 1.08rem;
  padding-inline-start: 12px;
  border-inline-start: 3px solid transparent;
  border-image: var(--brand-grad) 1;
}
.prose ul,
.prose ol {
  margin: 6px 0 12px;
  padding-inline-start: 22px;
}
.prose li {
  margin-bottom: 6px;
}
.prose strong {
  color: #fff;
}
.prose p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .panel {
    padding: 16px;
  }
  .topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .topbar-user-text {
    display: none;
  }
  .timeline-row {
    grid-template-columns: 96px 1fr;
  }
  .timeline-meta {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
