/* ============================================
   MEDIASWIPE OS — Design System
   Spójny z mediaswipe.pl: ciemny, czerwień #E63946, wysoki kontrast
   ============================================ */

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

/* --- VARIABLES (identyczne z landing page) --- */
:root {
  --bg:           #08080d;
  --bg-2:         #0e0e16;
  --bg-3:         #14141e;
  --surface:      rgba(255,255,255,0.03);
  --surface-hover:rgba(255,255,255,0.06);
  --border:       rgba(255,255,255,0.08);
  --border-hover: rgba(230,57,70,0.45);

  --primary:      #E63946;
  --primary-dark: #c5303c;
  --primary-hover:#f04550;
  --primary-glow: rgba(230,57,70,0.25);
  --primary-glow-strong: rgba(230,57,70,0.5);
  --accent:       #ff6b6b;
  --accent-light: #ff9b9b;

  --success:      #10b981;
  --success-bg:   rgba(16,185,129,0.1);
  --warning:      #f59e0b;
  --warning-bg:   rgba(245,158,11,0.1);
  --danger:       #ef4444;
  --danger-bg:    rgba(239,68,68,0.1);
  --info:         #3b82f6;
  --info-bg:      rgba(59,130,246,0.1);

  --text:         #f0f0f5;
  --text-muted:   rgba(240,240,245,0.55);
  --text-dim:     rgba(240,240,245,0.28);

  --sidebar-w:    240px;
  --topbar-h:     64px;

  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
  --radius-xl:    24px;

  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --shadow:       0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg:    0 8px 64px rgba(0,0,0,0.6);
  --shadow-glow:  0 0 60px rgba(230,57,70,0.12);

  --transition:   0.2s cubic-bezier(0.4,0,0.2,1);
  --transition-s: 0.15s cubic-bezier(0.4,0,0.2,1);
}


/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  top: -20vh; left: 10vw;
  width: 80vw; height: 80vw;
  background: radial-gradient(circle, rgba(230,57,70,0.06) 0%, transparent 60%);
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ==========================================
   LOGIN SCREEN
   ========================================== */
.screen { width: 100%; min-height: 100vh; }
.screen.hidden { display: none !important; }

#screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(230,57,70,0.15) 0%, transparent 70%);
}
.login-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black, transparent);
}
.login-glow {
  position: absolute;
  top: -200px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(230,57,70,0.2) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
}

.login-container {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  padding: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  animation: fadeInUp 0.6s ease;
}
.login-logo {
  display: flex; align-items: center; gap: 14px;
}
.login-logo-img { height: 50px; width: auto; filter: drop-shadow(0 0 15px rgba(230,57,70,0.25)); }
.login-os-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px; font-weight: 700;
  padding: 4px 10px;
  background: var(--primary); color: white;
  border-radius: 6px; letter-spacing: 1px;
}
.login-card {
  width: 100%;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.login-header { margin-bottom: 28px; }
.login-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--accent); letter-spacing: 1px;
  margin-bottom: 8px;
}
.login-title {
  font-size: 26px; font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff 0%, #ff9b9b 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-sub { font-size: 13px; color: var(--text-muted); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-error {
  background: var(--danger-bg); border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 13px; color: var(--danger);
}

/* ==========================================
   APP SHELL — SIDEBAR + MAIN
   ========================================== */
#screen-app {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: rgba(12,12,16,0.4);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 100;
  transition: transform var(--transition);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-img { height: 28px; width: auto; }
.sidebar-os {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  background: var(--primary); color: white;
  border-radius: 4px; letter-spacing: 1px;
}
.sidebar-nav {
  flex: 1; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.sidebar-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; color: var(--text-dim);
  letter-spacing: 2px; text-transform: uppercase;
  padding: 14px 10px 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-s);
  cursor: pointer;
}
.sidebar-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.sidebar-link.active {
  background: rgba(230,57,70,0.12);
  color: var(--accent);
  border: 1px solid rgba(230,57,70,0.25);
}
.sidebar-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }
.sidebar-logout {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all var(--transition-s);
}
.sidebar-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  overflow-y: auto;
  background: transparent;
}
.view { display: none; }
.view.active { display: block; }

