/* ==========================================================================
   XKIM Admin Console — Design System
   --------------------------------------------------------------------------
   A single, consistent stylesheet for the entire admin panel. Built around
   reusable primitives (cards, tables, buttons, modals, badges, forms, chat)
   so every page looks and behaves the same.
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------- */
:root {
  /* Brand */
  --ax-brand: #4f46e5;
  --ax-brand-600: #4338ca;
  --ax-brand-700: #3730a3;
  --ax-brand-50: #eef2ff;

  /* Surfaces */
  --ax-bg: #f6f7fb;
  --ax-panel: #ffffff;
  --ax-panel-2: #fafbff;
  --ax-border: #e6e8ef;
  --ax-border-strong: #d4d8e2;

  /* Text */
  --ax-text: #0f172a;
  --ax-text-2: #475569;
  --ax-text-3: #94a3b8;
  --ax-text-inverse: #ffffff;

  /* Semantic */
  --ax-success: #10b981;
  --ax-success-bg: #ecfdf5;
  --ax-success-border: #a7f3d0;
  --ax-warning: #f59e0b;
  --ax-warning-bg: #fffbeb;
  --ax-warning-border: #fde68a;
  --ax-danger: #ef4444;
  --ax-danger-bg: #fef2f2;
  --ax-danger-border: #fecaca;
  --ax-info: #0ea5e9;
  --ax-info-bg: #f0f9ff;
  --ax-info-border: #bae6fd;

  /* Layout */
  --ax-side-w: 240px;
  --ax-radius-sm: 6px;
  --ax-radius: 10px;
  --ax-radius-lg: 14px;
  --ax-radius-xl: 18px;

  /* Shadows */
  --ax-shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --ax-shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --ax-shadow: 0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --ax-shadow-lg: 0 12px 32px rgba(15,23,42,.10), 0 4px 12px rgba(15,23,42,.06);
}

