/* ============================================================
   FILE: /assets/css/app.css
   Archaeo System — Design System
   Dark UI · Electric Indigo Accent · Glass morphism
   ============================================================ */

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

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:        #080C14;
  --bg-surface:     #0E1420;
  --bg-elevated:    #141B2D;
  --bg-overlay:     #1A2235;
  --bg-hover:       #1E2940;

  /* Borders */
  --border:         rgba(255,255,255,0.07);
  --border-strong:  rgba(255,255,255,0.14);

  /* Accent — Electric Indigo */
  --accent:         #6366F1;
  --accent-hover:   #4F46E5;
  --accent-muted:   rgba(99,102,241,0.15);
  --accent-glow:    rgba(99,102,241,0.3);

  /* Teal secondary */
  --teal:           #0EA5E9;
  --teal-muted:     rgba(14,165,233,0.15);

  /* Text */
  --text-primary:   #F0F4FF;
  --text-secondary: #8B95A9;
  --text-muted:     #52617A;
  --text-inverse:   #0E1420;

  /* Status Colors */
  --green:          #10B981;
  --green-muted:    rgba(16,185,129,0.15);
  --yellow:         #F59E0B;
  --yellow-muted:   rgba(245,158,11,0.15);
  --red:            #EF4444;
  --red-muted:      rgba(239,68,68,0.15);
  --blue:           #3B82F6;
  --blue-muted:     rgba(59,130,246,0.15);
  --purple:         #A855F7;
  --purple-muted:   rgba(168,85,247,0.15);

  /* Spacing */
  --sidebar-width:  240px;
  --topbar-height:  64px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow:         0 4px 16px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-lg:      0 10px 40px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.4);
  --shadow-accent:  0 4px 24px rgba(99,102,241,0.35);

  /* Transitions */
  --transition:     0.18s ease;
  --transition-slow:0.35s ease;

  /* Fonts */
  --font-display:   'Syne', sans-serif;
  --font-body:      'DM Sans', sans-serif;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

input, select, textarea, button { font-family: var(--font-body); }

/* ─── Layout ────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  min-width: 0;
  transition: margin-left var(--transition-slow);
}

.main-content.sidebar-collapsed {
  margin-left: 64px;
}

.page-body {
  padding: 28px 32px;
  max-width: 1440px;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-slow);
  overflow-x: hidden;
}

.sidebar.collapsed { width: 64px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-height);
}

.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  color: white; flex-shrink: 0;
  font-family: var(--font-display);
}

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-slow);
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label { opacity: 0; width: 0; overflow: hidden; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.nav-section { margin-bottom: 8px; }
.nav-section-label {
  padding: 6px 16px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  transition: opacity var(--transition-slow);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}

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

.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-left: 2px solid var(--accent);
  margin-left: 6px;
  padding-left: 14px;
}

.nav-item .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.nav-label {
  transition: opacity var(--transition-slow);
  white-space: nowrap;
}

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

.sidebar-toggle-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.75rem;
}

.sidebar-toggle-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: rgba(8,12,20,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 90;
  transition: left var(--transition-slow);
}

.topbar.sidebar-collapsed { left: 64px; }

.topbar-left { display: flex; align-items: center; gap: 16px; }

.page-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--red);
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  cursor: pointer;
  border: 2px solid var(--border-strong);
  transition: border-color var(--transition);
}

.user-avatar:hover { border-color: var(--accent); }

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover { border-color: var(--border-strong); }

.card-glass {
  background: rgba(14,20,40,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ─── KPI Strip ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi-card:hover::before { opacity: 1; }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-body);
}

.btn:active { transform: translateY(0.5px); }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(99,102,241,0.45);
  color: white;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: var(--red-muted);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}

.btn-danger:hover { background: var(--red); color: white; transform: translateY(-1px); }

.btn-success {
  background: var(--green-muted);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.25);
}

.btn-success:hover { background: var(--green); color: white; }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 11px 28px; font-size: 0.95rem; }
.btn-icon { padding: 8px; }
.btn-ai {
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white;
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
}
.btn-ai:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(139,92,246,0.5); color: white; }

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B95A9' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 96px; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 0.75rem; color: var(--red); margin-top: 5px; }

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

/* ─── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  padding: 10px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-elevated); }
.table tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-green   { background: var(--green-muted);  color: var(--green); }
.badge-yellow  { background: var(--yellow-muted); color: var(--yellow); }
.badge-red     { background: var(--red-muted);    color: var(--red); }
.badge-blue    { background: var(--blue-muted);   color: var(--blue); }
.badge-purple  { background: var(--purple-muted); color: var(--purple); }
.badge-teal    { background: var(--teal-muted);   color: var(--teal); }
.badge-gray    { background: var(--bg-overlay);   color: var(--text-secondary); }
.badge-info    { background: rgba(99,102,241,0.15); color: var(--accent); }

/* ─── Progress Bar ───────────────────────────────────────────── */
.progress-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-overlay);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  transition: width 0.6s ease;
}

