/* ═══════════════════════════════════════════════════════════════
   Полезно Есть — QA Testing Platform
   Design System v2.0 · Brand-aligned dark theme
   ═══════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Brand palette — «Полезно Есть» */
  --brand:          #34d399;   /* Emerald green — здоровье, свежесть */
  --brand-hover:    #10b981;
  --brand-glow:     rgba(52, 211, 153, 0.12);
  --brand-surface:  rgba(52, 211, 153, 0.06);

  --cta:            #f97316;   /* Warm orange — действие, аппетит */
  --cta-hover:      #ea580c;
  --cta-glow:       rgba(249, 115, 22, 0.15);

  --accent:         #8b5cf6;   /* Violet — premium accent */
  --accent-glow:    rgba(139, 92, 246, 0.12);

  /* Surfaces */
  --bg-deep:        #070b14;
  --bg:             #0c1222;
  --surface:        #151d2e;
  --surface-alt:    #1b2640;
  --surface-hover:  #212f4a;
  --surface-glass:  rgba(21, 29, 46, 0.72);

  /* Text */
  --text:           #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted:     #64748b;
  --text-dim:       #475569;

  /* Semantic */
  --success:        #34d399;
  --success-bg:     rgba(52, 211, 153, 0.10);
  --warning:        #fbbf24;
  --warning-bg:     rgba(251, 191, 36, 0.10);
  --danger:         #ef4444;
  --danger-hover:   #dc2626;
  --danger-bg:      rgba(239, 68, 68, 0.10);
  --info:           #38bdf8;
  --info-bg:        rgba(56, 189, 248, 0.10);

  /* Chrome */
  --border:         rgba(148, 163, 184, 0.10);
  --border-hover:   rgba(148, 163, 184, 0.20);
  --field-bg:       #0a0f1c;
  --field-border:   rgba(148, 163, 184, 0.14);
  --field-focus:    rgba(52, 211, 153, 0.40);

  /* Geometry */
  --radius-sm:   8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.18);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.28);
  --shadow-lg:   0 20px 60px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 40px var(--brand-glow);

  /* Transitions */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --duration:  0.25s;
}

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

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

/* ── Animated Background Orbs ──────────────────────────────── */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  will-change: transform;
}

body::before {
  width: 45vw;
  height: 45vw;
  max-width: 600px;
  max-height: 600px;
  top: -10%;
  left: -8%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.10) 0%, rgba(52, 211, 153, 0.02) 60%, transparent 80%);
  animation: orbDrift1 18s ease-in-out infinite;
}

body::after {
  width: 40vw;
  height: 40vw;
  max-width: 500px;
  max-height: 500px;
  bottom: -5%;
  right: -6%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, rgba(139, 92, 246, 0.02) 60%, transparent 80%);
  animation: orbDrift2 22s ease-in-out infinite;
}

/* Third orb via a wrapper — injected from templates as .bg-orb */
.bg-orb {
  position: fixed;
  width: 35vw;
  height: 35vw;
  max-width: 450px;
  max-height: 450px;
  top: 50%;
  left: 55%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.06) 0%, rgba(249, 115, 22, 0.01) 60%, transparent 80%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  animation: orbDrift3 25s ease-in-out infinite;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}
h1 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.02em; font-weight: 800; }
h2 { font-size: clamp(1.15rem, 2.2vw, 1.5rem); letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; font-weight: 600; }

p { color: var(--text-secondary); line-height: 1.6; max-width: 72ch; }

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 6px;
}

code, .mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  color: var(--warning);
}

/* ── Layout Shell ──────────────────────────────────────────── */
.shell {
  width: min(1360px, 94vw);
  margin: 0 auto;
  padding: 0 0 48px;
  position: relative;
  z-index: 1;
}

/* ── Top Bar ───────────────────────────────────────────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(12, 18, 34, 0.85);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.top-bar-brand .brand-icon {
  font-size: 1.4rem;
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  color: #0c1222;
  flex-shrink: 0;
}

.top-bar-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}
.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

/* ── Hero / Page Header ────────────────────────────────────── */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.hero p { margin: 0; }
.hero h1 { margin-bottom: 6px; }

/* ── Status Card (hero) ────────────────────────────────────── */
.status-card {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  min-width: 170px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s ease;
  animation: fadeInUp 0.6s var(--ease-out) 0.15s both;
}
.status-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.status-card span { display: block; color: var(--text-muted); font-size: 0.8rem; font-weight: 500; }
.status-card strong { font-size: 1.2rem; color: var(--brand); }