/* TOP BAR */
.topbar {
  height: var(--topbar-h);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(12,12,16,0.3);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title {
  font-size: 17px; font-weight: 700;
}
.topbar-subtitle { font-size: 12px; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ==========================================
   FORMS & INPUTS
   ========================================== */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted); letter-spacing: 0.3px;
}
.form-row { display: grid; gap: 14px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="url"],
textarea, select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition-s), box-shadow var(--transition-s);
  outline: none;
  appearance: none;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(230,57,70,0.5);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.1);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
select option { background: var(--bg-3); color: var(--text); }

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  transition: all var(--transition-s);
  cursor: pointer; white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--primary); color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 16px var(--primary-glow); }
.btn-secondary {
  background: var(--surface-hover); color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: rgba(230,57,70,0.08); }
.btn-ghost { background: none; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success { background: var(--success-bg); color: var(--success); border-color: rgba(16,185,129,0.3); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon-only { padding: 8px; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ==========================================
   GLASS CARDS
   ========================================== */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  transition: border-color var(--transition-s), box-shadow var(--transition-s);
}
.glass-card:hover {
  border-color: rgba(230,57,70,0.3);
  box-shadow: 0 0 24px rgba(230,57,70,0.06);
}

/* ==========================================
   BADGES / STATUS PILLS
   ========================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-audit    { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.badge-summary  { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-priorities { background: rgba(251,146,60,0.15); color: #fb923c; border: 1px solid rgba(251,146,60,0.3); }
.badge-implementation { background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.3); }
.badge-closed   { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-ongoing  { background: rgba(108,58,237,0.15); color: var(--accent); border: 1px solid rgba(108,58,237,0.3); }
.badge-support  { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }

/* TAG CHIPS (audit tags) */
.tags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-s);
  user-select: none;
}
.tag-chip.inactive {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
  color: var(--text-dim);
}
.tag-chip.inactive:hover { border-color: rgba(255,255,255,0.2); color: var(--text-muted); }
.tag-chip[data-tag="bottleneck"].active   { background: rgba(239,68,68,0.15);  color: #ef4444; border-color: rgba(239,68,68,0.4); }
.tag-chip[data-tag="repetitive"].active  { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: rgba(245,158,11,0.4); }
.tag-chip[data-tag="ai"].active          { background: rgba(108,58,237,0.2);  color: var(--accent); border-color: rgba(108,58,237,0.5); }
.tag-chip[data-tag="quickwin"].active    { background: rgba(16,185,129,0.15); color: #10b981; border-color: rgba(16,185,129,0.4); }
.tag-chip[data-tag="followup"].active    { background: rgba(59,130,246,0.15); color: #3b82f6; border-color: rgba(59,130,246,0.4); }

/* ==========================================
   DASHBOARD
   ========================================== */
.page-content { padding: 24px 28px; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px; font-weight: 800;
}
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all var(--transition-s);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(255, 255, 255, 0.01);
}
.stat-card:hover { 
  border-color: rgba(230,57,70,0.3); 
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 40px rgba(230,57,70,0.08); 
  transform: translateY(-2px);
}
.stat-value {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 0.5px; margin-top: 4px;
}

/* Filters bar */
.filters-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: none; cursor: pointer;
  transition: all var(--transition-s);
}
.filter-btn:hover { border-color: rgba(230,57,70,0.4); color: var(--text); }
.filter-btn.active { background: rgba(230,57,70,0.12); color: var(--accent); border-color: rgba(230,57,70,0.4); }

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Project Row (List View) */
.project-row {
  display: flex; align-items: center; gap: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative; overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.project-row:hover {
  border-color: rgba(230,57,70,0.3);
  transform: translateX(4px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3), 0 0 40px rgba(230,57,70,0.1);
}
.project-row::before {
  content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 3px;
  background: var(--card-color, var(--primary));
}
.pr-info { flex: 1; min-width: 200px; }
.pr-workflow { display: flex; align-items: center; flex: 2; min-width: 300px; justify-content: center; }
.wf-node { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; opacity: 0.3; transition: opacity 0.3s; }
.wf-node.active { opacity: 1; color: var(--accent); }
.wf-node span { font-size: 10px; font-family: var(--font-mono); letter-spacing: 0.5px; text-transform: uppercase; }
.wf-edge { height: 1px; width: 40px; background: rgba(255,255,255,0.08); margin-bottom: 14px;}
.wf-edge.active { background: var(--accent); opacity: 0.5; }
.pr-status { width: 140px; display: flex; justify-content: flex-end; }
.pr-meta { width: 100px; font-size: 12px; color: var(--text-muted); text-align: right; font-family: var(--font-mono); }

/* Project Card */
.project-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.project-card:hover {
  border-color: rgba(230,57,70,0.3);
  transform: translateY(-4px);
  box-shadow: 0 30px 60px rgba(0,0,0,0.4), 0 0 60px rgba(230,57,70,0.12);
}
.project-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-color, var(--primary));
}
.project-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
}
.project-initials {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--card-color, var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: white;
  flex-shrink: 0;
}
.project-name { font-size: 15px; font-weight: 700; line-height: 1.3; }
.project-industry {
  font-size: 11px; color: var(--text-muted); margin-top: 3px;
}
.project-progress { display: flex; flex-direction: column; gap: 6px; }
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width 0.5s ease;
}
.project-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-dim);
}
.project-assigned {
  display: flex; gap: 4px;
}
.assigned-avatar {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white;
}

