/* public/css/app.css — Ergasti Lens Theme */
/* Design System: Dark version from logo */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Syne:wght@700;800&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #0A0F1E;
  --bg-secondary: #0D1530;
  --bg-surface: #111D3E;
  --accent-primary: #1E6FFF;
  --accent-glow: #3D9BFF;
  --accent-soft: #5BB8FF;
  --text-primary: #FFFFFF;
  --text-secondary: #A0B4D6;
  --text-muted: #4A6080;
  --border: #1A2E52;

  /* Semantic aliases for compatibility */
  --color-bg: var(--bg-primary);
  --color-surface: var(--bg-surface);
  --color-surface-2: var(--bg-secondary);
  --color-surface-3: var(--bg-surface);
  --color-border: var(--border);
  --color-border-glow: var(--accent-primary);
  --color-accent: var(--accent-primary);
  --color-accent-2: var(--accent-glow);
  --color-accent-green: #00ff88;
  --color-accent-red: #ff3355;
  --color-accent-yellow: #ffaa00;
  --color-text: var(--text-primary);
  --color-text-dim: var(--text-muted);
  --color-text-mid: var(--text-secondary);

  --glow-primary: 0 0 16px rgba(30, 111, 255, 0.4);
  --glow-border: 0 0 12px rgba(61, 155, 255, 0.3);

  --font-heading: 'DM Sans', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-code: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all 0.2s ease;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-glow); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Background: deep navy + radial glow + dot pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg-primary);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(30, 111, 255, 0.08) 0%, transparent 70%),
    radial-gradient(circle at 0 0, rgba(30, 111, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
  pointer-events: none;
}

a { color: var(--accent-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-glow); }

.main-content {
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  width: 100%;
}

/* ── Dashboard Layout (Sidebar + Main) ──────────────────────────────────────── */
.dashboard-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  min-height: 0;
}

.dashboard-sidebar {
  flex-shrink: 0;
  width: 240px;
  background: rgba(13, 21, 48, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 0;
  position: sticky;
  top: 86px;
}

.sidebar-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0.8;
}

.sidebar-search-input {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 32px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-body);
  outline: none;
  transition: var(--transition);
}

.sidebar-search-input::placeholder {
  color: var(--text-muted);
}

.sidebar-search-input:focus {
  border-color: rgba(30, 111, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(30, 111, 255, 0.15);
}

.sidebar-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-search-clear:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.sidebar-search-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 200;
  padding: 4px 0;
}

.sidebar-search-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-search-suggestion:hover,
.sidebar-search-suggestion.suggestion-highlight {
  background: rgba(30, 111, 255, 0.12);
  color: var(--accent-soft);
}