/* ── Glass Pane ────────────────────────────────────────────── */
.pane {
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 28px;
  overflow: hidden;
  animation: fadeInUp 0.5s var(--ease-out) both;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s var(--ease-out);
}
.pane:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}

.pane-header {
  margin-bottom: 20px;
}
.pane-header h2 { margin-bottom: 4px; }

/* ── Auth Shell (Login Page) ───────────────────────────────── */
.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface-glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  padding: 40px 36px;
  text-align: center;
  animation: fadeInUp 0.6s var(--ease-out) both;
}

.auth-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  display: block;
  border-radius: var(--radius-lg);
  filter: drop-shadow(0 0 20px var(--brand-glow));
  animation: floatIcon 3s ease-in-out infinite;
}

.auth-card h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--brand), var(--info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  color: var(--text-muted) !important;
  font-size: 0.9rem;
  margin-bottom: 28px !important;
}

.auth-card .step-form {
  text-align: left;
}

.auth-footer {
  margin-top: 24px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.auth-footer a {
  color: var(--brand);
  text-decoration: none;
}
.auth-footer a:hover {
  text-decoration: underline;
}

/* Error message for login */
.auth-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: shake 0.4s ease-in-out;
}

/* Ban warning */
.auth-ban-warning {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
  color: var(--warning);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Security info badge */
.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--brand-surface);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 20px;
}

/* ── Workspace Grid ────────────────────────────────────────── */
.workspace-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: start;
}

.pane-case { animation-delay: 0.1s; }
.pane-report { animation-delay: 0.2s; }

/* ── Progress Bar ──────────────────────────────────────────── */
.progress-wrapper {
  margin-bottom: 20px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.progress-track {
  height: 8px;
  background: rgba(148, 163, 184, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--info));
  border-radius: var(--radius-pill);
  transition: width 0.6s var(--ease-out);
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s ease-in-out infinite;
}

/* ── Current Step Card ─────────────────────────────────────── */
.current-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin: 18px 0;
  position: relative;
}
.current-step::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.instruction {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-glow);
  color: var(--brand);
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}

/* ── Forms ──────────────────────────────────────────────────── */
.step-form {
  display: grid;
  gap: 16px;
}

.form-group {
  display: grid;
  gap: 6px;
}

label, .field-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.4;
}

textarea, input, select {
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
  outline: none;
}

textarea { min-height: 120px; resize: vertical; }
#manual-steps { min-height: 180px; line-height: 1.55; }

textarea:focus, input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--field-focus);
}

textarea::placeholder, input::placeholder {
  color: var(--text-dim);
  opacity: 0.8;
}

/* ── Buttons ───────────────────────────────────────────────── */
button {
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 12px 20px;
  min-height: 48px;
  line-height: 1.3;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

/* Primary (CTA) */
.btn-primary, button[type="submit"] {
  background: linear-gradient(135deg, var(--brand), var(--brand-hover));
  color: #052e16;
  font-weight: 800;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.btn-primary:hover, button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--brand-glow);
}
.btn-primary:active, button[type="submit"]:active {
  transform: translateY(0);
}

/* Status buttons */
.btn-pass {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #052e16;
  font-weight: 800;
}
.btn-pass:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(34, 197, 94, 0.25); }

.btn-fail {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-weight: 800;
}
.btn-fail:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25); }

.btn-blocked {
  background: var(--surface-alt);
  border: 1px solid var(--border-hover);
  color: var(--text-muted);
  font-weight: 700;
}
.btn-blocked:hover { background: var(--surface-hover); color: var(--text-secondary); }

/* Ghost button */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
}
.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-surface);
}

/* Danger */
button.danger, .btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-hover));
  color: #fff;
  font-weight: 800;
}
button.danger:hover, .btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--danger-bg);
}

/* Accept */
.btn-accept {
  background: linear-gradient(135deg, var(--brand), var(--brand-hover));
  color: #052e16;
  font-weight: 800;
}
.btn-accept:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--brand-glow); }

/* Reject */
.btn-reject {
  background: linear-gradient(135deg, var(--danger), var(--danger-hover));
  color: #fff;
  font-weight: 800;
}
.btn-reject:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239, 68, 68, 0.2); }

/* Disabled */
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Status Actions Row ────────────────────────────────────── */
.status-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.status-actions button {
  flex: 1;
  min-width: 100px;
}