/* Empty state */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; max-width: 320px; margin: 0 auto 20px; }

/* ==========================================
   PROJECT DETAIL VIEW
   ========================================== */
.project-detail-header {
  padding: 24px 28px;
  background: rgba(12,12,16,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  backdrop-filter: blur(16px);
}
.project-back {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-s);
}
.project-back:hover { color: var(--accent); }
.project-detail-name {
  font-size: 20px; font-weight: 800; flex: 1;
}
.project-detail-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* Stage progression */
.stages-progression {
  display: flex; align-items: center;
  padding: 16px 28px;
  background: rgba(10,10,20,0.4);
  border-bottom: 1px solid var(--border);
  gap: 0;
  overflow-x: auto;
}
.stage-item {
  display: flex; align-items: center; gap: 0;
  flex-shrink: 0;
}
.stage-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  transition: all var(--transition-s);
  white-space: nowrap;
}
.stage-btn:hover { border-color: var(--border-hover); color: var(--text-muted); }
.stage-btn.active {
  background: rgba(230,57,70,0.12);
  border-color: rgba(230,57,70,0.4);
  color: var(--accent);
}
.stage-btn.completed {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.3);
  color: var(--success);
}
.stage-num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800;
  flex-shrink: 0;
}
.stage-btn.active .stage-num { background: var(--primary); color: white; }
.stage-btn.completed .stage-num { background: var(--success); color: white; }
.stage-arrow {
  width: 28px; height: 1px;
  background: var(--border);
  position: relative;
}
.stage-arrow::after {
  content: '›';
  position: absolute; right: -5px; top: -9px;
  color: var(--border); font-size: 14px;
}

/* Project tabs */
.project-tabs {
  display: flex; gap: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,20,0.3);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  /* Hide scrollbar cross-browser */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.project-tabs::-webkit-scrollbar { display: none; }

/* Fade on right edge to hint at more tabs */
.project-tabs::after {
  content: '';
  position: sticky;
  right: 0;
  min-width: 40px;
  background: linear-gradient(to right, transparent, rgba(10,10,20,0.9));
  pointer-events: none;
}

