/* =========================================================================
   Admin area — signed-in editors only.
   Deliberately plainer than the public site: this is a workspace.
   ========================================================================= */

.admin-body { background: var(--paper-shade); }

.admin-bar {
  background: var(--petrol-deep);
  color: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(233, 180, 76, 0.3);
}
.admin-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-block: 0.6rem;
}
.admin-bar .brand img { height: 2rem; }
.admin-bar nav ul { display: flex; flex-wrap: wrap; gap: 0.15rem; list-style: none; margin: 0; padding: 0; }
.admin-bar nav a {
  display: block; padding: 0.55rem 0.75rem; min-height: 44px;
  color: var(--paper); text-decoration: none; border-radius: var(--radius);
  display: flex; align-items: center;
}
.admin-bar nav a:hover { background: rgba(233, 180, 76, 0.16); color: var(--brass-bright); }
.admin-bar nav a[aria-current="page"] { color: var(--brass-bright); font-weight: 700; box-shadow: inset 0 -2px 0 var(--brass-bright); }
.admin-bar .spacer { margin-left: auto; }
.admin-user { font-size: var(--step--1); color: rgba(247, 244, 238, 0.8); }

.admin-main { padding-block: clamp(1.5rem, 4vw, 2.5rem); }
.admin-head {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.admin-head h1 { font-size: var(--step-2); }

.panel {
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 3vw, 1.75rem);
}
.panel + .panel { margin-top: 1.5rem; }
.panel h2 { font-size: var(--step-1); margin-bottom: 1rem; }

/* ---------- Post table ---------- */
.post-table { width: 100%; border-collapse: collapse; }
.post-table caption { text-align: left; padding-bottom: 0.75rem; color: var(--ink-soft); font-size: var(--step--1); }
.post-table th, .post-table td { text-align: left; padding: 0.75rem 0.75rem 0.75rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.post-table th { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.post-table .title-cell a { font-weight: 700; }
.post-table .actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
@media (max-width: 44.99em) {
  .post-table, .post-table tbody, .post-table tr, .post-table td { display: block; width: 100%; }
  .post-table thead { display: none; }
  .post-table tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; margin-bottom: 0.85rem; background: var(--paper-pure); }
  .post-table td { border: 0; padding: 0.25rem 0; }
  .post-table td::before { content: attr(data-label) ": "; font-weight: 700; color: var(--ink-soft); }
  .post-table td.title-cell::before, .post-table td.actions-cell::before { content: none; }
}

/* ---------- Editor layout ---------- */
.editor-layout { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 68em) {
  .editor-layout { grid-template-columns: minmax(0, 1fr) 21rem; }
  .editor-side { position: sticky; top: 5.5rem; }
}

.title-input {
  width: 100%;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-pure);
}

/* ---------- Toolbar ---------- */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: sticky;
  top: 4.25rem;
  z-index: 20;
}
.editor-toolbar .group { display: flex; gap: 0.25rem; }
.editor-toolbar .divider { width: 1px; background: var(--line); margin-inline: 0.35rem; align-self: stretch; }

.tool {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0 0.6rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
}
.tool:hover { background: var(--paper-shade); border-color: var(--line); }
.tool[aria-pressed="true"] { background: var(--petrol); color: var(--paper-pure); border-color: var(--petrol); }
.tool svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool .label { font-family: var(--font-display); font-weight: 700; }

/* ---------- Canvas ---------- */
.editor-canvas {
  min-height: 26rem;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  max-width: none;
}
.editor-canvas:focus-visible { outline: 3px solid var(--brass-text); outline-offset: -3px; }
.editor-canvas:empty::before,
.editor-canvas[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: var(--ink-soft);
  font-style: italic;
}
.editor-canvas .mc-figure { position: relative; }
.editor-canvas .mc-figure.is-selected {
  outline: 3px solid var(--brass);
  outline-offset: 4px;
  border-radius: 2px;
}
.editor-canvas .mc-embed { pointer-events: none; }
.editor-canvas .mc-carousel .carousel-slide { display: block; }

/* Block toolbar for a selected figure */
.block-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  padding: 0.5rem;
  margin-top: 0.75rem;
  background: var(--petrol-deep);
  border-radius: var(--radius);
}
.block-toolbar[hidden] { display: none; }
.block-toolbar .block-label {
  color: var(--brass-bright);
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.35rem;
}
.block-toolbar .tool { color: var(--paper); }
.block-toolbar .tool:hover { background: rgba(233, 180, 76, 0.18); border-color: var(--brass-bright); }
.block-toolbar .tool[aria-pressed="true"] { background: var(--brass-bright); color: var(--petrol-deep); border-color: var(--brass-bright); }
.block-toolbar .tool-danger:hover { background: #7d1d1d; border-color: #a33; color: #fff; }

/* ---------- Dialogs ---------- */
dialog.mc-dialog {
  width: min(100% - 2rem, 40rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--paper-pure);
  color: var(--ink);
}
dialog.mc-dialog::backdrop { background: rgba(11, 42, 50, 0.55); }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 { font-size: var(--step-1); margin: 0; }
.dialog-body { padding: 1.25rem; max-height: min(60vh, 34rem); overflow-y: auto; }
.dialog-foot {
  display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-end;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--paper);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.dialog-close {
  min-width: 44px; min-height: 44px;
  border: 1px solid var(--line); background: var(--paper);
  border-radius: var(--radius); font-size: 1.25rem; line-height: 1;
}

/* Alignment picker */
.align-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.align-picker label {
  display: flex; align-items: center; gap: 0.5rem;
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 0.6rem 0.85rem; min-height: 48px; cursor: pointer; font-weight: 600;
}
.align-picker input { margin: 0; width: 1.1rem; height: 1.1rem; }
.align-picker label:has(input:checked) { border-color: var(--brass); background: #fdf6e6; }
.align-picker label:has(input:focus-visible) { outline: 3px solid var(--brass-text); outline-offset: 2px; }

/* Media library grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 0.75rem; }
.media-grid button {
  padding: 0; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--paper); overflow: hidden; aspect-ratio: 1;
}
.media-grid button:hover, .media-grid button[aria-pressed="true"] { border-color: var(--brass); }
.media-grid img { width: 100%; height: 100%; object-fit: cover; }

/* Carousel builder rows */
.slide-rows { display: grid; gap: 0.85rem; }
.slide-row {
  display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 0.85rem; align-items: start;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem;
}
.slide-row img { width: 5.5rem; height: 5.5rem; object-fit: cover; border-radius: var(--radius); }
.slide-row .field { margin-bottom: 0.6rem; }

/* Status line */
/* These sit on .admin-bar's dark petrol background, not a light one — the
   colors are picked for contrast against var(--petrol-deep), not against
   paper. (font-weight:700 kept from the original, unrelated to the fix.) */
.save-state { font-size: var(--step--1); color: rgba(247, 244, 238, 0.8); }
.save-state[data-state="unsaved"] { color: var(--brass-bright); font-weight: 700; }
.save-state[data-state="saved"] { color: #4ade80; font-weight: 700; }
.save-state[data-state="error"] { color: #ff8a80; font-weight: 700; }

/* Login */
.login-wrap { display: grid; place-items: center; min-height: 70vh; padding: 2rem 1rem; }
.login-card { width: min(100%, 26rem); }
.login-card img { width: 12rem; margin: 0 auto 1.5rem; }

.page-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; margin: 1rem 0 0; padding: 0; font-weight: 700; }
