/* Keep the content manager aligned with the Lexinda product system palette. */
:root {
  --admin-bg: #f5f7fb;
  --admin-paper: #ffffff;
  --admin-ink: #0f172a;
  --admin-muted: #64748b;
  --admin-line: rgba(15, 23, 42, 0.09);
  --admin-line-strong: rgba(15, 23, 42, 0.16);
  --admin-table-header: #edf3f9;
  --admin-accent: #2563eb;
  --admin-accent-hover: #1d4ed8;
  --admin-accent-soft: rgba(37, 99, 235, 0.1);
  --admin-deep: #172033;
  --admin-green: #15803d;
  --admin-green-soft: rgba(21, 128, 61, 0.1);
  --admin-red: #dc2626;
  --admin-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --admin-shadow-md: 0 12px 28px rgba(15, 23, 42, 0.08);
  --admin-shadow-lg: 0 24px 54px rgba(15, 23, 42, 0.12);
}

/* The source admin exposes four quick color themes. Keep the palette switch
   entirely local to the admin shell so it never changes the public website. */
.admin_page[data-admin-theme="black"] {
  --admin-deep: #111827;
  --admin-accent: #475569;
  --admin-accent-hover: #334155;
  --admin-accent-soft: rgba(71, 85, 105, 0.12);
  --admin-table-header: #eef2f7;
}

.admin_page[data-admin-theme="red"] {
  --admin-deep: #4a1d1f;
  --admin-accent: #c2413d;
  --admin-accent-hover: #a8322f;
  --admin-accent-soft: rgba(194, 65, 61, 0.12);
  --admin-table-header: #f9eeee;
}

.admin_page[data-admin-theme="cyan"] {
  --admin-deep: #0f3b46;
  --admin-accent: #0891b2;
  --admin-accent-hover: #0e7490;
  --admin-accent-soft: rgba(8, 145, 178, 0.12);
  --admin-table-header: #eaf8fb;
}

html {
  min-width: 320px;
  background: var(--admin-bg);
}

body {
  min-width: 320px;
  font-family: "MiSans", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

.admin_login_page {
  background: var(--admin-deep);
}

.login_brand small {
  color: #cbd5e1;
}

.login_card,
.admin_panel,
.stat_card,
.quick_actions a {
  border-radius: 8px;
  box-shadow: var(--admin-shadow-sm);
}

.login_card {
  box-shadow: var(--admin-shadow-lg);
}

.brand_dot,
.profile_avatar {
  background: var(--admin-accent);
}

.eyebrow,
.stat_action {
  color: var(--admin-accent);
}

.login_form input,
.field input,
.field select,
.field textarea,
.settings_grid input,
.settings_grid textarea {
  min-height: 44px;
  border-color: var(--admin-line-strong);
  border-radius: 6px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.login_form input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px var(--admin-accent-soft);
}

.admin_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  min-height: 44px;
  border-color: var(--admin-line-strong);
  border-radius: 6px;
  text-transform: none;
  letter-spacing: 0;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.admin_button:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

.field label.admin_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--admin-ink);
  font-size: 11px;
  line-height: 1.2;
}

.field label.admin_button:hover {
  color: var(--admin-accent);
}

.field label.admin_button.primary,
.field label.admin_button.primary:hover {
  color: #ffffff;
}

