/* ========================================
   VISION AI - Clean Minimal Design
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Core Colors */
  --white: #ffffff;
  --black: #000000;
  
  /* Grays - Clean palette */
  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Blues - Primary accent */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  
  /* Status Colors */
  --green-50: #f0fdf4;
  --green-500: #22c55e;
  --green-600: #16a34a;
  
  --red-50: #fef2f2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition: 150ms ease;
  --transition-slow: 250ms ease;
}

/* ========================================
   BASE
   ======================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

::selection {
  background: var(--blue-100);
  color: var(--blue-700);
}

.hidden {
  display: none !important;
}

/* ========================================
   AUTH PAGE
   ======================================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--white) 0%, var(--gray-50) 100%);
  padding: 24px;
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-icon {
  font-size: 2rem;
}

.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

.auth-tagline {
  color: var(--gray-500);
  font-size: 0.938rem;
  font-weight: 400;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--gray-100);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab:hover {
  color: var(--gray-800);
}

.auth-tab.active {
  background: var(--white);
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.813rem;
  font-weight: 500;
  color: var(--gray-700);
}

.form-group input,
.form-group select {
  height: 44px;
  padding: 0 14px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-900);
  font-size: 0.938rem;
  font-family: inherit;
  transition: all var(--transition);
}

.form-group input:hover {
  border-color: var(--gray-400);
}

.form-group input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}

.form-group input::placeholder {
  color: var(--gray-400);
}

.password-input {
  position: relative;
}

.password-input input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.toggle-password:hover {
  opacity: 1;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.form-description {
  color: var(--gray-600);
  font-size: 0.875rem;
  line-height: 1.5;
}

.error-message {
  background: var(--red-50);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red-600);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.813rem;
  line-height: 1.4;
}

.success-message {
  background: var(--green-50);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--green-600);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.813rem;
  line-height: 1.4;
}

/* Buttons */
.btn-primary {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  background-color: #2563eb;
  border: none;
  border-radius: var(--radius);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-700);
  font-size: 0.938rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-link {
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition);
}

.btn-link:hover {
  color: var(--blue-600);
}

.btn-text {
  background: none;
  border: none;
  color: var(--blue-600);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition);
}

.btn-text:hover {
  color: var(--blue-700);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--gray-400);
  font-size: 0.75rem;
}

/* ========================================
   NAVBAR
   ======================================== */

.navbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  font-size: 1.5rem;
}

.nav-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}

.nav-user {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
}

.user-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--blue-600);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.813rem;
  color: var(--white);
}

.user-name {
  color: var(--gray-700);
  font-weight: 500;
  font-size: 0.875rem;
}

.dropdown-arrow {
  color: var(--gray-400);
  font-size: 0.625rem;
  margin-left: 2px;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  z-index: 1000;
}

