/* ─────────────────────────────────────────────────────────────────────────
   AutoHub — autohub-spa.css  (UI/UX hardening release)
   SPA shell, tables, forms, drawers, toasts, settings, dashboard.
───────────────────────────────────────────────────────────────────────── */

/* ══════════════════════════════════════════════════════════════════════
   1. SHELL
══════════════════════════════════════════════════════════════════════ */
.autohub-spa-body { overflow: hidden; background: var(--ah-bg); }

.spa-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.spa-sidebar {
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(170deg, var(--ah-sidebar) 0%, var(--ah-sidebar-2) 100%);
  color: var(--ah-sidebar-text);
  border-right: 1px solid rgba(255,255,255,.055);
  position: relative;
}
/* left edge accent stripe */
.spa-sidebar::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent 10%, var(--ah-blue) 45%, transparent 90%);
  opacity: .5;
  pointer-events: none;
}

.spa-brand-row {
  height: 54px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.spa-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: -.025em;
  text-decoration: none;
}
.spa-brand:hover { text-decoration: none; opacity: .9; }
.spa-brand img   { width: 29px; height: 29px; border-radius: 5px; }

.spa-user-card {
  margin: 10px 10px 5px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 6px;
  background: rgba(255,255,255,.042);
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  transition: background var(--ah-dur-fast) ease;
}
.spa-user-card:hover { background: rgba(255,255,255,.065); }
.spa-user-card strong { display: block; color: #fff; font-size: 12.5px; letter-spacing: -.01em; }
.spa-user-card small  { display: block; color: var(--ah-sidebar-muted); font-size: 11.5px; margin-top: 1px; }

.spa-avatar {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 5px;
  background: linear-gradient(135deg, #1d4b91, #2563eb);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  letter-spacing: -.02em;
}

.spa-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 7px 8px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.ah-nav-group {
  margin: 14px 8px 5px;
  color: var(--ah-sidebar-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-weight: 800;
  opacity: .7;
}
.spa-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ah-sidebar-text);
  padding: 7px 9px;
  border-radius: 5px;
  margin: 1px 0;
  font-weight: 650;
  font-size: 12.5px;
  border: 1px solid transparent;
  transition:
    background  var(--ah-dur-fast) ease,
    border-color var(--ah-dur-fast) ease,
    color        var(--ah-dur-fast) ease;
  position: relative;
}
.spa-nav a:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
  text-decoration: none;
}
.spa-nav a.active {
  background: rgba(37,99,235,.20);
  border-color: rgba(99,148,235,.18);
  color: #e0eaff;
  box-shadow: inset 2px 0 0 var(--ah-blue);
}
.spa-nav a span { width: 16px; display: inline-grid; place-items: center; opacity: .85; flex-shrink: 0; }

/* ── Main area ───────────────────────────────────────────────────────── */
.spa-main {
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ah-bg);
}

.spa-topbar {
  height: 54px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--ah-border);
  box-shadow: 0 1px 0 rgba(15,23,42,.03), var(--ah-shadow);
  z-index: 10;
  gap: 10px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.topbar-title-block  { min-width: 0; }
.spa-breadcrumb {
  font-size: 10.5px;
  color: var(--ah-muted);
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .075em;
  line-height: 1;
}
.spa-topbar h1 {
  font-size: 18px;
  line-height: 1.1;
  margin: 2px 0 0;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.02em;
}
.spa-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.top-icon {
  width: 30px; height: 30px;
  padding: 0;
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius);
  background: #fff;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background var(--ah-dur-fast) ease, border-color var(--ah-dur-fast) ease;
}
.top-icon:hover { background: var(--ah-surface-2); border-color: var(--ah-border-2); }
.top-icon img   { width: 15px; height: 15px; }

.mobile-only { display: none !important; }

/* ── Sidebar backdrop (mobile) ───────────────────────────────────────── */
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.44);
  z-index: 35;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ── Toasts ──────────────────────────────────────────────────────────── */
.spa-alerts {
  position: fixed;
  right: 16px; top: 66px;
  z-index: 80;
  display: grid;
  gap: 6px;
  pointer-events: none;
}
.spa-toast {
  min-width: 240px;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg, 8px);
  padding: 10px 13px;
  box-shadow: var(--ah-shadow-lg);
  animation: toastIn .22s var(--ah-ease, cubic-bezier(.16,1,.3,1));
  pointer-events: all;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.spa-toast.leaving {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity .18s ease, transform .18s ease;
}
.spa-toast strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ah-muted);
  font-weight: 800;
}
.spa-toast span { font-weight: 650; font-size: 13px; color: var(--ah-text); }

