@import url("/css/theme.css");

/* Admin shell — sample-structure style + Missional Agents theme */

.ap-admin-shell {
  --ap-sidebar-w: 250px;
  --ap-sidebar-collapsed: 64px;
  --ap-header-h: 60px;
  --ap-gray-50: #f2f5f6;
  --ap-gray-100: #f3f4f6;
  --ap-gray-200: #e5e7eb;
  --ap-gray-400: #9ca3af;
  --ap-gray-500: #6b7280;
  --ap-gray-600: #4b5563;
  --ap-gray-700: #374151;
  --ap-gray-800: #1f2937;
  --ap-gray-900: #111827;
  /* Missional Agents — https://www.missionalagents.com/ */
  --ap-primary: #072344;
  --ap-primary-deep: #10253e;
  --ap-primary-mid: #0a2f52;
  --ap-primary-50: #e8eef4;
  --ap-chrome: #072344;
  --ap-chrome-header: #072344;
  --ap-white: #fff;
  min-height: 100vh;
  background: var(--ap-gray-50);
}

.ap-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

.ap-sidebar-overlay.show {
  display: block;
}

.ap-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--ap-sidebar-w);
  height: 100vh;
  background: var(--ap-chrome);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 3px 0 14px rgba(7, 35, 68, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 110;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
  color: #fff;
}

.ap-sidebar-brand {
  height: var(--ap-header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.ap-sidebar-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.ap-sidebar-brand-text {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.ap-sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* legacy Edge */
}

.ap-sidebar-nav::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

.ap-sidebar-section {
  margin-bottom: 10px;
}

.ap-sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
  padding: 12px 12px 6px;
}

.ap-sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 12px 12px 6px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  text-align: left;
}

.ap-sidebar-section-toggle:hover {
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
}

.ap-section-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease;
}

.ap-sidebar-section.is-closed .ap-section-chevron {
  transform: rotate(-90deg);
}

.ap-sidebar-section.is-open .ap-section-chevron {
  transform: rotate(0deg);
}

.ap-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: #cfe0e7;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.ap-nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ap-nav-item.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

.ap-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ap-nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-sidebar-bottom {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.ap-sidebar-collapse {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #cfe0e7;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.ap-sidebar-collapse:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ap-sidebar-collapse svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.25s;
}

.ap-sidebar.collapsed {
  width: var(--ap-sidebar-collapsed);
}

.ap-sidebar.collapsed .ap-sidebar-section-title,
.ap-sidebar.collapsed .ap-sidebar-section-toggle,
.ap-sidebar.collapsed .ap-nav-label,
.ap-sidebar.collapsed .ap-collapse-label,
.ap-sidebar.collapsed .ap-sidebar-brand-text {
  display: none;
}

.ap-sidebar.collapsed .ap-nav-item {
  justify-content: center;
  padding: 10px;
}

.ap-sidebar.collapsed .ap-sidebar-collapse svg {
  transform: rotate(180deg);
}

.ap-sidebar.collapsed .ap-sidebar-brand {
  justify-content: center;
  padding: 0;
}

.ap-admin-header {
  position: fixed;
  top: 0;
  left: var(--ap-sidebar-w);
  right: 0;
  height: var(--ap-header-h);
  background: var(--ap-chrome-header);
  border-bottom: none;
  box-shadow: 0 3px 14px rgba(7, 35, 68, 0.35);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  transition: left 0.25s ease;
}

.ap-admin-shell.is-collapsed .ap-admin-header {
  left: var(--ap-sidebar-collapsed);
}

.ap-admin-header-left,
.ap-admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ap-header-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.ap-header-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
}

.ap-admin-header-title b {
  display: block;
  font-size: 15px;
  color: #fff;
  line-height: 1.2;
}

.ap-admin-header-title small {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.ap-admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.ap-admin-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.ap-header-signout {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 9px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.ap-header-signout:hover {
  background: rgba(255, 255, 255, 0.22);
}

.ap-admin-main {
  margin-left: var(--ap-sidebar-w);
  margin-top: var(--ap-header-h);
  min-height: calc(100vh - var(--ap-header-h));
  padding: 24px 32px 40px;
  transition: margin-left 0.25s ease;
  width: auto;
  max-width: none;
}

.ap-admin-shell.is-collapsed .ap-admin-main {
  margin-left: var(--ap-sidebar-collapsed);
}

.ap-content-header {
  margin-bottom: 20px;
}

.ap-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.ap-page-header-actions {
  flex-shrink: 0;
  margin-left: auto;
}

.ap-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ap-gray-500);
  margin-bottom: 6px;
}

.ap-breadcrumb svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.ap-page-header h1 {
  margin: 0;
  font-size: 24px;
  color: var(--ap-gray-900);
  font-weight: 700;
}

.ap-page-header .ap-page-sub {
  margin: 6px 0 0;
  color: var(--ap-gray-500);
  font-size: 14px;
  max-width: 640px;
}

