/* ============================================================
   Nexus v1.0 — Thème Violet Identity
   Style : identité violet-rose homogène, fonts lisibles, responsive
   ============================================================ */

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

:root {
  /* ---- Palette signature : Graphite + Ambre (mode clair par défaut) ---- */
  --primary:       #D98A1E;   /* ambre — accent principal / marque */
  --primary-dark:  #B5731A;   /* ambre hover plus foncé */
  --primary-light: #E8A94D;
  --mid:           #C98A2E;
  --accent:        #D98A1E;   /* l'ambre reste l'accent de marque */
  --accent-dark:   #B5731A;
  --pink:          #f5576c;   /* conservé pour couleur métier projet */
  --blue:          #4facfe;   /* info */
  --green:         #2ecc71;   /* succès */
  --teal:          #1abc9c;
  --orange:        #e67e22;
  --red:           #e74c3c;   /* alerte */
  --danger:        #e74c3c;   /* alias sémantique alerte (utilisé inline) */

  /* ---- Gradients (ambre) ---- */
  --gradient-primary: linear-gradient(135deg, #D98A1E, #E8A94D);
  --gradient-accent:  linear-gradient(135deg, #E8A94D, #D98A1E);
  --gradient-success: linear-gradient(135deg, #2ecc71, #27ae60);
  --gradient-warning: linear-gradient(135deg, #e67e22, #D98A1E);

  /* ---- Glass (graphite neutre) ---- */
  --glass-bg:      rgba(255, 255, 255, 0.55);
  --glass-border:  rgba(120, 116, 108, 0.25);
  --glass-shadow:  0 1px 4px rgba(40, 38, 34, 0.06), 0 4px 16px rgba(40, 38, 34, 0.05);
  --glass-blur:    blur(14px);

  /* ---- Surfaces — Graphite clair ---- */
  --bg-page:       #e9e7e3;
  --card-bg:       #ffffff;
  --card-border:   #d9d6cf;
  --card-shadow:   0 1px 3px rgba(40, 38, 34, 0.06), 0 2px 8px rgba(40, 38, 34, 0.05);
  --sidebar-bg:    #ffffff;
  --sidebar-border: #d9d6cf;
  --text:          #2b2a27;
  --text-secondary:#5c5a54;
  --text-muted:    #8a857b;

  /* ---- Dimensions ---- */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --shell-topbar-h: 48px;
  --shell-bottom-h: 52px;
  --shell-rail-w:  280px;
  --sidebar-w:  240px;
  --topbar-h:   0px;

  /* ---- Animation ---- */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 18px; } /* base augmentee pour lisibilite */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--shell-rail-w);
  grid-template-rows: var(--shell-topbar-h) 1fr var(--shell-bottom-h);
  height: 100vh;
  overflow: hidden;
}

/* ===== SHELL TOP BAR (Zone 1 · KPIs + thème + notifs + actions) ===== */
.shell-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 1rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  z-index: 30;
  position: relative;
  overflow: visible;
}
.shell-topbar .topbar-brand {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--primary);
  white-space: nowrap;
  margin-right: 0.6rem;
  flex-shrink: 0;
}
.shell-topbar .topbar-kpi {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.68rem;
  padding: 0.08rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.02);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
  border: 1px solid transparent;
}
.shell-topbar .topbar-kpi:hover { background: rgba(0,0,0,0.05); border-color: var(--card-border); }
.shell-topbar .topbar-kpi .kpi-num { font-weight: 700; color: var(--text); }
.shell-topbar .topbar-kpi .kpi-lbl { color: var(--text-muted); font-size: 0.62rem; }
.shell-topbar .topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

/* ===== SHELL BOTTOM BAR (Zone 2 · Chat Atlas persistant) ===== */
.shell-bottom {
  grid-column: 1 / -1;
  grid-row: 3;
  background: var(--card-bg);
  border-top: 1px solid var(--card-border);
  z-index: 25;
  display: flex;
  align-items: center;
}
.shell-bottom-chat {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 1rem;
}
.shell-bottom-msgs {
  display: none;
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.62rem;
  padding: 0.2rem 0.4rem;
  background: rgba(0,0,0,0.02);
  border-radius: 4px;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}
