/* News Centralised Portal — design tokens (align with Figma handoff patterns) */

:root {
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --sidebar-width: 280px;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07080c;
  --bg-dots: rgba(255, 255, 255, 0.035);
  --surface: #101218;
  --surface-2: #161a22;
  --border: #252b38;
  --border-subtle: #1c212c;
  --text: #f4f6fa;
  --muted: #949bab;
  --accent: #5b96ff;
  --accent-strong: #3b7aed;
  --accent-muted: rgba(91, 150, 255, 0.14);
  --success: #4ade80;
  --danger: #fb7185;
  --switch-track: #2f3648;
  --sidebar-bg: #0a0c11;
  --sidebar-border: #161a24;
  --sidebar-hover: rgba(255, 255, 255, 0.055);
  --sidebar-active: rgba(91, 150, 255, 0.14);
  --table-head: #141821;
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-float: 0 20px 50px rgba(0, 0, 0, 0.5);
  /* Material-outlined–style fields */
  --mui-outlined-border: rgba(255, 255, 255, 0.23);
  --mui-outlined-border-hover: rgba(255, 255, 255, 0.5);
  --mui-outlined-bg: transparent;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ebeef5;
  --bg-dots: rgba(15, 23, 42, 0.045);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e1e7ef;
  --border-subtle: #eef2f7;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-muted: rgba(37, 99, 235, 0.1);
  --success: #059669;
  --danger: #dc2626;
  --switch-track: #cbd5e1;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e8ecf2;
  --sidebar-hover: rgba(15, 23, 42, 0.05);
  --sidebar-active: rgba(37, 99, 235, 0.1);
  --table-head: #f1f5f9;
  --shadow-card: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-float: 0 20px 50px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
}

body.sidebar-open {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
.page-head__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h2,
h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.015em;
}

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

.nowrap {
  white-space: nowrap;
}

/* ——— Page shell ——— */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.75rem;
}

.page-head__text {
  min-width: 0;
}

.page-head__title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.65rem, 2.5vw, 2rem);
}

.page-head__desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 36rem;
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-card__hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.card-section-title {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.table-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.table-card .data-table {
  margin: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--table-head);
}

.data-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table a {
  font-weight: 500;
  text-decoration: none;
}

.data-table a:hover {
  text-decoration: underline;
}

.text-link-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.text-link-back:hover {
  color: var(--accent);
}

.article-hero-img {
  max-width: 100%;
  border-radius: var(--radius);
  display: block;
}

/* Fixed square thumbnails (galleries, delivery payload, compose previews). */
.img-thumb {
  width: 7.5rem;
  height: 7.5rem;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: block;
}

.article-body {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
}

.subsection-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
}