.ap-card {
  background: var(--ap-white);
  border: 1px solid var(--ap-gray-200);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.ap-card-body {
  padding: 0;
}

.ap-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.ap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ap-table th,
.ap-table td {
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ap-gray-200);
  vertical-align: middle;
}

.ap-table th {
  background: var(--ap-gray-50);
  color: var(--ap-gray-500);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ap-table tbody tr:hover {
  background: #fafbfc;
}

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

.ap-table code {
  font-size: 12px;
  background: var(--ap-gray-100);
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--ap-gray-700);
}

.ap-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.ap-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 8px;
  background: #fff;
  color: var(--ap-gray-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ap-icon-btn:hover {
  background: var(--ap-gray-100);
  color: var(--ap-primary);
}

.ap-icon-btn.danger:hover {
  background: #fdecea;
  color: #c0392b;
  border-color: #f5c6c2;
}

.ap-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ap-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ap-gray-500);
}

.ap-empty h3 {
  margin: 0 0 6px;
  color: var(--ap-gray-800);
  font-size: 16px;
}

.ap-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--ap-gray-200);
  background: var(--ap-gray-50);
}

.ap-pagination-info {
  font-size: 13px;
  color: var(--ap-gray-600);
}

.ap-pagination-info b {
  color: var(--ap-gray-900);
}

.ap-pagination-pager {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-pagination-page {
  font-size: 13px;
  font-weight: 600;
  color: var(--ap-gray-700);
  min-width: 110px;
  text-align: center;
}

.ap-pagination-btn {
  border: 1px solid var(--ap-gray-200);
  background: #fff;
  color: var(--ap-primary);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.ap-pagination-btn:hover:not(:disabled) {
  background: var(--ap-primary-50);
}

.ap-pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Modal */
.ap-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.ap-modal {
  background: var(--ap-white);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.ap-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ap-gray-200);
}

.ap-modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--ap-gray-900);
}

.ap-modal-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ap-gray-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ap-modal-close:hover {
  background: var(--ap-gray-100);
}

.ap-modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.ap-modal-body {
  padding: 22px;
}

.ap-modal-body .ap-alert {
  margin-bottom: 14px;
}

.ap-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--ap-gray-200);
  background: var(--ap-gray-50);
}

.ap-modal .form-group {
  margin-bottom: 14px;
}

.ap-modal .form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ap-gray-600);
  margin-bottom: 5px;
}

.req-star {
  color: #c0392b;
  font-weight: 700;
}

.ap-modal .form-group small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ap-gray-500);
}

.ap-modal .form-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 9px;
  background: #fff;
}

.ap-modal .form-input:focus {
  outline: 2px solid rgba(7, 35, 68, 0.18);
  border-color: var(--ap-primary);
}

.ap-modal .master-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ap-gray-700);
  margin-top: 4px;
}

/* Masters add/edit — wider + 2 fields per row so tall forms stay shorter */
.ap-modal--master {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ap-modal--master-wide {
  max-width: 760px;
}

.ap-modal--master form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.ap-modal--master .ap-modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ap-modal--master .ap-modal-footer {
  flex-shrink: 0;
}

.master-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
  align-items: start;
}

.master-form-grid .form-group {
  margin-bottom: 14px;
  min-width: 0;
}

.master-span-2 {
  grid-column: 1 / -1;
}

.master-hex-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.master-hex-swatch {
  width: 44px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.master-list-thumb {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--ap-gray-200);
  display: block;
  background: var(--ap-gray-100);
}

.master-image-field {
  display: flex;
  gap: 14px;
  align-items: stretch;
  flex-wrap: wrap;
}

.master-image-preview {
  width: 180px;
  height: 110px;
  border: 1.5px dashed var(--ap-gray-200);
  border-radius: 10px;
  background: #f7fafb;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: 12px;
}

.master-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.master-image-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-width: 160px;
}

.master-image-actions .ap-btn.is-disabled,
.master-image-actions label.ap-btn.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.master-image-actions label.ap-btn {
  cursor: pointer;
  text-align: center;
  justify-content: center;
}

.master-image-actions small {
  margin-top: 0;
}

@media (max-width: 640px) {
  .ap-modal--master,
  .ap-modal--master-wide {
    max-width: 100%;
  }

  .master-form-grid {
    grid-template-columns: 1fr;
  }
}

.ap-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.ap-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ap-btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  min-height: 32px;
}

.ap-btn-sm svg {
  width: 14px;
  height: 14px;
}