.admin_button.primary {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

.admin_button.primary:hover {
  background: var(--admin-accent-hover);
  border-color: var(--admin-accent-hover);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.admin_flash {
  border-left-color: var(--admin-accent);
  background: var(--admin-accent-soft);
  border-radius: 0 6px 6px 0;
}

.admin_flash.success {
  border-left-color: var(--admin-green);
  background: var(--admin-green-soft);
}

.admin_flash.error {
  border-left-color: var(--admin-red);
  background: rgba(220, 38, 38, 0.1);
}

.admin_sidebar {
  background: var(--admin-deep);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
}

.admin_logo_image {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  object-fit: contain;
}

.admin_logo_text strong,
.admin_logo_text small {
  display: block;
}

.admin_logo_text strong {
  color: #fff;
  font-size: 18px;
  letter-spacing: .08em;
}

.admin_logo_text small {
  color: #cbd5e1;
  font-size: 11px;
  margin-top: 3px;
}

.admin_nav a,
.admin_sidebar_footer a,
.admin_sidebar_footer button {
  min-height: 44px;
  color: #cbd5e1;
  text-transform: none;
  letter-spacing: 0;
  border-radius: 6px;
}

.admin_nav a i,
.admin_sidebar_footer i {
  color: #93c5fd;
}

.admin_nav a:hover,
.admin_nav a.active {
  background: rgba(37, 99, 235, 0.18);
  border-left-color: var(--admin-accent);
}

.admin_nav a.active i {
  color: #bfdbfe;
}

.admin_sidebar_footer a:hover,
.admin_sidebar_footer button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.admin_topbar h1,
.panel_heading h2,
.stat_card strong,
.quick_actions a {
  color: var(--admin-deep);
}

.stat_card:hover {
  box-shadow: var(--admin-shadow-md);
}

.stat_label,
.admin_table th,
.status {
  text-transform: none;
  letter-spacing: 0;
}

.admin_table th {
  background: var(--admin-table-header);
  color: var(--admin-muted);
}

.admin_table td {
  color: #334155;
}

.admin_table tbody tr:hover {
  background: #f8fafc;
}

.row_actions a,
.row_actions button {
  width: 40px;
  height: 40px;
  border-radius: 6px;
}

.row_actions a:hover,
.row_actions button:hover {
  border-color: rgba(37, 99, 235, 0.34);
  color: var(--admin-accent);
  background: var(--admin-accent-soft);
}

.status.published {
  background: var(--admin-green-soft);
  color: var(--admin-green);
  border-radius: 999px;
}

.status.draft {
  background: #f1f5f9;
  color: var(--admin-muted);
  border-radius: 999px;
}

.status {
  white-space: nowrap;
}

.quick_actions a {
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.quick_actions a:hover {
  border-color: rgba(37, 99, 235, 0.34);
  box-shadow: var(--admin-shadow-md);
  transform: translateY(-2px);
}

.quick_actions a > i {
  color: var(--admin-accent);
}

.toggle_ui {
  border-radius: 999px;
}

.toggle_field input:checked + .toggle_ui {
  background: var(--admin-accent);
}

.image_field {
  display: grid;
  gap: 10px;
}

.image_preview {
  width: min(100%, 240px);
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--admin-line-strong);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--admin-muted);
  font-size: 12px;
}

.image_preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image_field_controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.image_field_controls > [data-image-url] {
  flex: 1 1 320px;
  min-width: 220px;
}

.image_upload_input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.upload_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 44px;
  min-height: 44px;
  line-height: 1.2;
  white-space: nowrap;
}

.upload_button.is_dragover {
  border-color: var(--admin-accent);
  background: var(--admin-accent-soft);
  color: var(--admin-accent);
  box-shadow: 0 0 0 3px var(--admin-accent-soft);
}

.upload_button.primary.is_dragover {
  background: var(--admin-accent-hover);
  color: #ffffff;
}

.upload_button.is_loading {
  opacity: .62;
  pointer-events: none;
}

[data-upload-status],
.upload_status {
  color: var(--admin-muted);
  font-size: 11px;
}

[data-upload-status].is_error,
.upload_status.is_error {
  color: var(--admin-red);
}

[data-upload-status].is_success {
  color: var(--admin-green);
}

.gallery_preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 8px;
}

.gallery_preview img,
.gallery_preview > span {
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--admin-line-strong);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--admin-muted);
  object-fit: cover;
  font-size: 11px;
}

.field_tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.field_tools small {
  margin-top: 0;
}

.media_heading {
  align-items: flex-start;
}

.panel_hint {
  margin: 7px 0 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.media_upload_action {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 7px;
}

.media_grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.media_card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-paper);
  box-shadow: var(--admin-shadow-sm);
}

.media_thumbnail {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f1f5f9;
}

.media_thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.media_card_body {
  display: grid;
  gap: 4px;
  padding: 14px 14px 11px;
}

.media_name {
  overflow: hidden;
  color: var(--admin-deep);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media_meta,
.media_reference,
.media_reference_list {
  color: var(--admin-muted);
  font-size: 11px;
  line-height: 1.45;
}

.media_reference {
  margin-top: 4px;
}

.media_reference.protected {
  color: var(--admin-accent);
}

.media_reference.unused {
  color: var(--admin-green);
}

.media_reference_list {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media_card_actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.media_card_actions form {
  margin: 0;
}

.media_card_actions .admin_button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 11px;
}

.danger_button {
  color: var(--admin-red);
  border-color: rgba(220, 38, 38, .22);
}

.danger_button:hover {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, .42);
  background: rgba(220, 38, 38, .06);
}

.disabled_button {
  cursor: not-allowed;
  color: var(--admin-muted);
  background: #f1f5f9;
  opacity: .78;
}

.media_empty {
  padding: 45px 0;
}

.quick_actions {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1050px) {
  .quick_actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .admin_sidebar {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .quick_actions {
    grid-template-columns: 1fr;
  }

  .admin_nav a,
  .admin_sidebar_footer a,
  .admin_sidebar_footer button {
    min-height: 44px;
  }

  .row_actions a,
  .row_actions button {
    width: 44px;
    height: 44px;
  }

  .media_heading {
    gap: 14px;
  }

  .media_upload_action {
    align-items: stretch;
    width: 100%;
  }

  .media_upload_action .admin_button {
    justify-content: center;
  }

  .image_field_controls > [data-image-url] {
    flex-basis: 100%;
    min-width: 0;
  }

  .image_field_controls > .admin_button {
    flex: 1 1 auto;
    justify-content: center;
  }
}