.tab-btn {
  padding: 13px 14px;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-s);
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }


/* ==========================================
   AUDIT MODULE
   ========================================== */
.audit-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: calc(100vh - 220px);
}
.audit-main { padding: 24px 24px 24px 28px; overflow-y: auto; }
.audit-sidebar {
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: calc(100vh - 220px);
  position: sticky; top: 0;
}

/* Department cards */
.dept-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.dept-card {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color var(--transition-s);
}
.dept-card:hover { border-color: rgba(230,57,70,0.2); }
.dept-card.expanded {
  border-color: rgba(230,57,70,0.35);
  box-shadow: 0 0 32px rgba(230,57,70,0.06);
}
.dept-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition-s);
}
.dept-header:hover { background: var(--surface-hover); }
.dept-icon-wrap {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: rgba(230,57,70,0.1);
  border: 1px solid rgba(230,57,70,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(230,57,70,0.15), inset 0 0 8px rgba(230,57,70,0.05);
  transition: box-shadow var(--transition-s);
}
.dept-card.expanded .dept-icon-wrap {
  box-shadow: 0 0 20px rgba(230,57,70,0.25), inset 0 0 12px rgba(230,57,70,0.08);
}
.dept-icon-wrap i, .dept-icon-wrap .ph {
  font-size: 17px;
  color: var(--accent);
  display: block;
  line-height: 1;
}
.dept-info { flex: 1; min-width: 0; }
.dept-name { font-size: 14px; font-weight: 700; }
.dept-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.dept-score { display: flex; gap: 2px; }
.star-btn { font-size: 14px; cursor: pointer; transition: transform 0.1s; }
.star-btn:hover { transform: scale(1.2); }
.dept-chevron {
  font-size: 12px; color: var(--text-dim);
  transition: transform var(--transition-s);
}
.dept-card.expanded .dept-chevron { transform: rotate(180deg); }
.dept-completed-badge {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--success-bg);
  border: 1px solid rgba(16,185,129,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.dept-body { display: none; padding: 0 16px 16px; }
.dept-card.expanded .dept-body { display: block; }

/* Questions */
.questions-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.question-item {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}
.question-header {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px 8px;
}
.q-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--accent);
  font-weight: 700; padding-top: 2px;
  flex-shrink: 0;
}
.q-text { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.5; flex: 1; }
.q-delete {
  color: var(--text-dim); font-size: 13px; cursor: pointer;
  opacity: 0; transition: opacity var(--transition-s), color var(--transition-s);
  padding: 2px;
}
.question-item:hover .q-delete { opacity: 1; }
.q-delete:hover { color: var(--danger); }
.q-answer-wrap { padding: 0 14px 10px; }
.q-answer {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  resize: vertical; min-height: 60px;
  outline: none;
  transition: border-color var(--transition-s);
}
.q-answer:focus { border-color: rgba(230,57,70,0.4); box-shadow: 0 0 0 2px rgba(230,57,70,0.08); }
.q-tags { display: flex; gap: 5px; padding: 0 14px 12px; flex-wrap: wrap; }
.key-finding-btn {
  font-size: 11px; color: var(--text-dim);
  cursor: pointer; background: none; border: none;
  display: flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 4px;
  transition: all var(--transition-s);
}
.key-finding-btn:hover { color: var(--warning); }
.key-finding-btn.active { color: var(--warning); }

/* Dept notes */
.dept-notes-section { margin-top: 12px; }
.dept-notes-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 1px; margin-bottom: 6px;
}
.dept-notes-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  min-height: 90px;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-s);
}
.dept-notes-input:focus { border-color: rgba(230,57,70,0.4); box-shadow: 0 0 0 2px rgba(230,57,70,0.08); }