.ap-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.ap-btn-primary {
  background: var(--ma-orange, #e08d2b);
  color: #fff;
}

.ap-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.ap-btn-ghost {
  background: #fff;
  color: var(--ap-gray-700);
  border: 1px solid var(--ap-gray-200);
}

.ap-btn-accent {
  background: var(--ap-primary, #072344);
  color: #fff;
}

.ap-btn-accent:hover:not(:disabled) {
  filter: brightness(1.06);
}

.ap-btn-danger {
  background: #c0392b;
  color: #fff;
}

.ap-btn-danger:hover:not(:disabled) {
  background: #a93226;
}

.ap-confirm-text {
  margin: 0;
  color: var(--ap-gray-700);
  line-height: 1.5;
}
@media (max-width: 900px) {
  .ap-header-toggle {
    display: inline-flex;
  }

  .ap-sidebar {
    transform: translateX(-100%);
    width: var(--ap-sidebar-w);
  }

  .ap-sidebar.open {
    transform: translateX(0);
  }

  .ap-admin-header,
  .ap-admin-shell.is-collapsed .ap-admin-header {
    left: 0;
  }

  .ap-admin-main,
  .ap-admin-shell.is-collapsed .ap-admin-main {
    margin-left: 0;
    padding: 18px 14px 32px;
  }

  .ap-admin-user-name {
    display: none;
  }
}

.ap-admin-shell {
  font-family: var(--ma-body);
  color: var(--ma-text);
}

.ap-sidebar-logo.ma-logo-on-dark {
  filter: brightness(0) invert(1);
}

.ap-btn-primary {
  background: var(--ma-orange-gradient);
  color: var(--ma-navy);
}

.ap-btn-secondary {
  background: transparent;
  color: var(--ap-primary);
  border: 1px solid var(--ap-primary);
}

.ap-btn-secondary:hover:not(:disabled) {
  background: var(--ap-primary-50);
}

.ap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.ap-toolbar-note {
  font-size: 0.88rem;
  color: var(--ap-gray-500);
}

.ap-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.ap-stat-card {
  background: var(--ap-white);
  border: 1px solid var(--ap-gray-200);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(7, 35, 68, 0.04);
}

.ap-stat-card strong {
  display: block;
  font-size: 1.75rem;
  color: var(--ap-primary);
  line-height: 1.1;
  font-family: var(--ma-display);
  font-weight: 500;
}

.ap-stat-card span {
  font-size: 0.88rem;
  color: var(--ap-gray-500);
}

.ap-alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.ap-alert-error {
  background: var(--ma-red-tint);
  color: var(--ma-red);
  border: 1px solid rgba(179, 58, 58, 0.2);
}

.ap-alert-info {
  background: var(--ma-cream);
  color: var(--ma-navy);
  border: 1px solid #ffd9a8;
}

.ap-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ap-badge-published {
  background: var(--ma-green-tint);
  color: var(--ma-green);
}

.ap-badge-draft {
  background: var(--ma-cream);
  color: var(--ma-orange-dark);
}

.ap-badge-archived {
  background: var(--ap-gray-100);
  color: var(--ap-gray-500);
}

.ap-actions,
.ap-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.ap-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 35, 68, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.ap-modal-backdrop .ap-modal {
  padding: 0;
}

.ap-modal-backdrop .ap-modal h2 {
  margin: 0;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ap-gray-200);
  font-family: var(--ma-display);
  font-size: 1.15rem;
  color: var(--ap-gray-900);
}

.ap-modal-backdrop .ap-modal form {
  padding: 22px;
}

.ap-field {
  margin-bottom: 14px;
}

.ap-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ap-gray-600);
}

.ap-field input,
.ap-field select,
.ap-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 9px;
  font: inherit;
  box-sizing: border-box;
}

.ap-field textarea {
  min-height: 80px;
  resize: vertical;
}

.ap-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.ap-nav-tag {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 2px 6px;
  margin-left: auto;
}

.ap-card-heading {
  margin: 0;
  padding: 16px 18px 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ap-gray-900);
}

.ap-card-section-head .ap-card-heading {
  padding: 0;
}

.ap-church-account-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: -6px;
}

.ap-church-account-page .ap-breadcrumb {
  margin-bottom: 0;
}

.ap-church-account-lead {
  margin: 0;
}

.ap-church-account-name {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ap-gray-900);
  font-family: inherit;
}

.ap-church-account-meta {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ap-gray-600);
  line-height: 1.45;
}

.ap-church-account-section .ap-card-heading {
  padding: 0;
}

.ap-card-section-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--ap-gray-100);
}

.ap-card-section-head .ap-list-note {
  margin: 6px 0 0;
}

.ap-card-section-empty {
  margin: 0;
  padding: 18px;
  color: var(--ap-gray-500);
  font-size: 14px;
}

.ap-table th.ap-th-actions,
.ap-table td.ap-td-actions {
  width: auto;
  min-width: 92px;
  white-space: nowrap;
  text-align: right;
  padding-left: 12px;
  padding-right: 18px;
  vertical-align: middle;
}

.ap-table td.ap-td-actions .ap-row-actions {
  width: 100%;
}

.ap-table.ap-table-compact-actions td.ap-td-session {
  min-width: 140px;
  max-width: 220px;
}

.ap-breadcrumb a {
  color: var(--ap-primary);
  text-decoration: none;
  font-weight: 600;
}

.ap-breadcrumb a:hover {
  text-decoration: underline;
}

