/* ========================================
   Rogue Cortex Developer Portal
   ======================================== */

/* --- Preview Gate --- */

.preview-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.preview-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px;
}

.preview-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 24px;
  font-size: 0.8125rem;
  color: #888888;
  border-top: 1px solid #ececec;
  background: #ffffff;
}

.preview-footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 0.9375rem;
}

.preview-footer a {
  color: #555555;
  text-decoration: none;
}

.preview-footer a:hover {
  color: #222222;
  text-decoration: underline;
}

.preview-footer-sep {
  color: #c8c8c8;
}

.preview-gate-box {
  background: #ffffff;
  border: 1px solid #d5d5d5;
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.preview-gate-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888888;
  margin-bottom: 32px;
}

.preview-gate-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.preview-gate-subtitle {
  font-size: 0.95rem;
  color: #555555;
  margin: 0 0 28px;
  line-height: 1.5;
}

.preview-gate-request {
  margin: 20px 0 0;
  font-size: 0.85rem;
  color: #555555;
}

.preview-gate-request a {
  color: inherit;
  font-weight: 600;
}

.preview-gate-error {
  background: #fff0f0;
  border: 1px solid #f5c2c2;
  border-radius: 6px;
  color: #c0392b;
  font-size: 0.875rem;
  padding: 10px 14px;
  margin-bottom: 20px;
}

.preview-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-gate-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  background: #f8f8f8;
  color: #222222;
  outline: none;
  transition: border-color 0.15s;
}

.preview-gate-input:focus {
  border-color: #222222;
  background: #ffffff;
}

.preview-gate-submit {
  width: 100%;
  padding: 12px;
  background: #222222;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.preview-gate-submit:hover {
  background: #444444;
}

/* --- Reset & Base --- */

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