/* ——— Sidebar ——— */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.sidebar-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.sidebar__header {
  padding: 1.35rem 1.1rem 1.1rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.sidebar__brand:hover {
  text-decoration: none;
  opacity: 0.95;
}

.sidebar__brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.05rem;
  font-family: var(--font-display);
  color: #fff;
  background: linear-gradient(145deg, var(--accent-strong) 0%, #7c3aed 100%);
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

html[data-theme="dark"] .sidebar__brand-mark {
  box-shadow: 0 4px 20px rgba(91, 150, 255, 0.25);
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.sidebar__brand-title {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.sidebar__brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar__scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.85rem 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.sidebar__label {
  margin: 1rem 0.6rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.sidebar__label:first-child {
  margin-top: 0.25rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.58rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.sidebar__link:hover {
  background: var(--sidebar-hover);
  text-decoration: none;
}

.sidebar__link.is-active {
  background: var(--sidebar-active);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar__link.is-active .sidebar__icon {
  color: var(--accent);
}

.sidebar__icon {
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.12s ease;
}

.sidebar__link:hover .sidebar__icon {
  color: var(--text);
}

.sidebar__footer {
  flex-shrink: 0;
  padding: 1rem 0.85rem 1.1rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.sidebar__theme {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.72rem;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.sidebar__avatar {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  background: var(--sidebar-active);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.sidebar__user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.sidebar__user-name {
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.sidebar__logout-form {
  margin: 0;
  flex-shrink: 0;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.sidebar__logout:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}

.app-shell {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-topbar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 3.5rem;
  padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 var(--border-subtle);
}

.app-topbar__title {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: -0.35rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease;
}

.sidebar-toggle:hover {
  background: var(--sidebar-hover);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .sidebar-backdrop.is-visible {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-float);
  }

  .app-shell {
    margin-left: 0;
  }

  .app-topbar {
    display: flex;
  }
}

@media (min-width: 901px) {
  .sidebar-backdrop {
    display: none !important;
  }
}

/* ——— Theme toggle ——— */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  user-select: none;
}

.theme-toggle__text {
  color: var(--muted);
  transition: color 0.15s ease, opacity 0.15s ease;
}

html[data-theme="light"] .theme-toggle__text--light {
  color: var(--text);
  font-weight: 600;
}

html[data-theme="light"] .theme-toggle__text--dark {
  opacity: 0.45;
}

html[data-theme="dark"] .theme-toggle__text--dark {
  color: var(--text);
  font-weight: 600;
}

html[data-theme="dark"] .theme-toggle__text--light {
  opacity: 0.45;
}

.theme-switch {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--switch-track);
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-switch:hover {
  border-color: var(--accent);
}

.theme-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

html[data-theme="dark"] .theme-switch::after {
  transform: translateX(20px);
}

.theme-toggle--floating {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

/* ——— Main content ——— */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
  box-sizing: border-box;
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 20px 20px;
}

.app-main--guest {
  max-width: 480px;
  background-image: none;
}

.app-main--guest.app-main--shared-preview {
  max-width: 720px;
}

/* HTMX boosted navigation: only #hx-main-inner swaps; sidebar stays painted */
.hx-main-inner {
  transition: opacity 0.14s ease-out;
}

#hx-main-inner.htmx-swapping {
  opacity: 0.35;
}

#hx-main-inner.htmx-settling {
  opacity: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

h1,
h2,
h3 {
  margin-top: 0;
}

h2 {
  font-size: 1.1rem;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

table:not(.data-table) {
  width: 100%;
  border-collapse: collapse;
}

table:not(.data-table) th,
table:not(.data-table) td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

table:not(.data-table) th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1.1rem;
  min-height: 2.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.btn:hover {
  text-decoration: none;
  background: var(--surface-2);
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  filter: none;
}

.btn-primary:active,
.btn:active {
  transform: scale(0.98);
}

.btn-loader {
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: none;
}

.btn.is-loading .btn-loader {
  display: inline-block;
  animation: btn-spinner 0.75s linear infinite;
}

@keyframes btn-spinner {
  to {
    transform: rotate(360deg);
  }
}

.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="url"],
.form-row input[type="password"],
.form-row textarea,
.form-row select {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.form-row textarea {
  min-height: 140px;
  resize: vertical;
}

.form-row ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.form-row ul li {
  margin-bottom: 0.35rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.errorlist {
  color: var(--danger);
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.messages li {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.875rem;
}

.messages .success {
  border-color: var(--success);
  background: rgba(52, 222, 128, 0.08);
}

html[data-theme="light"] .messages .success {
  background: rgba(5, 150, 105, 0.08);
}

.messages .error {
  border-color: var(--danger);
  background: rgba(251, 113, 133, 0.08);
}

html[data-theme="light"] .messages .error {
  background: rgba(220, 38, 38, 0.06);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success {
  background: rgba(52, 222, 128, 0.15);
  color: var(--success);
}

html[data-theme="light"] .badge-success {
  background: rgba(5, 150, 105, 0.12);
  color: var(--success);
}

.badge-fail {
  background: rgba(251, 113, 133, 0.15);
  color: var(--danger);
}

.badge-pending {
  background: rgba(148, 155, 171, 0.2);
  color: var(--muted);
}

/* ——— Compose: portal multi-select cards ——— */
.portal-cards-fieldset {
  border: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.portal-cards-legend {
  margin: 0 0 0.65rem;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.portal-cards-toolbar {
  margin-bottom: 0.85rem;
}

.portal-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.portal-card {
  display: block;
  margin: 0;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.portal-card:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.portal-card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.portal-card.is-selected {
  border-color: var(--accent);
  background: var(--sidebar-active);
  box-shadow: 0 0 0 1px var(--accent);
}

.portal-card__body {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  min-height: 3.5rem;
}

.portal-card__logo-wrap {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-card__logo-wrap--placeholder {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  background: var(--sidebar-active);
  border-color: transparent;
}

.portal-card__logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-card__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.portal-card__name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.portal-card__meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-card__check {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.portal-card.is-selected .portal-card__check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* Per-portal form (fieldset + legend) */
fieldset.portal-edit-form {
  min-width: 0;
  margin-inline: 0;
}

.portal-edit-form__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0 0 0.85rem;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.portal-edit-form__legend-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
}

.portal-edit-form__legend-name {
  font-size: 1.08rem;
}

.portal-edit-form__legend-meta {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
}

.portal-edit-form__input,
.portal-edit-form__textarea,
.portal-edit-form__file {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.portal-edit-form__textarea {
  min-height: 14rem;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 0.65rem 0.75rem;
}

.portal-edit-form__textarea:focus-visible,
.portal-edit-form__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.portal-edit-form__field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.portal-override-block {
  --portal-accent-idx: 0;
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-left-color: hsl(
    calc(158 + var(--portal-accent-idx) * 36),
    48%,
    42%
  );
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.2rem;
  margin-bottom: 1.35rem;
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
}

.portal-overrides > .portal-override-block:last-child {
  margin-bottom: 0;
}

.portal-override-block__identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.portal-override-block__logo {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.portal-override-block__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portal-override-block__logo--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  background: var(--sidebar-active);
  border-color: transparent;
}

.portal-override-block__identity-text {
  min-width: 0;
  flex: 1;
}

.portal-override-block__index {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.portal-override-block__name {
  margin: 0 0 0.15rem;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
}

.portal-override-block__url {
  display: block;
  font-size: 0.78rem;
  word-break: break-all;
}

.portal-override-block__effective {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.effective-row .effective-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.effective-value {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.effective-value--custom {
  padding: 0.35rem 0.5rem;
  margin-left: -0.25rem;
  border-radius: 6px;
  background: var(--sidebar-active);
  border-left: 3px solid var(--accent);
}

.portal-override-block__fields-legend {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.portal-override-block__file-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}

.portal-overrides__head {
  margin-bottom: 1rem;
}

.portal-overrides__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.portal-overrides__lead {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  max-width: 40rem;
}

.portal-overrides__defaults {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.portal-overrides__defaults-label {
  display: block;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.portal-overrides__defaults-line {
  margin: 0 0 0.35rem;
}

.portal-overrides__defaults-line:last-child {
  margin-bottom: 0;
}

/* ——— Compose: step flow ——— */
.compose-card .compose-flow {
  list-style: none;
  margin: 0;
  padding: 0;
}

.compose-flow__step {
  margin: 0;
  padding: 0 0 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.compose-flow__step:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.compose-flow__step-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.compose-flow__badge {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.compose-flow__step-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.compose-flow__step-desc {
  margin: 0;
  font-size: 0.85rem;
  max-width: 42rem;
}

.compose-flow__step-body {
  padding-left: 0;
}

.compose-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 0.65rem;
}

.compose-thumbs__item {
  position: relative;
  flex: 0 0 auto;
}

.compose-thumbs__badge {
  position: absolute;
  top: 0.3rem;
  left: 0.3rem;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.35rem;
  text-align: center;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  pointer-events: none;
}

html[data-theme="dark"] .compose-thumbs__badge {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
}

.compose-thumbs__remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.12s ease, color 0.12s ease;
}

.compose-thumbs__remove:hover {
  background: var(--danger);
  color: #fff;
}

.compose-thumbs__remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html[data-theme="dark"] .compose-thumbs__remove {
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
}

@media (min-width: 560px) {
  .compose-flow__step-body {
    padding-left: calc(2rem + 1rem);
  }
}

.compose-flow__customize-row {
  margin-bottom: 0.75rem;
}

.compose-flow__manual-load {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.compose-flow__manual-hint {
  flex: 1 1 12rem;
  margin: 0;
  font-size: 0.8rem;
  max-width: 28rem;
}

.compose-flow__portal-mode {
.compose-flow__portal-mode-btn--active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.compose-flow__portal-mode-btn--active:hover {
  background: var(--accent-strong);
  filter: none;
}
  gap: 0.5rem 0.65rem;
}

/* Selected mode uses .btn-primary (toggled in portal_cards.js); keep inactive as default .btn */

.compose-flow__portal-mode-note {
  margin-top: 0.65rem;
  margin-bottom: 0;
  font-size: 0.8rem;
  max-width: 38rem;
}

.compose-flow__actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.compose-flow__publish-hint {
  margin: 0 0 0.85rem;
  max-width: 38rem;
  font-size: 0.875rem;
}

/* Step 4: window-style panel for per-portal editing */
.compose-portal-window {
  margin-top: 0.25rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card), 0 12px 40px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  max-width: 100%;
}

[data-theme="dark"] .compose-portal-window {
  box-shadow: var(--shadow-card), 0 12px 40px rgba(0, 0, 0, 0.35);
}

.compose-portal-window__titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.compose-portal-window__title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.compose-portal-window__subtitle {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  max-width: 36rem;
}

.compose-portal-window__dots {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  padding-top: 0.2rem;
}

.compose-portal-window__dots span {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--border);
  opacity: 0.85;
}

.compose-portal-window__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}

.compose-portal-window__toolbar-hint {
  flex: 1 1 14rem;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  max-width: 32rem;
}

.compose-portal-window__body {
  max-height: min(70vh, 640px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.compose-portal-window__slot {
  padding: 1rem 1.1rem 1.25rem;
  min-height: 4rem;
}

.data-table--deliveries .delivery-title-cell {
  max-width: 12rem;
}

.data-table--deliveries .delivery-body-cell {
  max-width: 18rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.delivery-portal-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.delivery-portal-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.payload-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.payload-chip {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 4px;
  background: var(--sidebar-active);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ——— Article detail: main reference + per-portal payloads ——— */
.article-main-ref {
  margin-bottom: 2rem;
}

.article-main-ref__label {
  margin: 0 0 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.article-main-ref__title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.article-main-ref__body {
  font-size: 0.95rem;
  line-height: 1.6;
}

.article-main-ref__hero {
  margin: 0 0 1rem;
}

.article-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-start;
}

.article-gallery__cell {
  margin: 0;
  padding: 0;
  border: 0;
}

.delivery-card__payload-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.delivery-card__payload-gallery .delivery-card__payload-img-wrap {
  margin: 0;
}

.delivery-card__payload-gallery .delivery-card__payload-img.img-thumb {
  width: 7.5rem;
  height: 7.5rem;
  max-width: 7.5rem;
  max-height: 7.5rem;
}

.article-deliveries-intro {
  margin: -0.35rem 0 1.25rem;
  max-width: 40rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.article-deliveries-intro a {
  color: var(--accent);
  font-weight: 500;
}

.delivery-cards {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.delivery-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.delivery-card--differs {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-card);
}

.delivery-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 1.15rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-subtle);
}

.delivery-card__portal {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.delivery-card__portal-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.delivery-card__portal-logo--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
  background: var(--sidebar-active);
  border-color: transparent;
}

.delivery-card__portal-name {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.delivery-card__portal-url {
  margin: 0;
  font-size: 0.78rem;
  word-break: break-all;
}

.delivery-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-end;
}

.delivery-card__badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.delivery-card__badge--differs {
  background: var(--sidebar-active);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.delivery-card__badge--same {
  background: rgba(148, 155, 171, 0.15);
  color: var(--muted);
  border: 1px solid var(--border);
}

.delivery-card__diff-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 2.25rem;
}

.delivery-card__diff-none {
  margin: 0;
  font-size: 0.8rem;
}

.delivery-card__payload {
  padding: 1rem 1.15rem 1.15rem;
}

.delivery-card__payload-label {
  margin: 0 0 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.delivery-card__payload-label:not(:first-child) {
  margin-top: 1rem;
}

.delivery-card__payload-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.delivery-card__payload-title--differs {
  padding: 0.35rem 0.5rem;
  margin-left: -0.25rem;
  border-radius: 6px;
  background: var(--sidebar-active);
  border-left: 3px solid var(--accent);
}

.delivery-card__payload-body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text, inherit);
}

.delivery-card__payload-body--differs {
  padding: 0.5rem 0.6rem;
  margin-left: -0.25rem;
  border-radius: 6px;
  background: var(--sidebar-active);
  border-left: 3px solid var(--accent);
}

.delivery-card__payload-img-wrap {
  margin: 0.35rem 0 0;
}

.delivery-card__payload-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: cover;
}

.delivery-card__payload-img--differs {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.delivery-card__img-note {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
}

.delivery-card__foot {
  padding: 0.65rem 1.15rem;
  font-size: 0.78rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-2);
}

.delivery-card__err {
  display: block;
  margin-top: 0.35rem;
  color: var(--danger, #c0392b);
}

.portal-override-block__compare-flag {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.4;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
}

.portal-override-block__compare-flag--differs {
  background: var(--sidebar-active);
  border-color: var(--accent);
  color: var(--text, inherit);
  font-weight: 500;
}

.portal-override-block--differs {
  border-left-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent);
}

/* ——— Share (Figma-style link sharing) ——— */
.share-panel-slot {
  margin-bottom: 1.5rem;
}

.share-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-card);
}

.share-panel--portal {
  margin-bottom: 1.25rem;
}

.share-panel__messages {
  margin: 0 0 1rem;
}

.share-panel__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.share-panel__title {
  margin: 0 0 0.35rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.share-panel__subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 36rem;
}

.share-access-pill {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--sidebar-active);
  color: var(--accent);
  border: 1px solid var(--border);
}

.share-panel__section {
  margin-bottom: 1rem;
}

.share-panel__label {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.share-panel__empty {
  margin: 0 0 1rem;
  font-size: 0.875rem;
}

.share-panel__footer {
  padding-top: 0.25rem;
}

.share-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.share-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem 0.65rem;
}

.share-link-row--single {
  align-items: center;
}

.share-url-field {
  flex: 1;
  min-width: 12rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.share-link-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.share-link-meta {
  width: 100%;
  margin: 0;
  font-size: 0.75rem;
}

.share-revoke-form {
  margin: 0;
  display: inline;
}

.share-btn-danger {
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
  background: transparent;
}

.share-btn-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

html[data-theme="light"] .share-btn-danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

.btn-copy {
  min-height: 2.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

.share-create-form {
  margin: 0;
  display: inline-block;
}

.shared-preview-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
}

.shared-preview-banner strong {
  display: block;
  font-size: 0.9rem;
}

.shared-preview-banner .muted {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.shared-preview-banner__icon {
  font-size: 1.35rem;
  line-height: 1;
}

/* ——— Login ——— */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, var(--accent-muted), var(--bg));
}

html[data-theme="dark"] .login-page {
  background: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(91, 150, 255, 0.12), transparent 55%), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.login-brand__mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  background: linear-gradient(145deg, var(--accent-strong) 0%, #7c3aed 100%);
}

.login-brand__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0;
  line-height: 1.2;
}

.login-brand__sub {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.login-input {
  width: 100%;
  max-width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-sans);
}

.login-hint {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.login-hint code {
  font-size: 0.85em;
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: var(--sidebar-hover);
  font-family: ui-monospace, monospace;
}

/* ——— Staff: onboard user ——— */
.onboard-page {
  max-width: 72rem;
  margin: 0 auto;
}

.onboard-page__head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.onboard-back {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.onboard-back:hover {
  background: var(--surface-2);
  border-color: var(--muted);
  color: var(--accent);
  text-decoration: none;
}

.onboard-back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.onboard-page__head-text {
  min-width: 0;
}

.onboard-page__title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.onboard-page__lede {
  margin: 0;
  font-size: 0.875rem;
  max-width: 40rem;
}

.onboard-form__grid {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 960px) {
  .onboard-form__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  }

  .onboard-form__grid.onboard-form__grid--perms-only {
    grid-template-columns: minmax(0, 1fr);
    max-width: 28rem;
  }
}

.onboard-panel-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.onboard-panel-desc {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.onboard-form__col--account .onboard-panel-title {
  margin-bottom: 0.85rem;
}

.onboard-perm-card {
  margin-bottom: 1.25rem;
}

.onboard-perm-card:last-child {
  margin-bottom: 0;
}

.onboard-toggle-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.onboard-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.onboard-toggle-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.onboard-toggle-row:first-child {
  padding-top: 0;
}

.onboard-toggle-row__text {
  min-width: 0;
}

.onboard-toggle-row__label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.onboard-toggle-row__hint {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.onboard-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.onboard-switch__track {
  display: block;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--switch-track);
  transition: background 0.2s ease;
  position: relative;
}

.onboard-switch__track::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.onboard-switch__input:checked + .onboard-switch__track {
  background: var(--accent);
}

.onboard-switch__input:checked + .onboard-switch__track::after {
  transform: translateX(18px);
}

.onboard-switch__input:focus-visible + .onboard-switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.onboard-portal-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.onboard-portal-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.onboard-portal-tile:hover {
  border-color: var(--muted);
  background: var(--surface-2);
}

.onboard-portal-tile:has(.onboard-switch__input:checked) {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.onboard-portal-tile__main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.onboard-portal-tile__logo-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
}

.onboard-portal-tile__logo-wrap--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--muted);
}

.onboard-portal-tile__logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.onboard-portal-tile__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.onboard-portal-tile__name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.onboard-portal-tile__url {
  font-size: 0.72rem;
  word-break: break-all;
}

.onboard-form__actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.onboard-form__errors {
  margin: 0 0 1rem;
}