.ap-sidebar.collapsed .ap-nav-tag {
  display: none;
}

/* ── List toolbar, filters, improved modals ─────────────────────── */

.ap-list-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ap-list-filters {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.ap-filter-count {
  font-size: 13px;
  color: var(--ap-gray-500);
  white-space: nowrap;
  margin-left: auto;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--ap-white);
  border: 1px solid var(--ap-gray-200);
  border-radius: 10px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.filter-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.filter-select {
  position: relative;
  flex-shrink: 0;
}

.filter-select select {
  appearance: none;
  padding: 6px 36px 6px 32px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 8px;
  font-size: 13px;
  min-width: 160px;
  max-width: 220px;
  background: var(--ap-gray-50);
  min-height: 32px;
  font-family: inherit;
  color: var(--ap-gray-800);
  cursor: pointer;
}

.filter-select.has-clear select {
  padding-right: 44px;
}

.filter-select select:focus,
.filter-search input:focus {
  outline: none;
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 3px var(--ap-primary-50);
}

.filter-select > svg,
.filter-search > svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--ap-gray-400);
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.filter-search input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 8px;
  font-size: 13px;
  background: var(--ap-gray-50);
  min-height: 32px;
  font-family: inherit;
  color: var(--ap-gray-800);
  box-sizing: border-box;
}

.filter-search.has-clear input {
  padding-right: 44px;
}

.filter-search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ap-gray-600);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.filter-search-clear:hover {
  background: var(--ap-gray-100);
}

.clear-filters {
  font-size: 13px;
  color: var(--ap-primary);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  padding: 4px 0;
}

.clear-filters:hover {
  text-decoration: underline;
}

.ap-icon-btn.accent {
  color: var(--ap-primary);
  border-color: rgba(7, 35, 68, 0.2);
}

.ap-icon-btn.accent:hover {
  background: var(--ap-primary-50);
  color: var(--ap-primary);
}

.ap-table td.ap-td-muted {
  color: var(--ap-gray-500);
  font-size: 13px;
}

.ap-table td.ap-td-strong {
  font-weight: 600;
  color: var(--ap-gray-900);
}

.ap-table .ap-td-actions {
  min-width: 92px;
  text-align: right;
}

.ap-path-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ap-path-E {
  background: var(--ma-green-tint);
  color: var(--ma-green);
}

.ap-path-C {
  background: #eef2ff;
  color: #4338ca;
}

.ap-path-A {
  background: var(--ma-cream);
  color: var(--ma-orange-dark);
}

.ap-modal-form {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  width: 100%;
  max-width: 520px;
}

.ap-modal-wide {
  max-width: 680px;
}

/* Question full editor */
.ap-question-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ap-editor-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ap-editor-back {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ap-gray-600);
  text-decoration: none;
}

.ap-editor-back:hover {
  color: var(--ap-gray-900);
}

.ap-editor-title {
  margin: 0;
  font-family: var(--ma-display);
  font-size: 1.35rem;
  color: var(--ap-gray-900);
}

.ap-editor-subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--ap-gray-600);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ap-editor-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

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

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

.ap-editor-tab {
  border: 1px solid var(--ap-gray-200);
  background: #fff;
  color: var(--ap-gray-700);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}

.ap-editor-tab.active,
.ap-editor-tab.is-active,
.ap-editor-tab.ap-editor-tab-active {
  border-color: var(--ap-primary);
  background: rgba(255, 168, 66, 0.12);
  color: var(--ap-gray-900);
  font-weight: 600;
}

.ap-editor-card {
  padding: 22px;
}

.ap-editor-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--ap-gray-200);
}

.ap-editor-footer .ap-btn {
  margin-left: auto;
}

.ap-editor-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ap-editor-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ap-editor-panel-desc {
  margin: 0;
  color: var(--ap-gray-600);
  font-size: 14px;
  max-width: 720px;
  line-height: 1.45;
}

.ap-editor-panel-title {
  margin: 0 0 4px;
  font-family: var(--ma-display);
  font-size: 1.05rem;
  color: var(--ap-gray-900);
}

.ap-editor-panel-desc-lead {
  max-width: none;
  margin-bottom: 4px;
}

.ap-subform-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ap-subform-card {
  border: 1px solid var(--ap-gray-200);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}

.ap-subform-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.ap-subform-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ap-gray-800);
  letter-spacing: 0.02em;
}

.ap-subform-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ap-subform-field {
  display: block;
}

.ap-subform-field textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 9px;
  font: inherit;
  line-height: 1.45;
  resize: vertical;
  box-sizing: border-box;
  background: var(--ap-gray-50);
}

.ap-subform-field textarea:focus {
  outline: none;
  border-color: var(--ap-primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--ap-primary-50);
}

.ap-btn-danger-text {
  color: #b02828;
}

.ap-btn-danger-text:hover {
  color: #8f2020;
  background: #fdecee;
}