.shell-bottom-chat.expanded .shell-bottom-msgs { display: block; }
.shell-bottom-input {
  flex: 1;
  display: flex;
  gap: 0.3rem;
  align-items: center;
}
.shell-bottom-input input {
  flex: 1;
  font-size: 0.7rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--text);
}
.shell-bottom-input button {
  white-space: nowrap;
  font-size: 0.7rem;
  padding: 0.3rem 0.7rem;
}
.shell-bottom .bottom-toggle-msgs {
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  cursor: pointer;
  color: var(--text-muted);
  border: none;
  background: none;
}
/* Desktop: history visible above bottom bar */
@media(min-width: 769px) {
  .shell-bottom { position: relative; }
  .shell-bottom-msgs { display: block; }
  .shell-bottom .bottom-toggle-msgs { display: none; }
}

/* ===== SHELL RIGHT RAIL (Zone 3 · Console + Activité live) ===== */
.shell-rightrail {
  grid-column: 3;
  grid-row: 2;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--card-border);
  overflow-y: auto;
  padding: 0.8rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 15;
  transition: var(--transition);
}
.shell-rightrail h3 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.shell-rightrail .rail-section {
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}
.shell-rightrail .rail-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}
.shell-rightrail .rail-btn-grid button {
  font-size: 0.62rem;
  padding: 0.25rem 0.3rem;
  white-space: nowrap;
}
.rail-activity-item {
  font-size: 0.58rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  line-height: 1.35;
}
.rail-activity-item .act-from { font-weight: 600; color: var(--primary); }
.rail-activity-item .act-time { font-size: 0.5rem; color: var(--text-muted); }
/* Toggle button for rail (mobile) */
.rail-toggle-btn {
  display: none;
  position: fixed;
  right: 0.5rem;
  bottom: 70px;
  z-index: 500;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.rail-overlay { display: none; position: fixed; inset: 0; z-index: 480; background: rgba(0,0,0,0.3); }
.shell-rightrail.mobile-open { left: auto; right: 0; }

/* ===== SIDEBAR ===== */
.sidebar {
  grid-column: 1;
  grid-row: 2;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--sidebar-border);
  padding: 1.2rem 0.7rem;
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  margin-bottom: 1.4rem;
}
.sidebar .logo .icon {
  width: 2.2rem;
  height: 2.2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.sidebar .logo .txt { font-weight: 650; font-size: 1.05rem; letter-spacing: -0.01em; }
.sidebar .logo .sub { font-size: 0.62rem; color: var(--text-muted); margin-top: -1px; }

/* Navigation */
.sidebar nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }

.sidebar .nav-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0.7rem 0.6rem 0.35rem;
  font-weight: 600;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 480;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar nav a:hover {
  background: rgba(217, 138, 30, 0.08);
  color: var(--primary);
}
.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(217,138,30,0.15), rgba(232,169,77,0.10));
  color: var(--primary-dark);
  font-weight: 580;
}
.sidebar nav a .emoji {
  width: 1.3rem;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* User info in sidebar */
.sidebar .user-card {
  padding: 0.7rem;
  margin-top: auto;
  border-top: 1px solid rgba(160,130,200,0.15);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar .user-card:hover { background: rgba(217,138,30,0.06); }
.sidebar .user-card .avatar {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar .user-card .info { flex: 1; min-width: 0; }
.sidebar .user-card .name { font-size: 0.78rem; font-weight: 600; }
.sidebar .user-card .role { font-size: 0.64rem; color: var(--text-muted); }

/* ===== MAIN CONTENT ===== */
.main-content {
  grid-column: 2;
  grid-row: 2;
  padding: 1.4rem 1.8rem;
  overflow-y: auto;
  min-height: 0;
  max-width: 100%;
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.page-header h1 {
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-header .subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}
.page-header .actions {
  display: flex;
  gap: 0.45rem;
}

/* ===== GLASS CARD ===== */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}
.glass-card:hover {
  box-shadow: 0 4px 16px rgba(40, 38, 34, 0.10);
}

/* ===== WIDGETS GRID ===== */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.4rem;
}

.widget {
  composes: glass-card;
  padding: 1.15rem;
  position: relative;
  overflow: hidden;
}
.widget .icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}
.widget .value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.widget .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}
.widget .trend {
  font-size: 0.68rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.widget .trend.up { color: var(--green); }
.widget .trend.down { color: var(--red); }

/* ===== CARDS ===== */
.card {
  composes: glass-card;
  padding: 1.2rem;
  margin-bottom: 1.1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
}
.card h2 {
  font-size: 0.9rem;
  font-weight: 650;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(160,130,200,0.12);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
}
.card h2 .badge {
  margin-left: auto;
  font-size: 0.62rem;
  padding: 0.06rem 0.5rem;
  border-radius: 20px;
  font-weight: 500;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.15rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 560;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.3s;
}
.btn:hover::after { opacity: 1; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 2px 12px rgba(217, 138, 30, 0.25);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(217, 138, 30, 0.4); }

.btn-accent {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
}
.btn-success {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  color: white;
}
.btn-danger {
  background: linear-gradient(135deg, #f5576c, #fa709a);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover {
  background: rgba(217, 138, 30, 0.06);
  color: var(--text);
}

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.74rem; }
.btn-lg { padding: 0.6rem 1.5rem; font-size: 0.9rem; }

/* Pulse animation for action buttons */
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(217,138,30,0.25); }
  50% { box-shadow: 0 4px 24px rgba(217,138,30,0.5); }
}
.btn-cta {
  animation: btnPulse 2s infinite;
}

