:root {
  --navy: #111046;
  --navy-soft: #1b1b36;
  --yellow: #e8c03c;
  --green: #00853f;
  --green-dark: #00682f;
  --cream: #faf9f5;
  --sable: #f6f5f2;
  --line: #e2ded2;
  --text: #1b1b36;
  --ink: #1b1b36;
  --muted: #555c67;
  --white: #ffffff;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --max: 1210px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 8px 24px rgba(17, 16, 70, .08);
  --shadow-hover: 0 16px 38px rgba(17, 16, 70, .13);
  font-family: -apple-system, "Segoe UI", Roboto, Calibri, Arial, sans-serif;
  color: var(--text);
  background: var(--cream);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(var(--max), calc(100% - 72px));
  margin-inline: auto;
}

h1, h2, h3, p {
  margin: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--green);
}

.hidden {
  display: none !important;
}

.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 38px 34px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand-mark {
  font-size: 26px;
  font-weight: 850;
  letter-spacing: -.02em;
  color: var(--navy);
}

.brand-mark span {
  color: var(--yellow);
}

.auth-card .eyebrow {
  margin: 18px 0 8px;
}

.auth-card h1 {
  font-size: 24px;
  line-height: 1.2;
  color: var(--navy);
}

.auth-card p.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--green);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--yellow);
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}

.field > span,
.field-label {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(232, 192, 60, .75);
  outline-offset: 2px;
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .03em;
  background: var(--navy);
  color: #fff;
  transition: transform .15s, background .15s;
}

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

.btn.primary {
  background: var(--green);
  box-shadow: 0 3px 0 var(--green-dark);
}

.btn.primary:hover {
  background: var(--green-dark);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--navy);
}

.btn.ghost:hover {
  border-color: var(--navy);
}

.btn.danger {
  background: var(--danger);
}

.btn.block {
  width: 100%;
  margin-top: 20px;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.form-error,
.notice {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  background: #fff1f0;
  color: var(--danger);
  border: 1px solid #f5c6c2;
}

.notice.ok {
  background: #effaf3;
  color: #05603a;
  border-color: #b7e4c7;
}

.shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  background: var(--white);
  border-bottom: 1px solid rgba(17, 16, 70, .08);
  box-shadow: 0 4px 24px rgba(17, 16, 70, .04);
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand img {
  width: auto;
  height: 26px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.nav-pill:hover {
  background: rgba(17, 16, 70, .06);
}

.nav-pill.active {
  background: var(--navy);
  color: #fff;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-user .who {
  font-size: 13px;
  color: var(--muted);
}

.header-user .who strong {
  color: var(--navy);
}

.header-user .tab {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.header-user .tab:hover {
  border-color: var(--navy);
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid rgba(0, 133, 63, .25);
  border-radius: 999px;
  background: #edf8f2;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.main {
  width: min(var(--max), calc(100% - 72px));
  margin: 0 auto;
  padding: clamp(28px, 4vw, 52px) 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px;
  margin-bottom: 26px;
}

.page-head .eyebrow {
  margin-bottom: 10px;
}

.page-head h1 {
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--navy);
}

.page-head .grow {
  flex: 1;
}

.page-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 0 rgba(17, 16, 70, .03);
  overflow: hidden;
}

.panel-pad {
  padding: 24px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--sable);
}

tbody tr:hover {
  background: #fbfaf4;
}

