:root {
  --cream: #f5eee3;
  --white: #fffdf9;
  --ink: #16283c;
  --ink-soft: #667480;
  --amber: #c97b1a;
  --amber-soft: rgba(201,123,26,0.12);
  --green: #216948;
  --green-soft: rgba(33,105,72,0.12);
  --blue: #1a5fa4;
  --blue-soft: rgba(26,95,164,0.12);
  --danger: #b64d3f;
  --border: #ddcdbb;
  --shadow: 0 18px 60px rgba(22,40,60,0.08);
}

* { box-sizing: border-box; }

html { scroll-padding-top: 82px; }

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
.wrap { width: min(1360px, calc(100% - 28px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(245,238,227,0.92);
  border-bottom: 1px solid rgba(221,205,187,0.86);
}

.topbar-inner, .hero-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar-inner { min-height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  position: relative;
}

.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 6px;
}

.brand-mark::before {
  width: 14px;
  height: 18px;
  left: 6px;
  top: 6px;
  background: var(--amber);
}

.brand-mark::after {
  width: 14px;
  height: 18px;
  right: 6px;
  top: 10px;
  background: rgba(255,255,255,0.64);
}

.brand-name {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.topnav { display: flex; gap: 8px; }

.topnav a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.topnav a.active, .topnav a:hover {
  background: rgba(22,40,60,0.06);
  color: var(--ink);
}

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

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.chip-subtle {
  padding: 7px 12px;
  background: rgba(255,255,255,0.34);
  border-color: rgba(221,205,187,0.7);
  font-size: 0.76rem;
  color: rgba(102,116,128,0.92);
}

.btn, .btn-light, .btn-ghost, .mini-btn, .btn-text {
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.btn:hover, .btn-light:hover, .btn-ghost:hover, .mini-btn:hover, .btn-text:hover {
  transform: translateY(-1px);
}

.btn:disabled, .btn-light:disabled, .btn-ghost:disabled, .mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
}

.btn {
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--white);
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(22,40,60,0.16);
}

.btn.loading { opacity: 0.76; cursor: wait; }

.btn-light {
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  color: var(--white);
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.18);
}

.btn-ghost, .mini-btn {
  padding: 10px 14px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  font-weight: 600;
}

.btn-discreet {
  padding: 9px 12px;
  font-size: 0.86rem;
}

.btn-text {
  padding: 0;
  background: transparent;
  color: rgba(255,255,255,0.82);
  font-weight: 700;
}

.btn-text:hover { color: var(--white); }

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 18%, rgba(201,123,26,0.28), transparent 32%),
    linear-gradient(135deg, var(--ink) 0%, #1d3552 58%, #264a6e 100%);
  color: var(--white);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.28;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.85fr);
  gap: 26px;
  align-items: center;
  padding: 54px 0 72px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.76);
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(201,123,26,0.16);
}

.hero h1 {
  margin: 0;
  max-width: 15ch;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero p {
  margin: 18px 0 0;
  max-width: 62ch;
  color: rgba(255,255,255,0.78);
  line-height: 1.7;
}

.hero-actions, .hero-notes, .meta, .tags, .source-filter-list, .toggle-row, .topline, .status-tools, .info-grid, .meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-actions { margin-top: 26px; }

.hero-secondary-link {
  display: inline-flex;
  margin-top: 14px;
  color: rgba(255,255,255,0.82);
  font-weight: 700;
}

.hero-secondary-link:hover { color: var(--white); }

.hero-notes {
  margin-top: 20px;
  color: rgba(255,255,255,0.74);
  font-size: 0.9rem;
}

.hero-panel {
  border-radius: 24px;
  padding: 24px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
}

.hero-panel .kicker {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.72);
}

.hero-panel h2 {
  margin: 10px 0 12px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.56rem;
  line-height: 1.15;
}

.hero-panel p { margin: 0; color: rgba(255,255,255,0.76); }

.mini-grid, .modal-grid, .profile-banner-grid, .suitability-grid, .resource-grid, .timeline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-banner-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-grid { margin-top: 18px; }

.mini-metric {
  border-radius: 18px;
  padding: 16px;
  background: rgba(255,255,255,0.08);
}

.mini-metric strong { display: block; font-size: 1.5rem; }

.mini-metric span {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
}

.content { margin-top: 0; padding: 24px 0 44px; }

.card, .signal-card, .source-card, .log-card, .profile-banner, .suitability-card, .resource-card, .auth-card {
  background: var(--white);
  border: 1px solid rgba(221,205,187,0.94);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.dashboard {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.card, .profile-banner, .resource-card, .auth-card { padding: 20px; }

.stack, .flow-stack, .signal-list, .logs, .resource-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fcf8f2;
  color: var(--ink);
  outline: none;
}

.status-tools {
  justify-content: flex-end;
  align-items: flex-start;
}

.status-select {
  width: auto;
  min-width: 168px;
  max-width: 100%;
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fcf8f2;
  color: var(--ink);
  font-weight: 600;
  outline: none;
}

.toggle, .source-pill {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.source-pill {
  border-radius: 14px;
  background: #faf4ec;
}

.source-pill.active {
  background: var(--amber-soft);
  border-color: rgba(201,123,26,0.25);
  color: #8a4f0a;
}

.flow-head, .signal-head, .source-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.flow-head { margin-bottom: 18px; }

.flow-head h2, .modal h2, .resource-hero h1, .auth-card h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.flow-head h2 { font-size: 1.6rem; }

.flow-head p, .modal p, .resource-card p, .auth-card p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.section-kicker {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.count {
  color: var(--ink-soft);
  font-size: 0.92rem;
  white-space: nowrap;
}

.signal-card {
  padding: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(252,248,242,0.98) 100%);
}

.signal-card.process {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,250,253,0.98) 100%);
}