/* ===== FORM ELEMENTS ===== */
input, textarea, select,
.input-field {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  width: 100%;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus,
.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 138, 30, 0.12);
}
input::placeholder, textarea::placeholder,
.input-field::placeholder { color: var(--text-muted); }

select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239a8aaa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.2rem;
}

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
thead th {
  text-align: left;
  padding: 0.55rem 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(160,130,200,0.1);
}
tbody td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid rgba(160,130,200,0.06);
  vertical-align: middle;
}
tbody tr:hover td { background: rgba(217, 138, 30, 0.03); }
tbody tr:last-child td { border-bottom: none; }

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.64rem;
  padding: 0.1rem 0.55rem;
  border-radius: 20px;
  font-weight: 540;
  gap: 0.22rem;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-primary { background: rgba(217,138,30,0.12); color: var(--primary); }
.badge-success { background: rgba(79,172,254,0.12); color: #4facfe; }
.badge-warning { background: rgba(240,147,251,0.12); color: #c026d3; }
.badge-danger  { background: rgba(245,87,108,0.12); color: var(--red); }
.badge-muted   { background: rgba(120,100,160,0.1); color: var(--text-secondary); }

/* ===== TAB SYSTEM ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(160,130,200,0.12);
  margin-bottom: 1.1rem;
}
.tab {
  padding: 0.5rem 1.15rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 560;
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }

/* ===== TAB BAR (alt) ===== */
.tab-bar { display: flex; gap: 0.3rem; border-bottom: 1px solid rgba(160,130,200,0.12); margin-bottom: 0.85rem; }
.tab-btn {
  padding: 0.35rem 0.9rem; font-size: 0.76rem; font-weight: 500;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 620; }

/* ===== HEALTH BARS ===== */
.health-bar {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.3rem 0; font-size: 0.72rem;
}
.health-bar .bar-track {
  flex: 1; height: 7px; background: rgba(160,130,200,0.12); border-radius: 4px; overflow: hidden;
}
.health-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #2ecc71, #4facfe);
  transition: width 0.5s ease;
}
.health-fill.warning { background: linear-gradient(90deg, var(--orange), var(--primary-light)); }
.health-fill.danger { background: linear-gradient(90deg, #e74c3c, #f5576c); }

/* ===== PROJECT ITEMS ===== */
.proj-badge {
  width: 2rem; height: 2rem; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; flex-shrink: 0; color: white;
}
.proj-info { flex: 1; min-width: 0; }
.proj-name { font-size: 0.82rem; font-weight: 620; }
.proj-desc { font-size: 0.68rem; color: var(--text-secondary); line-height: 1.35; }

/* ===== CMD+K PALETTE ===== */
.cmd-palette {
  position: fixed; top: 20%; left: 50%; transform: translateX(-50%);
  width: 520px; max-width: 92vw; z-index: 10000;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(24px);
  border: 1px solid var(--card-border); border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(40, 38, 34, 0.25); overflow: hidden;
}
.cmd-input {
  width: 100%; padding: 0.8rem 1rem; border: none; border-bottom: 1px solid rgba(160,130,200,0.1);
  font-size: 0.9rem; outline: none; background: transparent;
}
.cmd-results { max-height: 320px; overflow-y: auto; }
.cmd-item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 1rem; font-size: 0.78rem; cursor: pointer;
  transition: background 0.1s;
}
.cmd-item:hover, .cmd-item.selected { background: rgba(217,138,30,0.08); }
.cmd-item .cmd-shortcut {
  margin-left: auto; font-size: 0.64rem; color: var(--text-muted);
  background: rgba(160,130,200,0.1); padding: 0.1rem 0.35rem; border-radius: 4px;
}

/* ===== SETTINGS ===== */
.settings-section {
  margin-bottom: 1.3rem; padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(160,130,200,0.1);
}
.settings-section h3 { font-size: 0.8rem; font-weight: 640; margin-bottom: 0.55rem; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.35rem 0; font-size: 0.78rem;
}
.settings-row .label { color: var(--text-secondary); }
.settings-row .value { font-weight: 500; }

.color-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 0.35rem; }
.color-swatch {
  width: 100%; aspect-ratio: 1; border-radius: var(--radius-sm);
  cursor: pointer; border: 2px solid transparent; transition: var(--transition);
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(217,138,30,0.2); }

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

/* ===== LOGIN PAGE (conservée à l'identique) ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--primary-light) 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute;
  width: 650px; height: 650px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  top: -200px; right: -200px; border-radius: 50%;
}
.login-page::after {
  content: ''; position: absolute;
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  bottom: -100px; left: -100px; border-radius: 50%;
}
.login-box {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 400px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  position: relative;
  z-index: 1;
}
.login-box .logo { text-align: center; margin-bottom: 1.5rem; }
.login-box .logo .icon {
  width: 3.5rem; height: 3.5rem;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 0.6rem;
}
.login-box .logo h1 { color: white; font-size: 1.3rem; font-weight: 700; }
.login-box .logo p { color: rgba(255,255,255,0.6); font-size: 0.75rem; }
.login-box label { color: rgba(255,255,255,0.8); font-size: 0.75rem;
  font-weight: 500; display: block; margin-bottom: 0.3rem; }
.login-box input, .login-box .input-field {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: white; margin-bottom: 0.8rem;
}
.login-box input::placeholder { color: rgba(255,255,255,0.4); }
.login-box input:focus { border-color: rgba(255,255,255,0.5);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.1); }
.login-box .btn {
  width: 100%; justify-content: center;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.3);
  color: white; padding: 0.7rem; font-size: 0.85rem;
}
.login-box .btn:hover { background: rgba(255,255,255,0.3); }
.login-box .error { color: #ff6b6b; font-size: 0.7rem; margin-top: 0.4rem; text-align: center; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn 0.25s ease both; }
.animate-slide-up { animation: slideUp 0.3s ease both; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(160,130,200,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(160,130,200,0.3); }

/* ===== HAMBURGER MENU (mobile) ===== */
.hamburger {
  display: none; position: fixed; top: 0.6rem; left: 0.6rem; z-index: 500;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9); border: 1px solid var(--card-border);
  cursor: pointer; font-size: 1.3rem; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(40,38,34,0.10);
  transition: all 0.2s;
}
.hamburger:hover { background: white; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(45,20,70,0.3); backdrop-filter: blur(3px);
}