td .title {
  display: block;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

td .slug {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  background: #f0efe8;
  color: #4b4b5e;
  white-space: nowrap;
}

.badge.draft {
  background: #fff3d6;
  color: #7a5300;
}

.badge.live {
  background: #e8f7ee;
  color: #05603a;
}

.badge.feat {
  background: #111046;
  color: #fff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions .btn {
  padding: 8px 13px;
  font-size: 12px;
}

.list-count {
  padding: 14px 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn,
.page-num {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.page-btn:hover:not(:disabled),
.page-num:hover {
  border-color: var(--navy);
}

.page-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.page-num.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 24px;
}

@media (max-width: 980px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

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

@media (max-width: 620px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.cover-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fdfcf6;
}

.cover-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.path {
  flex: 1;
  min-width: 180px;
  padding: 9px 11px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--line);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.block-editor {
  display: grid;
  gap: 10px;
}

textarea.blocks {
  min-height: 520px;
  font-size: 12.5px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.upload-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.upload-item {
  display: flex;
  gap: 10px;
  align-items: center;
}

.audit-table td {
  font-size: 12.5px;
}

.audit-table .action {
  font-weight: 750;
  color: var(--navy);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 11, 47, .62);
}

.modal {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal h2 {
  color: var(--navy);
  font-size: 21px;
  margin-bottom: 8px;
}

.modal p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.modal .toolbar {
  justify-content: flex-end;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* --- Editeur de blocs et couverture --- */
.cover-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin-top: 12px;
  border-radius: 10px;
  overflow: hidden;
  background: #ece9dc;
  border: 1px solid var(--line);
}

.cover-preview img,
.block-preview img,
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 90px;
  color: var(--muted);
  font-size: 12px;
  background: #f6f4ea;
}

.cover-warning {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fff7df;
  border: 1px solid #f0d48a;
  color: #7a5300;
  font-size: 12.5px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.template-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin: -4px 0 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.template-info a {
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}

.block-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.block-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf7;
  overflow: hidden;
}

.block-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f7f4e8;
  border-bottom: 1px solid var(--line);
}

.block-title {
  flex: 1;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--navy);
}

.block-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.block-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.block-preview {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f1efe5;
}

.block-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fbfaf4;
}

.block-add select {
  width: auto;
  min-width: 200px;
}

.text-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.text-toolbar button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 650;
}

.text-toolbar button:hover {
  border-color: var(--green);
  color: var(--green);
}

.list-editor {
  display: grid;
  gap: 8px;
}

.list-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.list-item input {
  flex: 1;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.thumb {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.thumb img {
  aspect-ratio: 1;
  border-radius: 5px;
  background: #eceae0;
}

.thumb input {
  padding: 7px 8px;
  font-size: 12px;
}

.btn.small,
.btn.ghost.small {
  padding: 6px 10px;
  font-size: 11.5px;
}

textarea.advanced-json {
  min-height: 220px;
  font-size: 12px;
}

@media (max-width: 720px) {
  .block-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .block-actions {
    width: 100%;
  }

  .block-preview {
    max-width: none;
  }

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

a.brand-mark {
  display: inline-block;
  text-decoration: none;
}

a.brand-mark:hover {
  opacity: .85;
}

.block-card.has-error {
  border-color: #b42318;
  box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.18);
}

.theme-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.theme-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcf7;
}

.theme-order {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-fields {
  display: grid;
  gap: 10px;
}

.theme-fields .field {
  margin-top: 0;
}

.theme-id {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
}

.theme-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.theme-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.theme-add input {
  flex: 1;
  min-width: 180px;
}

@media (max-width: 860px) {
  .site-header {
    position: static;
  }

  .theme-row {
    grid-template-columns: 1fr;
  }

  .theme-order {
    flex-direction: row;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 0;
  }

  .header-user {
    margin-left: auto;
  }

  .header-nav {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    padding-bottom: 4px;
  }

  .nav-pill {
    flex: 0 0 auto;
  }

  .header-user .who {
    display: none;
  }
}

@media (max-width: 620px) {
  .container,
  .main {
    width: calc(100% - 32px);
  }

  .brand img {
    height: 22px;
  }

  .nav-pill {
    padding: 6px 10px;
    font-size: 12px;
  }

  .page-head h1 {
    font-size: clamp(32px, 10vw, 42px);
  }
}

.media-warning {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #f0c48a;
  border-radius: 10px;
  background: #fff7e8;
  color: #7a4b00;
  font-size: 13px;
  line-height: 1.55;
}

.media-warning p {
  margin: 6px 0 0;
  color: #7a4b00;
}