/* ── Review Actions ────────────────────────────────────────── */
.review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ── File Upload ───────────────────────────────────────────── */
.file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.evidence-zone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  background: rgba(52, 211, 153, 0.02);
}
.evidence-zone:hover, .evidence-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-surface);
}
.evidence-zone .upload-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}
.evidence-zone .upload-text {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.evidence-zone .upload-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  min-height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 10px 18px;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  font-size: 0.88rem;
}
.file-picker:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.file-name {
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* ── Evidence Preview ──────────────────────────────────────── */
.evidence-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.evidence-preview .evidence-icon { font-size: 1.2rem; }
.evidence-preview .evidence-name { flex: 1; overflow-wrap: anywhere; }

/* ── Metrics ───────────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.metrics div, .metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}
.metrics span, .metric-label { display: block; color: var(--text-muted); font-size: 0.78rem; font-weight: 500; }
.metrics strong, .metric-value { font-size: 1.8rem; font-weight: 800; color: var(--text); display: block; margin-top: 2px; }

.metric-value.success { color: var(--success); }
.metric-value.danger { color: var(--danger); }
.metric-value.warning { color: var(--warning); }

/* ── Timeline / Step List ──────────────────────────────────── */
.timeline {
  list-style: none;
  display: grid;
  gap: 10px;
}

.timeline-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(255,255,255,0.02);
  display: grid;
  gap: 6px;
  transition: all var(--duration) var(--ease-out);
  position: relative;
  padding-left: 22px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--text-dim);
}

.timeline-item.passed::before { background: var(--success); }
.timeline-item.passed { border-color: rgba(52, 211, 153, 0.2); background: var(--success-bg); }

.timeline-item.failed::before { background: var(--danger); }
.timeline-item.failed { border-color: rgba(239, 68, 68, 0.2); background: var(--danger-bg); }

.timeline-item.blocked::before { background: var(--warning); }
.timeline-item.blocked { border-color: rgba(251, 191, 36, 0.2); background: var(--warning-bg); }

.timeline-item.pending::before { background: var(--text-dim); }
.timeline-item.active::before { background: var(--brand); }
.timeline-item.active { border-color: rgba(52, 211, 153, 0.3); background: var(--brand-surface); }

.timeline-item strong { font-size: 0.92rem; }
.timeline-item small { color: var(--text-muted); font-size: 0.82rem; }
.timeline-item span { font-size: 0.88rem; color: var(--text-secondary); }

/* ── Status Badge (pill) ───────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.status-badge-pass { background: var(--success-bg); color: var(--success); border: 1px solid rgba(52, 211, 153, 0.25); }
.status-badge-fail { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.25); }
.status-badge-blocked { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(251, 191, 36, 0.25); }
.status-badge-pending { background: rgba(100, 116, 139, 0.1); color: var(--text-dim); border: 1px solid var(--border); }

/* ── Review Card ───────────────────────────────────────────── */
.review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid;
  gap: 12px;
  transition: all var(--duration) var(--ease-out);
  animation: fadeInUp 0.4s var(--ease-out) both;
}
.review-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.review-card-body {
  display: grid;
  gap: 8px;
}

.review-field {
  display: grid;
  gap: 2px;
}
.review-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.review-field-value {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ── Comment Area (conditional) ────────────────────────────── */
.comment-area {
  display: grid;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s var(--ease-out), opacity 0.3s var(--ease-out), margin 0.3s var(--ease-out);
  margin-top: 0;
}
.comment-area.visible {
  max-height: 300px;
  opacity: 1;
  margin-top: 12px;
}

/* ── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  pointer-events: auto;
  animation: slideInRight 0.4s var(--ease-out) both;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

.toast.fade-out { animation: slideOutRight 0.3s var(--ease-out) both; }

.toast-icon { font-size: 1.2rem; flex-shrink: 0; }

/* ── Confirmation Dialog ───────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 20, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease both;
}
.dialog-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeInUp 0.3s var(--ease-out) both;
}
.dialog-box h3 { margin-bottom: 8px; }
.dialog-box p { margin-bottom: 24px; text-align: center; }
.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Button Link ───────────────────────────────────────────── */
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand), var(--brand-hover));
  color: #052e16;
  font-weight: 800;
  padding: 12px 20px;
  text-decoration: none;
  line-height: 1.3;
  transition: all var(--duration) var(--ease-out);
}
.button-link:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--brand-glow); }