.dropdown-header {
  padding: 14px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.dropdown-email {
  display: block;
  color: var(--gray-800);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.dropdown-role {
  display: inline-block;
  padding: 2px 8px;
  background: var(--blue-100);
  border-radius: var(--radius-full);
  font-size: 0.688rem;
  font-weight: 600;
  color: var(--blue-700);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dropdown-divider {
  height: 1px;
  background: var(--gray-200);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background var(--transition);
}

.dropdown-item:hover {
  background: var(--gray-50);
}

.dropdown-item span {
  font-size: 1rem;
  opacity: 0.7;
}

.dropdown-item.danger {
  color: var(--red-600);
}

.dropdown-item.danger:hover {
  background: var(--red-50);
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
  min-height: calc(100vh - 64px);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 40px;
}

.container-narrow {
  max-width: 800px;
}

.view-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.view-header .view-title {
  margin-bottom: 0;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 8px;
  transition: color var(--transition);
}

.btn-back:hover {
  color: var(--blue-600);
}

/* ========================================
   DASHBOARD
   ======================================== */

.dashboard-header {
  margin-bottom: 32px;
}

.dashboard-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.dashboard-subtitle {
  color: var(--gray-500);
  font-size: 1rem;
}

/* Dashboard two-column layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 32px;
  align-items: start;
  margin-top: 32px;
}

.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--blue-200);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-50);
  border-radius: var(--radius);
  font-size: 1.125rem;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-title-main {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 20px;
}

.upload-card {
  /* Sidebar card - sticky */
}

.upload-card.sticky {
  position: sticky;
  top: 88px;
}

/* Form */
form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 5px;
}

.hint {
  font-weight: 400;
  color: var(--gray-400);
  font-size: 0.688rem;
}

/* File Input */
.file-input-wrapper {
  position: relative;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.file-input-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  background: var(--gray-50);
  transition: all var(--transition);
}

.file-input-wrapper:hover .file-input-display {
  border-color: var(--blue-400);
  background: var(--blue-50);
}

.upload-icon {
  font-size: 1.125rem;
  opacity: 0.6;
}

.upload-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.upload-main {
  font-weight: 500;
  color: var(--gray-700);
  font-size: 0.813rem;
}

.upload-sub {
  font-size: 0.688rem;
  color: var(--gray-400);
}

.file-input-display.has-file {
  border-color: var(--blue-500);
  border-style: solid;
  background: var(--blue-50);
}

.file-input-display.has-file .upload-main {
  color: var(--blue-600);
}

/* URL Input */
input[type="url"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  color: var(--gray-900);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all var(--transition);
}

input:hover,
select:hover {
  border-color: var(--gray-400);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}

input::placeholder {
  color: var(--gray-400);
}

input:disabled {
  background: var(--gray-100);
  opacity: 0.7;
  cursor: not-allowed;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray-400);
  font-size: 0.688rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 4px 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* Submit Button */
#submitBtn {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  background-color: #2563eb;
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}

#submitBtn:hover:not(:disabled) {
  background-color: #1d4ed8;
}

#submitBtn:active:not(:disabled) {
  transform: scale(0.98);
}

#submitBtn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

/* Recent Section */
.recent-section {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h3 {
  font-size: 0.938rem;
  font-weight: 600;
  color: var(--gray-800);
}

.analyses-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analyses-list-full {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  text-align: center;
  color: var(--gray-500);
  padding: 32px 20px;
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.analysis-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.analysis-item:hover {
  background: var(--blue-50);
  border-color: var(--blue-200);
}

.analysis-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.analysis-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  flex-shrink: 0;
}

.analysis-details {
  flex: 1;
  min-width: 0;
}

.analysis-details h4 {
  color: var(--gray-800);
  font-size: 0.813rem;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.analysis-meta {
  display: flex;
  gap: 8px;
  font-size: 0.688rem;
  color: var(--gray-500);
}

.analysis-status {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.status-completed {
  background: var(--green-50);
  color: var(--green-600);
}

.status-processing {
  background: var(--blue-50);
  color: var(--blue-600);
}

.status-failed {
  background: var(--red-50);
  color: var(--red-600);
}

.status-pending {
  background: var(--amber-50);
  color: var(--amber-500);
}

/* ========================================
   PROGRESS
   ======================================== */

.progress-card {
  text-align: center;
  padding: 40px 24px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}

.progress-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.progress-header h2 {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--gray-700);
}

.progress-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-fill {
  height: 100%;
  background: var(--blue-600);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.35;
  transition: opacity var(--transition);
}

.step.active,
.step.done {
  opacity: 1;
}

.step.done .step-icon {
  color: var(--blue-600);
}

.step-icon {
  font-size: 1.25rem;
}

.step-label {
  font-size: 0.688rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
}

.progress-status {
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* ========================================
   RESULTS
   ======================================== */

.results-section {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.results-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
}

.results-meta {
  display: flex;
  gap: 8px;
}

.meta-badge {
  padding: 4px 10px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-600);
}

.meta-badge.success {
  background: var(--green-50);
  color: var(--green-600);
}

/* Result Cards */
.result-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
  transition: background var(--transition);
}

.card-header:hover {
  background: var(--gray-100);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  font-size: 1rem;
  opacity: 0.7;
}

.card-header h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
}