.progress-bar.green  { background: var(--green); }
.progress-bar.yellow { background: var(--yellow); }
.progress-bar.red    { background: var(--red); }

/* ─── Drawer / Slide-over ───────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.drawer-overlay.open { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 560px;
  max-width: 95vw;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer.open { transform: translateX(0); }

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

.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from { transform: scale(0.95) translateY(-10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ─── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  font-family: var(--font-body);
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

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

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 13px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 300px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toast-in 0.3s ease;
  border-left: 3px solid var(--accent);
}

@keyframes toast-in {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.toast-msg { font-size: 0.78rem; color: var(--text-secondary); }
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }

/* ─── Kanban Board ───────────────────────────────────────────── */
.kanban-wrap {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-col {
  min-width: 260px;
  max-width: 280px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-col-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.kanban-count {
  background: var(--bg-elevated);
  border-radius: 100px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.kanban-cards { padding: 10px; flex: 1; min-height: 100px; }

.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: all var(--transition);
  position: relative;
}

.kanban-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.kanban-card.sortable-ghost { opacity: 0.4; }
.kanban-card.sortable-chosen { cursor: grabbing; box-shadow: var(--shadow-lg); }

.kanban-card-name { font-size: 0.875rem; font-weight: 600; margin-bottom: 6px; }
.kanban-card-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── Gantt / Timeline ───────────────────────────────────────── */
.gantt-wrap {
  overflow-x: auto;
}

.gantt-grid {
  display: grid;
  min-width: 800px;
}

.gantt-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
}

.gantt-label {
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.gantt-weeks {
  position: relative;
  display: grid;
}

.gantt-bar {
  height: 24px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
}

.gantt-bar.completed { background: var(--green); }
.gantt-bar.at-risk   { background: var(--yellow); }
.gantt-bar.overdue   { background: var(--red); }

/* ─── Score Ring ─────────────────────────────────────────────── */
.score-ring {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  border: 3px solid;
  flex-shrink: 0;
}

.score-ring.high   { border-color: var(--green);  color: var(--green);  background: var(--green-muted); }
.score-ring.medium { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-muted); }
.score-ring.low    { border-color: var(--red);    color: var(--red);    background: var(--red-muted); }

/* ─── AI Panel ───────────────────────────────────────────────── */
.ai-panel {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.05));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius);
  padding: 20px;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ai-orb {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  animation: ai-pulse 3s ease-in-out infinite;
}

@keyframes ai-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
}

.ai-thinking {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 0;
}

.ai-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: ai-bounce 1.2s ease-in-out infinite;
}

.ai-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ─── Activity Feed ──────────────────────────────────────────── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.activity-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }
.activity-text strong { color: var(--text-primary); }
.activity-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
}

.page-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p  { font-size: 0.85rem; }

/* ─── Quick Actions ──────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Utility ────────────────────────────────────────────────── */
.text-muted    { color: var(--text-muted); }
.text-accent   { color: var(--accent); }
.text-green    { color: var(--green); }
.text-red      { color: var(--red); }
.text-yellow   { color: var(--yellow); }
.text-sm       { font-size: 0.82rem; }
.text-xs       { font-size: 0.72rem; }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.gap-16        { gap: 16px; }
.mb-4          { margin-bottom: 4px; }
.mb-8          { margin-bottom: 8px; }
.mb-12         { margin-bottom: 12px; }
.mb-16         { margin-bottom: 16px; }
.mb-24         { margin-bottom: 24px; }
.mt-auto       { margin-top: auto; }
.ml-auto       { margin-left: auto; }
.w-full        { width: 100%; }
.rounded       { border-radius: var(--radius-sm); }
.cursor-pointer { cursor: pointer; }
.overflow-hidden { overflow: hidden; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2        { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3        { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ─── Loading Spinner ────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ─── Divider ────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ─── Alert ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-info    { background: var(--accent-muted); border: 1px solid rgba(99,102,241,0.25); color: #A5B4FC; }
.alert-success { background: var(--green-muted);  border: 1px solid rgba(16,185,129,0.25); color: #6EE7B7; }
.alert-warning { background: var(--yellow-muted); border: 1px solid rgba(245,158,11,0.25); color: #FCD34D; }
.alert-danger  { background: var(--red-muted);    border: 1px solid rgba(239,68,68,0.25);  color: #FCA5A5; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .main-content, .main-content.sidebar-collapsed {
    margin-left: 0;
  }

  .topbar, .topbar.sidebar-collapsed { left: 0; }

  .page-body { padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kanban-wrap { gap: 10px; }
  .kanban-col { min-width: 240px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }

  .mobile-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 95;
  }
}

@media (min-width: 769px) {
  .mobile-bottom-nav { display: none; }
}