/* ===== RESPONSIVE ===== */
/* Tablet (≤1024px): sidebar compact, 2-col grid */
@media(max-width: 1024px) {
  .main-content { padding: 1.2rem; }
  .widget-grid { grid-template-columns: 1fr 1fr; gap: 0.8rem; }
  .sidebar { width: 220px; }
  .sidebar .logo .txt { font-size: 0.85rem; }
  .sidebar .logo .sub { font-size: 0.6rem; }
  .metrics-grid { grid-template-columns: 1fr; }
  .card { padding: 0.9rem; }
  .card h2 { font-size: 0.8rem; margin-bottom: 0.5rem; }
  .page-header h1 { font-size: 1.1rem; }
  .terminal-box { min-height: 240px; max-height: 380px; }
  .explorer-wrap { height: 380px; flex-direction: column; }
  .explorer-sidebar { width: 100%; max-height: 120px; }
  .modal-box { width: 90vw; max-width: 500px; padding: 1rem; }
}

/* Mobile (<768px): sidebar hidden → hamburger slide-in, 1-col */
@media(max-width: 768px) {
  html { font-size: 16px; }

  /* Hamburger */
  .hamburger { display: flex; }

  /* Sidebar: overlay slide-in */
  .sidebar {
    position: fixed; top: 0; left: -280px; bottom: 0; z-index: 450;
    width: 260px; height: 100vh;
    transition: left 0.3s ease;
    padding: 3.8rem 0.8rem 0.8rem;
    background: rgba(255,255,255,0.97); backdrop-filter: blur(20px);
    box-shadow: 4px 0 30px rgba(40,38,34,0.20);
    overflow-y: auto;
    flex-direction: column;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }
  
  /* Right rail: hidden by default, slide-in on toggle */
  .shell-rightrail {
    position: fixed; top: var(--shell-topbar-h); right: -300px; bottom: var(--shell-bottom-h);
    width: 280px; z-index: 460;
    transition: right 0.3s ease;
    box-shadow: -2px 0 12px rgba(0,0,0,0.1);
  }
  .rail-toggle-btn { display: flex; align-items: center; justify-content: center; }
  .rail-overlay.open { display: block; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { grid-column: auto; grid-row: auto; }
  .main-content { grid-column: 1; grid-row: 2 / 4; }
  .shell-rightrail { grid-column: auto; grid-row: auto; }
  
  /* User card visible in mobile sidebar */
  .sidebar .user-card { display: flex; }
  
  /* Layout */
  .app-layout { display: block; }
  .main-content { padding: 0.8rem; margin-top: 0.5rem; }
  .shell-topbar { padding: 0.15rem 0.5rem; gap: 0.2rem; overflow-x: auto; }
  .shell-topbar .topbar-brand { font-size: 0.68rem; }
  .shell-topbar .topbar-kpi { font-size: 0.6rem; padding: 0.05rem 0.25rem; }
  .shell-bottom-chat { padding: 0.15rem 0.4rem; }
  .shell-bottom-msgs { max-height: 120px; }
  .shell-bottom-input input { font-size: 0.65rem; }
  
  /* Grids → 1 col */
  .widget-grid { grid-template-columns: 1fr; gap: 0.6rem; }
  .metrics-grid { grid-template-columns: 1fr; gap: 0.4rem; }
  
  /* Cards */
  .card { padding: 0.7rem; margin-bottom: 0.6rem; }
  .card h2 { font-size: 0.78rem; }
  .page-header h1 { font-size: 1rem; }
  .page-header .subtitle { font-size: 0.6rem; }
  
  /* Project banner */
  .project-banner { padding: 0.4rem 0.6rem; margin-bottom: 0.6rem; }
  
  /* Dashboard health bars */
  .health-bar { font-size: 0.65rem; }
  
  /* Agent feed */
  #agentFeed { grid-template-columns: 1fr !important; }
  #dashProjects { grid-template-columns: 1fr !important; }
  
  /* War Room */
  #panel-corp .page-header .actions { flex-direction: column; gap: 0.3rem; }
  
  /* Terminal */
  .terminal-box { min-height: 200px; max-height: 300px; padding: 0.6rem; font-size: 0.7rem; }
  
  /* Explorer */
  .explorer-wrap { height: auto; flex-direction: column; }
  .explorer-sidebar { width: 100%; max-height: 100px; }
  
  /* Kanban */
  .kanban-board { flex-direction: column; }
  .kanban-column { min-width: auto; max-width: none; }
  
  /* Roadmap */
  .roadmap-columns { grid-template-columns: 1fr; }
  .roadmap-col { min-width: 0; }
  .gantt-wrap { font-size: 0.64rem; }
  
  /* Modals */
  .modal-box { width: 95vw; max-width: 400px; padding: 0.8rem; max-height: 90vh; }
  
  /* Action dock */
  .action-dock { left: 0; padding: 0.3rem 0.5rem; gap: 0.2rem; }
  .dock-btn { padding: 0.3rem 0.5rem; font-size: 0.65rem; border-radius: 6px; }
  
  /* Quick actions */
  .quick-actions-panel { right: 0.3rem; top: 3.5rem; width: 170px; }
  
  /* Notifications */
  #notifDropdown { width: 95vw; right: 0; }
  
  /* Chat */
  .chat-panel { height: auto; }
  .chat-msgs { max-height: 250px; }
  
  /* Tables */
  .table-wrap { font-size: 0.65rem; }
  thead th, tbody td { padding: 0.35rem 0.4rem; }
  
  /* Toast */
  .toast { max-width: 90vw; font-size: 0.7rem; }
  
  /* Bug button smaller */
  .bug-btn { width: 40px; height: 40px; bottom: 45px; right: 12px; }
  
  /* Context menu */
  .context-menu { min-width: 150px; }
  .ctx-item { padding: 0.5rem 0.8rem; font-size: 0.74rem; } /* touch-friendly */
  
  /* Cmd+K */
  .palette-box { width: 95vw; }
  
  /* Form inputs full-width */
  input, textarea, select, .input-field { width: 100%; box-sizing: border-box; }
  
  /* Tab bar scrollable */
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }
}