.card-toggle {
  color: var(--gray-400);
  font-size: 0.75rem;
  transition: transform var(--transition);
}

.card-content {
  padding: 18px;
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.7;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.card-content.expanded {
  max-height: 3000px;
}

.transcription-card .card-content {
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
  font-size: 0.813rem;
  color: var(--gray-600);
  background: var(--gray-50);
  white-space: pre-wrap;
}

.analysis-card .card-header {
  cursor: default;
}

.analysis-card .card-content {
  max-height: none;
}

/* Markdown Styles */
.card-content h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-top: 24px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

.card-content h2:first-child {
  margin-top: 0;
}

.card-content h3 {
  font-size: 0.938rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-top: 18px;
  margin-bottom: 8px;
}

.card-content h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-top: 14px;
  margin-bottom: 6px;
}

.card-content p {
  margin-bottom: 12px;
}

.card-content ul,
.card-content ol {
  margin-bottom: 12px;
  padding-left: 20px;
}

.card-content li {
  margin-bottom: 4px;
}

.card-content strong {
  font-weight: 600;
  color: var(--gray-900);
}

.card-content em {
  color: var(--gray-600);
}

.card-content code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85em;
  color: var(--blue-600);
}

.card-content blockquote {
  border-left: 3px solid var(--blue-400);
  margin: 14px 0;
  padding-left: 14px;
  color: var(--gray-600);
  font-style: italic;
}

.card-content hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 18px 0;
}

/* Chat */
.chat-section {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.chat-icon {
  font-size: 1rem;
  opacity: 0.7;
}

.chat-header h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
}

.chat-messages {
  padding: 18px;
  min-height: 100px;
  max-height: 280px;
  overflow-y: auto;
}

.chat-hint {
  text-align: center;
  color: var(--gray-500);
}

.chat-hint p {
  margin-bottom: 14px;
  font-size: 0.875rem;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.suggestion-btn {
  background: var(--white);
  border: 1px solid var(--gray-300);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.813rem;
  font-family: inherit;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
}

.suggestion-btn:hover {
  border-color: var(--blue-400);
  color: var(--blue-600);
  background: var(--blue-50);
}

.chat-message {
  margin-bottom: 12px;
  animation: fadeIn 0.2s ease;
}

.chat-message.user {
  text-align: right;
}

.chat-message.user .message-content {
  background: var(--blue-600);
  color: var(--white);
  margin-left: auto;
}

.chat-message.assistant .message-content {
  background: var(--gray-100);
  color: var(--gray-800);
}

.message-content {
  display: inline-block;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: left;
}

.message-content p {
  margin-bottom: 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.chat-input-wrapper {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
}

.chat-input-wrapper input {
  flex: 1;
}

#chatSendBtn {
  height: 44px;
  padding: 0 18px;
  background: var(--blue-600);
  border: none;
  border-radius: var(--radius);
  color: var(--white);
  font-weight: 500;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

#chatSendBtn:hover:not(:disabled) {
  background: var(--blue-700);
}

#chatSendBtn:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

/* ========================================
   PROFILE & USERS
   ======================================== */

.profile-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  background: var(--blue-600);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--white);
}

.profile-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.profile-info p {
  color: var(--gray-500);
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.profile-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--blue-100);
  border-radius: var(--radius-full);
  font-size: 0.688rem;
  font-weight: 600;
  color: var(--blue-700);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.profile-form {
  padding: 24px;
}

.profile-section {
  padding: 24px;
  border-top: 1px solid var(--gray-200);
}

.profile-section h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.search-input {
  flex: 1;
}

.filter-select {
  min-width: 160px;
}

/* Users List */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
}

.user-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-item-avatar {
  width: 40px;
  height: 40px;
  background: var(--blue-600);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--white);
}