.sidebar-search-suggestion .suggestion-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-search-suggestion .suggestion-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-search-suggestion .suggestion-count {
  font-size: 11px;
  font-family: var(--font-code);
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.sidebar-search-suggestions-empty {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.sidebar-folders-default,
.sidebar-folders-search {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-search-empty {
  padding: 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.sidebar-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  margin: 0 6px 8px;
  border-top: 1px solid var(--border);
}

.sidebar-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  background: rgba(30, 111, 255, 0.08);
  border: 1px solid rgba(30, 111, 255, 0.35);
  border-radius: var(--radius-sm);
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-pagination-btn:hover {
  background: rgba(30, 111, 255, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 12px rgba(30, 111, 255, 0.2);
}

.sidebar-pagination-info {
  font-size: 11px;
  font-family: var(--font-code);
  color: var(--text-muted);
  padding: 0 8px;
}

.sidebar-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

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

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  border-radius: var(--radius-sm);
  margin: 0 6px;
  font-size: 13px;
}

.sidebar-item:hover {
  background: rgba(30, 111, 255, 0.08);
  color: var(--accent-soft);
}

.sidebar-item.active {
  background: rgba(30, 111, 255, 0.15);
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-icon {
  flex-shrink: 0;
  color: inherit;
  opacity: 0.9;
}

.sidebar-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-count {
  font-size: 11px;
  font-family: var(--font-code);
  color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

.sidebar-item.active .sidebar-count {
  color: var(--accent-soft);
}

.sidebar-item-wrap {
  display: flex;
  align-items: center;
  margin: 0 6px;
  border-radius: var(--radius-sm);
}

.sidebar-item-wrap > a {
  flex: 1;
  min-width: 0;
}

.sidebar-item-wrap.active .sidebar-item {
  background: rgba(30, 111, 255, 0.15);
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-item-menu {
  position: relative;
  flex-shrink: 0;
}

.sidebar-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
}

.sidebar-item-wrap:hover .sidebar-menu-btn,
.sidebar-menu-btn:focus {
  opacity: 1;
}

.sidebar-menu-btn:hover {
  background: rgba(30, 111, 255, 0.15);
  color: var(--accent-soft);
}

.sidebar-dropdown {
  left: 0;
  right: auto;
}

.sidebar-footer {
  padding: 12px 16px 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.sidebar-new-folder {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--accent-soft);
  text-decoration: none;
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: 1px dashed rgba(30, 111, 255, 0.4);
}

.sidebar-new-folder:hover {
  background: rgba(30, 111, 255, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.dashboard-main {
  flex: 1;
  min-width: 0;
}

/* Analysis list (refined card layout) */
.analysis-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analysis-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 20px;
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.analysis-card:hover {
  border-color: rgba(30, 111, 255, 0.5);
  box-shadow: 0 4px 20px rgba(30, 111, 255, 0.08);
}

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

.analysis-card .analysis-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.analysis-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.analysis-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-code);
}

.analysis-metrics {
  display: flex;
  gap: 14px;
}

.metric {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-code);
}

.metric-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.metric-green { background: var(--color-accent-green); box-shadow: 0 0 6px var(--color-accent-green); }
.metric-blue { background: var(--accent-primary); box-shadow: 0 0 6px var(--accent-primary); }
.metric-yellow { background: var(--color-accent-yellow); box-shadow: 0 0 6px var(--color-accent-yellow); }

.analysis-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn-ghost {
  background: transparent !important;
  border-color: transparent !important;
}

.btn-ghost:hover {
  background: rgba(30, 111, 255, 0.12) !important;
  border-color: rgba(30, 111, 255, 0.3) !important;
}

@media (max-width: 900px) {
  .dashboard-layout { flex-direction: column; }
  .dashboard-sidebar {
    width: 100%;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
  }
  .sidebar-header { display: none; }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
    gap: 8px;
  }
  .sidebar-item-wrap {
    margin: 0;
    display: flex;
    align-items: center;
  }
  .sidebar-item-wrap .sidebar-item { margin: 0; }
  .sidebar-item {
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(0,0,0,0.2);
    margin: 0;
  }
  .sidebar-item.active,
  .sidebar-item-wrap.active .sidebar-item { background: rgba(30, 111, 255, 0.25); }
  .sidebar-footer { border-top: none; padding: 0; margin: 0; width: 100%; }
  .sidebar-new-folder { justify-content: center; width: 100%; }
}

/* ── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  isolation: isolate;
  pointer-events: auto;
}

.navbar a { pointer-events: auto; }

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-decoration: none;
}

.navbar-logo {
  display: block;
  height: 55px;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(30, 111, 255, 0.4));
}

.navbar-links { display: flex; gap: 8px; margin-left: 16px; }

.nav-link {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
  letter-spacing: 1px;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.nav-link.active {
  color: var(--accent-primary);
  background: rgba(30, 111, 255, 0.12);
}

.navbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(30, 111, 255, 0.15);
  border: 1px solid rgba(30, 111, 255, 0.3);
  color: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-body);
}

.user-name { font-size: 12px; color: var(--text-primary); }
.user-team { font-size: 10px; color: var(--text-muted); font-family: var(--font-code); }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  border-color: var(--color-accent-red);
  color: var(--color-accent-red);
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-primary);
  color: var(--text-primary);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary:hover {
  box-shadow: var(--glow-primary);
  transform: scale(1.02);
  color: var(--text-primary);
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.btn-full { width: 100%; justify-content: center; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-glow);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-secondary:hover {
  box-shadow: var(--glow-border);
  border-color: var(--accent-glow);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 51, 85, 0.1);
  color: var(--color-accent-red);
  border: 1px solid rgba(255, 51, 85, 0.3);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: rgba(255, 51, 85, 0.2);
}

.btn-success {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 229, 160, 0.15);
  color: #00e5a0;
  border: 1px solid rgba(0, 229, 160, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}
.btn-success:hover { background: rgba(0, 229, 160, 0.25); }

.btn-warning {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 209, 102, 0.15);
  color: #ffd166;
  border: 1px solid rgba(255, 209, 102, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}
.btn-warning:hover { background: rgba(255, 209, 102, 0.25); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-ghost svg { flex-shrink: 0; }
.btn-ghost:hover { color: var(--accent-soft); border-color: var(--border); }

.btn-sm { padding: 8px 14px; font-size: 12px; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.form-optional { color: var(--text-muted); font-size: 10px; font-weight: 400; }

.form-hint { color: var(--text-muted); font-size: 11px; margin-top: 6px; line-height: 1.4; }
.form-hint-success { color: var(--accent-success, #00e5a0); }
.form-hint-error { color: var(--accent-red, #ff6b6b); }

.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

.form-input-with-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}
.form-input-with-toggle .form-input {
  flex: 1;
  padding-right: 44px;
}
.form-input-with-toggle .form-toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-input-with-toggle .form-toggle-password:hover {
  color: var(--accent-primary);
}

.form-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-code);
  font-size: 13px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(30, 111, 255, 0.2);
}

/* ── Toast Notifications ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast-container:empty { display: none; }

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(13, 21, 48, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-message {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast-success {
  border-left: 3px solid var(--color-accent-green);
}

.toast-success .toast-message { color: var(--text-primary); }

.toast-error {
  border-left: 3px solid var(--color-accent-red);
}

.toast-error .toast-message { color: var(--text-primary); }

.toast-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* ── Auth Pages ─────────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 64px);
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
}

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo { margin-bottom: 16px; }
.auth-logo img {
  display: block;
  margin: 0 auto;
  max-width: 360px;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(30, 111, 255, 0.3));
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.auth-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: var(--font-body);
}

.auth-form { display: flex; flex-direction: column; gap: 20px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 12px; color: var(--text-muted); }
.auth-link { color: var(--accent-primary); font-weight: 600; }
.auth-link:hover { color: var(--accent-glow); }

/* ── Page Header ────────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.page-title { font-family: var(--font-heading); font-size: 24px; font-weight: 700; color: var(--text-primary); letter-spacing: 0.5px; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 4px; font-family: var(--font-body); }

.team-badge {
  display: inline-block;
  background: rgba(30, 111, 255, 0.15);
  border: 1px solid rgba(30, 111, 255, 0.3);
  color: var(--accent-soft);
  font-size: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* ── Dashboard Layout (Sidebar + Main) ───────────────────────────────────────── */
.dashboard-layout {
  display: flex;
  gap: 0;
  min-height: 0;
  align-items: stretch;
}
.dashboard-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: rgba(13, 21, 48, 0.6);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dashboard-sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 0 20px 12px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.dashboard-sidebar .folder-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin: 0 8px;
  border-radius: var(--radius-sm);
}
.dashboard-sidebar .folder-nav-item:hover {
  background: rgba(30, 111, 255, 0.08);
  color: var(--text-primary);
}
.dashboard-sidebar .folder-nav-item.active {
  background: rgba(30, 111, 255, 0.12);
  color: var(--accent-soft);
  border-left-color: var(--accent-primary);
  font-weight: 600;
}
.dashboard-sidebar .folder-nav-item .folder-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
}
.dashboard-sidebar .folder-nav-item.active .folder-icon { opacity: 1; }
.dashboard-sidebar .folder-nav-item .folder-count {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--font-code);
  color: var(--text-muted);
}
.dashboard-sidebar .folder-nav-item.active .folder-count { color: var(--accent-soft); }
.dashboard-sidebar .folder-nav-item-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.dashboard-sidebar .folder-nav-item-wrap .folder-menu-btn {
  margin-left: auto;
  opacity: 0;
  transition: var(--transition);
}
.dashboard-sidebar .folder-nav-item-wrap:hover .folder-menu-btn { opacity: 1; }
.dashboard-sidebar-add {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.dashboard-sidebar-add .btn-secondary {
  width: calc(100% - 40px);
  margin: 0 20px;
  justify-content: center;
}
.dashboard-main {
  flex: 1;
  min-width: 0;
  padding: 0 0 0 32px;
}

/* ── Stats Bar ───────────────────────────────────────────────────────────────── */
.stats-bar { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }

.stat-card {
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  flex: 1;
  min-width: 140px;
}

.stat-number { font-family: var(--font-heading); font-size: 28px; font-weight: 700; color: var(--accent-primary); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.5px; }

/* ── Section Header ─────────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-family: var(--font-heading); font-size: 14px; font-weight: 700; color: var(--text-primary); letter-spacing: 0.5px; }
.section-count { font-size: 11px; font-family: var(--font-code); color: var(--text-muted); }

/* ── Cards (Analysis, Folder, Tips) ──────────────────────────────────────────── */
.analyses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.analysis-card {
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition);
}

