/* Ramsey Systems - Admin Site Stylesheet
   Dressed like the website (static/css/site.css): its hero gradient, header,
   fonts and pill buttons, so the admin feels like part of the same company. */

@font-face {
  font-family: "Montserrat";
  src: url("/admin/brand/fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  src: url("/admin/brand/fonts/montserrat-latin-ext.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Brand palette */
  --navy: #013669;
  --navy-dark: #002244;
  --navy-hover: #024a8f;
  --navy-subtle: #edf5fc;
  --red: #b42d34;
  --red-hover: #9c252b;
  --red-subtle: #fef2f2;
  --red-border: #fecaca;
  --hero-from: #e14e50;    /* the website's hero gradient */
  --hero-to: #372c82;
  --brand-gradient: linear-gradient(90deg, var(--hero-from), var(--hero-to));
  --nav: #5d7085;          /* the website's nav links */

  /* Neutrals */
  --ink: #0f172a;
  --ink-body: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-hover: #cbd5e1;
  --soft: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;

  /* Feedback / Semantic */
  --ok: #166534;
  --ok-bg: #f0fdf4;
  --ok-border: #bbf7d0;
  --info: #1d4ed8;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --error: #991b1b;
  --error-bg: #fef2f2;
  --error-border: #fecaca;

  /* Typography */
  --font-heading: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;  /* as the website */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Elevation */
  --shadow-xs: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(15 23 42 / 0.07), 0 1px 2px -1px rgb(15 23 42 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.08), 0 4px 6px -4px rgb(15 23 42 / 0.03);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
}

/* ---------------------------------------------------------------- resets */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink-body);
  font: 15px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  accent-color: var(--navy);
}

a {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--navy-hover);
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--ink);
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 {
  margin: 0 0 16px;
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  margin: 40px 0 16px;
  font-size: 20px;
  line-height: 1.35;
}

h3 {
  margin: 24px 0 12px;
  font-size: 17px;
}

p {
  margin: 0 0 12px;
}

p:last-child {
  margin-bottom: 0;
}

:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.muted, .optional {
  color: var(--muted);
  font-weight: 400;
}

.optional {
  font-size: 13px;
  margin-left: 4px;
}

.small {
  font-size: 13px;
}

.subtitle {
  color: var(--muted);
  font-size: 15px;
  margin: 4px 0 0;
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 36px;
  padding: 16px 24px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

/* The website's hero gradient, as a stripe along the top edge. */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--brand-gradient);
}

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

.brand img {
  display: block;
  width: auto;
  height: 34px;
}

.brand-tag {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-alt);
  color: var(--muted);
  font: 700 11px/1.4 var(--font-heading);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 26px;
}

/* As the website's menu: a grey underline grows on hover; red marks this page. */
.topbar nav a {
  position: relative;
  padding: 8px 2px 10px;
  color: var(--nav);
  font: 500 15px/1.2 var(--font-heading);
  text-decoration: none;
}

.topbar nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--nav);
  scale: 0 1;
  transition: scale 0.25s ease;
}

.topbar nav a:hover {
  color: var(--navy);
}

.topbar nav a:hover::after {
  scale: 1 1;
}

.topbar nav a[aria-current="page"] {
  color: var(--navy);
}

.topbar nav a[aria-current="page"]::after {
  background: var(--red);
  scale: 1 1;
}

.user-menu,
.signout {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  font-size: 14px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-body);
  font-weight: 500;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  color: #fff;
  font: 700 13px var(--font-heading);
  text-transform: uppercase;
}

.signout-button {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--line-hover);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--ink-body);
  font: 600 13px var(--font-body);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.signout-button:hover {
  background: var(--surface-alt);
  border-color: #94a3b8;
  color: var(--ink);
}

/* ---------------------------------------------------------------- draft bar */

.draftbar {
  padding: 10px 24px;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn);
  font-size: 14px;
  font-weight: 500;
}

.draftbar-inner,
.draftbar p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 1040px;
  margin: 0 auto;
}

.draft-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.draftbar a {
  color: var(--warn);
  font-weight: 600;
  text-decoration: underline;
}

.draftbar a:hover {
  color: #78350f;
}

/* ---------------------------------------------------------------- layout */

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}