/* ── Existing Component Compatibility ──────────────────────── */
/* Partner bundle cards */
.partner-bundle-list { display: grid; gap: 16px; }
.partner-bundle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: grid;
  gap: 16px;
}
.partner-bundle-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.partner-badge { border-radius: var(--radius-pill); padding: 7px 12px; font-weight: 800; border: 1px solid var(--border); }
.partner-badge-complete { background: var(--success-bg); color: var(--success); }
.partner-badge-missing_evidence { background: var(--warning-bg); color: var(--warning); }
.partner-badge-version_mismatch { background: var(--danger-bg); color: var(--danger); }
.partner-safe-meta { display: grid; grid-template-columns: 1fr; gap: 10px; }
.partner-safe-meta dt { color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.partner-safe-meta dd { margin: 0; overflow-wrap: anywhere; }

/* Ops dashboard */
.ops-summary { display: grid; gap: 18px; }
.ops-overall { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ops-status { border-radius: var(--radius-pill); padding: 7px 12px; font-weight: 900; border: 1px solid var(--border); display: inline-flex; }
.ops-status-ok, .ops-status-pass { background: var(--success-bg); color: var(--success); }
.ops-status-warning { background: var(--warning-bg); color: var(--warning); }
.ops-status-fail { background: var(--danger-bg); color: var(--danger); }
.ops-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ops-metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; min-width: 0; }
.ops-metric span { display: block; color: var(--text-muted); overflow-wrap: anywhere; }
.ops-metric strong { font-size: 2rem; }
.ops-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ops-columns section { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; min-width: 0; }
.ops-columns ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.ops-columns li { overflow-wrap: anywhere; line-height: 1.4; }
.ops-action-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.ops-action-group { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; min-width: 0; display: grid; gap: 12px; align-content: start; }
.ops-action-group-header { display: grid; gap: 4px; }
.ops-action-group-header p { margin-bottom: 0; }
.ops-actions { margin: 0; }
.ops-actions button, .ops-actions .button-link { flex: 1 1 260px; }
.ops-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.ops-result-card { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; min-width: 0; display: grid; gap: 12px; }
.ops-result-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ops-result-header h3 { margin: 0; }
.ops-copy-button { min-height: 38px; padding: 9px 12px; border-radius: 10px; flex: 0 1 auto; }
.ops-result-pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; background: var(--field-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; max-height: 360px; overflow: auto; min-width: 0; margin: 0; }

/* Lifecycle */
.lifecycle-card { display: grid; gap: 18px; }
.lifecycle-actions { margin: 2px 0 4px; }
.lifecycle-actions button { flex: 0 1 340px; }
.lifecycle-form { gap: 18px; }
.lifecycle-form button[type="submit"] { margin-top: 4px; width: 100%; }

/* Nextcloud runbook */
.nextcloud-runbook-grid { display: grid; gap: 18px; }
.nextcloud-runbook-steps { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.nextcloud-runbook-step { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; overflow-wrap: anywhere; }
.nextcloud-runbook-step p { margin: 8px 0 0; }
.nextcloud-runbook-summary small { overflow-wrap: anywhere; color: var(--text-muted); }

.shell > .pane { margin-top: 24px; min-height: auto; }
.form-row { display: grid; gap: 8px; min-width: 0; }
.result-card { min-height: 220px; }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(80px); }
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--brand-glow); }
  50%      { box-shadow: 0 0 24px 4px var(--brand-glow); }
}