.analysis-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px rgba(30, 111, 255, 0.15);
}

.analysis-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.analysis-title { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.4; font-family: var(--font-body); }
.analysis-date { font-size: 10px; color: var(--text-muted); font-family: var(--font-code); white-space: nowrap; }
.analysis-stats { display: flex; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.analysis-stat { display: flex; align-items: center; gap: 5px; font-size: 11px; font-family: var(--font-code); color: var(--text-muted); letter-spacing: 0.5px; }
.stat-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.stat-green { background: var(--color-accent-green); box-shadow: 0 0 6px var(--color-accent-green); }
.stat-blue { background: var(--accent-primary); box-shadow: 0 0 6px var(--accent-primary); }
.stat-yellow { background: var(--color-accent-yellow); box-shadow: 0 0 6px var(--color-accent-yellow); }
.analysis-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.folder-card {
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
}

.folder-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px rgba(30, 111, 255, 0.15);
}

.folder-card-all {
  text-decoration: none;
  color: inherit;
}

.folder-card-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-card-link {
  flex: 1;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.folder-card-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.folder-card-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.folder-card-menu-btn:hover {
  background: rgba(30, 111, 255, 0.15);
  color: var(--accent-soft);
}

.folder-card-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 120px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 100;
  padding: 4px 0;
}