.user-item-details h4 {
  color: var(--gray-800);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.user-item-details p {
  color: var(--gray-500);
  font-size: 0.75rem;
}

.user-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-role-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.688rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.role-admin { background: var(--red-50); color: var(--red-600); }
.role-manager { background: var(--blue-50); color: var(--blue-600); }
.role-user { background: var(--green-50); color: var(--green-600); }
.role-viewer { background: var(--gray-100); color: var(--gray-600); }

/* Loading State */
.loading-state {
  text-align: center;
  padding: 40px;
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
  font-size: 1.063rem;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--gray-400);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-content form {
  padding: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.pagination button {
  height: 36px;
  min-width: 36px;
  padding: 0 12px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-700);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--blue-400);
  color: var(--blue-600);
}

.pagination button.active {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: var(--white);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========================================
   RESPONSIVE
   ======================================== */

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

  .upload-card.sticky {
    position: static;
  }

  .container {
    padding: 28px 24px;
  }
}

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

  .user-name {
    display: none;
  }

  .filter-bar {
    flex-direction: column;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .view-header .btn-primary {
    width: 100%;
  }

  /* Results adjustments */
  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-meta {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  /* Base */
  .container {
    padding: 16px;
  }

  /* Navbar mobile */
  .navbar {
    height: 56px;
    padding: 0 16px;
  }

  .nav-logo {
    font-size: 1.25rem;
  }

  .nav-title {
    font-size: 1rem;
  }

  .user-btn {
    padding: 4px 8px 4px 4px;
  }

  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .dropdown-arrow {
    display: none;
  }

  .dropdown-menu {
    width: calc(100vw - 32px);
    right: -8px;
  }

  /* Dashboard header mobile */
  .dashboard-header {
    margin-bottom: 20px;
  }

  .dashboard-header h2 {
    font-size: 1.375rem;
  }

  .dashboard-subtitle {
    font-size: 0.875rem;
  }

  /* Stats grid mobile - horizontal scroll */
  .stats-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .stats-grid::-webkit-scrollbar {
    display: none;
  }

  .stat-card {
    flex: 0 0 auto;
    min-width: 130px;
    padding: 14px;
    scroll-snap-align: start;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.625rem;
  }

  /* Dashboard grid mobile */
  .dashboard-grid {
    gap: 20px;
    margin-top: 24px;
  }

  /* Cards mobile */
  .card {
    padding: 16px;
    border-radius: var(--radius);
  }

  .card-title-main {
    font-size: 0.938rem;
    margin-bottom: 16px;
  }

  /* Upload area mobile */
  .file-input-display {
    padding: 20px 16px;
    flex-direction: column;
    text-align: center;
  }

  .upload-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
  }

  .upload-main {
    font-size: 0.875rem;
  }

  /* Form mobile */
  form {
    gap: 14px;
  }

  .input-group label {
    font-size: 0.75rem;
  }

  input[type="url"],
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  select {
    height: 44px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  #submitBtn {
    height: 48px;
    font-size: 0.938rem;
  }

  .divider {
    margin: 8px 0;
  }

  /* Recent section mobile */
  .recent-section {
    padding: 16px;
    border-radius: var(--radius);
  }

  .section-header {
    margin-bottom: 14px;
  }

  .section-header h3 {
    font-size: 0.875rem;
  }

  /* Analysis items mobile */
  .analyses-list {
    gap: 8px;
  }

  .analysis-item {
    padding: 12px;
  }

  .analysis-icon {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }

  .analysis-details h4 {
    font-size: 0.813rem;
  }

  .analysis-meta {
    font-size: 0.625rem;
    gap: 6px;
  }

  .analysis-status {
    padding: 2px 6px;
    font-size: 0.563rem;
  }

  /* Results mobile */
  .result-card {
    border-radius: var(--radius);
  }

  .card-header {
    padding: 12px 14px;
  }

  .card-header h3 {
    font-size: 0.813rem;
  }

  .card-content {
    padding: 14px;
    font-size: 0.813rem;
  }

  .card-content h2 {
    font-size: 0.938rem;
  }

  .card-content h3 {
    font-size: 0.875rem;
  }

  /* Chat mobile */
  .chat-section {
    border-radius: var(--radius);
  }

  .chat-header {
    padding: 12px 14px;
  }

  .chat-header h3 {
    font-size: 0.813rem;
  }

  .chat-messages {
    padding: 14px;
    min-height: 80px;
    max-height: 200px;
  }

  .chat-hint p {
    font-size: 0.813rem;
  }

  .chat-suggestions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .suggestion-btn {
    flex: 1 1 auto;
    min-width: calc(50% - 3px);
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .message-content {
    padding: 10px 12px;
    font-size: 0.813rem;
    max-width: 90%;
  }

  .chat-input-wrapper {
    padding: 12px 14px;
    gap: 8px;
  }

  #chatSendBtn {
    padding: 0 14px;
    font-size: 0.813rem;
  }

  /* Back button mobile */
  .btn-back {
    font-size: 0.813rem;
    margin-bottom: 12px;
  }

  /* View title mobile */
  .view-title {
    font-size: 1.25rem;
    margin-bottom: 16px;
  }

  /* Profile mobile */
  .profile-card {
    border-radius: var(--radius);
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .profile-avatar {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
  }

  .profile-info h3 {
    font-size: 1.063rem;
  }

  .profile-form,
  .profile-section {
    padding: 16px;
  }

  .profile-section h4 {
    font-size: 0.938rem;
  }

  /* Users list mobile */
  .user-item {
    padding: 12px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .user-item-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.813rem;
  }

  .user-item-details h4 {
    font-size: 0.813rem;
  }

  .user-item-details p {
    font-size: 0.688rem;
  }

  .user-item-actions {
    width: 100%;
    justify-content: space-between;
  }

  /* Modal mobile */
  .modal {
    padding: 16px;
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-header {
    padding: 16px;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .modal-content form {
    padding: 16px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-actions button {
    width: 100%;
  }

  /* Auth page mobile */
  .auth-page {
    padding: 16px;
    align-items: flex-start;
    padding-top: 60px;
  }

  .auth-container {
    max-width: 100%;
  }

  .auth-header {
    margin-bottom: 24px;
  }

  .logo-icon {
    font-size: 1.75rem;
  }

  .auth-logo h1 {
    font-size: 1.375rem;
  }

  .auth-tagline {
    font-size: 0.875rem;
  }

  .auth-card {
    padding: 20px 16px;
    border-radius: var(--radius);
  }

  .auth-tabs {
    margin-bottom: 20px;
  }

  .auth-tab {
    padding: 10px 12px;
    font-size: 0.813rem;
  }

  .auth-form {
    gap: 14px;
  }

  .btn-primary {
    height: 48px;
    font-size: 0.938rem;
  }

  .btn-secondary {
    height: 44px;
    font-size: 0.875rem;
  }

  .auth-footer {
    margin-top: 16px;
    font-size: 0.688rem;
  }

  /* Pagination mobile */
  .pagination {
    gap: 4px;
  }

  .pagination button {
    height: 36px;
    min-width: 36px;
    padding: 0 10px;
    font-size: 0.813rem;
  }

  /* Filter bar mobile */
  .filter-bar {
    gap: 10px;
  }

  .search-input,
  .filter-select {
    height: 44px;
  }

  /* Progress mobile */
  .progress-card {
    padding: 24px 16px;
  }

  .progress-header h2 {
    font-size: 1rem;
  }

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

  .step-label {
    font-size: 0.563rem;
  }

  /* Meta badges mobile */
  .meta-badge {
    padding: 3px 8px;
    font-size: 0.688rem;
  }

  /* Empty state mobile */
  .empty-state {
    padding: 24px 16px;
    font-size: 0.813rem;
  }
}

/* Extra small devices */
@media (max-width: 380px) {
  .container {
    padding: 12px;
  }

  .stat-card {
    min-width: 115px;
    padding: 12px;
  }

  .suggestion-btn {
    min-width: 100%;
  }

  .auth-card {
    padding: 16px 14px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