/* ── Background Orb Drift ─────────────────────────────────── */
@keyframes orbDrift1 {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(8vw, 6vh) scale(1.08); }
  50%  { transform: translate(3vw, 12vh) scale(0.95); }
  75%  { transform: translate(-5vw, 4vh) scale(1.05); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes orbDrift2 {
  0%   { transform: translate(0, 0) scale(1); }
  30%  { transform: translate(-7vw, -5vh) scale(1.06); }
  60%  { transform: translate(-3vw, -10vh) scale(0.94); }
  80%  { transform: translate(4vw, -3vh) scale(1.03); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes orbDrift3 {
  0%   { transform: translate(0, 0) scale(1); }
  20%  { transform: translate(-6vw, 5vh) scale(1.04); }
  45%  { transform: translate(5vw, -4vh) scale(0.96); }
  70%  { transform: translate(-2vw, -8vh) scale(1.07); }
  100% { transform: translate(0, 0) scale(1); }
}

/* ── Subtle Element Animations ────────────────────────────── */

/* Hero entrance */
.hero > div { animation: fadeInUp 0.5s var(--ease-out) both; }

/* Stagger workspace panes */
.pane-case  { animation: fadeInUp 0.55s var(--ease-out) 0.1s both; }
.pane-report { animation: fadeInUp 0.55s var(--ease-out) 0.25s both; }

/* Progress bar entrance */
.progress-wrapper { animation: fadeInUp 0.5s var(--ease-out) 0.05s both; }

/* Metric cards stagger */
.metrics div:nth-child(1) { animation: fadeInUp 0.4s var(--ease-out) 0.1s both; }
.metrics div:nth-child(2) { animation: fadeInUp 0.4s var(--ease-out) 0.18s both; }
.metrics div:nth-child(3) { animation: fadeInUp 0.4s var(--ease-out) 0.26s both; }
.metrics div:nth-child(4) { animation: fadeInUp 0.4s var(--ease-out) 0.34s both; }
.metrics div:nth-child(5) { animation: fadeInUp 0.4s var(--ease-out) 0.42s both; }

/* Metric card hover */
.metrics div, .metric-card {
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s ease, border-color 0.35s ease;
}
.metrics div:hover, .metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

/* Timeline item hover */
.timeline-item {
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.timeline-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

/* Review card hover */
.review-card {
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s ease, border-color 0.35s ease;
}
.review-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

/* Current step breathing glow */
.current-step {
  transition: box-shadow 0.4s ease;
}
.current-step:hover {
  box-shadow: 0 0 30px rgba(52, 211, 153, 0.06);
}

/* Badge pulse on hover */
.badge {
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
}
.badge:hover {
  transform: scale(1.05);
}

/* Status badge subtle bounce */
.status-badge {
  transition: transform 0.25s var(--ease-out);
}
.status-badge:hover {
  transform: scale(1.08);
}

/* Evidence zone pulse */
.evidence-zone {
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s var(--ease-out);
}
.evidence-zone:hover {
  transform: scale(1.01);
}

/* Top bar smooth slide-down */
.top-bar {
  animation: fadeIn 0.4s ease both;
}

/* Auth card entrance (slower, grander) */
.auth-card {
  animation: fadeInUp 0.7s var(--ease-out) 0.1s both;
}

/* Security badge delayed entrance */
.security-badge {
  animation: fadeIn 0.5s ease 0.5s both;
}

/* Form fields stagger */
.auth-card .form-group:nth-child(1) { animation: fadeInUp 0.4s var(--ease-out) 0.3s both; }
.auth-card .form-group:nth-child(2) { animation: fadeInUp 0.4s var(--ease-out) 0.4s both; }
.auth-card button[type="submit"] { animation: fadeInUp 0.4s var(--ease-out) 0.5s both; }
.auth-footer { animation: fadeIn 0.5s ease 0.7s both; }

/* Focus glow on inputs */
input:focus, textarea:focus, select:focus {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile-first (основная работа на смартфонах)
   ═══════════════════════════════════════════════════════════════ */

/* ── Touch Targets — everywhere at least 44px ────────────── */
@media (pointer: coarse) {
  button, .btn-pass, .btn-fail, .btn-blocked,
  .btn-accept, .btn-reject, .btn-ghost, .btn-primary,
  .btn-logout, input, textarea, select {
    min-height: 48px;
    font-size: max(16px, 1em); /* Prevents iOS zoom on focus */
  }

  .timeline-item {
    min-height: 52px;
    padding: 14px 16px;
  }

  .review-card {
    padding: 18px;
  }
}

/* ── Small Phones (up to 420px) ──────────────────────────── */
@media (max-width: 420px) {
  html { font-size: 15px; }

  .shell {
    width: 100%;
    padding: 0 10px 24px;
  }

  .top-bar {
    padding: 8px 12px;
    margin-bottom: 16px;
    gap: 8px;
  }

  .top-bar-brand {
    font-size: 0.85rem;
    gap: 6px;
  }
  .top-bar-brand .brand-icon {
    width: 22px !important;
    height: 22px !important;
  }
  .top-bar-brand span:last-child {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .top-bar-name { display: none; }
  .avatar { width: 30px; height: 30px; font-size: 0.7rem; }
  .btn-logout { padding: 5px 10px; font-size: 0.72rem; }

  .hero {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .hero h1 { font-size: 1.3rem; }
  .hero p { font-size: 0.85rem; }
  .eyebrow { font-size: 0.68rem; }

  .status-card {
    padding: 12px 14px;
    min-width: auto;
  }
  .status-card strong { font-size: 1rem; }

  .pane {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .auth-card {
    padding: 24px 18px;
    border-radius: var(--radius-lg);
  }
  .auth-logo {
    width: 64px;
    height: 64px;
  }
  .auth-card h1 { font-size: 1.35rem; }

  .workspace-grid { grid-template-columns: 1fr; gap: 14px; }

  .current-step { padding: 16px; }
  .instruction { font-size: 0.95rem; }

  .status-actions {
    flex-direction: column;
    gap: 8px;
  }
  .status-actions button { width: 100%; }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .metrics div {
    padding: 10px 8px;
  }
  .metrics span { font-size: 0.65rem; }
  .metrics strong { font-size: 1rem; }

  .timeline { gap: 8px; }
  .timeline-item { padding: 10px 12px; }

  .review-card { padding: 14px; }
  .review-actions {
    flex-direction: column;
    gap: 8px;
  }
  .review-actions button { width: 100%; }

  .progress-label { font-size: 0.75rem; }

  button, .btn-primary {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
  }

  .evidence-zone {
    padding: 24px 14px;
  }
  .upload-text { font-size: 0.85rem; }

  /* Dialog full-width on tiny phones */
  .dialog-box {
    width: calc(100vw - 32px);
    max-width: none;
  }
}

/* ── Regular Phones (421–767px) ──────────────────────────── */
@media (max-width: 767px) and (min-width: 421px) {
  .shell {
    width: 100%;
    padding: 0 14px 32px;
  }

  .top-bar {
    padding: 10px 16px;
    margin-bottom: 20px;
  }

  .top-bar-brand { font-size: 0.9rem; }
  .top-bar-name { display: none; }

  .hero {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }

  .workspace-grid { grid-template-columns: 1fr; gap: 16px; }

  .pane {
    padding: 20px;
    border-radius: var(--radius-lg);
  }

  .auth-card { padding: 32px 28px; }

  .status-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .status-actions button { flex: 1; min-width: 100px; }

  .review-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .review-actions button { flex: 1; }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  button, .btn-primary { width: 100%; }

  .lifecycle-actions { display: grid; grid-template-columns: 1fr; }
  .lifecycle-actions button { width: 100%; flex-basis: auto; }
}

/* ── All phones combined (up to 767px) ───────────────────── */
@media (max-width: 767px) {
  /* Safe areas for notched phones */
  .top-bar {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .shell {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  /* Bottom padding for phones with gesture bars */
  body {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* Horizontal scroll for metrics on narrow screens */
  .metrics {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .metrics::-webkit-scrollbar { display: none; }

  /* Stack review card header */
  .review-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ops-metrics, .ops-columns, .ops-action-groups, .ops-result-grid {
    grid-template-columns: 1fr;
  }

  /* Toast at top on mobile */
  .toast-container {
    top: 60px;
    bottom: auto;
    right: 10px;
    left: 10px;
    width: auto;
  }
  .toast {
    width: 100%;
  }
}

/* ── Tablets (768–979px) ─────────────────────────────────── */
@media (min-width: 768px) and (max-width: 979px) {
  .shell {
    width: min(100% - 32px, 1360px);
    padding-bottom: 40px;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .top-bar { padding: 10px 20px; }

  .pane { padding: 24px; border-radius: var(--radius-lg); }

  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .lifecycle-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .ops-metrics, .ops-columns { grid-template-columns: 1fr 1fr; }
}

/* ── Desktop (980px+) ────────────────────────────────────── */
@media (min-width: 980px) {
  .shell {
    width: min(1360px, 94vw);
  }

  .workspace-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
  }

  .hero {
    flex-direction: row;
    align-items: flex-end;
  }
}

/* ── Landscape phones (short viewport) ───────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .auth-shell {
    padding: 12px;
  }
  .auth-card {
    padding: 20px;
  }
  .auth-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
  }
  .auth-card h1 { font-size: 1.2rem; margin-bottom: 2px; }
  .auth-subtitle { margin-bottom: 14px !important; }
}

/* ── Reduced Motion (accessibility) ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .progress-fill::after { animation: none; }
  body::before, body::after, .bg-orb { animation: none; }
}