.folder-card-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.folder-card-dropdown-item:hover {
  background: rgba(30, 111, 255, 0.1);
  color: var(--accent-soft);
}

.folder-card-dropdown-danger:hover {
  background: rgba(255, 51, 85, 0.15);
  color: var(--color-accent-red);
}

.folder-delete-form { margin: 0; }

/* ── Empty State ─────────────────────────────────────────────────────────────── */
.status-banner {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid;
}
.status-banner.status-pending {
  background: rgba(255, 209, 102, 0.12);
  border-color: rgba(255, 209, 102, 0.4);
  color: var(--accent-yellow, #ffd166);
}
.status-banner.status-suspended {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.4);
  color: var(--accent-red, #ff6b6b);
}

.empty-state { text-align: center; padding: 80px 20px; }
.empty-state-icon { margin-bottom: 16px; color: var(--text-muted); }
.empty-state-title { font-family: var(--font-heading); font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; letter-spacing: 0.5px; }
.empty-state-text { color: var(--text-muted); margin-bottom: 24px; font-size: 13px; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 40px;
  padding: 0 18px;
  background: rgba(30, 111, 255, 0.08);
  border: 1px solid rgba(30, 111, 255, 0.4);
  border-radius: var(--radius-sm);
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: var(--transition);
  text-decoration: none;
}

.pagination-btn:hover {
  background: rgba(30, 111, 255, 0.18);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 14px rgba(30, 111, 255, 0.25);
}

.pagination-info {
  font-size: 12px;
  font-family: var(--font-code);
  color: var(--text-muted);
  padding: 0 8px;
}

/* ── Analyze Page ───────────────────────────────────────────────────────────── */
.analyze-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }

@media (max-width: 768px) { .analyze-layout { grid-template-columns: 1fr; } }