.spa-toast.error  { border-color: #fecaca; background: #fff7f5; }
.spa-toast.error  strong { color: #b91c1c; }
.spa-toast.ok     { border-color: #a7f3c0; background: #f5fff8; }
.spa-toast.ok     strong { color: #15803d; }
.spa-toast.warn   { border-color: #fde68a; background: #fffef5; }
.spa-toast.warn   strong { color: #b45309; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ── Content area ────────────────────────────────────────────────────── */
.spa-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px 20px 52px;
  animation: spaIn .15s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,23,42,.12) transparent;
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.spa-card {
  background: #fff;
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg, 8px);
  box-shadow: var(--ah-shadow);
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
}
.spa-card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: -.02em;
  color: #0f172a;
}

/* ── Page intro hero ─────────────────────────────────────────────────── */
.page-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: var(--ah-radius-lg);
  background: linear-gradient(115deg, #0d1629 0%, #1a3060 60%, #172a55 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 4px 14px rgba(10,20,50,.18);
  position: relative;
  overflow: hidden;
}
/* mesh highlight */
.page-intro::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(99,148,235,.18) 0%, transparent 70%);
  pointer-events: none;
}
.page-intro h2    { margin: 0; font-size: 20px; letter-spacing: -.03em; color: #fff; }
.page-intro p     { margin: 4px 0 0; color: #94a3b8; font-size: 13px; }

/* ── Dashboard grid ──────────────────────────────────────────────────── */
.spa-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.spa-stat {
  padding: 14px 15px;
  border-radius: var(--ah-radius-lg);
  background: #fff;
  border: 1px solid var(--ah-border);
  box-shadow: var(--ah-shadow);
  transition: box-shadow var(--ah-dur-fast) ease, transform var(--ah-dur-fast) ease;
}
.spa-stat:hover {
  box-shadow: var(--ah-shadow-lg);
  transform: translateY(-2px);
}
.spa-stat .label {
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--ah-muted);
  font-weight: 800;
  letter-spacing: .07em;
}
.spa-stat .value {
  font-size: 26px;
  font-weight: 850;
  letter-spacing: -.04em;
  margin-top: 5px;
  color: #0f172a;
}
.spa-stat.compact .value { font-size: 20px; }

/* ── Dashboard panels ────────────────────────────────────────────────── */
.dashboard-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(250px, .75fr);
  gap: 14px;
  margin: 14px 0;
}
.activity-list  { display: grid; gap: 6px; }
.activity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius);
  padding: 9px 10px;
  background: #fbfdff;
  transition: background var(--ah-dur-fast) ease, border-color var(--ah-dur-fast) ease;
}
.activity-row:hover { background: #f6f9ff; border-color: var(--ah-border-2); }
.activity-row strong { display: block; font-size: 12.5px; color: #1e2c42; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-row small  { display: block; color: var(--ah-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-row time   { font-size: 11px; color: var(--ah-muted-2, #94a3b8); white-space: nowrap; }

.quick-action-grid { display: grid; gap: 7px; }
.quick-action {
  display: block; text-decoration: none; color: #1e2c42;
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius);
  background: #fbfdff;
  padding: 10px 11px;
  transition: background var(--ah-dur-fast) ease, border-color var(--ah-dur-fast) ease, transform var(--ah-dur-fast) ease, box-shadow var(--ah-dur-fast) ease;
}
.quick-action:hover {
  background: #f0f6ff;
  border-color: #b8cdf3;
  transform: translateY(-1px);
  box-shadow: 0 3px 9px rgba(26,75,174,.09);
  text-decoration: none;
}
.quick-action.primary { border-color: #c7dafc; background: #f5f8ff; }
.quick-action strong  { display: block; font-size: 13px; letter-spacing: -.01em; }
.quick-action small   { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ah-muted); }

/* ── Toolbar ─────────────────────────────────────────────────────────── */
.smart-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.smart-toolbar .left, .smart-toolbar .right {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.smart-toolbar h2 { margin: 0; font-size: 14.5px; letter-spacing: -.015em; }

/* ── Form inputs ─────────────────────────────────────────────────────── */
.smart-input,
.smart-select,
.smart-textarea {
  border: 1px solid var(--ah-border-2);
  border-radius: var(--ah-radius);
  padding: 0 9px;
  background: #fff;
  color: var(--ah-text);
  height: var(--ah-control-h);
  min-height: var(--ah-control-h);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--ah-dur-fast) ease, box-shadow var(--ah-dur-fast) ease;
}
.smart-select { padding-right: 26px; }
.smart-textarea {
  width: 100%;
  min-height: 110px;
  height: auto;
  padding: 7px 9px;
  font-family: var(--ah-mono);
  font-size: 12.5px;
  resize: vertical;
  line-height: 1.5;
}
.smart-input:hover,
.smart-select:hover,
.smart-textarea:hover  { border-color: var(--ah-border-2); }
.smart-input:focus,
.smart-select:focus,
.smart-textarea:focus {
  border-color: var(--ah-blue);
  box-shadow: 0 0 0 3px var(--ah-blue-ring, rgba(26,75,174,.15));
}
input[type=number].smart-input { max-width: 120px; }

/* ── Tables ──────────────────────────────────────────────────────────── */
.smart-table-wrap {
  overflow: auto;
  border-radius: var(--ah-radius);
  border: 1px solid var(--ah-border);
  background: #fff;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,23,42,.10) transparent;
}
.smart-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.smart-table th,
.smart-table td {
  padding: 6px 9px;
  border-bottom: 1px solid #edf2f8;
  text-align: left;
  vertical-align: middle;
}
.smart-table th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  background: #f7f9fc;
  position: sticky;
  top: 0;
  z-index: 1;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 750;
  border-bottom: 1px solid #e3eaf5;
}
.smart-table th.sorted         { color: #1a3a72; background: #f2f6fd; }
.smart-table th .sort-mark     { margin-left: 4px; color: #1a3a72; font-size: 10px; font-weight: 900; }
.smart-table th .sort-index    {
  display: inline-grid; place-items: center;
  min-width: 13px; height: 13px;
  margin-left: 2px;
  border-radius: 999px;
  background: #dbeafe; color: #1e3a8a;
  font-size: 8.5px; font-weight: 900; line-height: 1;
}
.smart-table td                { font-size: 13px; height: 33px; color: #1a2b42; }
.smart-table td.smart-cell-rendered { white-space: normal; }
.smart-table .smart-cell-text  {
  display: block; min-width: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.smart-table .smart-cell-time  { color: #64748b; }
.smart-table tr:last-child td  { border-bottom: 0; }
.smart-table tbody tr:hover td { background: #f6f9ff; }

/* row actions */
.smart-table .row-actions      { display: flex; gap: 3px; flex-wrap: nowrap; white-space: nowrap; }
.smart-table td:has(.row-actions) { padding-top: 3px; padding-bottom: 3px; }
.row-actions .ah-btn,
.smart-table .ah-btn           { height: 24px; min-height: 24px; font-size: 11.5px; padding: 0 7px; border-radius: var(--r-xs, 3px); }
.smart-table .ah-btn.smart-action-icon { width: 24px; min-width: 24px; padding: 0; display: inline-grid; place-items: center; }
.smart-table .ah-btn.smart-action-icon .btn-ico { width: 13px; height: 13px; }

/* configurable table chrome */
.smart-table-configurable     { table-layout: fixed; min-width: 100%; width: max-content; }
.smart-table-configurable th  { position: relative; user-select: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 18px; }
.smart-table-configurable td  { overflow: hidden; text-overflow: ellipsis; vertical-align: middle !important; min-width: 0; }
.smart-table-configurable th[draggable=true] { cursor: pointer; }
.smart-table-configurable th.dragging  { opacity: .5; }
.smart-table-configurable th.drag-over { outline: 2px solid rgba(26,75,174,.35); outline-offset: -2px; background: #eef5ff; }
.smart-th-label { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.smart-col-resize {
  position: absolute; top: 0; right: 0; width: 9px; height: 100%;
  cursor: col-resize; z-index: 2;
}
.smart-col-resize::after {
  content: ''; position: absolute;
  right: 4px; top: 20%; bottom: 20%;
  width: 1px; background: #c0cfe2; opacity: .7;
}
.smart-col-resize:hover::after { background: var(--ah-blue); opacity: 1; }
.smart-resizing, .smart-resizing * { cursor: col-resize !important; user-select: none !important; }

.smart-table .select-col       { width: 34px; text-align: center; }
.smart-table .select-col-col   { width: 34px !important; }
.smart-table .select-col input { width: 14px; height: 14px; accent-color: var(--ah-blue); cursor: pointer; }
.smart-fill-col-col            { width: auto; }
.smart-table .smart-fill-col   { min-width: 0; width: auto; padding: 0 !important; border-left: 0; border-right: 0; background: #fff !important; cursor: default; }
.smart-table th.smart-fill-col { background: #f7f9fc !important; }

/* hint above table */
.smart-table-hint {
  margin: -3px 0 8px;
  color: var(--ah-muted-2, #94a3b8);
  font-size: 11px;
  letter-spacing: .01em;
}

/* ── Pagination ──────────────────────────────────────────────────────── */
.smart-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ah-muted);
}
.smart-pagination-top    { margin: 0 0 8px; }
.smart-pagination-bottom { margin: 8px 0 0; }
.smart-pagination .page-controls { display: flex; align-items: center; gap: 3px; }
.smart-pagination .page-size     { display: flex; align-items: center; gap: 6px; }
.smart-pagination .ah-btn.icon   { width: 24px; height: 24px; min-height: 24px; border-radius: var(--r-xs, 3px); }
.smart-pagination .btn-ico       { width: 11px; height: 11px; opacity: .72; }

.page-jump-wrap {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ah-muted); font-size: 12px; font-weight: 650; white-space: nowrap; margin: 0 3px;
}
.page-jump-wrap .page-jump {
  width: 50px; height: 24px; min-height: 24px;
  padding: 0 5px; text-align: center; font-size: 12px; border-radius: var(--r-xs, 3px);
}
.page-jump-wrap [data-total-pages] { min-width: 20px; color: #475569; font-weight: 750; }

/* spinner */
.table-spinner {
  width: 14px; height: 14px;
  border: 2px solid #dbe3ee;
  border-top-color: var(--ah-blue);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  opacity: 0; margin: 0 3px;
}
.table-spinner.active { opacity: 1; }

/* ── Bulk bar ────────────────────────────────────────────────────────── */
.smart-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -3px 0 9px;
  padding: 7px 10px;
  border: 1px solid #c8d8f0;
  background: linear-gradient(90deg, #f0f6ff, #f8fbff);
  border-radius: var(--ah-radius);
  font-size: 12px;
  color: #334155;
  box-shadow: 0 1px 4px rgba(26,75,174,.07);
}
.smart-bulk-bar[hidden]             { display: none !important; }
.smart-bulk-bar [data-selected-count] { font-weight: 800; color: #1a2b42; }
.smart-bulk-bar .smart-select       { width: auto; min-width: 180px; height: 26px; min-height: 26px; font-size: 12px; }
.smart-bulk-bar .ah-btn             { height: 26px; min-height: 26px; }

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--ah-border);
  margin-bottom: 14px;
}
.tab {
  border: 0; background: transparent;
  padding: 8px 13px;
  font-weight: 750; font-size: 12.5px;
  color: #64748b;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color var(--ah-dur-fast) ease, border-color var(--ah-dur-fast) ease;
  border-radius: var(--r-xs, 3px) var(--r-xs, 3px) 0 0;
}
.tab:hover         { color: #1a3a72; background: #f5f8fc; }
.tab.active        { color: var(--ah-blue); border-bottom-color: var(--ah-blue); }

/* ── Form primitives ─────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 11px; }
.form-field label, .field-label {
  display: flex; align-items: center; gap: 3px;
  font-weight: 750; font-size: 12px; color: #283a52; margin-bottom: 5px;
}
.form-field:has(.is-invalid) label { color: #912018; }
.form-field input[type=checkbox] { width: auto; height: auto; accent-color: var(--ah-blue); }
.form-actions {
  display: flex; justify-content: flex-end; align-items: center; gap: 7px;
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--ah-border);
}
.form-actions.sticky {
  position: sticky; bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.88), #fff 38%);
  z-index: 2;
  margin-left: -16px; margin-right: -16px; margin-bottom: -16px;
  padding: 12px 16px;
  box-shadow: 0 -4px 12px rgba(15,23,42,.04);
}
.two-col   { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.inline-edit { display: flex; gap: 6px; align-items: center; min-width: 230px; }
.inline-edit .smart-input, .inline-edit .smart-select { flex: 1 1 auto; }
.check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; margin: 8px 0;
  user-select: none;
}
.check-row input { width: 14px; height: 14px; accent-color: var(--ah-blue); cursor: pointer; }

/* Form feedback */
.required-mark  { color: #b91c1c; font-weight: 800; }
.field-hint     { font-size: 11.5px; color: var(--ah-muted); margin-top: 4px; line-height: 1.4; }
.field-error    { min-height: 16px; margin-top: 4px; color: #b91c1c; font-size: 11.5px; font-weight: 650; }
.smart-input.is-invalid,
.smart-select.is-invalid,
.smart-textarea.is-invalid { border-color: #d92d20; background: #fffafa; box-shadow: 0 0 0 3px rgba(217,45,32,.10); }
.form-error-summary {
  border: 1px solid #f3b5ae; background: #fff4f2; color: #912018;
  border-radius: var(--ah-radius); padding: 8px 10px; margin: 0 0 12px;
  font-size: 12.5px; font-weight: 700;
}
.form-error-summary[hidden] { display: none; }

/* ── Drawer ──────────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15,23,42,.32);
  opacity: 0;
  transition: opacity var(--ah-dur-mid) ease;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
.drawer-backdrop.open { opacity: 1; }
.drawer-panel {
  position: absolute; right: 0; top: 0;
  height: 100vh;
  width: min(560px, 100%);
  background: #fff;
  border-left: 1px solid var(--ah-border);
  box-shadow: -10px 0 30px rgba(15,23,42,.12), -2px 0 6px rgba(15,23,42,.05);
  transform: translateX(104%);
  transition: transform var(--ah-dur-slow) var(--ah-ease, cubic-bezier(.16,1,.3,1));
  display: flex; flex-direction: column;
}
.drawer-backdrop.open .drawer-panel { transform: none; }
.drawer-panel.wide { width: min(860px, 100%); }

.drawer-panel header {
  height: 54px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #edf2f7;
  background: #fbfdff;
}
.drawer-panel header h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }

.drawer-body {
  padding: 16px;
  overflow: auto;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,23,42,.10) transparent;
}
.drawer-confirm { z-index: 120; }

/* Searchable drawer chrome */
.drawer-search {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding: 8px 9px;
  border: 1px solid var(--ah-border); border-radius: var(--ah-radius);
  background: #fbfdff;
}
.drawer-search.two       { display: grid; grid-template-columns: minmax(0, 1fr) 200px; }
.drawer-search .smart-input { width: 100%; }
.drawer-search-hint, .drawer-meta {
  font-size: 12px; color: var(--ah-muted); white-space: nowrap;
}
.drawer-meta {
  display: flex; gap: 7px;
  justify-content: flex-end; margin: -4px 0 9px;
}
.drawer-meta span {
  border: 1px solid var(--ah-border); background: #f8fafc;
  border-radius: var(--r-xs, 3px); padding: 2px 6px;
  font-weight: 700; font-size: 11px;
}
.empty-inline    { margin: 8px 0 0; color: var(--ah-muted); font-size: 12px; }
.drawer-body form .form-actions .ah-btn.primary { min-width: 90px; }

/* ── Confirm modal ───────────────────────────────────────────────────── */
.ah-confirm-backdrop {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: rgba(15,23,42,.38);
  padding: 18px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.ah-confirm-modal {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg, 8px);
  box-shadow: var(--ah-shadow-lg);
  padding: 20px;
  animation: modalIn .22s var(--ah-ease, cubic-bezier(.16,1,.3,1));
}
.ah-confirm-modal h2  { margin: 0 0 8px; font-size: 18px; letter-spacing: -.025em; }
.ah-confirm-modal p   { margin: 0; color: var(--ah-muted); line-height: 1.5; }
.ah-confirm-modal .form-actions { margin-top: 18px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── Roles ───────────────────────────────────────────────────────────── */
.role-list { display: grid; gap: 8px; }
.role-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--ah-border); border-radius: var(--ah-radius);
  background: #fbfdff;
  transition: border-color var(--ah-dur-fast) ease, background var(--ah-dur-fast) ease;
}
.role-card:hover { border-color: var(--ah-border-2); background: #f8fbff; }
.role-card small { display: block; margin-top: 2px; color: var(--ah-muted); font-size: 12px; }
.role-card-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

.role-chip-list { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; max-width: 360px; }
.role-chip-list.large { max-width: none; gap: 6px; padding: 6px 0; }
.role-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px;
  border: 1px solid #cad5e2; border-radius: var(--r-xs, 3px);
  background: #f4f7fb; color: #243247;
  font-size: 11px; font-weight: 750; line-height: 1; white-space: nowrap;
  transition: background var(--ah-dur-fast) ease;
}
.role-chip:hover { background: #edf2f9; }
.role-chip button {
  width: 14px; height: 14px; padding: 0; border: 0; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer;
  border-radius: 2px; color: #6b7789; opacity: .75;
}
.role-chip button:hover { background: #dde7f1; opacity: 1; color: #b91c1c; }
.chip-ico { width: 9px; height: 9px; display: block; }

.role-assignment-box {
  border: 1px solid var(--ah-border); background: #fbfdff;
  border-radius: var(--ah-radius); padding: 10px 11px; margin: 10px 0;
}
.role-assignment-box h3 { margin: 0 0 8px; font-size: 12.5px; color: #253348; }

/* ── Permissions grid ────────────────────────────────────────────────── */
.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 6px;
  max-height: 65vh; overflow: auto; padding-right: 4px;
  scrollbar-width: thin;
}
.permission-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 9px;
  border: 1px solid var(--ah-border); border-radius: var(--ah-radius);
  background: #fbfdff;
  transition: background var(--ah-dur-fast) ease, border-color var(--ah-dur-fast) ease;
  cursor: pointer;
}
.permission-row:hover        { background: #f4f8fd; border-color: var(--ah-border-2); }
.permission-row input        { margin-top: 3px; width: 14px; height: 14px; accent-color: var(--ah-blue); cursor: pointer; flex-shrink: 0; }
.permission-row strong       { font-family: var(--ah-mono); font-size: 11.5px; color: #1a2b42; display: block; }
.permission-row small        { display: block; color: var(--ah-muted); font-size: 11px; margin-top: 2px; line-height: 1.35; }

/* ── Settings ────────────────────────────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 222px minmax(0, 1fr);
  gap: 14px; align-items: start;
}
.settings-tabs-card { padding: 8px; }
.settings-tabs      { display: grid; gap: 2px; }
.settings-tab {
  height: 34px; border: 0; border-radius: var(--ah-radius);
  background: transparent; color: #3d5068;
  font-weight: 750; text-align: left;
  padding: 0 10px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  transition: background var(--ah-dur-fast) ease, color var(--ah-dur-fast) ease;
  font-size: 12.5px;
}
.settings-tab:hover         { background: #f2f5f9; color: #1e2c42; }
.settings-tab.active        { background: #ebf2ff; color: var(--ah-blue); box-shadow: inset 2px 0 0 var(--ah-blue); font-weight: 800; }
.setting-tab-ico            { width: 14px; height: 14px; object-fit: contain; opacity: .78; flex-shrink: 0; }

.settings-panel             { min-height: 240px; }
.settings-grid              { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 10px; }
.settings-panel .smart-toolbar { border-bottom: 1px solid var(--ah-border); padding-bottom: 10px; }

.setting-card               { border: 1px solid var(--ah-border); border-radius: var(--ah-radius); background: #fff; overflow: hidden; transition: box-shadow var(--ah-dur-fast) ease; }
.setting-card:hover         { box-shadow: var(--ah-shadow); }
.setting-card-head          { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 10px; border-bottom: 1px solid var(--ah-border); background: #fbfdff; }
.setting-card-head strong   { display: block; font-size: 13px; color: #1a2b42; margin-bottom: 3px; }
.setting-card-head small    { display: inline-block; }
.setting-card-editor        { padding: 10px; }
.setting-card-editor .inline-edit { min-width: 0; width: 100%; }
.setting-card-editor .inline-edit .ah-btn { flex: 0 0 auto; }
.setting-card-foot          { padding: 0 10px 9px; color: var(--ah-muted-2); font-size: 11px; }

/* ── Pre-JSON block ──────────────────────────────────────────────────── */
.pre-json {
  white-space: pre-wrap;
  font-family: var(--ah-mono);
  background: #0f1a2e;
  color: #bfd8f8;
  border-radius: var(--ah-radius);
  padding: 12px 14px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid rgba(255,255,255,.06);
}

/* ── Misc small components ───────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 32px 14px;
  color: var(--ah-muted); font-size: 13px;
}
.spa-hero-card { display: flex; align-items: center; gap: 14px; padding: 18px; background: #fff; border: 1px solid var(--ah-border); border-radius: var(--ah-radius-lg); box-shadow: var(--ah-shadow); }
.spa-spinner   { width: 24px; height: 24px; border: 3px solid #dbe3ee; border-top-color: var(--ah-blue); border-radius: 50%; animation: spin .8s linear infinite; }

.spa-skeleton  { background: linear-gradient(90deg, #eef2f6, #f8fafc, #eef2f6); background-size: 220% 100%; border-radius: var(--ah-radius); animation: shimmer 1.1s infinite; }
.spa-skeleton.line  { height: 28px; margin: 7px 0; }
.spa-skeleton.small { width: 60%; }

/* Skeleton loader */
.page-skeleton-card { display: grid; gap: 12px; }
.skeleton-line, .skeleton-box, .skeleton-table div {
  background: linear-gradient(90deg, #eef2f6, #f8fafc, #eef2f6);
  background-size: 220% 100%; animation: shimmer 1.1s infinite; border-radius: var(--ah-radius);
}
.skeleton-line      { height: 18px; width: 44%; }
.skeleton-line.wide { height: 24px; width: 68%; }
.skeleton-grid      { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.skeleton-box       { height: 72px; }
.skeleton-table     { display: grid; gap: 7px; }
.skeleton-table div { height: 30px; }

/* Smart combo / select */
.smart-combo              { position: relative; }
.smart-combo-menu {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 3px);
  background: #fff; border: 1px solid var(--ah-border-2); border-radius: var(--ah-radius);
  box-shadow: var(--ah-shadow-lg); overflow: hidden;
  max-height: 240px; overflow-y: auto;
}
.smart-combo-item        { padding: 8px 10px; cursor: pointer; font-size: 13px; }
.smart-combo-item:hover, .smart-combo-item.active { background: #f0f6ff; }
.smart-combo-item small  { display: block; color: var(--ah-muted); font-size: 11.5px; }

.multi-chips      { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; min-height: 26px; }
.chip {
  display: inline-flex; gap: 5px; align-items: center;
  padding: 3px 7px; border-radius: 999px;
  background: #eef2ff; color: #1d4ed8;
  font-weight: 700; font-size: 12px;
}
.chip button { border: 0; background: transparent; cursor: pointer; color: inherit; }

/* Smart choice (searchable select) */
.smart-native-hidden      { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
.smart-choice             { position: relative; min-width: 120px; max-width: 100%; display: inline-block; vertical-align: middle; }
.smart-choice-button {
  height: var(--ah-control-h); min-height: var(--ah-control-h); width: 100%; max-width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--ah-border-2); border-radius: var(--ah-radius);
  background: #fff; color: var(--ah-text); padding: 0 9px;
  font: inherit; font-size: 13px; cursor: pointer; text-align: left;
  transition: border-color var(--ah-dur-fast) ease, box-shadow var(--ah-dur-fast) ease;
}
.smart-choice-button:hover            { border-color: var(--ah-border-2); }
.smart-choice.open .smart-choice-button,
.smart-choice-button:focus            { border-color: var(--ah-blue); box-shadow: 0 0 0 3px var(--ah-blue-ring, rgba(26,75,174,.15)); outline: none; }
.smart-choice-button [data-choice-label] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-choice-caret                   { flex: 0 0 auto; color: #64748b; font-size: 10px; }
.smart-choice-menu {
  position: absolute; z-index: 95; left: 0; top: calc(100% + 4px);
  min-width: 100%; width: max-content; max-width: min(640px, calc(100vw - 32px));
  background: #fff; border: 1px solid var(--ah-border-2); border-radius: var(--ah-radius);
  box-shadow: var(--ah-shadow-lg); padding: 7px; overflow: hidden;
  animation: menuIn .14s var(--ah-ease, cubic-bezier(.16,1,.3,1));
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scaleY(.97); } to { opacity: 1; transform: none; } }
.smart-choice-search    { width: 100%; min-width: 210px; margin-bottom: 6px; }
.smart-choice-items     { max-height: 250px; overflow: auto; display: grid; gap: 2px; scrollbar-width: thin; }
.smart-choice-item {
  border: 0; background: #fff; border-radius: var(--ah-radius);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; padding: 7px 9px;
  color: var(--ah-text); cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap;
  transition: background var(--ah-dur-fast) ease;
}
.smart-choice-item span { overflow: hidden; text-overflow: ellipsis; }
.smart-choice-item:hover               { background: #f0f6ff; }
.smart-choice-item.selected            { background: #eef4ff; color: #17336f; font-weight: 750; }
.smart-choice-item[disabled]           { opacity: .45; cursor: not-allowed; }
.smart-choice-empty                    { padding: 12px; color: var(--ah-muted); text-align: center; font-size: 12.5px; }
.form-field .smart-choice, .smart-toolbar .smart-choice, .inline-edit .smart-choice { width: 100%; }
.smart-toolbar .left > .smart-choice   { width: auto; min-width: 160px; max-width: 250px; }
.smart-pagination .smart-choice        { width: 82px; min-width: 82px; }
.smart-bulk-bar .smart-choice          { min-width: 180px; width: auto; }
.smart-choice.is-invalid .smart-choice-button { border-color: #d92d20; background: #fffafa; box-shadow: 0 0 0 3px rgba(217,45,32,.10); }

/* ── Password-change forced mode ─────────────────────────────────────── */
.password-required-card { border-color: #f3c46b; background: #fffaf0; }
.muted-card             { background: #f8fafc; }

/* ── Alert style (also overrides base) ──────────────────────────────── */
.ah-alert        { border-radius: var(--ah-radius); padding: 9px 11px; margin: 0 0 10px; font-size: 13px; }
.ah-alert.warn   { border: 1px solid #f3c46b; background: #fff7e6; color: #7a4a00; }
.ah-alert.error  { border: 1px solid #fecaca; background: #fff1f2; color: #991b1b; }
.ah-alert.ok     { border: 1px solid #a7f3c0; background: #f0fdf4; color: #166534; }

/* ── Module page host ────────────────────────────────────────────────── */
.module-page-card { min-height: 180px; }

/* ── Misc layouts ────────────────────────────────────────────────────── */
.spa-card .smart-toolbar > span.ah-muted { align-self: center; font-size: 12px; }
.smart-table time { white-space: nowrap; color: #64748b; }

/* ── Animations ──────────────────────────────────────────────────────── */
@keyframes spaIn  { from { opacity: .6; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes shimmer{ to { background-position: -220% 0; } }

/* ══════════════════════════════════════════════════════════════════════
   2. RESPONSIVE
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .two-col           { grid-template-columns: 1fr; }
  .inline-edit       { min-width: 0; }
  .role-card         { align-items: flex-start; flex-direction: column; }
  .role-card-actions { justify-content: flex-start; }
  .permission-grid   { grid-template-columns: 1fr; }
  .dashboard-panels  { grid-template-columns: 1fr; }
  .activity-row      { grid-template-columns: auto minmax(0, 1fr); }
  .activity-row time { grid-column: 2; }
}

@media (max-width: 960px) {
  .settings-layout   { grid-template-columns: 1fr; }
  .settings-tabs     { display: flex; overflow: auto; padding-bottom: 2px; }
  .settings-tab      { flex: 0 0 auto; }
  .settings-grid     { grid-template-columns: 1fr; }
  .role-chip-list    { max-width: none; }
  .drawer-search.two { grid-template-columns: 1fr; }
  .drawer-meta       { justify-content: flex-start; }
}

@media (max-width: 920px) {
  /* Collapse sidebar to off-canvas */
  .spa-shell            { grid-template-columns: 1fr; }
  .spa-sidebar {
    position: fixed; z-index: 40; left: 0; top: 0;
    width: min(272px, 86vw);
    transform: translateX(-104%);
    transition: transform var(--ah-dur-slow) var(--ah-ease, cubic-bezier(.16,1,.3,1));
    box-shadow: 14px 0 36px rgba(15,23,42,.22);
  }
  .spa-sidebar.open      { transform: none; }
  .mobile-only           { display: inline-grid !important; }
  .spa-main              { width: 100vw; }
  .spa-topbar            { padding: 0 10px; height: 52px; }
  .spa-topbar h1         { font-size: 16px; }
  .topbar-left           { gap: 7px; }
  .spa-top-actions .ah-btn { padding: 0 7px; }
  .spa-content           { padding: 13px 11px 44px; }
  .page-intro            { align-items: flex-start; flex-direction: column; }
  .smart-toolbar         { align-items: stretch; }
  .smart-toolbar .left,
  .smart-toolbar .right  { width: 100%; }
  .smart-input[data-q]   { width: 100%; }
  .smart-bulk-bar        { align-items: flex-start; flex-wrap: wrap; }
  .smart-bulk-bar .smart-select { min-width: 150px; }
  .skeleton-grid         { grid-template-columns: 1fr; }
  .skeleton-line,
  .skeleton-line.wide    { width: 100%; }
  .form-actions.sticky   { margin-left: -12px; margin-right: -12px; }
  .smart-pagination      { align-items: flex-start; }
  .smart-pagination .page-size,
  .smart-pagination .page-controls { width: 100%; justify-content: flex-start; }
}

@media (max-width: 600px) {
  .spa-card               { padding: 12px; }
  .drawer-panel           { width: 100%; }
  .spa-dashboard-grid     { grid-template-columns: repeat(2, 1fr); }
}
/* Drawer UX hardening */
body.drawer-open { overflow: hidden; }
.drawer-backdrop.closing { opacity: 0; pointer-events: none; }
.drawer-backdrop.closing .drawer-panel { transform: translateX(104%); }
.ah-confirm-backdrop { opacity: 1; transition: opacity var(--ah-dur-mid) ease; }
.ah-confirm-backdrop.closing { opacity: 0; pointer-events: none; }
.ah-confirm-backdrop.closing .ah-confirm-modal { opacity: 0; transform: translateY(8px) scale(.97); transition: opacity var(--ah-dur-fast) ease, transform var(--ah-dur-fast) ease; }
.smart-choice-menu.align-right { left: auto; right: 0; }
.smart-choice-menu.drop-up { top: auto; bottom: calc(100% + 4px); transform-origin: bottom; }
.smart-choice.opening .smart-choice-menu { will-change: transform, opacity; }
@media (prefers-reduced-motion: reduce) {
  .drawer-backdrop,
  .drawer-panel,
  .ah-confirm-backdrop,
  .ah-confirm-modal,
  .smart-choice-menu { transition: none !important; animation: none !important; }
}

/* 0.8.33 full UI motion polish: page, cards, tables, drawers, modals, dropdowns */
.spa-content {
  scroll-behavior: smooth;
  transition: opacity var(--ah-dur-mid) ease, transform var(--ah-dur-mid) var(--ah-ease-soft);
}
.spa-content.ah-page-loading {
  cursor: progress;
}
.spa-content.ah-page-ready {
  animation: pageSettle .24s var(--ah-ease-soft) both;
}
.ui-reveal {
  opacity: 0;
  transform: translateY(10px) scale(.992);
  transform-origin: center top;
  will-change: transform, opacity;
}
.spa-content.ah-page-ready .ui-reveal,
.drawer-backdrop.open .ui-reveal {
  animation: uiReveal .34s var(--ah-ease-soft) both;
}
.ui-reveal-d0 { animation-delay: 0ms; }
.ui-reveal-d1 { animation-delay: 32ms; }
.ui-reveal-d2 { animation-delay: 64ms; }
.ui-reveal-d3 { animation-delay: 96ms; }
.ui-reveal-d4 { animation-delay: 128ms; }
.ui-reveal-d5 { animation-delay: 160ms; }
.ui-reveal-d6 { animation-delay: 192ms; }
.ui-reveal-d7 { animation-delay: 224ms; }
.ui-reveal-d8 { animation-delay: 256ms; }
.ui-reveal-d9 { animation-delay: 288ms; }
.ui-reveal-d10 { animation-delay: 320ms; }
.ui-reveal-d11 { animation-delay: 352ms; }
.ui-reveal-d12 { animation-delay: 384ms; }
@keyframes pageSettle { from { opacity: .78; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@keyframes uiReveal { from { opacity: 0; transform: translateY(10px) scale(.992); } to { opacity: 1; transform: none; } }
@keyframes rowReveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes softPop { 0% { opacity: 0; transform: translateY(8px) scale(.965); } 70% { opacity: 1; transform: translateY(-1px) scale(1.006); } 100% { opacity: 1; transform: none; } }
@keyframes softDrop { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes softRise { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

.spa-card,
.spa-stat,
.quick-action,
.activity-row,
.role-card,
.setting-card,
.wallboard-card,
.flow-block,
.status-chart,
.chart-series-toggle {
  transform: translateZ(0);
  transition:
    border-color var(--ah-dur-mid) var(--ah-ease-soft),
    background-color var(--ah-dur-mid) var(--ah-ease-soft),
    box-shadow var(--ah-dur-mid) var(--ah-ease-soft),
    transform var(--ah-dur-mid) var(--ah-ease-soft),
    filter var(--ah-dur-mid) var(--ah-ease-soft),
    opacity var(--ah-dur-mid) ease;
}
.spa-card:hover,
.setting-card:hover,
.wallboard-grid section:hover {
  box-shadow: 0 10px 28px rgba(15,23,42,.09), 0 2px 7px rgba(15,23,42,.05);
}
.spa-stat:hover,
.quick-action:hover,
.activity-row:hover,
.role-card:hover,
.flow-block:hover,
.wallboard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgba(15,23,42,.09), 0 2px 6px rgba(15,23,42,.05);
}

/* Sidebar overlay polish */
.sidebar-backdrop {
  opacity: 0;
  transition: opacity var(--ah-dur-mid) ease, backdrop-filter var(--ah-dur-mid) ease;
}
.sidebar-backdrop.open { opacity: 1; }
.sidebar-backdrop.closing { opacity: 0; pointer-events: none; }
.spa-sidebar {
  transition: transform var(--ah-dur-slow) var(--ah-ease-soft), box-shadow var(--ah-dur-slow) ease;
}
.spa-nav a { transition: background-color var(--ah-dur-mid) ease, border-color var(--ah-dur-mid) ease, color var(--ah-dur-mid) ease, transform var(--ah-dur-mid) var(--ah-ease-soft), box-shadow var(--ah-dur-mid) ease; }
.spa-nav a:hover { transform: translateX(2px); }
.spa-nav a.active { box-shadow: inset 2px 0 0 var(--ah-blue), 0 4px 14px rgba(37,99,235,.10); }

/* Toasts: show + leave, not just instant add/remove */
.spa-toast {
  opacity: 0;
  transform: translateX(18px) translateY(-4px) scale(.96);
  transition: opacity var(--ah-dur-mid) ease, transform var(--ah-dur-mid) var(--ah-ease-soft), filter var(--ah-dur-mid) ease;
  animation: none;
}
.spa-toast.shown { opacity: 1; transform: none; }
.spa-toast.leaving { opacity: 0; transform: translateX(18px) scale(.97); filter: blur(.2px); }

/* SmartTable: smooth loading and row reveal */
.smart-table-wrap {
  position: relative;
  transition: opacity var(--ah-dur-mid) ease, box-shadow var(--ah-dur-mid) ease, border-color var(--ah-dur-mid) ease;
}
.is-loading [data-smart-table-wrap]::after {
  content: 'Loading…';
  position: absolute;
  right: 10px;
  top: 8px;
  z-index: 3;
  border: 1px solid #dbe7fb;
  background: rgba(255,255,255,.92);
  color: #17336f;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(15,23,42,.10);
  animation: softDrop .18s var(--ah-ease-soft) both;
}
.is-loading .smart-table tbody { opacity: .58; }
.smart-table tbody tr.smart-row-enter {
  animation: rowReveal .22s var(--ah-ease-soft) both;
}
.smart-row-d0 { animation-delay: 0ms; }
.smart-row-d1 { animation-delay: 13ms; }
.smart-row-d2 { animation-delay: 26ms; }
.smart-row-d3 { animation-delay: 39ms; }
.smart-row-d4 { animation-delay: 52ms; }
.smart-row-d5 { animation-delay: 65ms; }
.smart-row-d6 { animation-delay: 78ms; }
.smart-row-d7 { animation-delay: 91ms; }
.smart-row-d8 { animation-delay: 104ms; }
.smart-row-d9 { animation-delay: 117ms; }
.smart-row-d10 { animation-delay: 130ms; }
.smart-row-d11 { animation-delay: 143ms; }
.smart-row-d12 { animation-delay: 156ms; }
.smart-row-d13 { animation-delay: 169ms; }
.smart-row-d14 { animation-delay: 182ms; }
.smart-row-d15 { animation-delay: 195ms; }
.smart-row-d16 { animation-delay: 208ms; }
.smart-row-d17 { animation-delay: 221ms; }
.smart-row-d18 { animation-delay: 234ms; }
.smart-row-d19 { animation-delay: 247ms; }
.smart-row-d20 { animation-delay: 260ms; }
.smart-row-d21 { animation-delay: 273ms; }
.smart-row-d22 { animation-delay: 286ms; }
.smart-row-d23 { animation-delay: 299ms; }
.smart-row-d24 { animation-delay: 312ms; }
.smart-table tbody tr td {
  transition: background-color var(--ah-dur-mid) ease, color var(--ah-dur-mid) ease, box-shadow var(--ah-dur-mid) ease;
}
.smart-table tbody tr:hover td { box-shadow: inset 0 1px 0 rgba(37,99,235,.035), inset 0 -1px 0 rgba(37,99,235,.035); }
.smart-empty-row .empty-state { animation: softPop .24s var(--ah-ease-soft) both; }
.smart-bulk-bar[hidden] { display: none; }
.smart-bulk-bar:not([hidden]) { animation: softRise .22s var(--ah-ease-soft) both; }

/* Inputs and form feedback */
.smart-input,
.smart-select,
.smart-textarea,
.smart-choice-button,
.smart-combo input {
  transition: border-color var(--ah-dur-mid) ease, box-shadow var(--ah-dur-mid) ease, background-color var(--ah-dur-mid) ease, transform var(--ah-dur-mid) var(--ah-ease-soft);
}
.smart-input:focus,
.smart-select:focus,
.smart-textarea:focus,
.smart-choice.open .smart-choice-button,
.smart-choice-button:focus {
  transform: translateY(-1px);
}
.form-field { transition: transform var(--ah-dur-mid) var(--ah-ease-soft), opacity var(--ah-dur-mid) ease; }
.form-field:focus-within { transform: translateY(-1px); }
.field-error:not(:empty), .form-error-summary:not([hidden]) { animation: softPop .22s var(--ah-ease-soft) both; }

/* Drawers: nicer glass, entry, closing and body reveal */
.drawer-backdrop {
  background: rgba(15,23,42,.38);
  transition: opacity var(--ah-dur-mid) ease, backdrop-filter var(--ah-dur-mid) ease;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}
.drawer-backdrop.open {
  opacity: 1;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.drawer-backdrop.closing { opacity: 0; pointer-events: none; }
.drawer-panel {
  transition: transform var(--ah-dur-slow) var(--ah-ease-soft), opacity var(--ah-dur-mid) ease, box-shadow var(--ah-dur-slow) ease;
  opacity: .98;
}
.drawer-backdrop.open .drawer-panel { transform: none; opacity: 1; box-shadow: -22px 0 58px rgba(15,23,42,.22), -3px 0 9px rgba(15,23,42,.06); }
.drawer-panel.closing,
.drawer-backdrop.closing .drawer-panel { transform: translateX(104%); opacity: .86; }
.drawer-body { overscroll-behavior: contain; }
.drawer-body > * { transform-origin: center top; }
.drawer-panel header { transition: background-color var(--ah-dur-mid) ease, box-shadow var(--ah-dur-mid) ease; }
.drawer-backdrop.open .drawer-panel header { box-shadow: 0 1px 0 rgba(15,23,42,.03); }

/* Confirm modals */
.ah-confirm-backdrop {
  opacity: 0;
  transition: opacity var(--ah-dur-mid) ease, backdrop-filter var(--ah-dur-mid) ease;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}
.ah-confirm-backdrop.open { opacity: 1; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.ah-confirm-backdrop.closing { opacity: 0; pointer-events: none; }
.ah-confirm-modal {
  animation: softPop .26s var(--ah-ease-soft) both;
  transform-origin: center;
}
.ah-confirm-modal.closing,
.ah-confirm-backdrop.closing .ah-confirm-modal {
  opacity: 0;
  transform: translateY(8px) scale(.965);
  transition: opacity var(--ah-dur-mid) ease, transform var(--ah-dur-mid) var(--ah-ease-soft);
}

/* Dropdowns and searchable combos */
.smart-choice-menu,
.smart-combo-menu {
  transform-origin: top left;
  transition: opacity 140ms ease, transform 140ms var(--ah-ease-soft), filter 140ms ease;
}
.smart-choice.open .smart-choice-menu,
.smart-combo.open .smart-combo-menu { animation: softDrop .16s var(--ah-ease-soft) both; }
.smart-choice.closing .smart-choice-menu,
.smart-combo.closing .smart-combo-menu { opacity: 0; transform: translateY(-4px) scale(.985); filter: blur(.2px); }
.smart-choice-menu.drop-up { transform-origin: bottom left; }
.smart-choice-menu.align-right { transform-origin: top right; }
.smart-choice-menu.drop-up.align-right { transform-origin: bottom right; }
.smart-choice-item,
.smart-combo-item {
  transition: background-color var(--ah-dur-fast) ease, color var(--ah-dur-fast) ease, transform var(--ah-dur-fast) var(--ah-ease-soft);
}
.smart-choice-item:hover,
.smart-combo-item:hover { transform: translateX(2px); }
.smart-choice-caret { transition: transform var(--ah-dur-mid) var(--ah-ease-soft); }
.smart-choice.open .smart-choice-caret { transform: rotate(180deg); }

/* Tabs/chips/settings */
.tabs .tab,
.settings-tab,
.role-chip,
.chip,
.chart-series-toggle {
  transition: background-color var(--ah-dur-mid) ease, border-color var(--ah-dur-mid) ease, color var(--ah-dur-mid) ease, transform var(--ah-dur-mid) var(--ah-ease-soft), box-shadow var(--ah-dur-mid) ease;
}
.tabs .tab:hover,
.settings-tab:hover,
.role-chip:hover,
.chip:hover,
.chart-series-toggle:hover { transform: translateY(-1px); }
.tabs .tab.active,
.settings-tab.active { animation: softPop .22s var(--ah-ease-soft) both; }

/* Skeletons feel softer */
.skeleton-line,
.skeleton-box,
.skeleton-table div,
.spa-skeleton {
  animation-duration: 1.35s;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.025);
}

@media (prefers-reduced-motion: reduce) {
  .ui-reveal,
  .spa-content.ah-page-ready .ui-reveal,
  .drawer-backdrop.open .ui-reveal,
  .smart-table tbody tr.smart-row-enter,
  .spa-content.ah-page-ready,
  .spa-toast,
  .ah-confirm-modal,
  .smart-choice.open .smart-choice-menu,
  .smart-combo.open .smart-combo-menu,
  .wallboard-flip .wallboard-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* 0.8.40 CSP-safe floating portal for all SmartSelect / combo dropdowns */
.ah-floating-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  overflow: visible;
  isolation: isolate;
}
.ah-floating-layer > .ah-portal-menu {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 2147483001 !important;
  pointer-events: auto;
  max-width: calc(100vw - 20px);
  overscroll-behavior: contain;
}
.ah-floating-layer > .smart-choice-menu.ah-portal-menu {
  width: max-content;
  overflow: hidden;
}
.ah-floating-layer > .smart-choice-menu.ah-portal-menu .smart-choice-items {
  max-height: calc(100% - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.ah-floating-layer > .smart-combo-menu.ah-portal-menu {
  min-width: 160px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.ah-portal-menu.ah-portal-measuring {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: none !important;
  animation: none !important;
}
.ah-portal-menu.placement-top { transform-origin: bottom left; }
.ah-portal-menu.placement-bottom { transform-origin: top left; }
.ah-portal-menu.placement-left { transform-origin: top right; }
.ah-portal-menu.placement-right { transform-origin: top left; }
.ah-portal-menu.align-right { transform-origin: top right; }
.ah-portal-menu.drop-up.align-right,
.ah-portal-menu.placement-top.align-right { transform-origin: bottom right; }
.ah-portal-menu.is-open {
  animation: softDrop .16s var(--ah-ease-soft) both;
}
.ah-portal-menu.placement-top.is-open {
  animation-name: softDropUp;
}
.ah-portal-menu.placement-left.is-open {
  animation-name: softDropLeft;
}
.ah-portal-menu.placement-right.is-open {
  animation-name: softDropRight;
}
.ah-portal-menu.is-closing {
  opacity: 0;
  transform: translateY(-4px) scale(.985);
  filter: blur(.2px);
  transition: opacity 140ms ease, transform 140ms var(--ah-ease-soft), filter 140ms ease;
}
@keyframes softDropUp { from { opacity: 0; transform: translateY(4px) scale(.985); filter: blur(.2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes softDropLeft { from { opacity: 0; transform: translateX(4px) scale(.985); filter: blur(.2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes softDropRight { from { opacity: 0; transform: translateX(-4px) scale(.985); filter: blur(.2px); } to { opacity: 1; transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) {
  .ah-portal-menu,
  .ah-portal-menu.is-open,
  .ah-portal-menu.is-closing {
    animation: none !important;
    transition: none !important;
  }
}

/* Public URL helper for email links */
.public-url-edit { flex-wrap: wrap; }
.public-url-edit .smart-input { min-width: 260px; }
.setting-help { margin: 8px 0 0; color: var(--ah-muted); font-size: 12px; line-height: 1.45; }

/* MFA enrollment QR */
.mfa-qr-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin: 12px 0;
  border: 1px solid var(--ah-border);
  border-radius: 10px;
  background: var(--ah-card-soft, #f8fafc);
}
.mfa-qr {
  width: 180px;
  height: 180px;
  flex: 0 0 auto;
  border: 1px solid var(--ah-border);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  image-rendering: pixelated;
}
.ah-details {
  margin: 10px 0 14px;
}
.ah-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ah-muted);
}
@media(max-width: 720px) {
  .mfa-qr-card { flex-direction: column; align-items: flex-start; }
}

/* Global long-running operation overlay */
.ah-operation-overlay {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 18, 28, .46);
  backdrop-filter: blur(4px);
}
.ah-operation-overlay[hidden] { display: none !important; }
.ah-operation-card {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 18px;
  background: var(--ah-card, #fff);
  box-shadow: 0 28px 70px rgba(0,0,0,.28);
  padding: 20px;
  animation: softRise .18s var(--ah-ease-soft, ease) both;
}
.ah-operation-overlay.is-closing .ah-operation-card { animation: softFadeOut .16s ease both; }
.ah-operation-head {
  display: flex;
  gap: 14px;
  align-items: center;
}
.ah-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(42, 93, 168, .18);
  border-top-color: var(--ah-primary, #2563eb);
  animation: ahSpin .8s linear infinite;
  flex: 0 0 auto;
}
.ah-operation-title {
  font-size: 16px;
  font-weight: 850;
  color: var(--ah-ink, #172033);
}
.ah-operation-message {
  margin-top: 3px;
  color: var(--ah-muted, #64748b);
  font-size: 13px;
}
.ah-operation-progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(100, 116, 139, .18);
  margin: 18px 0 10px;
}
.ah-operation-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ah-primary, #2563eb), #63a4ff);
  transition: width .18s ease;
}
.ah-operation-overlay.is-indeterminate .ah-operation-bar {
  width: 40%;
  animation: ahIndeterminate 1.15s ease-in-out infinite;
}
.ah-operation-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ah-muted, #64748b);
  font-size: 12px;
  font-weight: 700;
}
.ah-operation-overlay.is-error .ah-operation-bar { background: linear-gradient(90deg, #b91c1c, #f97316); }
body.ah-operation-active { cursor: progress; }
@keyframes ahSpin { to { transform: rotate(360deg); } }
@keyframes ahIndeterminate {
  0% { transform: translateX(-120%); }
  50% { transform: translateX(80%); }
  100% { transform: translateX(240%); }
}
@keyframes softFadeOut { to { opacity: 0; transform: translateY(8px) scale(.985); } }
@media (prefers-reduced-motion: reduce) {
  .ah-spinner, .ah-operation-overlay.is-indeterminate .ah-operation-bar, .ah-operation-card { animation: none !important; }
}

/* 0.8.65 P1 — unified UI polish primitives */
.drawer-panel.drawer-tool header,
.drawer-panel.drawer-detail header,
.drawer-panel.drawer-danger header,
.drawer-panel.drawer-form header {
  min-height: 58px;
}
.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.drawer-title-ico {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}
.drawer-title-wrap h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-panel.drawer-danger header {
  background: linear-gradient(180deg, #fff7ed, #fff);
  border-bottom-color: #fed7aa;
}
.drawer-panel.drawer-detail .drawer-body,
.drawer-panel.drawer-tool .drawer-body {
  background: linear-gradient(180deg, #fbfdff 0, #fff 90px);
}
.ah-drawer-intro {
  margin: 0 0 14px;
  color: var(--ah-muted);
  font-size: 13px;
  line-height: 1.5;
}
.ah-drawer-section {
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg);
  background: #fff;
  box-shadow: var(--ah-shadow-soft, 0 8px 20px rgba(15,23,42,.04));
  padding: 14px;
  margin: 0 0 14px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(255,255,255,.7);
}
.pill.running { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.pill.queued  { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.country-flag,
.country-flag-fallback {
  width: 22px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(15,23,42,.12), 0 1px 3px rgba(15,23,42,.12);
  background: #fff;
}
.country-flag.missing,
.country-flag-missing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 16px;
}
.ah-state {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 86px;
}
.ah-state .state-ico {
  width: 30px;
  height: 30px;
  opacity: .72;
}
.ah-state strong {
  color: var(--ah-ink);
  font-size: 13.5px;
}
.ah-state p {
  margin: 0;
  max-width: 520px;
  color: var(--ah-muted);
  line-height: 1.45;
}
.ah-error-state {
  color: #991b1b;
}
.ah-loading-state .spa-spinner {
  width: 28px;
  height: 28px;
}
.ah-operation-actions {
  margin-top: 13px;
  display: flex;
  justify-content: flex-end;
}
.ah-operation-actions .ah-btn[hidden] { display: none !important; }
.ah-operation-overlay.is-cancelled .ah-operation-bar {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}
.ah-operation-overlay.is-cancelled .ah-spinner {
  border-top-color: #f97316;
}
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid var(--ah-border-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f8fafc;
  color: var(--ah-muted);
  font-size: 11px;
  font-family: var(--ah-mono);
}
.job-hero {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 16px;
  align-items: start;
}
.job-hero h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.job-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.job-summary-card {
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius);
  background: #fbfdff;
  padding: 10px 12px;
  min-width: 0;
}
.job-summary-card span {
  display: block;
  color: var(--ah-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.job-summary-card strong {
  display: block;
  margin-top: 4px;
  color: var(--ah-ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.job-detail-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 14px;
}
.event-timeline {
  position: relative;
  display: grid;
  gap: 10px;
}
.event-item {
  display: grid;
  grid-template-columns: 120px minmax(0,1fr);
  gap: 12px;
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius);
  background: #fff;
  padding: 10px 12px;
}
.event-time {
  color: var(--ah-muted);
  font-size: 12px;
  font-weight: 700;
}
.event-main {
  min-width: 0;
}
.event-main header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 5px;
}
.event-main p {
  margin: 0;
  color: var(--ah-ink);
  overflow-wrap: anywhere;
}
.event-main .ah-pre {
  margin-top: 8px;
  max-height: 180px;
}
@media(max-width: 900px){
  .job-summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .job-detail-grid { grid-template-columns: 1fr; }
  .event-item { grid-template-columns: 1fr; }
}

/* 0.8.67 P2 — reusable widgets and duplicate-action guards */
.ah-btn.is-busy,
.ah-btn.is-disabled,
button.is-busy,
button.is-disabled {
  cursor: progress;
  opacity: .78;
}
.ah-btn[disabled],
button[disabled],
input[disabled],
select[disabled],
textarea[disabled] {
  cursor: not-allowed;
}
.mini-spinner {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 7px;
  animation: ahSpin .8s linear infinite;
}
.is-loading {
  min-height: 80px;
}
.summary-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}
.summary-card {
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius);
  background: #fbfdff;
  padding: 10px 12px;
  min-width: 0;
}
.summary-card span {
  display: block;
  color: var(--ah-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.summary-card strong {
  display: block;
  margin-top: 4px;
  color: var(--ah-ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.summary-card small {
  display: block;
  margin-top: 3px;
  color: var(--ah-muted);
  line-height: 1.35;
}
.detail-list,
.ihub-tracker-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .75rem;
}
.detail-item {
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-sm, 8px);
  background: #fbfdff;
  padding: 9px 10px;
  min-width: 0;
}
.detail-item strong {
  display: block;
  color: var(--ah-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .035em;
  margin-bottom: 3px;
}
.detail-item span {
  color: var(--ah-ink);
  overflow-wrap: anywhere;
}
.result-section h2,
.spa-card.result-section h2 {
  display: flex;
  gap: 8px;
  align-items: center;
}
.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ah-muted);
  font-weight: 700;
}
.drawer-body[aria-busy="true"] {
  cursor: progress;
}
@media (prefers-reduced-motion: reduce) {
  .mini-spinner { animation: none !important; }
}


/* 0.9.0 UX pass — consistent business app chrome, command menu and visual rhythm */
.spa-content {
  background:
    radial-gradient(circle at top left, rgba(26,75,174,.055), transparent 260px),
    linear-gradient(180deg, rgba(255,255,255,.28), transparent 180px);
}
.spa-card,
.spa-stat,
.smart-table-wrap,
.setting-card,
.role-card,
.summary-card,
.detail-item,
.job-summary-card {
  border-color: rgba(15,23,42,.095);
}
.spa-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(26,75,174,.18), transparent);
  opacity: .75;
  pointer-events: none;
}
.spa-card > :first-child { margin-top: 0; }

.spa-brand img, .spa-avatar {
  box-shadow: 0 0 0 1px rgba(255,255,255,.10), 0 10px 24px rgba(0,0,0,.18);
}
.spa-user-card {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
}
.spa-nav a {
  min-height: 32px;
}
.spa-nav a.active::after {
  content: '';
  position: absolute;
  right: 9px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #93c5fd;
  box-shadow: 0 0 0 4px rgba(147,197,253,.10);
}
.spa-nav a:focus-visible {
  outline-color: rgba(147,197,253,.9);
  outline-offset: 1px;
}

.spa-topbar {
  backdrop-filter: saturate(1.08) blur(12px);
  -webkit-backdrop-filter: saturate(1.08) blur(12px);
}
.spa-top-actions { min-width: 0; }
.topbar-command {
  min-width: 136px;
  justify-content: flex-start;
}
.topbar-command .btn-ico { opacity: .72; }
.topbar-command .top-kbd {
  margin-left: auto;
}

.page-intro {
  min-height: 96px;
}
.page-intro::before {
  content: '';
  position: absolute;
  inset: -60% auto auto 34%;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: conic-gradient(from 210deg, transparent, rgba(96,165,250,.16), transparent 42%);
  pointer-events: none;
}
.page-intro > * { position: relative; z-index: 1; }
.page-intro h1, .page-intro h2 {
  text-wrap: balance;
}
.page-intro p, .spa-card p.ah-muted, .smart-toolbar p.ah-muted {
  max-width: 78ch;
}

.smart-toolbar {
  min-height: 34px;
}
.smart-toolbar .left, .smart-toolbar .right {
  min-width: 0;
}
.smart-input, .smart-select, .smart-textarea, .ah-field input, .ah-field select, .ah-field textarea {
  font-size: 13px;
}
.smart-input::placeholder, .ah-field input::placeholder, .smart-textarea::placeholder {
  color: #9aa8ba;
}
.smart-table-wrap {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
.smart-table th {
  height: 34px;
}
.smart-table tbody tr:nth-child(even) td {
  background-image: linear-gradient(0deg, rgba(248,250,252,.58), rgba(248,250,252,.58));
}
.smart-table tbody tr:hover td {
  background-image: none;
}
.empty-state.ah-state {
  padding: 18px 16px;
  text-align: center;
}

/* Command palette */
body.command-open { overflow: hidden; }
.ah-command-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25000;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 9vh 18px 18px;
  background: rgba(13,22,41,.42);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  opacity: 0;
  transition: opacity var(--ah-dur-mid) ease, backdrop-filter var(--ah-dur-mid) ease;
}
.ah-command-backdrop.open {
  opacity: 1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ah-command-backdrop.closing {
  opacity: 0;
  pointer-events: none;
}
.ah-command-palette {
  width: min(680px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.52);
  border-radius: 16px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 30px 90px rgba(4,12,28,.34), 0 8px 24px rgba(4,12,28,.16);
  transform: translateY(10px) scale(.985);
  transition: transform var(--ah-dur-slow) var(--ah-ease-soft);
}
.ah-command-backdrop.open .ah-command-palette { transform: none; }
.ah-command-head {
  padding: 12px;
  border-bottom: 1px solid var(--ah-border);
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.ah-command-search {
  height: 44px;
  display: grid;
  grid-template-columns: 22px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ah-border-2);
  border-radius: 12px;
  background: #fff;
  padding: 0 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,.9), inset 0 1px 2px rgba(15,23,42,.035);
}
.ah-command-search img { width: 18px; height: 18px; opacity: .58; }
.ah-command-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  height: 40px;
  font: inherit;
  font-size: 15px;
  color: var(--ah-text);
  background: transparent;
}
.ah-command-list {
  max-height: min(58vh, 520px);
  overflow: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,23,42,.16) transparent;
}
.ah-command-section {
  padding: 10px 10px 5px;
  color: var(--ah-muted);
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ah-command-item {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 28px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ah-text);
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  transition: background-color var(--ah-dur-mid) ease, border-color var(--ah-dur-mid) ease, transform var(--ah-dur-mid) var(--ah-ease-soft), box-shadow var(--ah-dur-mid) ease;
}
.ah-command-item:hover,
.ah-command-item.active {
  background: #f2f6ff;
  border-color: #d7e5ff;
  box-shadow: 0 7px 20px rgba(26,75,174,.09);
  transform: translateY(-1px);
}
.ah-command-item img { width: 20px; height: 20px; opacity: .78; }
.ah-command-title {
  display: block;
  font-weight: 820;
  font-size: 13.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ah-command-meta {
  display: block;
  color: var(--ah-muted);
  font-size: 11.5px;
  margin-top: 1px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ah-command-path {
  color: #7b8ba1;
  font-family: var(--ah-mono);
  font-size: 10.5px;
  background: #f8fafc;
  border: 1px solid var(--ah-border);
  border-radius: 999px;
  padding: 3px 7px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ah-command-empty {
  margin: 8px;
  padding: 22px 16px;
  border: 1px dashed var(--ah-border-2);
  border-radius: 12px;
  color: var(--ah-muted);
  text-align: center;
  background: #fbfdff;
}
.ah-command-foot {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px 12px;
  color: var(--ah-muted);
  font-size: 11.5px;
  border-top: 1px solid var(--ah-border);
  background: #fbfdff;
}
.ah-command-foot span { display: inline-flex; align-items: center; gap: 5px; }

@media (max-width: 920px) {
  .topbar-command { min-width: 34px; width: 34px; padding: 0; justify-content: center; }
  .topbar-command span, .topbar-command .top-kbd { display: none; }
  .spa-top-actions { gap: 4px; }
}
@media (max-width: 640px) {
  .spa-top-actions .ah-btn:not(.topbar-command):not(.icon) span { display: none; }
  .spa-top-actions .ah-btn:not(.topbar-command):not(.icon) { width: 32px; padding: 0; }
  .ah-command-backdrop { padding: 6vh 10px 10px; align-items: start; }
  .ah-command-palette { border-radius: 13px; }
  .ah-command-item { grid-template-columns: 24px minmax(0,1fr); }
  .ah-command-path { display: none; }
  .ah-command-foot { flex-direction: column; align-items: flex-start; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .ah-command-backdrop, .ah-command-palette, .ah-command-item { transition: none !important; animation: none !important; transform: none !important; }
}