/* Add question */
.add-question-row {
  display: flex; gap: 8px; margin-top: 12px;
}

/* Recording */
.recording-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
}
.rec-indicator {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse-rec 1s infinite;
}
@keyframes pulse-rec {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.rec-time { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.rec-status { font-size: 12px; color: var(--text-muted); flex: 1; }

/* ==========================================
   AI PANEL (sidebar)
   ========================================== */
.ai-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.ai-panel-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(230,57,70,0.3);
  box-shadow: 0 0 15px rgba(230,57,70,0.1);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.ai-panel-title { font-size: 13px; font-weight: 700; }
.ai-panel-sub { font-size: 11px; color: var(--text-muted); }
.ai-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin-left: auto;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

.ai-context-label {
  padding: 8px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: rgba(108,58,237,0.05);
}

.ai-messages {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.ai-msg {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.6;
  max-width: 92%;
}
.ai-msg-user {
  background: rgba(230,57,70,0.12);
  border: 1px solid rgba(230,57,70,0.25);
  align-self: flex-end;
  color: var(--accent-light);
}
.ai-msg-assistant {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: var(--text);
}
.ai-msg-system {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  color: #6ee7b7;
  font-size: 11.5px;
  align-self: center;
  text-align: center;
}
.ai-typing {
  display: flex; gap: 4px; padding: 12px; align-self: flex-start;
}
.ai-typing span {
  width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
  animation: typing-dot 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.ai-input-area {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; flex-direction: column;
}
.ai-quick-btn {
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11px; font-weight: 600;
  background: rgba(230,57,70,0.08);
  border: 1px solid rgba(230,57,70,0.2);
  color: var(--accent);
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  transition: all var(--transition-s);
}
.ai-quick-btn:hover { background: rgba(230,57,70,0.15); }
.ai-input-row { display: flex; gap: 8px; }
.ai-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 12.5px;
  resize: none; min-height: 38px;
  outline: none;
  transition: border-color var(--transition-s);
}
.ai-input:focus { border-color: rgba(108,58,237,0.4); }
.ai-send-btn {
  width: 36px; height: 38px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(230,57,70,0.3);
  box-shadow: 0 0 15px rgba(230,57,70,0.1);
  color: var(--primary); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: all var(--transition-s);
}
.ai-send-btn:hover { background: rgba(230,57,70,0.1); box-shadow: 0 0 20px rgba(230,57,70,0.25); color: var(--accent); }

/* ==========================================
   TASKS / KANBAN
   ========================================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 20px 28px;
  align-items: start;
}
.kanban-col { display: flex; flex-direction: column; gap: 10px; }
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.col-todo    { background: rgba(107,114,128,0.12); color: #9ca3af; border: 1px solid rgba(107,114,128,0.2); }
.col-in-progress { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.col-review  { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.col-done    { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.col-count {
  width: 20px; height: 20px;
  border-radius: 50%; background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
}
.task-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-s);
  display: flex; flex-direction: column; gap: 8px;
}
.task-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.task-priority-dot {
  width: 7px; height: 7px;
  border-radius: 50%; flex-shrink: 0;
}
.priority-critical { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.priority-high     { background: var(--warning); }
.priority-normal   { background: var(--info); }
.priority-low      { background: var(--text-dim); }
.task-title { font-size: 13px; font-weight: 600; line-height: 1.4; }
.task-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-dim); }

/* Time tracker */
.time-tracker-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 28px;
  background: rgba(10,10,20,0.6);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.timer-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 700;
  color: var(--accent);
}

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; animation: fadeIn 0.2s ease forwards;
}
.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 800; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px; background: var(--surface);
  color: var(--text-muted); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition-s);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 280px; max-width: 360px;
  animation: toastIn 0.3s ease;
  font-size: 13.5px; font-weight: 500;
}
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast.info    { border-color: rgba(59,130,246,0.4); }
.toast.warning { border-color: rgba(245,158,11,0.4); }
.toast-icon { font-size: 16px; }
.toast-msg { flex: 1; }

