:root {
  --bg: #f7f7fb;
  --panel: #ffffff;
  --line: #e8e8f2;
  --text: #1f2333;
  --muted: #6f7488;
  --primary: #5258d4;
  --primary-soft: #eef0ff;
  --danger: #c74c67;
  --success: #2f8f6b;
  --warning: #b98822;
  --shadow: 0 12px 32px rgba(38, 42, 82, 0.08);
  --radius: 20px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #fcfcff 0%, #f5f7fb 100%);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea {
  font: inherit;
}
button {
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 12px;
  padding: .8rem 1rem;
  cursor: pointer;
}
button.secondary { background: #edf0ff; color: #3a408c; }
button.danger { background: #ffe6ec; color: #a63754; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  width: 100%;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: .4rem; color: var(--muted); font-size: .92rem; }
hr { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.top-space { margin-top: 1rem; }
.danger-text { color: var(--danger); }
.full { grid-column: 1 / -1; }
.narrow { max-width: 860px; }
.empty-state { color: var(--muted); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(circle at top left, rgba(82,88,212,.15), transparent 30%),
    radial-gradient(circle at bottom right, rgba(61,186,152,.12), transparent 28%),
    linear-gradient(180deg, #fcfcff, #f4f7fb);
}
.login-card {
  width: min(100%, 460px);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  padding: 2rem;
  border-radius: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.7);
}
.eyebrow { color: var(--primary); font-weight: 700; letter-spacing: .03em; }
.stack-form { display: grid; gap: 1rem; margin-top: 1rem; }

.app-shell { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(16px);
  border-right: 1px solid rgba(231,233,243,.9);
  padding: 1.4rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: .9rem; padding-bottom: 1.2rem; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 18px;
  display: grid; place-items: center; font-size: 1.4rem;
  background: linear-gradient(145deg, #5258d4, #7d83ee); color: white;
  box-shadow: 0 12px 24px rgba(82,88,212,.25);
}
.nav-links { display: grid; gap: .45rem; }
.nav-links a {
  padding: .85rem 1rem; border-radius: 14px; color: var(--text); font-weight: 600;
}
.nav-links a:hover { background: var(--primary-soft); color: var(--primary); }
.content { padding: 1.6rem; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; }
.topbar h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.4rem); }
.searchbar { display: flex; gap: .6rem; width: min(100%, 430px); }
.flash-stack { display: grid; gap: .7rem; margin-bottom: 1rem; }
.flash {
  padding: .9rem 1rem; border-radius: 14px; border: 1px solid transparent;
}
.flash-success { background: #ecfbf4; color: #1e6f4d; border-color: #c8f0dc; }
.flash-error { background: #fff0f4; color: #9b3450; border-color: #ffd5e0; }
.panel, .record-card, .stat-card {
  background: var(--panel); border: 1px solid rgba(232,232,242,.95); box-shadow: var(--shadow); border-radius: var(--radius);
}
.panel { padding: 1.2rem; margin-bottom: 1.2rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.stats-grid, .cards-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 1.2rem; }
.stat-card { padding: 1rem 1.1rem; }
.stat-card span { display: block; color: var(--muted); margin-bottom: .5rem; }
.stat-card strong { font-size: 2rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.task-row, .initiative-row, .alert-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid #f0f1f7;
}
.task-row:last-child, .initiative-row:last-child { border-bottom: 0; }
.alert-row { align-items: flex-start; }
.task-row-side { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.kanban-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.kanban-col { background: #fafaff; border: 1px solid #ececff; border-radius: 18px; padding: .8rem; }
.kanban-col h3 { margin-top: 0; }
.kanban-card { background: white; border: 1px solid #ededf7; padding: .85rem; border-radius: 16px; margin-bottom: .7rem; }
.kanban-actions { display: flex; gap: .5rem; margin-top: .7rem; }
.record-card { padding: 0; overflow: hidden; }
.record-card summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem;
}
.record-card summary::-webkit-details-marker { display: none; }
.body-pad { padding: 0 1.1rem 1.1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .95rem; }
.inline-filters, .action-row, .inline-form { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; padding: .38rem .72rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
}
.status-a-faire { background: #edf2ff; color: #4250b7; }
.status-en-cours { background: #fff2de; color: #99641c; }
.status-en-relecture { background: #f3ebff; color: #7b43c1; }
.status-terminee { background: #e9fbf3; color: #1c7b58; }
.status-archivee { background: #eef0f5; color: #566074; }
.init-a-cadrer { background: #eef2ff; color: #4150b4; }
.init-en-cours { background: #fff1db; color: #996316; }
.init-veille { background: #eef8ff; color: #296f95; }
.init-bloque { background: #ffe9ef; color: #ab3d5e; }
.init-terminee, .init-realise, .init-confirme { background: #e8fbf1; color: #217452; }
.init-prevu { background: #eef2ff; color: #4250b7; }
.init-annule { background: #f3f4f8; color: #606b7e; }
.priority-basse { background: #edf7f0; color: #35734a; }
.priority-moyenne { background: #fff4df; color: #9a6f21; }
.priority-haute { background: #ffe9da; color: #b0592d; }
.priority-critique { background: #ffe4ec; color: #a13558; }
.simple-result { padding: .8rem 0; border-bottom: 1px solid #f0f1f7; }
.checkbox-row { flex-direction: row; align-items: center; gap: .7rem; color: var(--text); }
.checkbox-row input { width: auto; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid rgba(231,233,243,.9); }
  .topbar { flex-direction: column; }
  .searchbar { width: 100%; }
}

@media (max-width: 640px) {
  .content { padding: 1rem; }
  .panel, .login-card { padding: 1rem; }
  .record-card summary, .task-row, .initiative-row { align-items: flex-start; flex-direction: column; }
  .task-row-side { justify-content: flex-start; }
  .inline-filters, .action-row, .inline-form, .searchbar { flex-direction: column; align-items: stretch; }
  button { width: 100%; }
}
