:root {
  --color-primary: #4f46e5;
  --color-primary-soft: #eef2ff;
  --color-danger: #ef4444;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-bg: #f9fafb;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-border: #e2e8f0;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  direction: rtl;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: Vazirmatn, Tahoma, "Segoe UI", Arial, sans-serif;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body.ds-enabled {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: linear-gradient(180deg, #f9fafb 0%, #f8fafc 100%);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #3730a3;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
  color: #e2e8f0;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 14px;
  border-top-left-radius: 24px;
  border-bottom-left-radius: 24px;
}

.main-content {
  padding: 20px;
}

.page-wrap {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.btn-primary,
.btn-danger,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  color: #fff;
  background: var(--color-primary);
}

.btn-primary:hover {
  background: #4338ca;
}

.btn-danger {
  color: #fff;
  background: var(--color-danger);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-ghost {
  color: var(--color-text);
  background: #fff;
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: #f8fafc;
}

.muted {
  color: var(--color-muted);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(79, 70, 229, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(79, 70, 229, 0.28);
}

.sidebar-link.active {
  color: #fff;
  background: rgba(79, 70, 229, 0.45);
}

.sidebar-footer {
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.sidebar-logout {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.recording-saas-card {
  padding: 18px;
}

.recording-alert {
  border-radius: 12px;
  padding: 9px 12px;
  margin-bottom: 10px;
}

.recording-alert-ok {
  border: 1px solid #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.recording-alert-err {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.recording-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.recording-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.recording-state-badge {
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
}

.recording-state-badge.state-ready {
  background: #f8fafc;
  color: #334155;
}

.recording-state-badge.state-processing {
  background: #fff7ed;
  color: #b45309;
}

.recording-state-badge.state-completed {
  background: #ecfdf5;
  color: #047857;
}

.recording-upload-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.record-main-btn {
  width: 156px;
  height: 156px;
  border-radius: 999px;
  border: 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: radial-gradient(circle at 30% 30%, #ef4444, #b91c1c);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  animation: recording-pulse 1.8s infinite;
}

.record-main-btn.is-processing {
  background: radial-gradient(circle at 30% 30%, #f59e0b, #d97706);
  animation: none;
}

@keyframes recording-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  70% { box-shadow: 0 0 0 24px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.recording-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.waveform-placeholder {
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: flex-end;
  margin-top: 12px;
  height: 50px;
}

.waveform-placeholder span {
  width: 6px;
  border-radius: 999px;
  background: #818cf8;
  animation: wave 1.2s infinite ease-in-out;
}

.waveform-placeholder span:nth-child(odd) { animation-delay: .1s; }
.waveform-placeholder span:nth-child(even) { animation-delay: .2s; }
.waveform-placeholder span:nth-child(3n) { animation-delay: .3s; }

@keyframes wave {
  0%, 100% { height: 10px; opacity: .4; }
  50% { height: 42px; opacity: 1; }
}

.recording-hint {
  margin-top: 8px;
  text-align: center;
}

.minutes-ai-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.minutes-ai-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-progress-wrap {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8eefc;
  overflow: hidden;
  margin: 6px 0 4px;
}

.ai-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5 0%, #22c55e 100%);
  transition: width 0.25s ease;
}

.minutes-ai-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.minutes-col {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 12px;
}

.minutes-col h5 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.minutes-col textarea {
  width: 100%;
  min-height: 280px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  padding: 10px;
  line-height: 1.9;
}

.minutes-preview-box {
  white-space: pre-wrap;
  min-height: 280px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  padding: 10px;
  background: #fcfdff;
  line-height: 1.9;
}

#aiFlowTimeline {
  margin: 6px 0 4px;
  border: 1px dashed #dbe3f6;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fbfcff;
}

#aiMinutesPreviewBox {
  background: #ffffff;
}

.minutes-ai-rec {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 600;
}

.meter {
  margin-top: 10px;
  height: 46px;
  border: 1px solid var(--color-border);
  background: #f8fafc;
  border-radius: 12px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px;
}

.meter-bar {
  flex: 1;
  min-width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6366f1 0%, #818cf8 100%);
  height: 14%;
  transition: height 80ms linear;
}

.toast {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 1400;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: #0f172a;
  padding: 10px 14px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.toast-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.kanban-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.kanban-col {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  min-height: 120px;
}

.kanban-col h4 {
  margin: 0 0 8px 0;
  font-size: .95rem;
}

.kanban-card {
  display: block;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  color: #0f172a;
  background: #f8fafc;
}

.kanban-card small {
  display: block;
  color: #64748b;
  margin-top: 3px;
}

@media (max-width: 1100px) {
  .kanban-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 740px) {
  .kanban-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-left: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
  }

  .minutes-ai-grid {
    grid-template-columns: 1fr;
  }
}