/* ==========================================
   UTILITY & ANIMATIONS
   ========================================== */
.hidden { display: none !important; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-dark {
  border-color: rgba(108,58,237,0.2);
  border-top-color: var(--primary);
}
.divider {
  height: 1px; background: var(--border);
  margin: 4px 0;
}
.mono { font-family: 'JetBrains Mono', monospace; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ==========================================
   SUMMARY / REPORT VIEW
   ========================================== */
.report-section {
  padding: 24px 28px;
  max-width: 860px;
}
.report-section h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--accent);
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 16px;
}
.report-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.report-block h4 { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.report-block p { font-size: 13.5px; color: var(--text-muted); line-height: 1.7; }
.findings-list { display: flex; flex-direction: column; gap: 8px; }
.finding-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  font-size: 13px;
}
.finding-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 6px; flex-shrink: 0;
}

/* Maturity radar */
.maturity-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.maturity-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.maturity-label { font-size: 12px; font-weight: 600; }
.maturity-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.maturity-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.maturity-score { font-size: 11px; color: var(--text-muted); }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
  .audit-layout { grid-template-columns: 1fr; }
  .audit-sidebar { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 240px; }
  .sidebar.open { transform: translateX(0); --sidebar-w: 240px; }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .kanban-board { grid-template-columns: 1fr; padding: 14px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .stages-progression { gap: 4px; padding: 12px 16px; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

/* ==========================================
   PHOSPHOR ICONS � sizing & glow
   ========================================== */
i[class*="ph-"] {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  vertical-align: middle;
}
.sidebar-link i[class*="ph-"] { font-size: 16px; flex-shrink: 0; }
.tab-btn i[class*="ph-"] { font-size: 14px; }
.btn i[class*="ph-"] { font-size: 14px; }
.btn-sm i[class*="ph-"] { font-size: 13px; }
.dept-icon-wrap i[class*="ph-"] { font-size: 18px; color: var(--accent); }
.sidebar-logout i[class*="ph-"] { font-size: 14px; }

/* Dept actions row */
.dept-actions-row {
  display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center;
}

/* dept delete button */
.dept-delete-btn {
  padding: 4px 8px; border-radius: 6px;
  color: var(--text-dim); font-size: 12px;
  transition: all var(--transition-s);
  display: flex; align-items: center;
}
.dept-delete-btn:hover { background: var(--danger-bg); color: var(--danger); }

/* dept chevron */
.dept-chevron {
  font-size: 12px; color: var(--text-dim);
  transition: transform var(--transition);
  display: flex; align-items: center;
}
.dept-card.expanded .dept-chevron { transform: rotate(180deg); }

/* q-input (replacing inline style) */
.q-input {
  flex: 1; font-size: 13px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: rgba(255,255,255,0.04); color: var(--text); outline: none;
  transition: border-color var(--transition-s);
}
.q-input:focus { border-color: rgba(230,57,70,0.4); }

/* icon-picker-grid (modal icon picker) */
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px; margin-top: 8px;
}
.icon-pick {
  width: 100%;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-s);
  font-size: 20px;
}
.icon-pick i[class*="ph-"] { font-size: 22px; color: var(--text-muted); }
.icon-pick:hover, .icon-pick.selected {
  background: rgba(230,57,70,0.12);
  border-color: rgba(230,57,70,0.4);
  box-shadow: 0 0 12px rgba(230,57,70,0.2);
}
.icon-pick.selected i[class*="ph-"] { color: var(--accent); }

/* ai-context-label updated bg */
.ai-context-label { background: rgba(230,57,70,0.04); }

/* Star rating with ph-star */
.star-btn { font-size:14px; cursor:pointer; transition: transform 0.1s; display: inline-flex; align-items: center; }
.star-btn:hover { transform: scale(1.2); }