.ap-inline-empty {
  margin: 0;
  padding: 16px 18px;
  border: 1px dashed var(--ap-gray-300);
  border-radius: 10px;
  background: var(--ap-gray-50);
  color: var(--ap-gray-600);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}

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

.ap-check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ap-gray-700);
  cursor: pointer;
  margin-bottom: 0;
}

.ap-field > .ap-check-row {
  display: flex;
  align-items: center;
}

.ap-field-check-block {
  margin-bottom: 0;
  padding-top: 2px;
}

.ap-check-row-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  padding-top: 2px;
}

.ap-field-hint {
  margin: 6px 0 0 26px;
  font-size: 12px;
  color: var(--ap-gray-500);
  line-height: 1.45;
}

.ap-check-row input[type='checkbox'] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
}

/* Basic text editor (markdown toolbar) */
.ap-basic-editor {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--ap-gray-200);
  border-radius: 9px;
  overflow: hidden;
  background: #fff;
}

.ap-basic-editor.is-disabled {
  opacity: 0.7;
}

.ap-basic-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--ap-gray-200);
  background: var(--ap-gray-50);
}

.ap-basic-editor-btn {
  border: 1px solid var(--ap-gray-200);
  background: #fff;
  color: var(--ap-gray-700);
  border-radius: 7px;
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ap-basic-editor-btn:hover:not(:disabled) {
  border-color: var(--ap-primary);
  color: var(--ap-gray-900);
}

.ap-basic-editor-btn:disabled {
  cursor: not-allowed;
}

.ap-basic-editor-input {
  width: 100%;
  min-height: 220px;
  border: none;
  border-radius: 0;
  padding: 12px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
  box-sizing: border-box;
}

.ap-basic-editor-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--ap-primary-50);
}

.ap-field .ap-basic-editor {
  width: 100%;
}

.ap-field .ap-basic-editor-input {
  width: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.ap-field.has-error .ap-basic-editor-input:focus {
  box-shadow: inset 0 0 0 2px rgba(224, 90, 90, 0.35);
}

.ap-field.has-error .ap-basic-editor {
  border-color: #e05a5a;
}

.ap-basic-editor-hint {
  margin: 0;
  padding: 6px 10px 8px;
  font-size: 11px;
  color: var(--ap-gray-500);
  background: var(--ap-gray-50);
  border-top: 1px solid var(--ap-gray-100);
}

.ap-md-paragraph {
  margin: 0 0 0.5em;
}

.ap-md-paragraph:last-child {
  margin-bottom: 0;
}

.ap-md-list {
  margin: 0 0 0.75em 1.2em;
  padding: 0;
}

.ap-md-list li {
  margin-bottom: 0.25em;
}

.ap-question-preview-prompt .ap-md-paragraph a {
  color: var(--ap-primary-dark, #072344);
}

.ap-use-area-examples-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 14px;
  background: #fff;
}

.ap-use-area-examples-section-ok {
  border-color: rgba(15, 107, 60, 0.18);
  background: linear-gradient(180deg, rgba(232, 246, 239, 0.45) 0%, #fff 120px);
}

.ap-use-area-examples-section-no {
  border-color: rgba(176, 40, 40, 0.16);
  background: linear-gradient(180deg, rgba(253, 236, 238, 0.5) 0%, #fff 120px);
}

.ap-use-area-section-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 4px;
  font-family: var(--ma-display);
  font-size: 1.05rem;
  color: var(--ap-gray-900);
}

.ap-use-area-section-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ap-use-area-section-badge-ok {
  background: #e8f6ef;
  color: #0f6b3c;
}

.ap-use-area-section-badge-no {
  background: #fdecee;
  color: #b02828;
}

.ap-posture-grid {
  display: grid;
  gap: 16px;
}

.ap-posture-card-title {
  margin: 0 0 12px;
  font-family: var(--ma-display);
  font-size: 1rem;
  color: var(--ap-gray-900);
}

.ap-table-link {
  color: inherit;
  text-decoration: none;
}

.ap-table-link:hover {
  color: var(--ap-primary-dark, #c97a12);
  text-decoration: underline;
}

.ap-question-preview {
  border: 1px solid var(--ap-gray-200);
  border-radius: 12px;
  padding: 20px;
  background: #fff;
}

.ap-question-preview-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ap-question-preview-context {
  margin: 0 0 10px;
  color: var(--ap-gray-600);
  font-size: 14px;
}

.ap-question-preview-title {
  margin: 0 0 8px;
  font-family: var(--ma-display);
  font-size: 1.2rem;
}

.ap-question-preview-prompt {
  margin: 0 0 16px;
  line-height: 1.5;
}

.ap-question-preview-options {
  margin: 0 0 16px;
  padding-left: 20px;
}

.ap-question-preview-option-label {
  font-weight: 600;
}

.ap-question-preview-input {
  width: 100%;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 9px;
  box-sizing: border-box;
}

.ap-question-preview-details {
  margin-top: 12px;
  font-size: 14px;
  color: var(--ap-gray-700);
}

.ap-modal-form .ap-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ap-gray-200);
}

.ap-modal-form .ap-modal-header h2 {
  margin: 0;
  padding: 0;
  border: none;
  font-family: var(--ma-display);
  font-size: 1.15rem;
  color: var(--ap-gray-900);
}

.ap-modal-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ap-gray-500);
}

