:root {
  --bg: #fff8f1;
  --bg-2: #f7eefc;
  --panel: #ffffff;
  --text: #2f2437;
  --muted: #74677d;
  --line: #eaddea;
  --brand: #8a3b8f;
  --brand-dark: #6d2873;
  --brand-soft: #f6e8fb;
  --accent: #d97706;
  --accent-soft: #fff0d6;
  --teal: #0f766e;
  --teal-soft: #e2f7f4;
  --success: #0f766e;
  --warning: #b7791f;
  --danger: #b42318;
  --danger-soft: #fee2e2;
  --shadow: 0 14px 34px rgba(47, 36, 55, .10);
  --shadow-soft: 0 8px 22px rgba(47, 36, 55, .07);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 4%, rgba(217, 119, 6, .16), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(138, 59, 143, .18), transparent 30%),
    linear-gradient(180deg, #fff8f1 0%, #fbf7ff 48%, #f7fbfa 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(138, 59, 143, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 59, 143, .035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.75), transparent 70%);
}

a { color: var(--brand); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, #6d2873 0%, #8a3b8f 45%, #d97706 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .25);
  box-shadow: 0 10px 28px rgba(47, 36, 55, .18);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 28px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-weight: 900;
  letter-spacing: .04em;
  border: 1px solid rgba(255, 255, 255, .34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
}

.brand {
  font-size: 1.26rem;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: -.01em;
}

.brand:hover { text-decoration: none; color: #fff; }

.subtitle {
  display: block;
  color: rgba(255, 255, 255, .82);
  font-size: .85rem;
  margin-top: 2px;
}

nav {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a {
  padding: 9px 12px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .92);
  font-weight: 800;
  border: 1px solid transparent;
}

nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, .20);
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
  text-decoration: none;
}

nav a.logout-link {
  background: rgba(255, 255, 255, .12);
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 28px 42px;
  position: relative;
}

.hero {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96) 0%, rgba(246, 232, 251, .96) 52%, rgba(255, 240, 214, .96) 100%);
  border: 1px solid rgba(234, 221, 234, .95);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  right: -44px;
  top: -52px;
  width: 170px;
  height: 170px;
  border-radius: 999px;
  background: rgba(15, 118, 110, .12);
}

.hero > * { position: relative; z-index: 1; }
.hero.compact { padding: 22px 24px; }

h1, h2 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(1.65rem, 2vw, 2.15rem); letter-spacing: -.03em; }
h2 { font-size: 1.16rem; letter-spacing: -.015em; }

.hero p, .muted {
  color: var(--muted);
  margin: 8px 0 0;
}

.hero-actions,
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.card,
.panel {
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(234, 221, 234, .95);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.card {
  padding: 18px;
  position: relative;
  overflow: hidden;
  min-height: 120px;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--brand);
}

.card:nth-child(2)::before { background: var(--teal); }
.card:nth-child(3)::before { background: var(--accent); }
.card:nth-child(5)::before { background: #64748b; }
.card:nth-child(6)::before { background: #c026d3; }

.card .label {
  display: block;
  color: var(--muted);
  font-size: .84rem;
  margin-bottom: 8px;
  font-weight: 800;
}

.card strong {
  display: block;
  font-size: clamp(1.45rem, 2vw, 1.85rem);
  letter-spacing: -.03em;
}

.card.warning {
  background: linear-gradient(180deg, #fff8e8 0%, #fff 100%);
  border-color: #f4d38c;
}
.card.warning::before { background: var(--warning); }

.panel {
  padding: 18px;
  margin-bottom: 22px;
}

.panel.narrow {
  max-width: 520px;
  margin: 60px auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .94rem;
  overflow: hidden;
  border-radius: 14px;
}

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: linear-gradient(180deg, #fbf5ff 0%, #f7edf8 100%);
  color: #65456e;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 900;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(246, 232, 251, .42); }

.comments {
  max-width: 360px;
  color: #554b5f;
}

.right { text-align: right; }
.empty { color: var(--muted); text-align: center; padding: 28px; }

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 10px 15px;
  font-weight: 900;
  font-size: .92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(47, 36, 55, .06);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn:hover {
  background: var(--brand-soft);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(47, 36, 55, .11);
}

.btn.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-color: var(--brand);
  color: #fff;
}

.btn.primary:hover { background: linear-gradient(135deg, #963f9d 0%, #742a7b 100%); }

.btn.ghost {
  background: transparent;
  box-shadow: none;
}

.btn.small {
  padding: 7px 11px;
  font-size: .82rem;
}

.inline { display: inline; }

.pill {
  display: inline-flex;
  min-width: 38px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #edf2f7;
  font-weight: 900;
  color: #334155;
}

.pill.warning { background: #fff4d5; color: var(--warning); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px;
}

.filters input[type="search"] { flex: 1 1 360px; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(138, 59, 143, .55);
  box-shadow: 0 0 0 4px rgba(138, 59, 143, .11);
}

textarea { resize: vertical; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 800;
  color: #4b3d55;
}

.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }

.checkline {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  padding: 10px 0;
}

.checkline input { width: auto; }

.flash-stack { margin-bottom: 16px; }

.flash {
  border-radius: 16px;
  padding: 12px 14px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  box-shadow: var(--shadow-soft);
  font-weight: 700;
}

.flash.success {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.flash.error {
  background: #fef2f2;
  border-color: #fecaca;
}

.footer-note {
  max-width: 1320px;
  margin: -16px auto 28px;
  padding: 0 28px;
  color: var(--muted);
  font-size: .84rem;
  text-align: right;
}

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .topbar, .hero { flex-direction: column; align-items: flex-start; }
  nav { justify-content: flex-start; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2,
  .form-grid .span-3 { grid-column: span 1; }
  table.wide { min-width: 850px; }
  .panel { overflow-x: auto; }
}

@media (max-width: 640px) {
  .container { padding: 20px 14px 34px; }
  .topbar { padding: 13px 14px; }
  .cards { grid-template-columns: 1fr; }
  .hero { border-radius: 22px; padding: 20px; }
  .filters input[type="search"] { flex-basis: 100%; }
  nav a { padding: 8px 10px; }
}

@media print {
  body { background: #fff; }
  body::before, .topbar, .hero-actions, .actions, .filters, .footer-note { display: none !important; }
  .container { max-width: none; padding: 0; }
  .hero, .panel, .card { box-shadow: none; border: 1px solid #ccc; }
  a { color: #000; }
}

/* Logo La P'tite Maille dans l'entête du tableau de bord */
.dashboard-hero {
  align-items: center;
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.hero-logo {
  display: block;
  width: clamp(150px, 18vw, 230px);
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .72);
  border-radius: 18px;
  padding: 8px 12px;
  border: 1px solid rgba(234, 221, 234, .95);
  box-shadow: 0 8px 20px rgba(47, 36, 55, .08);
}

.hero-title-text {
  min-width: 0;
}

@media (max-width: 720px) {
  .hero-title-row {
    align-items: flex-start;
    gap: 14px;
  }

  .hero-logo {
    width: 128px;
    border-radius: 14px;
    padding: 7px 9px;
  }
}

@media print {
  .hero-title-row {
    display: flex !important;
  }

  .hero-logo {
    width: 150px;
    box-shadow: none;
  }
}