/* Tablet landscape (768-1024px): 2-col, sidebar compact visible */
@media(min-width: 768px) and (max-width: 1024px) {
  .app-layout { grid-template-columns: 200px 1fr 220px; }
  .main-content { padding: 1rem 1.2rem; }
  .action-dock { left: 200px; }
}

/* Desktop (1024-1440px): 2-3 col grid */
@media(min-width: 1024px) and (max-width: 1440px) {
  .widget-grid { grid-template-columns: repeat(3, 1fr); }
  .main-content { padding: 1.4rem 2rem; }
}

/* ===== WIDE SCREEN (21:9 et au-delà) ===== */
@media(min-width: 1800px) {
  .main-content { padding: 2rem 3.5rem; }
  .widget-grid { grid-template-columns: repeat(4, 1fr); gap: 1.3rem; }
  .sidebar { width: 260px; }
}

@media(min-width: 2200px) {
  .main-content { padding: 2.2rem 5rem; }
  .widget-grid { grid-template-columns: repeat(5, 1fr); gap: 1.4rem; }
}

/* ===== DARK MODE — Graphite moyen ===== */
[data-theme='dark'], .dark {
  --bg-page: #3f4147;
  --card-bg: #4a4d54;
  --card-border: #565a62;
  --card-shadow: 0 2px 10px rgba(0,0,0,0.3);
  --sidebar-bg: #43464c;
  --sidebar-border: #565a62;
  --text: #ECEAE6;
  --text-secondary: #c5c2ba;
  --text-muted: #a8a59c;
  --primary: #F0B657;       /* ambre clair en sombre */
  --primary-dark: #D98A1E;
  --primary-light: #F5C97E;
  --accent: #F0B657;
  --accent-dark: #D98A1E;
  --glass-bg: rgba(74,77,84,0.55);
  --glass-border: rgba(120,124,132,0.3);
  --glass-blur: blur(14px);
}
[data-theme='dark'] body, .dark body { background: var(--bg-page); }
[data-theme='dark'] .sidebar, .dark .sidebar { background: var(--sidebar-bg); border-color: var(--sidebar-border); }
[data-theme='dark'] .card, .dark .card { background: var(--card-bg); border-color: var(--card-border); }
[data-theme='dark'] .nav-items a, .dark .nav-items a { color: var(--text-secondary); }
[data-theme='dark'] .nav-items a.active, .dark .nav-items a.active { background: rgba(240,182,87,0.18); color: var(--primary); }
[data-theme='dark'] .dock-btn, .dark .dock-btn { background: var(--card-bg); color: var(--text-secondary); }
[data-theme='dark'] .quick-actions-panel, .dark .quick-actions-panel { background: var(--card-bg); }
[data-theme='dark'] .qa-btn, .dark .qa-btn { background: var(--card-bg); color: var(--text-secondary); }
[data-theme='dark'] input, [data-theme='dark'] textarea, [data-theme='dark'] select, [data-theme='dark'] .input-field,
.dark input, .dark textarea, .dark select, .dark .input-field { background: rgba(63,65,71,0.7); color: var(--text); border-color: var(--card-border); }
[data-theme='dark'] .tabular-data thead th, .dark .tabular-data thead th { color: var(--text-secondary); border-color: var(--card-border); }
[data-theme='dark'] .tabular-data tbody td, .dark .tabular-data tbody td { border-color: var(--card-border); color: var(--text-secondary); }
[data-theme='dark'] .user-dropdown, .dark .user-dropdown { background: var(--card-bg); }
[data-theme='dark'] .user-dropdown-item, .dark .user-dropdown-item { color: var(--text-secondary); }
[data-theme='dark'] .modal-box, .dark .modal-box { background: var(--card-bg); color: var(--text); }
[data-theme='dark'] .modal-overlay, .dark .modal-overlay { background: rgba(0,0,0,0.55); }
[data-theme='dark'] .context-menu, .dark .context-menu { background: var(--card-bg); }
[data-theme='dark'] .ctx-item, .dark .ctx-item { color: var(--text-secondary); }
[data-theme='dark'] .notification-bell, .dark .notification-bell { background: var(--card-bg); }
[data-theme='dark'] #notifDropdown, .dark #notifDropdown { background: var(--card-bg); }
[data-theme='dark'] .project-banner, .dark .project-banner { background: rgba(240,182,87,0.15); }
[data-theme='dark'] .roadmap-card, .dark .roadmap-card { background: var(--card-bg); }
[data-theme='dark'] .kanban-column, .dark .kanban-column { background: rgba(63,65,71,0.5); }
[data-theme='dark'] .kanban-card, .dark .kanban-card { background: var(--card-bg); }