/* --- Reset / globals ----------------------------------------------------- */
body.admin-body {
  margin: 0;
  background: var(--ax-bg);
  color: var(--ax-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.admin-body * { box-sizing: border-box; }
.admin-body a { color: var(--ax-brand); text-decoration: none; }
.admin-body a:hover { color: var(--ax-brand-600); }

/* --- App shell ----------------------------------------------------------- */
.ax-shell {
  display: grid;
  grid-template-columns: var(--ax-side-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.ax-side {
  background: linear-gradient(180deg, #111827 0%, #0b1224 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.ax-side__brand {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.ax-side__brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
}
.ax-side__brand-text {
  display: flex; flex-direction: column; line-height: 1.1;
}
.ax-side__brand-text strong { color: #fff; font-size: 15px; letter-spacing: .2px; }
.ax-side__brand-text small { color: #a5b4fc; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

.ax-side__group {
  padding: 18px 14px 6px;
  font-size: 11px;
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-weight: 700;
  opacity: .8;
}
.ax-side__nav { padding: 0 10px 24px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.ax-side__nav::-webkit-scrollbar { width: 6px; }
.ax-side__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.ax-side__link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background .12s ease, color .12s ease, transform .04s ease;
  position: relative;
  white-space: nowrap;
}
.ax-side__link:hover { background: rgba(255,255,255,.07); color: #fff; }
.ax-side__link.is-active {
  background: linear-gradient(90deg, rgba(99,102,241,.28), rgba(139,92,246,.18));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(165,180,252,.18);
}
.ax-side__link.is-active::before {
  content: "";
  position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  background: #a5b4fc;
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 14px rgba(165,180,252,.7);
}
.ax-side__link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; color: #a5b4fc; }
.ax-side__link.is-active svg { opacity: 1; color: #c7d2fe; }
.ax-side__badge {
  margin-left: auto;
  background: var(--ax-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.ax-side__bottom {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.18);
}
.ax-side__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(99,102,241,.4);
}
.ax-side__me { flex: 1; min-width: 0; }
.ax-side__me strong { color: #fff; font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-side__me small { color: #c7d2fe; font-size: 11px; font-weight: 500; }
.ax-side__signout {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: #94a3b8;
  display: grid; place-items: center;
  transition: background .12s ease, color .12s ease;
}
.ax-side__signout:hover { background: rgba(239,68,68,.15); color: #fca5a5; }

/* Main column */
.ax-main { display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.ax-topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ax-border);
  padding: 12px 24px;
  display: flex; align-items: center; gap: 16px;
}
.ax-topbar__burger {
  display: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--ax-border);
  background: #fff; color: var(--ax-text-2);
  cursor: pointer;
}
.ax-topbar__title { font-size: 16px; font-weight: 600; color: var(--ax-text); margin: 0; }
.ax-topbar__sub { color: var(--ax-text-3); font-size: 13px; margin-left: 4px; }

.ax-topbar__search {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
  position: relative;
}
.ax-topbar__search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--ax-border);
  border-radius: 8px;
  background: var(--ax-panel-2);
  font-size: 13px;
  color: var(--ax-text);
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.ax-topbar__search input:focus {
  outline: none;
  border-color: var(--ax-brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.ax-topbar__search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ax-text-3);
}
.ax-topbar__search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius);
  box-shadow: var(--ax-shadow-lg);
  max-height: 480px; overflow-y: auto;
  display: none;
  z-index: 50;
}
.ax-topbar__search-results.is-open { display: block; }
.ax-search-group { padding: 6px 0; border-bottom: 1px solid var(--ax-border); }
.ax-search-group:last-child { border-bottom: 0; }
.ax-search-group__title { padding: 6px 14px; font-size: 11px; font-weight: 700; color: var(--ax-text-3); text-transform: uppercase; letter-spacing: .6px; }
.ax-search-item { display: block; padding: 8px 14px; color: var(--ax-text); font-size: 13px; }
.ax-search-item:hover { background: var(--ax-panel-2); }
.ax-search-item small { color: var(--ax-text-3); margin-left: 6px; font-size: 12px; }
.ax-search-empty { padding: 16px; text-align: center; color: var(--ax-text-3); font-size: 13px; }

.ax-topbar__actions { display: flex; gap: 8px; align-items: center; }
.ax-topbar__icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--ax-panel-2);
  border: 1px solid var(--ax-border);
  color: var(--ax-text-2);
  display: grid; place-items: center;
  cursor: pointer;
  position: relative;
}
.ax-topbar__icon-btn:hover { background: #fff; color: var(--ax-text); border-color: var(--ax-border-strong); }
.ax-topbar__icon-btn--dot::after {
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ax-danger);
  border: 2px solid #fff;
}

/* Page content */
.ax-content {
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* --- Page header inside content ----------------------------------------- */
.ax-page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.ax-page-head__title { font-size: 22px; font-weight: 700; color: var(--ax-text); margin: 0 0 4px; }
.ax-page-head__subtitle { color: var(--ax-text-2); font-size: 13.5px; margin: 0; }
.ax-page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Breadcrumbs */
.ax-breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ax-text-3);
  margin-bottom: 10px;
}
.ax-breadcrumbs a { color: var(--ax-text-2); }
.ax-breadcrumbs a:hover { color: var(--ax-brand); }
.ax-breadcrumbs span { color: var(--ax-text-3); }

/* --- Cards --------------------------------------------------------------- */
.ax-card {
  background: var(--ax-panel);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius-lg);
  box-shadow: var(--ax-shadow-xs);
}
.ax-card__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ax-border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ax-card__title { font-size: 15px; font-weight: 600; color: var(--ax-text); margin: 0; }
.ax-card__subtitle { font-size: 12.5px; color: var(--ax-text-3); margin: 2px 0 0; }
.ax-card__body { padding: 18px 20px; }
.ax-card__foot {
  padding: 12px 20px;
  border-top: 1px solid var(--ax-border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--ax-panel-2);
  border-radius: 0 0 var(--ax-radius-lg) var(--ax-radius-lg);
}
.ax-card--plain { box-shadow: none; }

/* Stat cards */
.ax-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.ax-stat {
  background: var(--ax-panel);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius-lg);
  padding: 16px 18px;
  box-shadow: var(--ax-shadow-xs);
  position: relative;
  overflow: hidden;
}
.ax-stat__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 10px;
}
.ax-stat__label { font-size: 12px; font-weight: 600; color: var(--ax-text-3); text-transform: uppercase; letter-spacing: .5px; }
.ax-stat__value { font-size: 26px; font-weight: 700; color: var(--ax-text); margin-top: 4px; line-height: 1.1; }
.ax-stat__hint { font-size: 12px; color: var(--ax-text-2); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.ax-stat__delta--up { color: var(--ax-success); }
.ax-stat__delta--down { color: var(--ax-danger); }
.ax-stat--brand .ax-stat__icon { background: var(--ax-brand-50); color: var(--ax-brand); }
.ax-stat--success .ax-stat__icon { background: var(--ax-success-bg); color: var(--ax-success); }
.ax-stat--warning .ax-stat__icon { background: var(--ax-warning-bg); color: var(--ax-warning); }
.ax-stat--info .ax-stat__icon { background: var(--ax-info-bg); color: var(--ax-info); }
.ax-stat--danger .ax-stat__icon { background: var(--ax-danger-bg); color: var(--ax-danger); }

/* --- Buttons ------------------------------------------------------------- */
.ax-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--ax-brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, transform .04s ease, box-shadow .12s ease, color .12s ease, border-color .12s ease;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
.ax-btn:hover { background: var(--ax-brand-600); color: #fff; }
.ax-btn:active { transform: translateY(1px); }
.ax-btn:disabled, .ax-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.ax-btn--secondary {
  background: #fff;
  color: var(--ax-text);
  border-color: var(--ax-border-strong);
}
.ax-btn--secondary:hover { background: var(--ax-panel-2); color: var(--ax-text); border-color: var(--ax-text-3); }
.ax-btn--ghost {
  background: transparent;
  color: var(--ax-text-2);
  border-color: transparent;
}
.ax-btn--ghost:hover { background: var(--ax-panel-2); color: var(--ax-text); }
.ax-btn--danger { background: var(--ax-danger); }
.ax-btn--danger:hover { background: #dc2626; color: #fff; }
.ax-btn--success { background: var(--ax-success); }
.ax-btn--success:hover { background: #059669; color: #fff; }
.ax-btn--warning { background: var(--ax-warning); color: #78350f; }
.ax-btn--warning:hover { background: #f59e0b; color: #78350f; }
.ax-btn--sm { height: 30px; padding: 0 10px; font-size: 12px; }
.ax-btn--xs { height: 26px; padding: 0 8px; font-size: 12px; }
.ax-btn--lg { height: 42px; padding: 0 18px; font-size: 14px; }
.ax-btn--block { width: 100%; }
.ax-btn--icon { width: 36px; padding: 0; }
.ax-btn--sm.ax-btn--icon { width: 30px; }
.ax-btn--xs.ax-btn--icon { width: 26px; }

.ax-btn-group {
  display: inline-flex;
  background: var(--ax-panel-2);
  border: 1px solid var(--ax-border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.ax-btn-group button {
  height: 28px; padding: 0 10px;
  border: 0; background: transparent; color: var(--ax-text-2);
  border-radius: 6px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ax-btn-group button:hover { color: var(--ax-text); }
.ax-btn-group button.is-active {
  background: #fff;
  color: var(--ax-brand);
  box-shadow: var(--ax-shadow-xs);
}

/* --- Forms --------------------------------------------------------------- */
.ax-field { margin-bottom: 14px; }
.ax-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ax-text-2); margin-bottom: 6px; }
.ax-help { font-size: 12px; color: var(--ax-text-3); margin-top: 4px; }
.ax-input, .ax-select, .ax-textarea {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--ax-border-strong);
  border-radius: 8px;
  color: var(--ax-text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.ax-textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.ax-input:focus, .ax-select:focus, .ax-textarea:focus {
  outline: none;
  border-color: var(--ax-brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.ax-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.ax-input--sm { height: 30px; font-size: 12.5px; }
.ax-input-row { display: flex; gap: 8px; align-items: center; }

.ax-toggle {
  position: relative; display: inline-block; width: 36px; height: 20px; vertical-align: middle;
}
.ax-toggle input { opacity: 0; width: 0; height: 0; }
.ax-toggle__slot {
  position: absolute; inset: 0; background: #e5e7eb;
  border-radius: 999px; transition: background .12s;
}
.ax-toggle__slot::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: transform .12s;
  box-shadow: var(--ax-shadow-xs);
}
.ax-toggle input:checked + .ax-toggle__slot { background: var(--ax-brand); }
.ax-toggle input:checked + .ax-toggle__slot::before { transform: translateX(16px); }

/* --- Tables -------------------------------------------------------------- */
.ax-table-wrap {
  background: var(--ax-panel);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius-lg);
  overflow: hidden;
  box-shadow: var(--ax-shadow-xs);
}
.ax-table-toolbar {
  padding: 12px 16px;
  display: flex; gap: 10px; align-items: center;
  border-bottom: 1px solid var(--ax-border);
  background: var(--ax-panel-2);
  flex-wrap: wrap;
}
.ax-table-toolbar .ax-input { max-width: 280px; }

.ax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.ax-table thead th {
  background: var(--ax-panel-2);
  color: var(--ax-text-2);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--ax-border);
  white-space: nowrap;
}
.ax-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ax-border);
  vertical-align: middle;
}
.ax-table tbody tr:last-child td { border-bottom: 0; }
.ax-table tbody tr:hover { background: var(--ax-panel-2); }
.ax-table tbody tr.is-row-clickable { cursor: pointer; }
.ax-table__empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ax-text-3);
  font-size: 13.5px;
}
.ax-table__actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.ax-table--compact td { padding: 8px 14px; }

/* User cell (avatar + name + email) */
.ax-user-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.ax-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.ax-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ax-avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.ax-avatar--lg { width: 56px; height: 56px; font-size: 19px; }
.ax-avatar--xl { width: 80px; height: 80px; font-size: 26px; }
.ax-user-cell__main { min-width: 0; }
.ax-user-cell__name { font-weight: 600; color: var(--ax-text); display: block; overflow: hidden; text-overflow: ellipsis; }
.ax-user-cell__email { font-size: 12px; color: var(--ax-text-3); display: block; overflow: hidden; text-overflow: ellipsis; }

/* --- Badges & pills ----------------------------------------------------- */
.ax-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--ax-panel-2);
  color: var(--ax-text-2);
  border: 1px solid var(--ax-border);
  line-height: 1.4;
  white-space: nowrap;
}
.ax-badge--success { background: var(--ax-success-bg); color: #047857; border-color: var(--ax-success-border); }
.ax-badge--warning { background: var(--ax-warning-bg); color: #92400e; border-color: var(--ax-warning-border); }
.ax-badge--danger { background: var(--ax-danger-bg); color: #b91c1c; border-color: var(--ax-danger-border); }
.ax-badge--info { background: var(--ax-info-bg); color: #0369a1; border-color: var(--ax-info-border); }
.ax-badge--brand { background: var(--ax-brand-50); color: var(--ax-brand-700); border-color: #c7d2fe; }
.ax-badge--neutral { background: var(--ax-panel-2); color: var(--ax-text-2); border-color: var(--ax-border-strong); }
.ax-badge--dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

/* --- Alerts -------------------------------------------------------------- */
.ax-alert {
  display: flex; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--ax-radius);
  border: 1px solid var(--ax-info-border);
  background: var(--ax-info-bg);
  color: #0c4a6e;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.ax-alert--success { border-color: var(--ax-success-border); background: var(--ax-success-bg); color: #064e3b; }
.ax-alert--warning { border-color: var(--ax-warning-border); background: var(--ax-warning-bg); color: #78350f; }
.ax-alert--danger { border-color: var(--ax-danger-border); background: var(--ax-danger-bg); color: #7f1d1d; }
.ax-alert__icon { flex-shrink: 0; padding-top: 1px; }
.ax-alert__body { flex: 1; }
.ax-alert__title { font-weight: 600; margin-bottom: 2px; }

/* --- Modal --------------------------------------------------------------- */
.ax-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.ax-modal-backdrop.is-open { display: flex; }
.ax-modal {
  background: #fff;
  border-radius: var(--ax-radius-lg);
  box-shadow: var(--ax-shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: ax-modal-in .18s ease-out;
}
@keyframes ax-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ax-modal--lg { max-width: 720px; }
.ax-modal--xl { max-width: 960px; }
.ax-modal__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ax-border);
  display: flex; align-items: center; justify-content: space-between;
}
.ax-modal__title { font-size: 16px; font-weight: 600; margin: 0; color: var(--ax-text); }
.ax-modal__close {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 0; color: var(--ax-text-3);
  cursor: pointer;
  display: grid; place-items: center;
}
.ax-modal__close:hover { background: var(--ax-panel-2); color: var(--ax-text); }
.ax-modal__body { padding: 20px; overflow-y: auto; }
.ax-modal__foot {
  padding: 14px 20px;
  border-top: 1px solid var(--ax-border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--ax-panel-2);
  border-radius: 0 0 var(--ax-radius-lg) var(--ax-radius-lg);
}

/* --- Tabs ---------------------------------------------------------------- */
.ax-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--ax-border);
  margin-bottom: 16px;
}
.ax-tabs button {
  height: 36px; padding: 0 14px;
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--ax-text-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: -1px;
}
.ax-tabs button:hover { color: var(--ax-text); }
.ax-tabs button.is-active {
  color: var(--ax-brand);
  border-bottom-color: var(--ax-brand);
  font-weight: 600;
}
.ax-tab-count {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 18px; padding: 0 6px;
  margin-left: 6px;
  background: var(--ax-panel-2);
  color: var(--ax-text-2);
  border-radius: 9px;
  font-size: 11px; font-weight: 700;
}
.ax-tabs button.is-active .ax-tab-count {
  background: var(--ax-brand);
  color: #fff;
}

/* --- Product cards (in user profile) ----------------------------------- */
.ax-prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.ax-prod-card {
  background: var(--ax-panel);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.ax-prod-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15,23,42,.08);
  border-color: var(--ax-brand-soft);
}
.ax-prod-card__img {
  height: 140px;
  background: var(--ax-panel-2) center/cover no-repeat;
  position: relative;
}
.ax-prod-card__chip {
  position: absolute; top: 8px; left: 8px;
  background: rgba(15,23,42,.78); color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  letter-spacing: .3px;
}
.ax-prod-card__chip--hidden { background: rgba(239,68,68,.92); }
.ax-prod-card__body { padding: 10px 12px; flex: 1; }
.ax-prod-card__name {
  font-weight: 600; font-size: 13.5px;
  color: var(--ax-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
  min-height: 36px;
}
.ax-prod-card__meta { font-size: 11.5px; color: var(--ax-text-3); margin-bottom: 8px; }
.ax-prod-card__row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.ax-prod-card__views { color: var(--ax-text-3); font-size: 11.5px; }
.ax-prod-card__actions {
  padding: 8px 10px;
  border-top: 1px solid var(--ax-border);
  display: flex; gap: 6px;
  background: var(--ax-panel-2);
}
.ax-prod-card__actions .ax-btn { flex: 1; padding: 4px 6px; font-size: 11.5px; }

/* --- Product detail drawer ---------------------------------------------- */
.ax-prod-detail {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}
@media (max-width: 720px) {
  .ax-prod-detail { grid-template-columns: 1fr; }
}
.ax-prod-detail__main-img {
  width: 100%; aspect-ratio: 1/1;
  background: var(--ax-panel-2) center/cover no-repeat;
  border-radius: var(--ax-radius);
  border: 1px solid var(--ax-border);
}
.ax-prod-detail__thumbs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; margin-top: 8px;
}
.ax-prod-detail__thumb {
  aspect-ratio: 1/1;
  background: var(--ax-panel-2) center/cover no-repeat;
  border-radius: 6px; cursor: pointer;
  border: 1px solid var(--ax-border);
}
.ax-prod-detail__thumb:hover { border-color: var(--ax-brand); }

.ax-table--mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ax-table--mini td { padding: 5px 0; border-bottom: 1px dashed var(--ax-border); }
.ax-table--mini td:first-child { width: 100px; }

/* --- Admin Explore (category browser) ----------------------------------- */
.ax-explore {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 960px) {
  .ax-explore { grid-template-columns: 1fr; }
}
.ax-explore__side {
  background: var(--ax-panel);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius-lg);
  padding: 14px;
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.ax-explore__side-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.ax-cat-tree { display: flex; flex-direction: column; }
.ax-cat-node {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px;
  font-size: 13px; color: var(--ax-text-2);
  cursor: pointer;
  user-select: none;
}
.ax-cat-node:hover { background: var(--ax-panel-2); color: var(--ax-text); }
.ax-cat-node.is-active {
  background: var(--ax-brand-soft);
  color: var(--ax-brand);
  font-weight: 600;
}
.ax-cat-node.is-disabled { opacity: .5; }
.ax-cat-node--l0 { font-weight: 600; color: var(--ax-text); margin-top: 3px; }
.ax-cat-node--l1 { padding-left: 22px; }
.ax-cat-node--l2 { padding-left: 36px; font-size: 12.5px; }
.ax-cat-arrow {
  width: 12px; display: inline-block;
  color: var(--ax-text-3);
  font-size: 10px;
  transition: transform .15s ease;
}
.ax-cat-arrow.is-open { transform: rotate(90deg); }
.ax-cat-arrow--blank { visibility: hidden; }
.ax-cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-cat-count {
  background: var(--ax-panel-2);
  color: var(--ax-text-3);
  font-size: 10.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.ax-cat-node.is-active .ax-cat-count {
  background: var(--ax-brand);
  color: #fff;
}

.ax-explore__main {}
.ax-explore__breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ax-text-3);
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.ax-explore__breadcrumb .ax-link {
  background: none; border: 0; cursor: pointer;
  padding: 4px 6px; border-radius: 5px;
  color: var(--ax-text-2); font-size: 13px;
  font-family: inherit;
}
.ax-explore__breadcrumb .ax-link:hover { background: var(--ax-panel-2); color: var(--ax-text); }
.ax-bc-sep { color: var(--ax-text-3); }

.ax-explore__toolbar {
  display: flex; gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ax-prod-card__chip--brand {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

/* --- Empty state -------------------------------------------------------- */
.ax-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--ax-text-3);
}
.ax-empty__icon {
  width: 60px; height: 60px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--ax-panel-2);
  color: var(--ax-text-3);
  display: grid; place-items: center;
}
.ax-empty__title { color: var(--ax-text); font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.ax-empty__hint { font-size: 13px; color: var(--ax-text-3); max-width: 360px; margin: 0 auto; }

/* --- Chat / message thread (shared for support + verification) ---------- */
.ax-thread {
  display: flex; flex-direction: column;
  background: var(--ax-panel);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius-lg);
  overflow: hidden;
  min-height: 0;
}
.ax-thread__head {
  padding: 12px 16px;
  background: var(--ax-panel-2);
  border-bottom: 1px solid var(--ax-border);
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.ax-thread__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--ax-panel-2);
  min-height: 280px;
}
.ax-thread__body::-webkit-scrollbar { width: 8px; }
.ax-thread__body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.ax-msg {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--ax-shadow-xs);
}
.ax-msg--in {
  background: #fff;
  border: 1px solid var(--ax-border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ax-msg--out {
  background: var(--ax-brand);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ax-msg--system {
  align-self: center;
  background: var(--ax-warning-bg);
  border: 1px solid var(--ax-warning-border);
  color: #78350f;
  text-align: center;
  max-width: 90%;
  font-size: 12.5px;
  border-radius: 8px;
}
.ax-msg__meta {
  display: flex; gap: 8px;
  font-size: 11px;
  opacity: .75;
  margin-bottom: 4px;
}
.ax-msg--out .ax-msg__meta { color: rgba(255,255,255,.85); }
.ax-msg__attach {
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: rgba(0,0,0,.06);
  border-radius: 6px;
  font-size: 12.5px;
  color: inherit;
}
.ax-msg--out .ax-msg__attach { background: rgba(255,255,255,.18); }
.ax-msg__image {
  margin-top: 6px;
  max-width: 280px;
  border-radius: 8px;
  display: block;
}

.ax-thread__compose {
  padding: 10px;
  border-top: 1px solid var(--ax-border);
  background: #fff;
  display: flex; gap: 8px; align-items: flex-end;
  flex-wrap: wrap;
}
.ax-thread__compose textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px; max-height: 160px;
  border: 1px solid var(--ax-border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  outline: none;
  -webkit-appearance: none;
}
.ax-thread__compose textarea:focus {
  border-color: var(--ax-brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.ax-thread__compose .ax-btn {
  min-height: 44px;
  padding: 0 20px;
  flex-shrink: 0;
}
.ax-thread__attach-preview {
  margin: 6px 10px 0;
  padding: 6px 10px;
  background: var(--ax-info-bg);
  border: 1px solid var(--ax-info-border);
  border-radius: 6px;
  font-size: 12.5px;
  color: #0c4a6e;
  display: inline-flex; align-items: center; gap: 8px;
  width: 100%;
  box-sizing: border-box;
}
.ax-thread__attach-preview button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 14px; }

/* --- Split layout (inbox / detail) ------------------------------------- */
.ax-split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 130px);
}
.ax-split__list {
  background: var(--ax-panel);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ax-split__list-head { padding: 12px; border-bottom: 1px solid var(--ax-border); display: flex; flex-direction: column; gap: 8px; }
.ax-split__list-body { flex: 1; overflow-y: auto; }
.ax-split__detail {
  background: var(--ax-panel);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius-lg);
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* List item (inbox) */
.ax-inbox-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--ax-border);
  transition: background .1s ease;
  position: relative;
}
.ax-inbox-item:hover { background: var(--ax-panel-2); }
.ax-inbox-item.is-active { background: var(--ax-brand-50); }
.ax-inbox-item.is-active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--ax-brand);
}
.ax-inbox-item__main { flex: 1; min-width: 0; }
.ax-inbox-item__top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ax-inbox-item__name { font-weight: 600; font-size: 13.5px; color: var(--ax-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-inbox-item__time { font-size: 11.5px; color: var(--ax-text-3); flex-shrink: 0; }
.ax-inbox-item__preview { font-size: 12.5px; color: var(--ax-text-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ax-inbox-item__meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.ax-inbox-item__unread {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ax-brand);
  margin-top: 14px; flex-shrink: 0;
}

/* --- Page-specific compact helpers --------------------------------------- */
.ax-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ax-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ax-stack > * + * { margin-top: 12px; }
.ax-row { display: flex; gap: 12px; align-items: center; }
.ax-row--wrap { flex-wrap: wrap; }
.ax-spacer { flex: 1; }
.ax-divider { height: 1px; background: var(--ax-border); margin: 14px 0; }
.ax-muted { color: var(--ax-text-3); }
.ax-strong { color: var(--ax-text); font-weight: 600; }

/* Tiny KPI numbers under stat cards */
.ax-mini-kpi { font-size: 12.5px; color: var(--ax-text-2); display: flex; gap: 12px; }
.ax-mini-kpi b { color: var(--ax-text); font-weight: 700; }

/* Activity timeline */
.ax-timeline { position: relative; padding-left: 24px; }
.ax-timeline::before {
  content: ""; position: absolute;
  left: 9px; top: 4px; bottom: 4px;
  width: 2px; background: var(--ax-border);
}
.ax-timeline__item { position: relative; margin-bottom: 16px; }
.ax-timeline__item::before {
  content: ""; position: absolute;
  left: -19px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ax-brand);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--ax-border);
}
.ax-timeline__item--success::before { background: var(--ax-success); }
.ax-timeline__item--danger::before { background: var(--ax-danger); }
.ax-timeline__item--warning::before { background: var(--ax-warning); }
.ax-timeline__time { font-size: 11.5px; color: var(--ax-text-3); }
.ax-timeline__body { font-size: 13px; color: var(--ax-text); margin-top: 2px; }

/* Hero (used in user_detail) */
.ax-hero {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border-radius: var(--ax-radius-lg);
  padding: 22px 24px;
  margin-bottom: 18px;
  display: flex; gap: 18px; align-items: center;
  flex-wrap: wrap;
}
.ax-hero__name { font-size: 22px; font-weight: 700; margin: 0; }
.ax-hero__email { opacity: .85; font-size: 13.5px; }
.ax-hero__meta { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; font-size: 12.5px; opacity: .9; }
.ax-hero__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.ax-hero .ax-btn--secondary {
  background: rgba(255,255,255,.18);
  color: #fff;
  border-color: rgba(255,255,255,.3);
}
.ax-hero .ax-btn--secondary:hover { background: rgba(255,255,255,.28); }

/* Document tile */
.ax-doc {
  display: flex; gap: 10px; align-items: center;
  padding: 12px;
  background: var(--ax-panel-2);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius);
}
.ax-doc__icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--ax-brand-50);
  color: var(--ax-brand);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ax-doc__main { flex: 1; min-width: 0; }