.ap-modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.ap-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--ap-gray-200);
  background: var(--ap-gray-50);
}

.ap-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.ap-form-span-2 {
  grid-column: 1 / -1;
}

/* User modal — sectioned form layout */
.ap-user-modal-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--ap-gray-50) 0%, #fff 100%);
}

.ap-user-modal-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--ap-primary-50, rgba(232, 148, 58, 0.12));
  color: var(--ap-primary-dark, #c97a12);
  font-family: var(--ma-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ap-user-modal-summary-main {
  flex: 1;
  min-width: 0;
}

.ap-user-modal-summary-name {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: var(--ap-gray-900);
  line-height: 1.3;
}

.ap-user-modal-summary-email {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ap-gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ap-user-modal-summary-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ap-user-modal-summary-meta span {
  font-size: 12px;
  color: var(--ap-gray-500);
}

.ap-form-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ap-form-section {
  padding: 16px 18px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 12px;
  background: #fff;
}

.ap-form-section-password {
  border-color: rgba(7, 35, 68, 0.1);
  background: linear-gradient(180deg, rgba(247, 249, 252, 0.9) 0%, #fff 80px);
}

.ap-form-section-head {
  margin-bottom: 14px;
}

.ap-form-section-title {
  margin: 0;
  font-family: var(--ma-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ap-gray-900);
  line-height: 1.3;
}

.ap-form-section-desc {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ap-gray-500);
  line-height: 1.45;
}

.ap-form-section-toggle {
  margin-bottom: 0;
  padding: 10px 12px;
  border: 1px dashed var(--ap-gray-200);
  border-radius: 9px;
  background: var(--ap-gray-50);
}

.ap-form-section-toggle .ap-check-row {
  width: 100%;
}

.ap-form-section-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ap-gray-200);
}

.ap-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.ap-input-wrap input {
  flex: 1;
  padding-right: 4.25rem;
}

.ap-input-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ap-gray-600);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ap-input-toggle:hover {
  color: var(--ap-gray-900);
  background: var(--ap-gray-100);
}

.ap-password-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.ap-password-rules li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ap-gray-500);
  line-height: 1.35;
}

.ap-password-rules li::before {
  content: '';
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ap-gray-300);
}

.ap-password-rules li.is-met {
  color: #0f6b3c;
}

.ap-password-rules li.is-met::before {
  background: #0f6b3c;
}

.ap-status-toggle-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 10px;
  background: var(--ap-gray-50);
  cursor: pointer;
}

.ap-status-toggle-card input[type='checkbox'] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin-top: 2px;
  cursor: pointer;
}

.ap-status-toggle-copy strong {
  display: block;
  font-size: 14px;
  color: var(--ap-gray-900);
}

.ap-status-toggle-copy span {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ap-gray-500);
  line-height: 1.45;
}

.ap-field input:focus,
.ap-field select:focus,
.ap-field textarea:focus {
  outline: none;
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 3px var(--ap-primary-50);
}

.ap-field input:disabled {
  background: var(--ap-gray-50);
  color: var(--ap-gray-500);
}

.ap-field input.ap-input-readonly,
.ap-field input[readonly] {
  background: var(--ap-gray-200);
  color: var(--ap-gray-600);
  border-color: var(--ap-gray-200);
  cursor: default;
}

.ap-field.has-error input,
.ap-field.has-error select,
.ap-field.has-error textarea {
  border-color: #c0392b;
}

.ap-field.has-error input:focus,
.ap-field.has-error select:focus,
.ap-field.has-error textarea:focus {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

.ap-field-error {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #c0392b;
}

.ap-card .ap-empty {
  padding: 48px 24px;
}

.ap-card .ap-table-empty td {
  text-align: center;
  padding: 40px 20px;
  color: var(--ap-gray-500);
}

@media (max-width: 640px) {
  .ap-form-grid {
    grid-template-columns: 1fr;
  }

  .ap-password-rules {
    grid-template-columns: 1fr;
  }

  .ap-user-modal-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-search {
    max-width: none;
    flex: 1 1 100%;
  }

  .ap-list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* —— Toasts —— */
.ap-toast-viewport {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 28px));
  pointer-events: none;
}

.ap-toast {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 14px 16px;
  border-radius: 14px;
  background: #fff;
  color: var(--ap-gray-900);
  border: 1px solid var(--ap-gray-200);
  box-shadow:
    0 18px 40px rgba(7, 35, 68, 0.14),
    0 2px 8px rgba(7, 35, 68, 0.08);
  overflow: hidden;
  pointer-events: auto;
  animation: ap-toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.ap-toast-leave {
  animation: ap-toast-out 0.2s ease forwards;
}

.ap-toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ap-toast-icon svg {
  width: 18px;
  height: 18px;
}

.ap-toast-body {
  min-width: 0;
  padding-top: 1px;
}

.ap-toast-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2px;
  opacity: 0.72;
}