body {
  margin: 0;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: #1a1a2e;
  background: #fafafa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: #4361ee;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; margin-top: 2rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }

code {
  background: #eef;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* --- Container --- */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Top Nav --- */

.preview-bar {
  background: #f5a623;
  color: #5a3600;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 0;
  width: 100%;
}

.top-nav {
  background: #1a1a2e;
  color: #fff;
  padding: 0 1.5rem;
}

.nav-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}
.brand-link img {
  filter: brightness(0) invert(1);
}
.brand-light {
  font-weight: 300;
  opacity: 0.75;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-links a {
  color: #ccc;
  font-size: 0.9rem;
  font-weight: 600;
}
.nav-links a:hover {
  color: #fff;
  text-decoration: none;
}

.nav-admin-link {
  color: #f7c948 !important;
}

.nav-button {
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}
.nav-button:hover {
  background: #333;
  color: #fff;
}

/* Public layout — light nav */
.public-layout .top-nav {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
}
.public-layout .brand-link {
  color: #1a1a2e;
}
.public-layout .brand-link img {
  filter: none;
}
.public-layout .brand-link:hover {
  color: #4361ee;
}
.public-layout .nav-links a {
  color: #444;
}
.public-layout .nav-links a:hover {
  color: #1a1a2e;
}
.public-layout .nav-links .btn-primary {
  color: #fff;
}
.public-layout .nav-links .btn-primary:hover {
  color: #fff;
}
.public-layout .nav-button {
  border-color: #ccc;
  color: #444;
}
.public-layout .nav-button:hover {
  background: #f0f0f5;
  color: #1a1a2e;
}

.nav-divider {
  color: #555;
}

/* Admin theme — black to distinguish from portal */
.admin-nav {
  background: #111;
  border-bottom: 3px solid #555;
}
.admin-nav .nav-links a {
  color: #eee;
}
.admin-nav .nav-links a:hover {
  color: #fff;
}
.admin-nav .brand-link {
  color: #fff;
}
.admin-nav .nav-button {
  color: #eee;
  border-color: #666;
}
.admin-nav .nav-button:hover {
  background: #333;
  color: #fff;
}
.admin-nav .nav-divider {
  color: #666;
}

.admin-layout {
  background: #f5f5f5;
}

.admin-layout .btn-primary {
  background: #333;
  color: #fff;
}
.admin-layout .btn-primary:hover {
  background: #111;
  color: #fff;
}

.admin-layout .btn-outline {
  border-color: #333;
  color: #333;
}
.admin-layout .btn-outline:hover {
  background: #333;
  color: #fff;
}

.admin-layout .btn-sm.btn-outline {
  border-color: #555;
  color: #555;
}
.admin-layout .btn-sm.btn-outline:hover {
  background: #333;
  color: #fff;
}

.admin-layout .stat-number {
  color: #111;
}
.admin-layout .stat-green { color: #2e7d32; }
.admin-layout .stat-red { color: #c62828; }

.admin-layout main a {
  color: #333;
}
.admin-layout main a:hover {
  color: #000;
}

.admin-layout .container {
  max-width: 1400px;
}

.admin-layout h1 { font-size: 1.5rem; }
.admin-layout h2 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
}
.admin-layout h3 { font-size: 1rem; }

/* Admin shell — left nav + content, same shape as portal account shell. */
.admin-shell .docs-content { font-size: 0.9rem; }

.portal-layout .container:has(.account-shell),
.portal-layout .container:has(.docs-layout),
.portal-layout .container:has(.guide-cards) {
  max-width: 1400px;
}

/* --- Flash messages --- */

.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.flash-notice {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-alert {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* --- Buttons --- */

.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
  border: 1.5px solid transparent;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: #4361ee;
  color: #fff;
}
.btn-primary:hover {
  background: #3651d4;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #4361ee;
  color: #4361ee;
}
.btn-outline:hover {
  background: #4361ee;
  color: #fff;
}

.btn-danger {
  background: #e63946;
  color: #fff;
}
.btn-danger:hover {
  background: #c5303c;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

/* --- Hero (public landing) --- */

.hero {
  position: relative;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  text-align: center;
  padding: 7.5rem 1.5rem;
  overflow: hidden;
}

.hero .hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.75rem;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #b0c4de;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.hero-actions .btn-outline {
  border-color: #fff;
  color: #fff;
}
.hero-actions .btn-outline:hover {
  background: #fff;
  color: #1a1a2e;
}

/* Light hero variant (public home) */
.hero-light {
  background: linear-gradient(135deg, #f0f2ff 0%, #e8ecff 50%, #dde4ff 100%);
  color: #1a1a2e;
}
.hero-light h1 {
  color: #1a1a2e;
}
.hero-light .hero-subtitle {
  color: #444;
}
.hero-light .hero-actions .btn-primary {
  background: #4361ee;
  border-color: #4361ee;
  color: #fff;
}
.hero-light .hero-actions .btn-outline {
  border-color: #4361ee;
  color: #4361ee;
}
.hero-light .hero-actions .btn-outline:hover {
  background: #4361ee;
  color: #fff;
}

/* --- Home sections --- */

.home-sections {
  padding: 0;
}

.home-section {
  padding: 4.5rem 1.5rem;
}

.home-section-alt {
  background: #f5f5fa;
}

.home-section-row {
  display: flex;
  align-items: center;
  gap: 3rem;
  max-width: 960px;
  margin: 0 auto;
}

.home-section-row-reverse {
  flex-direction: row-reverse;
}

.home-section-text {
  flex: 1;
}

.home-section-visual {
  flex: 0 0 320px;
}

.home-section-visual svg {
  width: 100%;
  height: auto;
  display: block;
}

.home-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #1a1a2e;
}

.home-section p {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #444;
}

@media (max-width: 700px) {
  .home-section-row,
  .home-section-row-reverse {
    flex-direction: column;
  }
  .home-section-visual {
    flex: none;
    width: 100%;
    max-width: 280px;
  }
}

/* --- Features grid --- */

.features {
  max-width: 960px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.features-cta {
  text-align: center;
  margin-top: 3rem;
}

.feature-card {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.feature-card h3 {
  color: #4361ee;
}

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

.auth-form-container {
  max-width: 460px;
  margin: 4rem auto;
  padding: 2.5rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.auth-form-container h2 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.form-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.form-fieldset legend {
  font-weight: 700;
  font-size: 0.9rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  width: 100%;
}

.auth-alt {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: #666;
}

/* --- Forms --- */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.form-group-inline label {
  display: inline-block;
  min-width: 160px;
  margin-bottom: 0;
}

.form-group-inline input[type="text"],
.form-group-inline input[type="email"],
.form-group-inline input[type="password"],
.form-group-inline input[type="date"],
.form-group-inline input[type="number"],
.form-group-inline select {
  width: 260px;
}

.form-group-inline input[type="checkbox"] {
  width: auto;
}

.form-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-check input[type="checkbox"] {
  width: auto;
}
.form-check label {
  display: inline;
  margin-bottom: 0;
}

.form-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.form-errors {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}
.form-errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

/* --- Data tables --- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.data-table thead {
  background: #f0f0f5;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  font-weight: 600;
  color: #555;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr {
  border-top: 1px solid #eee;
}

.data-table tbody tr:hover {
  background: #f9f9fc;
}

.data-table .actions {
  white-space: nowrap;
}
.data-table .actions > * + * {
  margin-left: 0.4rem;
}
.data-table .actions form {
  display: inline-block;
}

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

.detail-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 2rem;
}

.detail-card dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
}

.detail-card dt {
  font-weight: 600;
  color: #666;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.detail-card dd {
  margin: 0;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.card-actions form {
  display: inline;
}

/* --- Page header (title + action button) --- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  margin-bottom: 0;
}
/* Lets a title carry a caption underneath without pushing the header's action
   button onto its own line — the flex row still sees two children. */
.page-header__titles {
  min-width: 0;
}
/* A heading's own margins have to go: a flex item establishes its own
   formatting context, so an h2's margin-top would sit *inside* this wrapper and
   drop the heading out of line with the button instead of spacing the section.
   .page-header--section carries that spacing instead. */
.page-header__titles h1,
.page-header__titles h2,
.page-header__titles h3 {
  margin: 0;
}
.page-header--section {
  margin-top: 2rem;
}
.page-caption {
  margin: 0.35rem 0 0;
  max-width: 60ch;
  color: #6b7280;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* --- Stats grid (admin dashboard) --- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.stat-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: #4361ee;
}

.stat-green { color: #2e7d32; }
.stat-red { color: #c62828; }

.stat-label {
  display: block;
  color: #666;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

/* --- Badges --- */

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-doc      { background: #e8f5e9; color: #2e7d32; }
.badge-owner    { background: #ede7f6; color: #4527a0; }
.badge-member   { background: #f0f0f5; color: #555; }
.badge-active   { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #fce4ec; color: #c62828; }
.badge-admin    { background: #fff3e0; color: #e65100; }
.badge-support  { background: #e3f2fd; color: #1565c0; }
.badge-staff-member { background: #ede7f6; color: #4527a0; }

.data-table tr.row-highlight > td { background: #fff8e1; }

/* Drop zone for package version uploads. */
.upload-dropzone {
  display: block;
  border: 2px dashed #bdbdbd;
  border-radius: 8px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}
.upload-dropzone:hover,
.upload-dropzone:focus-within {
  border-color: #1565c0;
  background: #f0f7ff;
}
.upload-dropzone.is-dragover {
  border-color: #1565c0;
  background: #e3f2fd;
}
.upload-dropzone-primary { font-weight: 600; }
.upload-dropzone-hint    { color: #666; font-size: 0.85rem; margin-top: 0.35rem; }
.upload-dropzone input[type="file"] { display: none; }

/* Compact dropzone variant used in the batch "new version" per-package rows. */
.upload-dropzone-sm { padding: 0.85rem 1rem; }
.upload-dropzone-sm .upload-dropzone-primary { font-weight: 500; font-size: 0.9rem; }

/* Batch new-version form: shared fields + one upload cell per package. */
.batch-version-shared {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.batch-version-shared .form-group { margin-bottom: 0; }
.batch-version-actions { margin-top: 1.5rem; }

.batch-pkg-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.batch-pkg-row .pkg-main { flex: 1 1 40%; min-width: 0; }
.batch-pkg-row .batch-pkg-upload { flex: 1 1 55%; }
.batch-row-status { font-size: 0.85rem; margin-top: 0.35rem; }
.batch-row-status[data-level="error"] { color: #c62828; }
.batch-row-status[data-level="warn"]  { color: #ef6c00; }
.batch-row-status[data-level="success"] { color: #2e7d32; }

/* Per-version "folder" view below the packages board. */
.pkg-versions-panel { margin-top: 2.5rem; }
.pkg-versions-title { margin-bottom: 0.25rem; }

.version-folder {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 0.6rem;
}
.version-folder-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  list-style: none;
}
.version-folder-summary::-webkit-details-marker { display: none; }
.version-folder-summary:hover { background: #fafafa; }
.version-folder-caret {
  color: #888;
  transition: transform 0.15s;
  display: inline-block;
}
.version-folder[open] > .version-folder-summary > .version-folder-caret { transform: rotate(90deg); }
.version-folder-name code { font-size: 0.95rem; }
.version-folder-date { margin-left: auto; font-size: 0.85rem; }

.version-folder-list {
  list-style: none;
  margin: 0;
  padding: 0 1rem 0.5rem;
  border-top: 1px solid #eee;
}
.version-folder-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f2f2f2;
}
.version-folder-item:last-child { border-bottom: none; }
.version-folder-item .pkg-main { flex: 1 1 40%; min-width: 0; }
.version-folder-item .pkg-meta { display: flex; align-items: center; gap: 1rem; }
.version-folder-nofile { font-style: italic; }

.upload-current {
  background: #f5f5f7;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.upload-current p { margin: 0.25rem 0; font-size: 0.9rem; }
.upload-current code { font-size: 0.8rem; word-break: break-all; }

/* Daily downloads bar chart on admin/packages/show */
.download-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding: 0.5rem 0;
  border-bottom: 1px solid #ddd;
  margin: 1rem 0 0.25rem;
}
.download-bar {
  flex: 1;
  min-width: 6px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  height: 100%;
}
.download-bar-fill {
  background: #1565c0;
  border-radius: 2px 2px 0 0;
  min-height: 1px;
  transition: background 0.15s;
}
.download-bar-fill.is-zero { background: #ddd; }
.download-bar:hover .download-bar-fill { background: #0d47a1; }
.download-chart-labels {
  display: flex;
  gap: 3px;
  margin-bottom: 1.5rem;
  font-size: 0.7rem;
  color: #666;
}
.download-chart-labels span { flex: 1; min-width: 6px; text-align: center; }

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

.package-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.package-header h3 {
  margin: 0;
}

.package-actions {
  margin-top: 0.75rem;
}

/* --- Portal downloads: grouped package sections --- */

.dl-group {
  margin-bottom: 2.5rem;
}
.dl-group-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid #e6e6ef;
}
/* The group title anchors each section — override the shell's top padding so
   the border sits tight against it. */
.account-shell .docs-content .dl-group-title {
  margin: 0;
  padding-top: 0;
}
.dl-group-count {
  font-size: 0.72rem;
  color: #666;
  background: #f0f0f5;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.dl-group-desc {
  margin: 0.5rem 0 0;
  color: #666;
  font-size: 0.85rem;
}

.dl-packages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.dl-package {
  background: #fff;
  border: 1.5px solid #e6e6ef;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.dl-package-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.account-shell .docs-content .dl-package-name {
  margin: 0;
  font-size: 1.05rem;
}
.dl-package-slug {
  font-size: 0.72rem;
  color: #888;
  background: #f5f5fa;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.dl-package-latest {
  margin-left: auto;
  font-size: 0.78rem;
  color: #666;
}
.dl-package-desc {
  margin: 0.5rem 0 0;
  color: #555;
  font-size: 0.88rem;
}
.dl-versions {
  margin-top: 0.9rem;
}
.dl-package-empty {
  margin: 0.75rem 0 0;
  color: #888;
  font-size: 0.85rem;
  font-style: italic;
}
.wizard-params {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.6rem;
}
.wizard-param {
  display: grid;
  grid-template-columns: minmax(12rem, max-content) 8rem;
  align-items: center;
  gap: 0.25rem 0.75rem;
  font-weight: normal;
}
.wizard-param__hint {
  grid-column: 1 / -1;
  font-size: 0.8rem;
}
@media (max-width: 600px) {
  .wizard-param { grid-template-columns: 1fr; }
}
.dl-withdrawn-reason {
  font-size: 0.8rem;
  margin-top: 0.2rem;
  max-width: 32rem;
}

/* --- Status bar --- */

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0f0f5;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  gap: 1rem;
}

.status-bar-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-green { background: #2e7d32; }
.status-dot-red { background: #c62828; }

/* --- Inline form (admin add package) --- */

.inline-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.form-select-inline {
  padding: 0.4rem 0.6rem;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}

/* --- Misc --- */

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.callout {
  background: #e3f2fd;
  border-left: 4px solid #4361ee;
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1.5rem;
}
.callout p { margin: 0; }
.callout-danger {
  background: #fdecec;
  border-left-color: #e5484d;
  color: #7a1f22;
}

.empty-state {
  color: #888;
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

.text-muted {
  color: #888;
  font-size: 0.85rem;
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

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

.docs-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.docs-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
}

.docs-sidebar-group {
  margin-bottom: 1.5rem;
}

.docs-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 0.5rem;
}

.docs-sidebar-link {
  display: block;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  color: #555;
  border-radius: 4px;
}
.docs-sidebar-link:hover {
  background: #f0f0f5;
  text-decoration: none;
  color: #1a1a2e;
}
.docs-sidebar-link.active {
  background: #4361ee;
  color: #fff;
}
.docs-sidebar-link.active:hover {
  background: #3651d4;
}

.docs-sidebar-link-sub {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: #777;
}

.docs-toc {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.docs-toc-link {
  display: block;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  color: #888;
}
.docs-toc-link:hover {
  color: #4361ee;
  text-decoration: none;
}
.docs-toc-h3 {
  padding-left: 1.25rem;
}

.docs-content {
  flex: 1;
  min-width: 0;
}

/* Total saved line — highlighted so the savings stand out */
.buy-license-summary .total-saved-row dt,
.buy-license-summary .total-saved-row dd {
  color: #2e7d32;
  font-weight: 600;
}

/* Renewal info below "Total today" when a subscription is selected */
.buy-license-renewal {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid #eee;
  font-size: 0.85rem;
  color: #555;
  text-align: center;
}
.buy-license-renewal strong { color: #1a1a2e; font-weight: 600; }

.buy-license-summary .btn-block {
  margin-top: 0.75rem;
}
.buy-license-summary .btn-block[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.buy-license-terms {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: #555;
  line-height: 1.4;
  cursor: pointer;
}
.buy-license-terms input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.buy-license-terms a { color: #4361ee; }

/* Terms acceptance on the signup and invitation forms. */
.form-terms {
  margin-top: 1.25rem;
}
.terms-accept {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #555;
  line-height: 1.45;
  cursor: pointer;
}
.terms-accept input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.terms-accept a { color: #4361ee; }

/* Legal documents rendered from docs/legal/*.md */
.legal-document {
  max-width: 760px;
  margin: 0 auto;
}
.legal-document-header { margin-bottom: 1.5rem; }
.legal-document-body h1 { font-size: 1.75rem; margin-top: 0; }
.legal-document-body h2 { font-size: 1.25rem; margin-top: 1.75rem; }
.legal-document-body h3 { font-size: 1.05rem; margin-top: 1.25rem; }
.legal-document-body p,
.legal-document-body li { font-size: 0.95rem; line-height: 1.6; }

/* Strikethrough list price next to discounted price */
.unit-price-list {
  text-decoration: line-through;
  color: #999;
  margin-right: 0.4rem;
  font-size: 0.85em;
  font-weight: 400;
}

/* Company discount banner above plan picker */
.company-discount-banner {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #1b5e20;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.company-discount-banner strong {
  font-weight: 700;
}

/* Admin: company-wide discount inline form */
.company-discount-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0.85rem 1.1rem;
  background: #f5f7ff;
  border: 1px solid #dfe4ff;
  border-radius: 8px;
  font-size: 0.95rem;
}
.company-discount-form .company-discount-label,
.company-discount-form .company-discount-input,
.company-discount-form .company-discount-suffix,
.company-discount-form .company-discount-help,
.company-discount-form .btn {
  font-size: 0.95rem;
  line-height: 1.4;
}
.company-discount-form .company-discount-label {
  font-weight: 600;
  margin: 0;
}
.company-discount-form .company-discount-input {
  width: 80px;
  padding: 0.45rem 0.6rem;
}
.company-discount-form .company-discount-suffix {
  color: #555;
  margin-right: 0.25rem;
}
.company-discount-form .btn {
  padding: 0.45rem 1rem;
}
.company-discount-form .company-discount-help {
  font-size: 0.8rem;
  color: #777;
  margin-left: auto;
}

/* Buy Licenses */
.buy-license-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}
.buy-license-plans {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.buy-license-plan-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1.5px solid #e5e5ec;
  border-radius: 8px;
  cursor: pointer;
}
.buy-license-plan-blurb {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}
.buy-license-plan-card.selected {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}
.buy-license-plan-card input[type="radio"],
.buy-license-maint-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.buy-license-plan-name { font-weight: 600; }
.buy-license-plan-blurb { font-size: 0.85rem; color: #666; }
.buy-license-plan-price { font-weight: 700; }
.buy-license-plan-unit { font-size: 0.8rem; color: #888; font-weight: 400; }
.buy-license-summary {
  background: #fff;
  padding: 1.25rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.buy-license-summary dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}
.buy-license-summary dt { color: #666; }
.buy-license-summary dd { margin: 0; text-align: right; }
.buy-license-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
  margin-bottom: 1rem;
}
.buy-license-total strong { font-size: 1.25rem; }
.btn-block { display: block; width: 100%; text-align: center; }

.buy-license-help {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 0.75rem;
}

.buy-license-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.buy-license-tiers-card {
  background: #fafafa;
  border: 1px solid #ececf2;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  color: #555;
}
.buy-license-tiers-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 0.4rem;
}
.buy-license-tiers {
  width: 100%;
  border-collapse: collapse;
}
.buy-license-tiers td {
  padding: 0.15rem 0;
}
.buy-license-tiers td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.buy-license-tiers tr.tier-active {
  font-weight: 600;
  color: #1a1a2e;
}
.buy-license-tiers-beaten {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #1b5e20;
}
.buy-license-tiers-note {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #888;
}

.buy-license-summary {
  font-size: 1rem;
}
.buy-license-summary h2 {
  font-size: 1.15rem;
}

.buy-license-maint-toggle {
  position: relative;
  display: grid;
  /* checkbox | name + blurb | price */
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1.5px solid #e5e5ec;
  border-radius: 8px;
  cursor: pointer;
}
.buy-license-maint-toggle.selected {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}
/* The box is shown rather than hidden behind the card: the outline says which
   state you are in, the checkbox says it is yours to change. */
.buy-license-maint-toggle input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: #4361ee;
  cursor: pointer;
}
.buy-license-maint-toggle:focus-within {
  border-color: #4361ee;
}
.buy-license-maint-name { font-weight: 600; }
.buy-license-maint-blurb { font-size: 0.85rem; color: #666; }
.buy-license-maint-price { font-weight: 700; }
.buy-license-disclaimer {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: #888;
  text-align: center;
}
@media (max-width: 800px) {
  .buy-license-layout { grid-template-columns: 1fr; }
}

.stripe-link code {
  color: #635bff;
}
.stripe-link:hover code {
  text-decoration: underline;
}

.sortable-header {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.sortable-header:hover {
  color: #4361ee;
  text-decoration: none;
}
.sortable-header.is-active {
  color: #4361ee;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.pagination-info {
  font-size: 0.85rem;
  color: #666;
}

/* Subscription cards */
.subscription-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.subscription-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.subscription-card-title {
  font-weight: 600;
  font-size: 1.05rem;
}
.subscription-card-meta {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}
.subscription-card-price {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: right;
  white-space: nowrap;
}
.subscription-card-price-unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: #888;
  display: block;
}
.subscription-card-stats {
  display: flex;
  gap: 2rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}
.subscription-card-stats > div { margin: 0; }
.subscription-card-stats dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 0.2rem;
}
.subscription-card-stats dd { margin: 0; font-size: 0.95rem; }
.subscription-card-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #4361ee;
  margin-bottom: 0.5rem;
}
.subscription-card-details summary:hover { text-decoration: underline; }
.subscription-card-empty {
  font-size: 0.85rem;
  color: #888;
  margin: 0.5rem 0 1rem;
}
.data-table-compact th,
.data-table-compact td {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}
.subscription-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}
.subscription-card-actions .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Inactive buttons read as disabled everywhere. */
.btn[disabled],
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.count-muted {
  color: #888;
  font-weight: 400;
  font-size: 0.85em;
}

.license-group-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}
.license-group-header code {
  background: #f0f0f5;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.95rem;
}
.license-group-count {
  font-size: 0.8rem;
  font-weight: 400;
  color: #888;
}

/* Account dashboard cards */
.account-dashboard-company {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.account-dashboard-company-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.account-dashboard-company-header h2 {
  margin: 0;
  padding: 0;
  border: none;
}
.account-dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.account-stat-card {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
}
.account-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: #1a1a2e;
}
.account-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-top: 0.25rem;
}
@media (max-width: 600px) {
  .account-dashboard-stats { grid-template-columns: 1fr; }
}

/* Account dashboard — tighter typography than docs */
.account-shell .docs-content { font-size: 0.9rem; }
.account-shell .docs-content h1 { font-size: 1.5rem; }
.account-shell .docs-content h2 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
}
.account-shell .docs-content h3 { font-size: 1rem; }
.account-shell .docs-content .detail-card dt { font-size: 0.8rem; }
.account-shell .docs-content .detail-card dd { font-size: 0.9rem; }

/* Markdown rendered content */
.docs-content h1 { margin-top: 0; }
.docs-content h2 {
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}
.docs-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

.docs-content pre {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

.docs-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.docs-content table th,
.docs-content table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  text-align: left;
  font-size: 0.9rem;
}
.docs-content table th {
  background: #f0f0f5;
  font-weight: 600;
}

.docs-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border-radius: 6px;
}

/* Guide cards */
.guide-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.guide-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow-wrap: break-word;
  word-break: break-word;
}
.guide-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.guide-card p {
  color: #666;
  font-size: 0.9rem;
  margin: 0;
}

/* --- Configuration editor --- */


/* --- JSON editor: gutter + coloured overlay + live verdict --- */

.json-editor {
  border-radius: 6px;
  overflow: hidden;
  background: #1a1a2e;
}

/* The height lives here, on the flex container, and nowhere else.

   Put it on __body instead and the gutter — which has no height of its own and
   renders one span per line — sets the flex line's cross size to its full
   content height. The frame then grows to the line count while __body stays
   put, and the text ends up in a short scrolling box at the top of a tall dark
   one, like an iframe. With the height here, both children stretch to it and
   the gutter's overflow does the clipping. */
.json-editor__frame {
  display: flex;
  align-items: stretch;
  height: 26rem;
}

/* Both boxes must agree on every metric that affects where a glyph lands, or
   the overlay drifts out from under the caret. Change these together.

   The selector is doubled on purpose. The editor sits inside a .form-group, and
   `.form-group textarea` (0-1-1) outranks a lone `.json-editor__ink` (0-1-0) —
   it would hand the textarea `font-family: inherit` (a proportional face!), a
   different size, different padding and a border, while the <pre> underneath
   kept monospace. The two layers then drift further apart along every line.
   Keep both classes, and keep re-declaring the properties that rule sets. */
.json-editor .json-editor__ink {
  margin: 0;
  border: 0;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  tab-size: 2;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
  border-radius: 0;

  /* Everything below shifts where a glyph lands. Declared explicitly — not
     left to inherit — so an ambient form or layout rule can't move one layer
     without moving the other. */
  font-weight: 400;
  font-style: normal;
  font-variant-ligatures: none;
  letter-spacing: normal;
  word-spacing: normal;
  text-indent: 0;
  text-transform: none;
  text-rendering: auto;
}

/* .form-group textarea:focus paints a border colour and a ring, which would
   sit over the overlay and move the text. The frame shows focus instead. */
.json-editor .json-editor__input:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}
.json-editor:focus-within {
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.json-editor__gutter {
  flex: 0 0 auto;
  padding: 1rem 0.75rem 1rem 1rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  text-align: right;
  color: #4a4a68;
  background: #16162a;
  user-select: none;
  overflow: hidden;
  min-width: 3ch;
  height: 100%;
}
.json-editor__line {
  display: block;
}
.json-editor__line.is-error {
  color: #fff;
  background: #e5484d;
  border-radius: 3px;
  padding: 0 0.35rem;
  margin: 0 -0.35rem;
  font-weight: 700;
}

.json-editor__body {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
}

.json-editor .json-editor__highlight,
.json-editor .json-editor__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.json-editor__highlight {
  overflow: hidden;
  color: #e0e0e0;
  pointer-events: none;
}

/* Readable on its own: without JavaScript the overlay stays empty, so the
   textarea keeps its own text and this degrades to the plain editor it was.
   The controller adds .is-enhanced once it connects, and only then does the
   text hand over to the coloured layer underneath. */
.json-editor .json-editor__input {
  background: transparent;
  color: #e0e0e0;
  caret-color: #e0e0e0;
  resize: none;
  overflow: auto;
  outline: none;
}
.json-editor.is-enhanced .json-editor__input {
  color: transparent;
}
.json-editor.is-enhanced .json-editor__input::selection {
  background: rgba(67, 97, 238, 0.45);
  color: transparent;
}

.json-editor__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: #16162a;
  border-top: 1px solid #26263f;
}

.json-editor__status {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.78rem;
  color: #9aa0b5;
}
.json-editor__status[data-state="valid"]   { color: #98c379; }
.json-editor__status[data-state="invalid"] { color: #ff7b72; font-weight: 600; }

.json-editor__repair[hidden] {
  display: none;
}

.json-editor__banner {
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.json-editor__banner ul {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
}
.json-editor__banner--error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}
.json-editor__banner--fixed {
  background: #e8f5e9;
  border: 1px solid #c3e6cb;
  color: #1b5e20;
}

/* JSON tokens, sharing the One Dark palette used by the API reference. */
.json-editor__highlight .syn-key     { color: #61afef; }
.json-editor__highlight .syn-string  { color: #98c379; }
.json-editor__highlight .syn-number  { color: #d19a66; }
.json-editor__highlight .syn-literal { color: #c678dd; }
.json-editor__highlight .syn-punct   { color: #abb2bf; }

.config-editor {
  width: 100%;
  min-height: 400px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  background: #1a1a2e;
  color: #e0e0e0;
  border: none;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  tab-size: 2;
  resize: vertical;
}
.config-editor:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.config-preview pre {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}
.config-preview pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.page-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Secondary line beneath a table cell's primary value (e.g. a slug under a name). */
.cell-subtext {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: #8a8a99;
}

/* Signed-license (JWT) display — wrap the long token instead of overflowing. */
.token-block {
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 9rem;
  overflow: auto;
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.5;
}
.token-block code {
  background: none;
  padding: 0;
  color: inherit;
}

/* --- Configuration content: tabs + block diagram --- */

.config-content {
  margin-bottom: 1.5rem;
}

.config-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid #e6e6ef;
  margin-bottom: 1rem;
}
.config-tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 1rem;
  margin-bottom: -1px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
}
.config-tab:hover {
  color: #1a1a2e;
}
.config-tab.is-active {
  color: #4361ee;
  border-bottom-color: #4361ee;
}

.cfg-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

/* Diagram toolbar: a permanent row of block-adding tools above the diagram,
   distinct from .cfg-toolbar (expand/collapse), which sits inside it. */
.cfg-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  margin-bottom: 1rem;
  background: #f7f7fb;
  border: 1px solid #e6e6ef;
  border-radius: 6px;
}
.cfg-tools:empty {
  display: none;
}

/* A tool and the sub-toolbar that drops open under it. */
.cfg-tool {
  position: relative;
}
.cfg-tool__button[aria-expanded="true"] {
  background: #4361ee;
  border-color: #4361ee;
  color: #fff;
}
.cfg-tool__menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 17rem;
  max-height: 24rem;
  overflow-y: auto;
  padding: 0.3rem;
  background: #fff;
  border: 1px solid #e1e1ee;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(26, 26, 46, 0.14);
}
.cfg-tool__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: none;
  border: 0;
  border-radius: 4px;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  color: #1a1a2e;
  cursor: pointer;
}
.cfg-tool__option:hover,
.cfg-tool__option:focus-visible {
  background: #eef1fe;
  outline: none;
}
.cfg-tool__option.is-draft {
  color: #6b7280;
}
.cfg-badge--draft {
  margin-left: auto;
  background: #fff4e5;
  border-color: #ffd9a8;
  color: #9a5b00;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Sits in a block's header, which is itself a button — hence the stopPropagation
   in the controller, so removing a block doesn't also collapse it on the way out. */
.cfg-block__delete {
  appearance: none;
  margin-left: auto;
  padding: 0 0.4rem;
  background: none;
  border: 0;
  border-radius: 4px;
  color: #9aa0b5;
  font-size: 0.85rem;
  line-height: 1.6;
  cursor: pointer;
}
.cfg-block__delete:hover,
.cfg-block__delete:focus-visible {
  background: #e5484d;
  color: #fff;
  outline: none;
}

/* Brief highlight so a newly added block is findable in a long diagram. */
.cfg-block.is-new {
  animation: cfg-block-in 1.2s ease-out;
}
@keyframes cfg-block-in {
  from { box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.45); }
  to   { box-shadow: 0 0 0 3px rgba(67, 97, 238, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .cfg-block.is-new { animation: none; }
}

.cfg-toolbar {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}
.cfg-toolbar__btn {
  appearance: none;
  background: #ffffff;
  border: 1px solid #e1e1ee;
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #4361ee;
  cursor: pointer;
}
.cfg-toolbar__btn:hover {
  background: #f2f4fd;
}

.cfg-top {
  margin-bottom: 1rem;
}

.cfg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
  align-items: start;
}

.cfg-block {
  border: 1px solid #e1e1ee;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}
/* Three sibling controls, not one button: the caret collapses, the title
   selects, the cross removes. They only look like a single bar. */
.cfg-block__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(180deg, #f7f8ff, #eef1fd);
  border: 0;
  border-bottom: 1px solid #e1e1ee;
  font: inherit;
  text-align: left;
}
.cfg-block__select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cfg-block__select:focus-visible {
  outline: 2px solid #4361ee;
  outline-offset: 2px;
  border-radius: 3px;
}
.cfg-block.is-collapsed .cfg-block__header {
  border-bottom-color: transparent;
}
.cfg-block__caret {
  appearance: none;
  flex: 0 0 auto;
  padding: 0 0.15rem;
  background: none;
  border: 0;
  border-radius: 3px;
  font: inherit;
  font-size: 0.7rem;
  color: #8a8a99;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.cfg-block__caret:hover,
.cfg-block__caret:focus-visible {
  color: #1a1a2e;
  background: rgba(67, 97, 238, 0.12);
  outline: none;
}

/* Services are software rather than hardware — give them their own accent the
   same way identity has one: header and outline only, body stays white.
   Violet, because identity is already green and the two must stay tellable
   apart at a glance. */
.cfg-block--service {
  border-color: #c4b5fd;
}
.cfg-block--service > .cfg-block__header {
  background: linear-gradient(180deg, #f5f3ff, #ede9fe);
  border-bottom-color: #c4b5fd;
}
.cfg-block--service.is-collapsed > .cfg-block__header {
  border-bottom-color: transparent;
}
.cfg-block--service > .cfg-block__header .cfg-block__title {
  color: #5b21b6;
}
.cfg-block--service > .cfg-block__header .cfg-badge--type {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #5b21b6;
}
.cfg-block--service.is-selected {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.35);
}
.cfg-block--service.is-selected > .cfg-block__header {
  background: linear-gradient(180deg, #ede9fe, #ddd6fe);
}

/* A selected block stays marked while you edit it — the ring survives redraws. */
.cfg-block.is-selected {
  border-color: #4361ee;
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.35);
}
.cfg-block.is-selected > .cfg-block__header {
  background: linear-gradient(180deg, #e8ecff, #dbe2fd);
}
.cfg-block.is-collapsed .cfg-block__caret {
  transform: rotate(-90deg);
}
.cfg-block.is-collapsed .cfg-block__body {
  display: none;
}
.cfg-block__title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1a1a2e;
}
.cfg-block__body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.cfg-block .cfg-block {
  background: #fafaff;
}
.cfg-block .cfg-block__header {
  background: #f2f4fd;
}

.cfg-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.3rem 0.85rem;
}
/* The identity block holds long values (UUID, names) — keep it one column. */
.cfg-block[data-key="identity"] > .cfg-block__body > .cfg-fields {
  grid-template-columns: 1fr;
}

/* Identity is the vehicle's special root block — give it a distinct accent. */
.cfg-block[data-key="identity"] {
  border-color: #9bd9c5;
}
.cfg-block[data-key="identity"] > .cfg-block__header {
  background: linear-gradient(180deg, #ecfdf5, #d6f3e7);
  border-bottom-color: #9bd9c5;
}
.cfg-block[data-key="identity"].is-collapsed > .cfg-block__header {
  border-bottom-color: transparent;
}
.cfg-block[data-key="identity"] > .cfg-block__header .cfg-block__title {
  color: #0f766e;
}
.cfg-field {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  min-width: 0;
}
.cfg-field__key {
  color: #6b7280;
  white-space: nowrap;
}
.cfg-field__val {
  color: #1a1a2e;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
  text-align: right;
}

.cfg-badge {
  margin-left: auto;
  background: #e7ebfd;
  color: #4361ee;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}
.cfg-badge--type {
  background: #1a1a2e;
  color: #ffffff;
}

.cfg-note {
  margin: 0;
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.4;
  color: #8a8a99;
}
.cfg-field--note {
  background: #f7f7fb;
  border-left: 2px solid #d9dcec;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
}

/* API reference */
/* --- Portal hero banner --- */

.portal-hero {
  position: relative;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  text-align: center;
  padding: 10rem 1.5rem;
  width: 100%;
  overflow: hidden;
}

.portal-hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.portal-hero-content {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.portal-hero-content * {
  pointer-events: auto;
}

.portal-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.portal-hero-subtitle {
  font-size: 1.15rem;
  color: #b0c4de;
  max-width: 550px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.portal-hero-subtitle strong {
  color: #fff;
}

/* --- Portal dashboard cards --- */

.portal-cards {
  position: relative;
}

.portal-card {
  padding: 4rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.portal-card::before {
  content: "";
  position: absolute;
  top: -3rem;
  left: -5%;
  right: -5%;
  height: 6rem;
  background: inherit;
  z-index: 0;
}

.portal-card-left {
  background: #f8f9ff;
}
.portal-card-left::before {
  background: #f8f9ff;
  transform: rotate(-2deg);
}

.portal-card-right {
  background: #fff;
}
.portal-card-right::before {
  background: #fff;
  transform: rotate(2deg);
}

.portal-card-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.portal-card-text {
  flex: 1;
}

.portal-card-text h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.75rem;
}

.portal-card-text p {
  font-size: 1rem;
  line-height: 1.7;
  color: #444;
  margin-bottom: 1.5rem;
}

.portal-card-visual {
  flex: 0 0 280px;
}

.portal-card-visual svg {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 700px) {
  .portal-card-inner {
    flex-direction: column;
  }
  .portal-card-visual {
    flex: none;
    width: 100%;
    max-width: 260px;
  }
}

@media (max-width: 600px) {
  .portal-hero h1 {
    font-size: 1.75rem;
  }
}

/* --- API module description --- */

.guides-intro {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #555;
  max-width: 720px;
  margin-bottom: 2rem;
}

.api-module-desc {
  color: #666;
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.api-entry {
  margin-bottom: 2rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}
.api-entry:first-child {
  padding-top: 0;
}
.api-entry:last-child,
.api-entry:has(+ h2) {
  border-bottom: none;
}
.api-entry .api-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.api-signature {
  background: #1a1a2e;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  overflow-x: auto;
}
.api-signature code {
  background: none;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.api-returns {
  font-size: 0.9rem;
  color: #555;
}
.api-returns code {
  background: none;
  padding: 0;
}

.api-params {
  margin: 0.75rem 0;
}
.api-params code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

.api-include {
  background: #1a1a2e;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  margin-bottom: 2rem;
}
.api-include code {
  background: none;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.api-details {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #555;
  margin: 0.5rem 0;
}

.api-note {
  background: #fff8e1;
  border-left: 3px solid #f9a825;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #5d4037;
  border-radius: 0 4px 4px 0;
  overflow: visible;
}

.api-available-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: #e3f2fd;
  color: #1565c0;
  margin-bottom: 0.75rem;
}

.api-available-upcoming {
  background: #fce4ec;
  color: #c62828;
}

/* --- Syntax highlighting (API signatures) --- */

.syn-keyword  { color: #c678dd; }                          /* purple — keywords */
.syn-type     { color: #61afef; }                          /* blue — types */
.syn-func     { color: #e5c07b; }                          /* gold — function names */
.syn-param    { color: #e06c75; }                          /* red-ish — parameter names */
.syn-arrow    { color: #56b6c2; }                          /* cyan — -> arrow */
.syn-paren    { color: #abb2bf; }                          /* light grey — parentheses */
.syn-bracket  { color: #abb2bf; }                          /* light grey — < > */
.syn-punct    { color: #abb2bf; }                          /* light grey — , ; = */

/* Code block tokens (dark background) */
.syn-comment   { color: #7f848e; font-style: italic; }    /* grey — comments */
.syn-string    { color: #98c379; }                         /* green — strings */
.syn-number    { color: #d19a66; }                         /* orange — numbers */
.syn-directive { color: #c678dd; }                         /* purple — preprocessor */

/* In tables (light background), use darker shades */
.data-table .syn-keyword  { color: #8839be; }
.data-table .syn-type     { color: #2a6fad; }
.data-table .syn-func     { color: #986801; }
.data-table .syn-param    { color: #c24a52; }
.data-table .syn-arrow    { color: #0e7e8c; }

/* --- Footer --- */

.site-footer {
  padding: 32px 0 24px;
  border-top: 1px solid #d5d5d5;
  background: #e6e6e6;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  justify-content: center;
  gap: 48px;
  width: min(1200px, 92vw);
  margin: 0 auto 24px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  margin-bottom: 4px;
}

.footer-col-title-admin {
  color: #8b1a1a;
}

.footer-col a {
  color: #222;
  text-decoration: none;
  font-size: 0.95rem;
}

.footer-col a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-copy {
  text-align: center;
  font-size: 0.85rem;
  color: #888;
  border-top: 1px solid #d5d5d5;
  padding-top: 20px;
}

.admin-footer {
  background: #111;
  border-top: 1px solid #333;
}

.admin-footer .footer-col-title {
  color: #777;
}

.admin-footer .footer-col-title-admin {
  color: #d45555;
}

.admin-footer .footer-col a {
  color: #aaa;
}

.admin-footer .footer-col a:hover {
  color: #fff;
}

.admin-footer .footer-copy {
  color: #555;
  border-top-color: #333;
}

/* Portal footer — dark blue */
.portal-layout .site-footer {
  background: #1a1a2e;
  border-top: 1px solid #2a2a4a;
}
.portal-layout .footer-col-title {
  color: #8888aa;
}
.portal-layout .footer-col-title-admin {
  color: #f7c948;
}
.portal-layout .footer-col a {
  color: #b0b8d0;
}
.portal-layout .footer-col a:hover {
  color: #fff;
}
.portal-layout .footer-copy {
  color: #666888;
  border-top-color: #2a2a4a;
}

/* --- Responsive --- */

@media (max-width: 640px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 0.75rem 0;
    gap: 0.5rem;
  }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  .detail-card dl {
    grid-template-columns: 1fr;
  }
  .footer-inner {
    flex-wrap: wrap;
    gap: 24px 36px;
    padding: 0 1.5rem;
  }
  .docs-layout {
    flex-direction: column;
  }
  .docs-sidebar {
    width: 100%;
    position: static;
  }
}

/* Cookie consent banner — fixed at bottom until accepted */
.cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 1000;
  background: #1a1a2e;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.cookie-banner-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  flex: 1;
  min-width: 240px;
}
.cookie-banner-text a {
  color: #9bb0ff;
  text-decoration: underline;
}
.cookie-banner-text a:hover { color: #fff; }
.cookie-banner .btn { flex-shrink: 0; }

/* Support ticket thread */
.support-thread {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0.5rem 0 1.5rem;
}
.support-message {
  padding: 0.9rem 1.1rem 0.9rem 1.25rem;
  border-radius: 8px;
  border: 1px solid #ececf2;
  background: #fff;
  border-left-width: 4px;
}
.support-message.from-customer {
  background: #f0fdf4;        /* light green */
  border-color: #d9f0e0;
  border-left-color: #2e7d32; /* green accent */
}
.support-message.from-support {
  background: #f5f7ff;        /* light blue */
  border-color: #dfe4ff;
  border-left-color: #4361ee; /* brand blue accent */
}
.support-message.from-customer .support-message-head strong { color: #1b5e20; }
.support-message.from-support  .support-message-head strong { color: #1a1a2e; }
.support-message-head {
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}
.support-message-body {
  font-size: 0.95rem;
  line-height: 1.55;
}
.support-message-body p { margin: 0 0 0.5rem; }
.support-message-body p:last-child { margin: 0; }

.form-hint {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: #555;
}

/* Per-company sub-menu in the portal sidebar */
.sidebar-company {
  margin: 0.1rem 0;
}
.sidebar-company-header {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.sidebar-company-link { flex: 1; }
.sidebar-company-caret {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-size: 0.65rem;
  line-height: 1;
  transition: transform 0.15s ease-out, color 0.15s;
}
.sidebar-company-caret:hover { color: #1a1a2e; }
.sidebar-company:not(.is-open) .sidebar-company-caret { transform: rotate(-90deg); }
.sidebar-company-body[hidden] { display: none; }

/* --- Admin package groups (vertical drag-and-drop board) --- */

.pg-hint {
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
}

.pg-board {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pg-section {
  background: #fff;
  border: 1.5px solid #e6e6ef;
  border-radius: 10px;
  padding: 1rem 1.15rem 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.pg-section.is-drop-target {
  border-color: #4361ee;
  border-style: dashed;
  background: #f5f7ff;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
}

.pg-section-head {
  margin-bottom: 0.5rem;
}
.pg-section-titlebar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.pg-section-title {
  margin: 0;
  font-size: 1.1rem;
}
.group-slug {
  font-size: 0.75rem;
  color: #555;
  background: #f0f0f5;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.pg-count {
  font-size: 0.78rem;
  color: #777;
  background: #f0f0f5;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.pg-section-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pg-locked {
  font-size: 0.8rem;
  white-space: nowrap;
}
.pg-section-desc {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.pkg-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0 0.35rem;
  min-height: 2.25rem;
}

.pkg-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 0.4rem;
  cursor: grab;
}
.pkg-item:last-child { margin-bottom: 0; }
.pkg-item:hover { border-color: #d7d7e6; background: #fbfbfe; }
.pkg-item.is-dragging { opacity: 0.45; cursor: grabbing; }

.pkg-drag {
  color: #bbb;
  font-size: 1.05rem;
  line-height: 1;
  cursor: grab;
  user-select: none;
}
.pkg-main {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 40%;
}
.pkg-name { font-weight: 600; }
.pkg-slug { font-size: 0.72rem; color: #888; }

.pkg-meta {
  display: flex;
  gap: 0.9rem;
  font-size: 0.78rem;
  flex: 1 1 auto;
}
.pkg-meta span { white-space: nowrap; }

.pkg-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}
.pkg-actions form { display: inline; }

.pkg-empty {
  padding: 0.6rem;
  font-size: 0.85rem;
  font-style: italic;
  border: 1px dashed #e0e0ec;
  border-radius: 8px;
  text-align: center;
}

@media (max-width: 720px) {
  .pkg-item { flex-wrap: wrap; }
  .pkg-meta { order: 3; flex-basis: 100%; }
}

/* ── Catalog hardware pictures ─────────────────────────────────────────── */
.hw-image {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  background: #f4f5f7;
  border-radius: 6px;
}
/* Drawings carry their own margin; no padding here (a % padding is taken
   from the container's width, which shrinks the drawing in wide layouts). */
.hw-image--icon {
  padding: 0;
}
.hw-image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #97a0af;
  font-size: 1.5rem;
}
.hw-image--thumb {
  width: 96px;
}
.hw-picture {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 110px;
}
.hw-picture__form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
}
.hw-picture__form input[type="file"] {
  max-width: 180px;
}

/* Board picker: one card per catalog board */
.board-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.board-picker .board-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem;
  border: 2px solid #dfe1e6;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
}
.board-card:hover {
  border-color: #4c9aff;
}
.board-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.board-card:has(input:checked) {
  border-color: #4361ee;
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}
.board-card:has(input:focus-visible) {
  outline: 2px solid #4361ee;
  outline-offset: 2px;
}
.board-card__label {
  display: block;
  font-weight: 600;
}
.board-card__meta {
  display: block;
  font-size: 0.8rem;
  color: #6b778c;
}
.board-summary {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.board-summary .hw-image {
  width: 150px;
  flex-shrink: 0;
}

/* Configuration toolbar options with a picture */
.cfg-tool__option img.cfg-tool__thumb.is-icon {
  padding: 2px;
  box-sizing: border-box;
}
.cfg-tool__option img.cfg-tool__thumb {
  flex-shrink: 0;
  margin: 0; /* the content area's image rule adds block margins */
  width: 42px;
  height: 28px;
  object-fit: contain;
  background: #f4f5f7;
  border-radius: 4px;
}

/* Wide tables scroll inside their card instead of pushing the page sideways. */
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.table-scroll > .data-table {
  margin-bottom: 0;
}

/* License kind: can the vehicle arm? */
.badge-kind-activated { background: #e3fcef; color: #006644; }
.badge-kind-unlimited { background: #deebff; color: #0747a6; }
.badge-kind-unactivated { background: #fffae6; color: #974f0c; }

/* Catalog picture cell: the picture, and a small control to swap in a photo. */
.hw-picture__replace summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: #4361ee;
}
.hw-picture__replace[open] summary {
  margin-bottom: 0.3rem;
}
.hw-picture__meta {
  font-size: 0.75rem;
  color: #6b778c;
}
.board-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.board-inline img {
  width: 36px;
  height: 24px;
  object-fit: contain;
}

/* Add Device wizard */
.wizard-steps {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
}
.wizard-steps li {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: #f1f2f4;
  color: #6b778c;
}
.wizard-steps li.is-current {
  background: #4361ee;
  color: #fff;
  font-weight: 600;
}
.wizard-steps li.is-done {
  background: #e3fcef;
  color: #006644;
}
.wizard-board {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.wizard-board img,
.wizard-board .hw-image {
  width: 72px;
  height: 48px;
  object-fit: contain;
}
.wizard-group {
  border: 0;
  padding: 0;
  margin: 0 0 1.75rem;
  min-width: 0;
}
.wizard-group legend {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}
.wizard-group__hint {
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}
.board-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.board-card:has(input[type="checkbox"]:checked)::after {
  content: "✓";
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: #4361ee;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.3rem;
  text-align: center;
}

/* Tabs across the related pages of one sidebar section */
.section-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid #dfe1e6;
  margin: 0 0 1.5rem;
  overflow-x: auto;
}
.section-tab {
  padding: 0.5rem 0.9rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: #6b778c;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.section-tab:hover {
  color: #172b4d;
}
.section-tab.is-active {
  color: #4361ee;
  border-bottom-color: #4361ee;
  font-weight: 600;
}

/* Row actions in a data table */
.data-table td.actions {
  white-space: nowrap;
}
.data-table td.actions > * + * {
  margin-left: 0.35rem;
}

/* A destructive action set apart at the foot of a detail page */
.danger-zone {
  margin-top: 2rem;
  border: 1px solid #f5c2c2;
}
.detail-card.danger-zone h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  color: #c0392b;
}

/* Devices list: selection and the actions on the selected rows */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}
.bulk-bar__seats {
  margin-left: auto;
  font-size: 0.85rem;
}
.data-table .select-col {
  width: 2rem;
  text-align: center;
}

/* One line per device; the full vehicle ID is on hover and the device page. */
.devices-table th,
.devices-table td,
.table-oneline th,
.table-oneline td {
  white-space: nowrap;
  vertical-align: middle;
}
.devices-table .badge {
  margin-right: 0.25rem;
}

/* An icon-only link in a table cell (e.g. download), with a comfortable hit area. */
.data-table .icon-col {
  text-align: center;
}
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  color: #4361ee;
}
.icon-link:hover,
.icon-link:focus-visible {
  background: #eef1fd;
}
button.icon-link {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.icon-link--danger {
  color: #c0392b;
}
.icon-link--danger:hover,
.icon-link--danger:focus-visible {
  background: #fdecea;
}
.data-table td.actions {
  vertical-align: middle;
}
.data-table td.actions > .icon-link {
  vertical-align: middle;
}
/* Wide one-line tables: a little less side padding so every column fits. */
.docs-content .table-oneline th,
.docs-content .table-oneline td {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}

/* Internal details (model, variance, ids) folded away under a summary. */
.advanced-details {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #ebecf0;
}
.advanced-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #6b778c;
}
.advanced-details dl {
  margin-top: 0.75rem;
}
.board-sync-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* Vehicle type page: the facts strip and the folded advanced editor. */
.type-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2.5rem;
  margin: 0 0 1.75rem;
}
.type-facts .wizard-board {
  margin: 0;
}
.type-facts__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9rem;
}
.type-facts__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b778c;
}
.advanced-settings {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid #dfe1e6;
  border-radius: 8px;
  background: #fff;
}
.advanced-settings > summary {
  cursor: pointer;
}
.advanced-settings[open] > summary {
  margin-bottom: 1rem;
}
.advanced-ids {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}

/* Admin → Package storage: connection test results */
.storage-test {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: #f4f5f7;
  font-size: 0.9rem;
}
.storage-test ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  list-style: none;
}
.storage-test__ok { color: #006644; }
.storage-test__fail { color: #c0392b; }