.signal-card.unread { border-left: 4px solid var(--amber); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge.new { background: var(--amber-soft); color: #8a4f0a; }
.badge.source, .badge.offre { background: rgba(22,40,60,0.08); color: var(--ink); }
.badge.processus { background: var(--green-soft); color: var(--green); }
.badge.campagne { background: var(--blue-soft); color: var(--blue); }
.badge.high { background: var(--green-soft); color: var(--green); }
.badge.mid { background: rgba(22,40,60,0.07); color: var(--ink-soft); }
.badge.low { background: rgba(182,77,63,0.1); color: var(--danger); }

.topline { margin-bottom: 10px; }

.signal-title {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.35;
}

.meta, .tags { margin-top: 12px; }

.meta-item {
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(22,40,60,0.05);
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f0e7da;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

.desc {
  margin-top: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  font-size: 0.94rem;
}

.info-grid { margin-top: 14px; }

.info-pill {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(22,40,60,0.05);
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.5;
}

.signal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.empty {
  padding: 52px 24px;
  text-align: center;
  border-radius: 22px;
  border: 1px dashed rgba(221,205,187,1);
  background: rgba(255,255,255,0.5);
  color: var(--ink-soft);
}

.log-card { padding: 18px; }

.log-card strong {
  display: block;
  font-size: 0.92rem;
}

.log-card span, .log-card p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer {
  padding: 20px 0 48px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.footer-inner {
  flex-wrap: wrap;
  align-items: flex-start;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  font-weight: 700;
  color: var(--ink);
}

.footer-note {
  max-width: 52ch;
  line-height: 1.65;
}

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  background: var(--ink);
  color: var(--white);
  padding: 13px 18px;
  border-radius: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-bg {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  background: rgba(22,40,60,0.48);
  padding: 28px 24px;
  overflow-y: auto;
  z-index: 70;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 56px);
  padding: 26px;
  border-radius: 26px;
  background: var(--white);
  border: 1px solid rgba(221,205,187,0.95);
  box-shadow: 0 26px 80px rgba(22,40,60,0.25);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal.compact { width: min(460px, 100%); }
.full { grid-column: 1 / -1; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  position: sticky;
  bottom: 0;
  padding-top: 14px;
  background: linear-gradient(180deg, rgba(255,253,249,0) 0%, rgba(255,253,249,0.92) 24%, rgba(255,253,249,1) 100%);
}

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn-cta {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--amber);
  color: var(--white) !important;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.btn-cta:hover { transform: translateY(-1px); opacity: 0.9; }

.profile-banner {
  margin-bottom: 18px;
  display: block;
}

.profile-banner[hidden] { display: none; }

.profile-banner-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.profile-banner-head h2 {
  margin: 0;
  font-size: 1.12rem;
}

.profile-banner-head p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.profile-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.admin-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.suitability {
  margin-bottom: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 6px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.8rem;
}

.section-head p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
  max-width: 58ch;
}

.suitability-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.suitability-card {
  padding: 20px;
}

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #8a4f0a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.suitability-card h3 {
  margin: 14px 0 8px;
  font-size: 1.05rem;
}

.suitability-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.resource-link {
  display: inline-flex;
  margin-top: 14px;
  font-weight: 700;
  color: var(--ink);
}

.resource-hero {
  padding: 40px 0 22px;
}

.resource-hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.resource-hero p {
  max-width: 65ch;
  color: var(--ink-soft);
  line-height: 1.75;
  margin: 16px 0 0;
}

.resource-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}

.resource-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.resource-card ul, .timeline-card ul {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  line-height: 1.75;
}

.timeline-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.timeline-card {
  padding: 20px;
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(221,205,187,0.94);
  border-radius: 22px;
}

.timeline-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.auth-shell {
  padding: 40px 0 44px;
}

.auth-card {
  width: min(560px, 100%);
  margin: 0 auto;
}

.auth-card h1 {
  font-size: 2rem;
  line-height: 1.08;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .dashboard { grid-template-columns: 270px minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .topnav { display: none; }
  .hero-inner { grid-template-columns: 1fr; padding: 42px 0 58px; }
  .dashboard { grid-template-columns: 1fr; }
  .profile-banner-grid,
  .suitability-grid,
  .resource-grid,
  .timeline-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .wrap { width: min(100% - 20px, 1360px); }
  .topbar-inner { min-height: 0; padding: 14px 0; flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: space-between; }
  .mini-grid, .modal-grid, .profile-banner-grid { grid-template-columns: 1fr; }
  .flow-head, .signal-head, .footer-inner, .section-head { flex-direction: column; align-items: flex-start; }
  .status-tools { width: 100%; }
  .status-select, .status-tools .btn-ghost { width: 100%; }
  .modal-bg { padding: 12px; }
  .modal {
    width: 100%;
    max-height: calc(100vh - 24px);
    padding: 18px;
    border-radius: 20px;
  }
}