.ap-toast-msg {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ap-gray-900);
  word-break: break-word;
}

.ap-toast-close {
  border: none;
  background: transparent;
  color: var(--ap-gray-500);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  margin-top: -2px;
}

.ap-toast-close svg {
  width: 14px;
  height: 14px;
}

.ap-toast-close:hover {
  background: var(--ap-gray-100);
  color: var(--ap-gray-900);
}

.ap-toast-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  transform-origin: left center;
  animation: ap-toast-bar 5s linear forwards;
}

.ap-toast-success {
  border-color: rgba(15, 107, 60, 0.18);
}

.ap-toast-success .ap-toast-icon {
  background: #e8f6ef;
  color: #0f6b3c;
}

.ap-toast-success .ap-toast-label {
  color: #0f6b3c;
}

.ap-toast-success .ap-toast-progress {
  background: linear-gradient(90deg, #1f9d5c, #0f6b3c);
}

.ap-toast-error {
  border-color: rgba(176, 40, 40, 0.2);
}

.ap-toast-error .ap-toast-icon {
  background: #fdecee;
  color: #b02828;
}

.ap-toast-error .ap-toast-label {
  color: #b02828;
}

.ap-toast-error .ap-toast-progress {
  background: linear-gradient(90deg, #e05a5a, #b02828);
}

.ap-toast-info {
  border-color: rgba(7, 35, 68, 0.14);
}

.ap-toast-info .ap-toast-icon {
  background: rgba(7, 35, 68, 0.08);
  color: var(--ap-primary-dark, #072344);
}

.ap-toast-info .ap-toast-label {
  color: var(--ap-primary-dark, #072344);
}

.ap-toast-info .ap-toast-progress {
  background: linear-gradient(90deg, #ffbf42, #072344);
}

@keyframes ap-toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) translateX(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
  }
}

@keyframes ap-toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px) translateX(10px) scale(0.98);
  }
}

@keyframes ap-toast-bar {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 600px) {
  .ap-toast-viewport {
    top: auto;
    bottom: 16px;
    right: 14px;
    left: 14px;
    width: auto;
  }
}

.ap-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.ap-preview-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ap-preview-pane {
  border: 1px solid var(--ap-border, #e2e8f0);
  border-radius: 8px;
  padding: 16px;
  background: var(--ap-surface, #fff);
}

.ap-preview-pane h4 {
  margin: 0 0 12px;
  font-size: 0.875rem;
  color: var(--ap-muted, #64748b);
}

.ap-preview-html {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.ap-preview-plain {
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .ap-preview-split {
    grid-template-columns: 1fr;
  }
}

.ap-code-input {
  font-family: var(--ma-mono, 'IBM Plex Mono', monospace);
  font-size: 13px;
  line-height: 1.5;
  min-height: 180px;
}

.ap-hint-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ap-panel-title {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.ap-meta-grid {
  display: grid;
  gap: 10px;
}

.ap-meta-row {
  display: grid;
  grid-template-columns: minmax(120px, 34%) 1fr;
  gap: 12px;
  align-items: baseline;
}

.ap-meta-label {
  color: var(--ap-muted, #64748b);
  font-size: 0.875rem;
}

.ap-meta-value {
  font-size: 0.9375rem;
  word-break: break-word;
}

.ap-mono-sm {
  font-family: var(--ma-mono, 'IBM Plex Mono', monospace);
  font-size: 0.8125rem;
}

.ap-back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--ap-muted, #64748b);
  font-size: 0.875rem;
  text-decoration: none;
}

.ap-back-link:hover {
  color: var(--ap-text, #0f172a);
}

.ap-answer-pre {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--ap-surface-muted, #f8fafc);
  font-family: var(--ma-mono, 'IBM Plex Mono', monospace);
  font-size: 0.8125rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-width: 420px;
}

.ap-code-block {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--ap-surface-muted, #f8fafc);
  font-family: var(--ma-mono, 'IBM Plex Mono', monospace);
  font-size: 0.8125rem;
  line-height: 1.45;
  overflow: auto;
}

.ap-validation-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 10px;
}

.ap-validation-block li {
  color: #b91c1c;
}

.ap-validation-warning li {
  color: #b45309;
}

.ap-section-card {
  background: var(--ap-white);
  border: 1px solid var(--ap-gray-200);
  border-radius: 12px;
  padding: 18px 20px;
}

.ap-list-note {
  margin: 0 0 16px;
  color: var(--ap-gray-600);
  font-size: 14px;
  line-height: 1.45;
}

.ap-settings-card {
  max-width: none;
  width: 100%;
}

.ap-filter-action {
  align-self: center;
  flex-shrink: 0;
}

.ap-th-actions {
  width: 120px;
  text-align: right;
}

.ap-action-badge-create {
  background: #ecfdf5;
  color: #047857;
}

.ap-action-badge-update {
  background: #eff6ff;
  color: #1d4ed8;
}

.ap-action-badge-delete {
  background: #fef2f2;
  color: #b91c1c;
}

.ap-action-badge-publish {
  background: rgba(255, 168, 66, 0.15);
  color: #9a3412;
}

/* Admin session detail */
.ap-session-loading {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ap-gray-600);
}

.ap-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(15, 23, 42, 0.12);
  border-top-color: var(--ap-primary, #ffa842);
  border-radius: 50%;
  animation: ap-spin 0.75s linear infinite;
}

@keyframes ap-spin {
  to {
    transform: rotate(360deg);
  }
}

.ap-session-header-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.ap-session-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ap-gray-100, #f1f5f9);
  color: var(--ap-gray-700);
  font-size: 0.8125rem;
  font-weight: 500;
}

.ap-session-chip-warn {
  background: #fef2f2;
  color: #b91c1c;
}

.ap-session-chip-note {
  background: #fffbeb;
  color: #b45309;
}

.ap-session-chip-adopted {
  background: #ecfdf5;
  color: #047857;
}

.ap-adoption-card {
  border-color: #a7f3d0;
  background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
}

.ap-session-uid {
  color: var(--ap-gray-500);
}

.ap-session-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 900px) {
  .ap-session-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ap-session-stat {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--ap-gray-200);
  border-radius: 12px;
  padding: 16px 18px;
}

.ap-session-stat-value {
  display: block;
  font-family: var(--ma-display);
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--ap-gray-900);
}

.ap-session-stat-label {
  display: block;
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--ap-gray-600);
}