.editor-card {
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.editor-dots { display: flex; gap: 6px; }
.dot-red { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.dot-yellow { width: 10px; height: 10px; border-radius: 50%; background: #febc2e; }
.dot-green { width: 10px; height: 10px; border-radius: 50%; background: #28c840; }
.editor-label { font-size: 10px; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; }
.char-count { margin-left: auto; font-size: 10px; color: var(--text-muted); font-family: var(--font-code); }

.editor-textarea {
  width: 100%;
  min-height: 380px;
  background: var(--bg-secondary);
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.8;
  padding: 20px;
  resize: vertical;
  caret-color: var(--accent-primary);
}

.editor-textarea::placeholder { color: var(--text-muted); opacity: 0.7; }

.analyze-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.btn-generate { flex: 1; min-width: 200px; padding: 14px 24px; }

.tips-card {
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.tips-title { font-family: var(--font-heading); font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; letter-spacing: 0.5px; }
.tips-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tips-list li { font-size: 12px; color: var(--text-secondary); padding-left: 16px; position: relative; line-height: 1.5; }
.tips-list li::before { content: '→'; position: absolute; left: 0; color: var(--accent-primary); }

kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: var(--font-code);
  color: var(--accent-glow);
}

.tips-text { font-size: 12px; color: var(--text-secondary); }

/* ── Loading ─────────────────────────────────────────────────────────────────── */
.loading-card {
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: loadingCardEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes loadingCardEnter {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Full overlay when shown — animation appears while waiting */
.loading-card.loading-card-visible {
  position: fixed !important;
  inset: 0;
  z-index: 9999;
  display: flex !important;
  align-items: center;
  justify-content: center;
  max-width: none;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

/* Fade out before redirect — animation disappears smoothly */
.loading-card.loading-card-done {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.loading-scene {
  width: 100%;
  height: 220px;
  min-height: 180px;
  background: #0a0f1e;
  position: relative;
}

.loading-content {
  padding: 24px 32px 32px;
  text-align: center;
}

.loading-spinner {
  width: 52px;
  height: 52px;
  border: 2px solid var(--border);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(30, 111, 255, 0.4); }
  50% { box-shadow: 0 0 20px 4px rgba(30, 111, 255, 0.2); }
}

.loading-title { font-family: var(--font-heading); font-size: 14px; font-weight: 700; color: var(--text-secondary); margin-bottom: 20px; letter-spacing: 0.5px; }
.loading-bar-wrap { max-width: 360px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin: 0 auto 12px; }
.loading-bar { height: 100%; background: var(--accent-primary); border-radius: 2px; width: 8%; transition: width 0.5s ease; }
.loading-step { font-size: 11px; color: var(--text-muted); font-family: var(--font-code); margin-bottom: 16px; }
.loading-note { font-size: 12px; color: var(--text-muted); }

/* Full overlay when animation is shown (Execute Analysis) */
.loading-card.loading-card-visible {
  position: fixed !important;
  inset: 0;
  z-index: 9999;
  display: flex !important;
  align-items: center;
  justify-content: center;
  max-width: none;
  border-radius: 0;
}
.loading-card.loading-card-visible .loader-shell {
  max-width: 900px;
}
/* Fade out before redirect when result is ready */
.loading-card.loading-card-done {
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

/* ── FlowAI Loader (Jira Analysis) ───────────────────────────────────────────── */
.flow-loader-wrap .loader-shell {
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: auto auto auto auto;
  gap: 12px;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 24px;
}

.flow-loader-wrap .flow-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(82, 160, 255, 0.15);
}

.flow-loader-wrap .flow-brand { display: none; }
.flow-loader-wrap .flow-brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #52a0ff, #00e5c0);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.flow-loader-wrap .flow-brand-text {
  font-family: 'Syne', 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
}
.flow-loader-wrap .flow-brand-text span { color: #52a0ff; }

.flow-loader-wrap .flow-header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
}

.flow-loader-wrap .flow-dot-live {
  width: 6px; height: 6px;
  background: #00e5c0;
  border-radius: 50%;
  animation: flowBlink 1.2s ease-in-out infinite;
  box-shadow: 0 0 8px #00e5c0;
}
@keyframes flowBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.flow-loader-wrap .flow-canvas-wrap {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  background: #0d1628;
  border: 1px solid rgba(82, 160, 255, 0.15);
  border-radius: 10px;
  overflow: hidden;
  height: 320px;
}
.flow-loader-wrap .flow-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.flow-loader-wrap .flow-canvas-overlay-tl {
  position: absolute; top: 12px; left: 12px;
  font-size: 9px; letter-spacing: 0.2em;
  color: rgba(82, 160, 255, 0.5);
  text-transform: uppercase;
}
.flow-loader-wrap .flow-canvas-overlay-br {
  position: absolute; bottom: 12px; right: 12px;
  font-size: 9px; letter-spacing: 0.12em;
  color: rgba(0, 229, 192, 0.5);
  text-transform: uppercase;
}

.flow-loader-wrap .flow-side-panel {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-loader-wrap .flow-card {
  background: #0d1628;
  border: 1px solid rgba(82, 160, 255, 0.15);
  border-radius: 8px;
  padding: 12px 14px;
}

.flow-loader-wrap .flow-card-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.flow-loader-wrap .flow-task-count { display: flex; align-items: baseline; gap: 6px; }
.flow-loader-wrap .flow-count-num {
  font-family: 'Syne', 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: #52a0ff;
  text-shadow: 0 0 16px rgba(82, 160, 255, 0.4);
}
.flow-loader-wrap .flow-count-unit { font-size: 10px; color: rgba(255, 255, 255, 0.35); }

.flow-loader-wrap .flow-phase-list { display: flex; flex-direction: column; gap: 6px; }
.flow-loader-wrap .flow-phase-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.3s;
}
.flow-loader-wrap .flow-phase-item.done { color: #00e5c0; }
.flow-loader-wrap .flow-phase-item.active { color: rgba(255, 255, 255, 0.9); }
.flow-loader-wrap .flow-phase-icon {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px;
  flex-shrink: 0;
}
.flow-loader-wrap .flow-phase-item.done .flow-phase-icon {
  background: #00e5c0;
  border-color: #00e5c0;
  color: #000;
}
.flow-loader-wrap .flow-phase-item.active .flow-phase-icon {
  border-color: #52a0ff;
  color: #52a0ff;
  animation: flowSpin 1.5s linear infinite;
}
@keyframes flowSpin { to { transform: rotate(360deg); } }

.flow-loader-wrap .flow-output-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.flow-loader-wrap .flow-tag {
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(82, 160, 255, 0.15);
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  transition: all 0.4s;
}
.flow-loader-wrap .flow-tag.lit {
  border-color: #52a0ff;
  color: #52a0ff;
  background: rgba(82, 160, 255, 0.08);
  box-shadow: 0 0 8px rgba(82, 160, 255, 0.2);
}

.flow-loader-wrap .flow-bottom-bar {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  gap: 16px;
}

.flow-loader-wrap .flow-main-progress { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.flow-loader-wrap .flow-progress-header { display: flex; justify-content: space-between; align-items: baseline; }
.flow-loader-wrap .flow-progress-stage { font-size: 11px; color: rgba(255,255,255,0.9); letter-spacing: 0.05em; }
.flow-loader-wrap .flow-progress-pct { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px; color: #52a0ff; }
.flow-loader-wrap .flow-track {
  height: 3px;
  background: rgba(82, 160, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.flow-loader-wrap .flow-fill {
  height: 100%;
  background: linear-gradient(90deg, #52a0ff, #00e5c0);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(82, 160, 255, 0.35);
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.flow-loader-wrap .flow-eta-block { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 70px; }
.flow-loader-wrap .flow-eta-label { font-size: 9px; letter-spacing: 0.2em; color: rgba(255,255,255,0.35); text-transform: uppercase; }
.flow-loader-wrap .flow-eta-val { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 20px; color: #ff8c42; }

.flow-loader-wrap .flow-log-container {
  grid-column: 1 / -1;
  grid-row: 4;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(82, 160, 255, 0.12);
  border-radius: 8px;
  padding: 10px 16px;
  height: 64px;
  overflow: hidden;
  position: relative;
}
.flow-loader-wrap .flow-log-title {
  position: absolute;
  top: -7px; left: 14px;
  font-size: 8px;
  letter-spacing: 0.25em;
  background: #0a0f1e;
  padding: 0 6px;
  color: rgba(82, 160, 255, 0.4);
}
.flow-loader-wrap .flow-output-preview { flex: 1; }

@media (max-width: 700px) {
  .flow-loader-wrap .loader-shell { grid-template-columns: 1fr; }
  .flow-loader-wrap .flow-side-panel { grid-row: 3; }
  .flow-loader-wrap .flow-bottom-bar { grid-row: 4; }
  .flow-loader-wrap .flow-log-container { grid-row: 5; }
}

/* ── Result Page ─────────────────────────────────────────────────────────────── */
.result-container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

.result-sticky-bar {
  position: sticky;
  top: 64px;
  z-index: 50;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.back-link { font-size: 11px; color: var(--text-muted); font-family: var(--font-body); letter-spacing: 0.5px; text-decoration: none; }
.back-link:hover { color: var(--accent-primary); }
.result-bar-sep { color: var(--text-muted); font-size: 12px; }
.result-bar-title { font-family: var(--font-heading); font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: 0.5px; flex: 1; min-width: 200px; }
.result-bar-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.result-bar-actions { display: flex; gap: 10px; }
.result-stat { display: flex; align-items: center; gap: 5px; font-size: 11px; font-family: var(--font-code); color: var(--text-muted); letter-spacing: 0.5px; }

.result-preview-section { margin-top: 16px; }

.dashboard-frame-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.frame-toolbar { padding: 10px 16px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
.dashboard-frame {
  width: 100%;
  height: calc(100vh - 180px);
  min-height: 500px;
  border: none;
  display: block;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dashboard-frame-wrapper:fullscreen,
.dashboard-frame-wrapper::-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-radius: 0;
}

.dashboard-frame-wrapper:fullscreen .dashboard-frame,
.dashboard-frame-wrapper::-webkit-full-screen .dashboard-frame {
  flex: 1;
  height: 100%;
}

body.dashboard-fullscreen .result-preview-section {
  position: fixed;
  inset: 0;
  z-index: 9999;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

body.dashboard-fullscreen .result-preview-section .dashboard-frame { flex: 1; height: 100%; }

/* ── Profile & Admin ────────────────────────────────────────────────────────── */
.profile-layout { display: grid; gap: 24px; max-width: 520px; }

.profile-card {
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
}

.profile-section-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

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

.admin-page .page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }

.admin-table-wrap {
  background: rgba(13, 21, 48, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: 24px;
}

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th,
.admin-table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
}

.admin-table td { font-size: 13px; color: var(--text-secondary); }
.admin-table tbody tr:hover { background: rgba(30, 111, 255, 0.04); }

.status-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.status-toggle-form {
  display: inline-block;
}

/* Toggle switch (track + thumb) */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: var(--bg-tertiary);
  transition: background 0.9s ease-in-out, border-color 0.9 ease-in-out, border-width 0.9s ease-in-out;
}
.toggle-switch .toggle-thumb {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 2px;
}
.toggle-switch.toggle-inactive { border: 2px solid #fff; background: #f5f3ef; }
.toggle-switch.toggle-inactive .toggle-thumb { transform: translateX(0); }
.toggle-switch.toggle-active {
  background: var(--accent-primary);
}
.toggle-switch.toggle-active .toggle-thumb { transform: translateX(20px); }
.toggle-switch:hover { opacity: 0.9; }

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.admin-action-form {
  display: inline-block;
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.role-member { background: rgba(61, 155, 255, 0.2); color: var(--accent-glow); }
.role-admin { background: rgba(30, 111, 255, 0.2); color: var(--accent-primary); }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-pending { background: rgba(255, 209, 102, 0.2); color: #ffd166; }
.status-active { background: rgba(0, 229, 160, 0.2); color: #00e5a0; }
.status-inactive { background: rgba(255, 107, 107, 0.2); color: #ff6b6b; }

.user-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.user-dropdown-trigger:hover { background: var(--bg-secondary); color: var(--accent-soft); }

/* Admin Settings dropdown (Profile, Users, AI) */
.admin-settings-wrap { position: relative; }
.admin-settings-trigger {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: var(--transition);
}
.admin-settings-trigger:hover {
  border-color: var(--accent-primary);
  color: var(--accent-soft);
}
.admin-settings-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 140px;
  background: rgba(13, 21, 48, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 6px 0;
  z-index: 100;
}
.admin-settings-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  transition: var(--transition);
}
.admin-settings-item:hover { background: rgba(30, 111, 255, 0.1); color: var(--accent-soft); }
.admin-settings-item.active { color: var(--accent-primary); background: rgba(30, 111, 255, 0.12); }
.admin-settings-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  background: var(--color-accent-amber, #f59e0b);
  color: #000;
  border-radius: 9px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Folder Modal ───────────────────────────────────────────────────────────── */
.folder-modal {
  background: rgba(13, 21, 48, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.folder-modal-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

.folder-form { display: flex; flex-direction: column; gap: 16px; }

/* ── Error Page ─────────────────────────────────────────────────────────────── */
.error-page { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 64px); padding: 40px 20px; }
.error-card { text-align: center; max-width: 520px; }
.error-code { font-family: var(--font-code); font-size: 96px; font-weight: 700; color: var(--color-accent-red); opacity: 0.3; line-height: 1; margin-bottom: 16px; }
.error-title { font-family: var(--font-heading); font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.error-message { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.error-actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 32px; flex-wrap: wrap; }
.error-stack {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: left;
  font-size: 11px;
  font-family: var(--font-code);
  color: var(--color-accent-red);
  overflow: auto;
  max-height: 300px;
}

/* ── Footer / Watermark ─────────────────────────────────────────────────────── */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 5px;
  padding: 24px 16px;
  margin-top: auto;
}

.app-footer-copyright {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.app-footer-link {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
  text-decoration: none;
  transition: var(--transition);
}
.app-footer-link:hover { color: var(--accent-primary); }

.app-footer-watermark {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.app-footer-watermark .ergasti-brand {
  color: var(--accent-primary);
  font-weight: 600;
  transition: var(--transition);
}

.app-footer-watermark .ergasti-brand:hover {
  color: var(--accent-glow);
  text-shadow: 0 0 12px rgba(61, 155, 255, 0.5);
}

/* Code blocks (for report iframe and inline) */
pre, code {
  font-family: var(--font-code);
  background: var(--bg-secondary);
  color: var(--accent-glow);
}

pre {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
}

/* ── Confirm Modal (Themed popup) ───────────────────────────────────────────── */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.confirm-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(13, 21, 48, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 24px rgba(30, 111, 255, 0.1);
}

.confirm-modal-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.confirm-modal-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-modal-cancel { min-width: 90px; }
.confirm-modal-confirm { min-width: 90px; }

/* Move/Copy modal */
.move-copy-actions { flex-wrap: wrap; gap: 12px; }
.move-copy-actions .btn-primary { order: -1; }

/* Rename folder modal */
.rename-folder-form .form-group { margin-bottom: 20px; }

/* Folder name real-time validation */
.folder-name-field { position: relative; }
.folder-name-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}
.folder-name-input-wrap .form-input {
  flex: 1;
  padding-right: 44px;
}
.folder-name-status {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.folder-name-status:not(.valid):not(.invalid) { opacity: 0; }
.folder-name-status.valid {
  color: var(--color-accent-green);
  opacity: 1;
}
.folder-name-status.valid svg { width: 20px; height: 20px; }
.folder-name-status.invalid {
  color: var(--color-accent-red);
  opacity: 1;
}
.folder-name-status.invalid svg { width: 20px; height: 20px; }
.folder-name-hint,
.folder-name-error {
  font-size: 12px;
  color: var(--color-accent-red);
  margin-top: 4px;
}
.folder-name-hint[hidden],
.folder-name-error[hidden] { display: none; }

/* Drag and drop feedback */
.sidebar-drop-target.drop-over { background: rgba(30, 111, 255, 0.2); border-radius: var(--radius-sm); }
.draggable-analysis { cursor: grab; }
.draggable-analysis.dragging { opacity: 0.5; cursor: grabbing; }

/* Tooltip base (for future tooltips) */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  z-index: 100;
  margin-bottom: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Responsive ────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .toast-container {
    left: 16px;
    right: 16px;
    top: 16px;
    max-width: none;
  }
  .main-content { padding: 16px 16px 100px; }
  .navbar-links { flex-wrap: wrap; }
  .page-header { flex-direction: column; }
  .result-sticky-bar { flex-direction: column; align-items: flex-start; }
  .dashboard-frame { height: 500px; }
  .stats-bar { gap: 10px; }
  .analyze-actions { flex-direction: column; }
  .btn-generate { min-width: unset; }
  .form-row { grid-template-columns: 1fr; }
}