.ax-doc__name { font-weight: 600; color: var(--ax-text); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-doc__hint { font-size: 12px; color: var(--ax-text-3); }

/* Chart placeholder (sparkline-style canvas wrapper) */
.ax-chart {
  position: relative;
  width: 100%;
  height: 220px;
}
.ax-chart svg { width: 100%; height: 100%; }

/* --- Toast notifications ------------------------------------------------ */
.ax-toast-wrap {
  position: fixed;
  bottom: 18px; right: 18px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.ax-toast {
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  box-shadow: var(--ax-shadow-lg);
  pointer-events: auto;
  display: flex; gap: 10px; align-items: center;
  min-width: 240px;
  animation: ax-toast-in .2s ease-out;
}
@keyframes ax-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.ax-toast--success { background: var(--ax-success); }
.ax-toast--danger { background: var(--ax-danger); }
.ax-toast--warning { background: var(--ax-warning); color: #78350f; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 960px) {
  .ax-shell { grid-template-columns: 1fr; }
  .ax-side {
    position: fixed;
    left: 0; top: 0; bottom: 0; height: 100vh;
    width: var(--ax-side-w);
    transform: translateX(-100%);
    transition: transform .18s ease;
  }
  .ax-side.is-open { transform: translateX(0); box-shadow: var(--ax-shadow-lg); }
  .ax-topbar__burger { display: grid; place-items: center; }
  .ax-topbar__search { display: none; }
  .ax-split { grid-template-columns: 1fr; min-height: auto; }
  .ax-grid-2, .ax-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .ax-content { padding: 12px; }
  .ax-hero { flex-direction: column; align-items: flex-start; }
  .ax-hero__actions { margin-left: 0; flex-wrap: wrap; }
  .ax-thread { min-height: 400px; }
  .ax-thread__body { min-height: 200px; padding: 10px; }
  .ax-thread__compose { padding: 8px; gap: 6px; }
  .ax-thread__compose textarea { font-size: 16px; min-height: 48px; padding: 10px 12px; }
  .ax-thread__compose .ax-btn { min-height: 48px; padding: 0 16px; }
  .ax-thread__compose .ax-btn--icon { min-height: 48px; width: 48px; }
  .ax-msg { max-width: 88%; }
  .ax-msg__image { max-width: 220px; }
  .ax-page-head { flex-direction: column; gap: 10px; align-items: flex-start; }
  .ax-page-head__actions { flex-wrap: wrap; }
  .ax-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .ax-tabs button { flex-shrink: 0; }
  .ax-stat-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Login screen (standalone) ------------------------------------------ */
.ax-login-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
}
.ax-login-card {
  width: 100%; max-width: 420px;
  background: #fff;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 24px 48px rgba(0,0,0,.18);
}
.ax-login-card__brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.ax-login-card__brand .mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  box-shadow: 0 8px 18px rgba(99,102,241,.35);
}
.ax-login-card h1 { margin: 0 0 4px; font-size: 20px; color: var(--ax-text); }
.ax-login-card p.sub { margin: 0 0 22px; color: var(--ax-text-3); font-size: 13.5px; }