.ap-session-policy-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(255, 168, 66, 0.12) 0%, #fff 55%);
  border-color: rgba(255, 168, 66, 0.35);
}

.ap-session-outputs {
  display: grid;
  gap: 18px;
}

.ap-session-outputs-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ap-session-outputs-empty {
  border: 1px dashed var(--ap-gray-300);
  border-radius: 12px;
  background: var(--ap-gray-50);
}

.ap-output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.ap-output-card {
  border: 1px solid var(--ap-gray-200);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ap-output-card.is-expanded {
  border-color: rgba(255, 168, 66, 0.45);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.ap-output-card-head {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.ap-output-type {
  display: block;
  font-weight: 600;
  color: var(--ap-gray-900);
}

.ap-output-desc {
  display: block;
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--ap-gray-600);
  line-height: 1.4;
}

.ap-output-chevron {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--ap-gray-100);
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--ap-gray-700);
}

.ap-output-card-meta {
  display: flex;
  gap: 12px;
  padding: 0 16px 12px;
  font-size: 0.75rem;
  color: var(--ap-gray-500);
}

.ap-output-card-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--ap-gray-100);
}

.ap-output-preview {
  margin: 12px 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ap-gray-700);
}

/* Admin policy viewer */
.ap-policy-viewer {
  display: grid;
  gap: 16px;
}

.ap-policy-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ap-policy-viewer-card {
  padding: 0;
  overflow: hidden;
}

.ap-policy-viewer-toolbar {
  padding: 16px 18px 0;
  border-bottom: 1px solid var(--ap-gray-200);
  background: var(--ap-gray-50);
}

.ap-policy-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 14px;
}

.ap-policy-tab-desc {
  margin: 0;
  padding: 12px 18px 0;
  color: var(--ap-gray-600);
  font-size: 0.875rem;
}

.ap-policy-doc {
  padding: 24px 28px 32px;
  font-family: var(--ma-display, 'Libre Baskerville', Georgia, serif);
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ap-gray-900);
}

.ap-policy-doc h1 {
  font-size: 1.55rem;
  margin: 0 0 12px;
}

.ap-policy-doc h2 {
  font-size: 1.15rem;
  margin: 18px 0 8px;
}

.ap-policy-doc h3 {
  font-size: 1rem;
  margin: 14px 0 6px;
}

.ap-policy-doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.ap-policy-doc th,
.ap-policy-doc td {
  border: 1px solid var(--ap-gray-300);
  padding: 8px 10px;
  vertical-align: top;
}

.ap-policy-doc .meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--ap-gray-200);
  border-radius: 8px;
  margin-bottom: 16px;
  background: var(--ap-gray-50);
}

.ap-policy-doc .ph {
  background: #fbf3e3;
}

.ap-policy-doc .attrib {
  color: var(--ap-gray-500);
  font-size: 0.85rem;
  margin-top: 20px;
}

@media print {
  .ap-sidebar,
  .ap-content-header,
  .ap-policy-viewer-head,
  .ap-policy-viewer-toolbar,
  .ap-policy-tab-desc {
    display: none !important;
  }

  .ap-admin-main {
    margin-left: 0 !important;
  }

  .ap-policy-viewer-card {
    border: 0;
    box-shadow: none;
  }

  .ap-policy-doc {
    padding: 0;
  }
}