.wrap.wide {
  max-width: none;
  padding: 20px 24px 32px;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.title-row h1 {
  margin: 0;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* ---------------------------------------------------------------- cards */

.card {
  margin: 0 0 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* Fieldset card resets: eliminates browser default fieldset border slicing */
fieldset.card {
  min-width: 0;
  border: 1px solid var(--line);
  padding: 24px;
  display: block;
}

.card legend {
  display: block;
  float: left;
  width: 100%;
  padding: 0 0 14px;
  margin: 0 0 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Clearfix for legend float */
fieldset.card::after {
  content: "";
  display: table;
  clear: both;
}

/* ---------------------------------------------------------------- sign-in page */

/* The website's home-page hero: its gradient, with the logo's dot swirl faint behind. */
.signin-page {
  background: var(--brand-gradient);
}

.signin-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 28px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 48px 16px;
  overflow: hidden;
}

.signin-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  margin: auto;
  width: min(120vw, 1180px);
  aspect-ratio: 2.62;
  background: url("/admin/brand/images/swirl.svg") no-repeat center / contain;
  opacity: 0.1;
  pointer-events: none;
}

.signin-card {
  width: min(100%, 420px);
  padding: 40px 36px 28px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 30px 70px -20px rgb(19 7 8 / 0.45), 0 2px 6px rgb(19 7 8 / 0.08);
  text-align: center;
  animation: signin-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.signin-logo {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 30px;
}

.signin-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.signin-lead {
  margin: 0 auto;
  max-width: 30ch;
  color: var(--ink-body);
  font-size: 15px;
}

.signin-card #google-signin {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin: 28px 0 22px;
}

.signin-card .notice {
  margin: 0 0 20px;
  text-align: left;
}

.signin-card .dev-login {
  margin: 24px 0 22px;
}

.signin-card .dev-login .help {
  margin-top: 8px;
}

.signin-note {
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.signin-back {
  color: rgb(255 255 255 / 0.85);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.signin-back:hover {
  color: #fff;
  text-decoration: underline;
}

.signin-back:focus-visible {
  outline-color: #fff;
}

@keyframes signin-rise {
  from { opacity: 0; transform: translateY(14px); }
}

@media (prefers-reduced-motion: reduce) {
  .signin-card { animation: none; }
}

/* ---------------------------------------------------------------- notices and badges */

.notice {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid;
  border-left: 4px solid;
  font-size: 14px;
  line-height: 1.5;
}

.notice.ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  border-left-color: var(--ok);
  color: var(--ok);
}

.notice.info {
  background: var(--info-bg);
  border-color: var(--info-border);
  border-left-color: var(--navy);
  color: var(--navy);
}

.notice.error {
  background: var(--error-bg);
  border-color: var(--error-border);
  border-left-color: var(--red);
  color: var(--error);
}

.notice ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.notice p {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge.new {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok);
}

.badge.deleted {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--red);
}

.badge.changed {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn);
}

/* ---------------------------------------------------------------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 20px;
  border: 1px solid var(--line-hover);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--ink-body);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease-in-out;
}

.button:hover {
  background: var(--soft);
  border-color: #94a3b8;
  color: var(--ink);
}

.button.primary {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
  box-shadow: 0 1px 2px rgba(1, 54, 105, 0.25);
}

.button.primary:hover {
  background: var(--navy-hover);
  border-color: var(--navy-hover);
  box-shadow: 0 2px 4px rgba(1, 54, 105, 0.3);
  transform: translateY(-1px);
  color: #fff;
}

.button.primary:active {
  background: var(--navy-dark);
  transform: translateY(0);
}

.button.secondary {
  background: #fff;
  border-color: var(--line-hover);
  color: var(--ink-body);
}

.button.secondary:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.button.danger {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 1px 2px rgba(180, 45, 52, 0.2);
}

.button.danger:hover {
  background: var(--red-hover);
  border-color: var(--red-hover);
  color: #fff;
}

.button.small {
  min-height: 32px;
  padding: 4px 14px;
  font-size: 13px;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}

.actions form {
  margin: 0;
}

.actions.sticky {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 0 -24px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

details.confirm {
  display: inline-block;
  position: relative;
}

details.confirm summary {
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
  user-select: none;
}

details.confirm summary:hover {
  background: var(--red-subtle);
}

details.confirm[open] {
  background: var(--red-subtle);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 4px 0;
}

details.confirm[open] summary {
  margin-bottom: 10px;
  font-weight: 700;
}

details.confirm form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.danger-zone {
  margin-top: 48px;
  padding: 20px 24px;
  border: 1px dashed var(--red-border);
  border-radius: var(--radius-lg);
  background: var(--red-subtle);
}

/* ---------------------------------------------------------------- forms */

.form:not(.page-form) {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.form .field {
  margin: 0 0 22px;
}

.field > label:not(.check) {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.field input[type="text"],
.field input[type="date"],
.field input[type="file"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-hover);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input[type="text"]:focus,
.field input[type="date"]:focus,
.field input[type="file"]:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(1, 54, 105, 0.12);
  outline: none;
}

.field input[type="file"] {
  padding: 9px 12px;
  background: var(--surface-alt);
  cursor: pointer;
}

.field textarea {
  resize: vertical;
  line-height: 1.5;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.prefixed {
  display: flex;
  align-items: stretch;
}

.prefixed span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line-hover);
  border-right: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.prefixed input {
  border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
}

.fixed {
  margin: 0;
  padding: 8px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  display: inline-block;
}

.current-photo {
  display: block;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  object-fit: cover;
}

/* TinyMCE wrapper polishing */
.tox.tox-tinymce {
  border: 1px solid var(--line-hover) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tox.tox-tinymce:focus-within {
  border-color: var(--navy) !important;
  box-shadow: 0 0 0 3px rgba(1, 54, 105, 0.12) !important;
}

/* ---------------------------------------------------------------- page sections */

.section {
  position: relative;
}

/* Under the legend: the legend floats (see .card legend), and a flex box beside a
   float squeezes into the space next to it, which here is none. */
.section .tools,
.subcard .tools {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.cards {
  margin: 16px 0 20px;
}

.subcard {
  margin: 0 0 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--soft);
}

.subcard legend {
  padding: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  border-bottom: none;
  margin-bottom: 8px;
}

details.advanced {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

details.advanced summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  user-select: none;
}

.add-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 24px;
  background: #f8fafc;
  border: 1px dashed var(--line-hover);
}

.add-section p {
  width: 100%;
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

/* ---------------------------------------------------------------- lists */

.changes,
.team-list,
.pages-list {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.changes li,
.team-list li,
.pages-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.changes li:hover,
.team-list li:hover,
.pages-list li:hover {
  border-color: var(--line-hover);
  box-shadow: var(--shadow-sm);
}

.changes li + li,
.team-list li + li,
.pages-list li + li {
  margin-top: 10px;
}

.change-label {
  flex: 1 1 200px;
  font-weight: 600;
  font-size: 15px;
}

.change-label a {
  text-decoration: none;
  color: var(--navy);
}

.change-label a:hover {
  text-decoration: underline;
}

.team-list img {
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.team-list .who {
  display: flex;
  flex-direction: column;
  flex: 1 1 180px;
}

.team-list .who strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.team-list .who span {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.team-list .move {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  background: var(--surface-alt);
  padding: 2px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
}

.team-list .move button {
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--ink-body);
  font-weight: 700;
  font-size: 14px;
  box-shadow: none;
}

.team-list .move button:hover:not(:disabled) {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.team-list .move button:disabled {
  opacity: 0.3;
}

/* The whole row opens the page: its one link's box is stretched over the row
   (a::after below), so a click anywhere on the row is a click on the link. */
.pages-list li {
  position: relative;
}

.pages-list li .muted {
  margin-left: auto; /* the address and count sit on the right, by the arrow */
}

.pages-list li a {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  color: var(--navy);
}

.pages-list li a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* An arrow at the end of the row, as on the dashboard tiles, says "this opens". */
.pages-list li::after {
  content: "→";
  color: var(--muted);
  font-size: 18px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.pages-list li:hover {
  border-color: var(--navy);
}

.pages-list li:hover a {
  color: var(--navy-hover);
  text-decoration: underline;
}

.pages-list li:hover::after {
  color: var(--navy);
  transform: translateX(4px);
}

/* Keyboard focus rings the whole row, not just the words of the link. */
.pages-list li:has(a:focus-visible) {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.pages-list li a:focus-visible {
  outline: none;
}

/* ---------------------------------------------------------------- table */

.posts {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.posts th,
.posts td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.posts th {
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.posts tbody tr:last-child td {
  border-bottom: none;
}

.posts tbody tr:hover td {
  background: var(--soft);
}

.posts td a {
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  font-size: 15px;
}

.posts td a:hover {
  text-decoration: underline;
}

.posts .date {
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
}

/* ---------------------------------------------------------------- tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--ink-body);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.2s ease;
}

.tile:hover {
  border-color: var(--line-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--ink-body);
}

.tile:hover::before {
  background: var(--brand-gradient);
}

.tile-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tile-icon {
  font-size: 20px;
  line-height: 1;
}

.tile strong {
  font-family: var(--font-heading);
  color: var(--navy);
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.tile strong::after {
  content: "→";
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.tile:hover strong::after {
  transform: translateX(4px);
  color: var(--navy);
}

.tile span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- empty state */

.empty-state {
  padding: 32px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  margin-bottom: 24px;
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}

/* ---------------------------------------------------------------- output / logs */

.output {
  overflow: auto;
  max-height: 60vh;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: #0f172a;
  color: #e2e8f0;
  font: 13px/1.6 var(--font-mono);
  white-space: pre-wrap;
  border: 1px solid #1e293b;
}

/* ---------------------------------------------------------------- preview */

.preview-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 14px 20px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.preview-bar p {
  margin: 0;
  flex: 1 1 240px;
  font-size: 14px;
}

.preview-bar form {
  margin: 0;
}

.preview-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-nav label {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.preview-nav select {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-hover);
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

iframe.preview {
  display: block;
  width: 100%;
  height: calc(100vh - 160px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
}

/* ---------------------------------------------------------------- visual page editor */

/* The page fills the window: the bar on top, the frame (the real page) below it. */
.editor-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.editor-page > .wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
}

.editor-page > .wrap > .notice {
  margin: 12px 24px 0;
}

.editor {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.editor-bar .crumbs {
  margin: 0;
  font-size: 15px;
}

.editor-bar .crumbs strong {
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 600;
}

.editor-status {
  margin: 0 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.editor-status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: var(--radius-full);
  background: var(--line-hover);
  vertical-align: 1px;
}

.editor-status.ok::before { background: #22c55e; }
.editor-status.dirty { color: var(--warn); }
.editor-status.dirty::before { background: #f59e0b; }
.editor-status.busy::before { background: var(--navy); }
.editor-status.error { color: var(--error); }
.editor-status.error::before { background: var(--red); }

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

.editor-errors {
  margin: 12px 24px 0;
}

.editor-hint {
  margin: 0;
  padding: 6px 24px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.editor-stage {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}

iframe.canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

/* Settings that don't show on the page slide over its right-hand side. */
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  width: min(380px, 100%);
  padding: 20px 24px;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px -16px rgb(15 23 42 / 0.25);
}

.drawer[hidden] {
  display: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.drawer-close:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.drawer .field input:not([type="checkbox"]),
.drawer .field textarea,
.drawer .field select {
  width: 100%;
}

/* The page editor's menu (right-click or ⋯ in the frame), drawn over the frame. */
.menu {
  position: fixed;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 230px;
  max-height: calc(100vh - 16px);
  padding: 6px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px -8px rgb(15 23 42 / 0.3), 0 2px 6px rgb(15 23 42 / 0.08);
}

.menu[hidden] {
  display: none;
}

.menu-group {
  margin: 6px 8px 2px;
  color: var(--muted);
  font: 700 11px/1.4 var(--font-heading);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-group:not(:first-child) {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.menu-item {
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-body);
  font: 500 14px/1.3 var(--font-body);
  text-align: left;
  cursor: pointer;
}

.menu-item:hover:not(:disabled),
.menu-item:focus-visible {
  background: var(--navy-subtle);
  color: var(--navy);
  outline: none;
}

.menu-item:disabled {
  color: var(--line-hover);
  cursor: default;
}

.menu-item.danger {
  color: var(--red);
}

.menu-item.danger:hover,
.menu-item.danger:focus-visible,
.menu-item.danger[data-armed] {
  background: var(--red-subtle);
  color: var(--red);
}

.menu-back {
  color: var(--muted);
}

/* A card's picture in the settings panel. */
.setting-label {
  margin: 0 0 6px;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
}

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

.setting-picture img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 2; /* as the site shows it (.item-image) */
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 680px) {
  .topbar {
    padding: 14px 16px 8px;
  }
  .brand img {
    height: 28px;
  }
  .topbar nav {
    width: 100%;
    order: 3;
    gap: 4px 20px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
  }
  .user-menu,
  .signout {
    margin-left: auto;
  }
  .wrap {
    padding: 20px 16px 80px;
  }
  .card {
    padding: 16px;
  }
  fieldset.card {
    padding: 16px;
  }
  .form:not(.page-form) {
    padding: 18px;
  }
  .actions.sticky {
    margin: 0 -16px;
    padding: 12px 16px;
  }
  h1 {
    font-size: 24px;
  }
}
