/* ==========================================================================
   MEDiCARE ARSERV DESIGN SYSTEM — Đồng bộ chuẩn MEDiCARE ERP (WCAG AA)
   Bootstrap 5.2 + Bootstrap Icons + React 18 UMD
   ========================================================================== */
:root {
  --primary-color: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-dark: #5b21b6;
  --primary-light: #f5f3ff;
  --primary-soft: #ede9fe;
  --primary-border: rgba(124, 58, 237, 0.25);
  --primary-ring: rgba(124, 58, 237, 0.22);
  --primary-gradient: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
  --accent-pink: #db2777;
  --accent-pink-dark: #be185d;
  --accent-pink-soft: #fdf2f8;

  --header-height: 56px;
  --sidebar-width: 278px;
  --header-bg: linear-gradient(135deg, #5b21b6 0%, #6d28d9 40%, #7c3aed 75%, #9333ea 100%);
  --sidebar-bg: linear-gradient(160deg, #090514 0%, #130b29 65%, #190e36 100%);
  --sidebar-active-bg: linear-gradient(135deg, #6d28d9 0%, #a855f7 100%);

  --ui-page: #f8fafc;
  --ui-surface: #ffffff;
  --ui-ink: #0f172a;
  --ui-ink-2: #1e293b;
  --ui-muted: #475569;
  --ui-subtle: #64748b;
  --ui-line: #e2e8f0;
  --ui-line-strong: #cbd5e1;

  --ui-success: #047857;
  --ui-success-soft: #ecfdf5;
  --ui-success-line: #a7f3d0;
  --ui-warning: #b45309;
  --ui-warning-soft: #fffbeb;
  --ui-warning-line: #fde68a;
  --ui-danger: #be123c;
  --ui-danger-soft: #fff1f2;
  --ui-danger-line: #fecdd3;
  --ui-info: #0369a1;
  --ui-info-soft: #f0f9ff;
  --ui-info-line: #bae6fd;

  --ui-radius: 14px;
  --ui-radius-md: 10px;
  --ui-radius-sm: 8px;
  --ui-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 6px 18px rgba(124, 58, 237, 0.06);
  --ui-shadow-pop: 0 16px 36px -6px rgba(15, 23, 42, 0.24), 0 4px 12px rgba(124, 58, 237, 0.12);

  --bs-primary: #7c3aed;
  --bs-primary-rgb: 124, 58, 237;
  --bs-link-color: #7c3aed;
  --bs-link-hover-color: #5b21b6;
}

body {
  background-color: var(--ui-page);
  color: var(--ui-ink-2);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  margin: 0;
}

h1, h2, h3, h4, h5, h6, .card-title, .modal-title {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.01em;
}

/* Primary Buttons & Focus Ring */
.btn-primary {
  background: var(--primary-gradient);
  border-color: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.24);
  font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #5b21b6 0%, #6d28d9 100%);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.34);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* ---------- Sticky Glassmorphism Topbar Header ---------- */
.arserv-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 1030;
  padding: 0 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 100%), var(--header-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12), 0 10px 24px -12px rgba(91, 33, 182, 0.45);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.arserv-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.arserv-menu-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.arserv-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: scale(1.03);
}

.arserv-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none !important;
  color: #fff !important;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.arserv-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.94);
}
.arserv-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #86efac;
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.28);
}

.arserv-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.18s ease;
}
.arserv-user-pill:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.4);
}
.arserv-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f472b6 0%, #c084fc 100%);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.arserv-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--ui-line);
  box-shadow: var(--ui-shadow-pop);
  color: var(--ui-ink-2);
  overflow: hidden;
  z-index: 1060;
}
.arserv-user-dropdown-head {
  padding: 13px 15px;
  background: linear-gradient(135deg, #f5f3ff 0%, #fdf2f8 100%);
  border-bottom: 1px solid var(--ui-line);
}
.arserv-dd-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 15px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-ink-2);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.14s ease;
}
.arserv-dd-item:hover {
  background: #f5f3ff;
  color: var(--primary-hover);
}
.arserv-dd-item.danger {
  color: #dc2626;
}
.arserv-dd-item.danger:hover {
  background: #fff1f2;
}
.arserv-dd-sep {
  border-top: 1px dashed var(--ui-line);
  margin: 4px 0;
}

/* ---------- Dark Purple Slide-out Sidebar Drawer ---------- */
.arserv-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 5, 20, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  animation: arservFadeIn 0.18s ease;
}
.arserv-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 310px;
  max-width: 88vw;
  background: var(--sidebar-bg);
  color: #f8fafc;
  border-right: 1px solid rgba(139, 92, 246, 0.22);
  box-shadow: 12px 0 40px rgba(9, 5, 20, 0.45);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transform: translateX(-102%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.arserv-drawer.open {
  transform: translateX(0);
}
.arserv-drawer-head {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.arserv-drawer-search {
  padding: 12px 14px 8px;
}
.arserv-drawer-search input {
  width: 100%;
  background: rgba(30, 27, 75, 0.55);
  border: 1px solid rgba(139, 92, 246, 0.28);
  color: #f8fafc;
  border-radius: 10px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  outline: none;
  transition: all 0.16s ease;
}
.arserv-drawer-search input::placeholder {
  color: #94a3b8;
}
.arserv-drawer-search input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
  background: rgba(30, 27, 75, 0.8);
}
.arserv-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 14px;
}
.arserv-drawer-body::-webkit-scrollbar {
  width: 5px;
}
.arserv-drawer-body::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 99px;
}

.arserv-menu-root {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 5px;
  border-radius: 10px;
  background: rgba(30, 27, 75, 0.34);
  border: 1px solid rgba(139, 92, 246, 0.14);
  color: #f1f5f9;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}
.arserv-menu-root:hover {
  background: rgba(30, 27, 75, 0.62);
  border-color: rgba(168, 85, 247, 0.45);
  color: #d8b4fe;
}
.arserv-menu-root.active-parent {
  background: var(--sidebar-active-bg);
  border-color: #a855f7;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(109, 40, 217, 0.36);
}
.arserv-tree-branch {
  padding-left: 14px;
  margin: 2px 0 8px 15px;
  border-left: 1px dashed rgba(168, 85, 247, 0.28);
}
.arserv-menu-leaf {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  margin-bottom: 3px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.16s ease;
}
.arserv-menu-leaf::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 9px;
  border-top: 1px dashed rgba(168, 85, 247, 0.28);
}
.arserv-menu-leaf:hover {
  color: #e9d5ff;
  background: rgba(139, 92, 246, 0.14);
  transform: translateX(3px);
}
.arserv-menu-leaf.active {
  color: #ffffff;
  background: rgba(139, 92, 246, 0.26);
  border-left: 3px solid #c084fc;
  font-weight: 700;
}
.arserv-drawer-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(139, 92, 246, 0.18);
  display: flex;
  gap: 8px;
}

/* Main Content Wrapper (Always clears fixed 56px topbar) */
#main.main {
  padding-top: var(--header-height) !important;
  margin-left: 0 !important;
  min-height: 100vh;
}
body.arserv-login-mode #main.main {
  padding-top: 0 !important;
}

/* ---------- ERP-Grade Split-Card Login ---------- */
.arserv-login-screen {
  min-height: 100vh;
  width: 100%;
  background: linear-gradient(135deg, #6d28d9 0%, #9333ea 45%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.arserv-login-card {
  width: 100%;
  max-width: 900px;
  min-height: 540px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 28px 65px rgba(15, 23, 42, 0.32);
  overflow: hidden;
  display: flex;
  position: relative;
}
.arserv-login-brand {
  flex: 1;
  background: linear-gradient(160deg, #160a33 0%, #241054 55%, #3b177d 100%);
  color: #ffffff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%);
}
.arserv-login-brand-dot {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #db2777 0%, #c2185b 100%);
  border: 4px solid #ffffff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(194, 24, 91, 0.45);
}
.arserv-login-form-side {
  flex: 1.15;
  padding: 48px 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.arserv-login-input {
  width: 100%;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  padding: 12px 18px 12px 44px;
  font-size: 15px;
  color: #0f172a;
  transition: all 0.16s ease;
  outline: none;
}
.arserv-login-input:focus {
  border-color: #c2185b;
  box-shadow: 0 0 0 3px rgba(194, 24, 91, 0.14);
}
.arserv-login-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #7c3aed 0%, #c2185b 100%);
  box-shadow: 0 8px 20px rgba(194, 24, 91, 0.28);
  cursor: pointer;
  transition: all 0.18s ease;
}
.arserv-login-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(194, 24, 91, 0.38);
}
.arserv-login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ---------- ERP-Grade Admin Shell, Object Cards & Tabs ---------- */
.sys-page {
  background: var(--ui-page);
  min-height: calc(100vh - var(--header-height));
  padding: 18px 20px 44px;
}
.sys-shell {
  background: #ffffff;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.sys-shell-top {
  padding: 18px 22px;
  background: linear-gradient(135deg, #faf5ff 0%, #ffffff 55%, #fdf2f8 100%);
  border-bottom: 1px solid var(--ui-line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.sys-shell-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.28);
  flex-shrink: 0;
}
.sys-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--ui-line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ui-ink-2);
}
.sys-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  overflow-x: auto;
  background: #ffffff;
}
.sys-tab-btn {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ui-muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}
.sys-tab-btn:hover {
  color: var(--tab-accent, var(--primary-color));
  background: var(--tab-soft, var(--primary-light));
  border-radius: 8px 8px 0 0;
}
.sys-tab-btn.active {
  color: var(--tab-accent, var(--primary-color));
  border-bottom-color: var(--tab-accent, var(--primary-color));
  background: var(--tab-soft, var(--primary-light));
  border-radius: 8px 8px 0 0;
}

.sys-entity-card {
  background: #ffffff;
  border: 1px solid var(--ui-line-strong);
  border-left: 4px solid var(--card-accent, var(--primary-color));
  border-radius: var(--ui-radius-md);
  padding: 12px 16px;
  margin-bottom: 10px;
  transition: all 0.16s ease;
}
.sys-entity-card:hover {
  border-color: #c4b5fd;
  border-left-color: var(--card-accent, var(--primary-hover));
  background: #faf8ff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.1);
  transform: translateY(-1px);
}
.sys-segmented {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
}
.sys-segmented button {
  border: none;
  background: transparent;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ui-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.sys-segmented button.active {
  background: #ffffff;
  color: var(--primary-hover);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.sys-matrix-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.14s ease;
}
.sys-matrix-row.granted {
  background: #faf5ff;
  border-left: 3.5px solid var(--primary-color);
}
.sys-matrix-row:hover {
  background: #f5f3ff;
}

.sys-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.sys-modal-panel {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--ui-shadow-pop);
}
.sys-modal-panel.xl {
  max-width: 1040px;
}
.sys-modal-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--ui-line);
  background: linear-gradient(135deg, #faf5ff 0%, #ffffff 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sys-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}
.sys-modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--ui-line);
  background: rgba(248, 250, 252, 0.94);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Global Toast Stack */
#arserv-toast-host {
  position: fixed;
  top: 68px;
  right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.arserv-toast {
  padding: 11px 15px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--ui-line);
  border-left: 4px solid var(--primary-color);
  box-shadow: var(--ui-shadow-pop);
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-ink);
  display: flex;
  align-items: center;
  gap: 9px;
  animation: arservSlideIn 0.2s ease;
}
.arserv-toast.success { border-left-color: #10b981; background: #ecfdf5; color: #065f46; }
.arserv-toast.error { border-left-color: #ef4444; background: #fff1f2; color: #9f1239; }
.arserv-toast.warn { border-left-color: #f59e0b; background: #fffbeb; color: #92400e; }

/* Workspace Portal Launcher Cards */
.portal-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 16px;
  background: #ffffff;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  text-decoration: none !important;
  color: var(--ui-ink-2) !important;
  transition: all 0.18s ease;
  height: 100%;
}
.portal-card:hover {
  border-color: #c4b5fd;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.13);
}
.portal-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
  color: var(--primary-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

@keyframes arservFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes arservSlideIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 768px) {
  .arserv-topbar { padding: 0 12px; }
  .arserv-brand-badge { display: none; }
  .arserv-login-screen { padding: 0; align-items: stretch; }
  .arserv-login-card { flex-direction: column; border-radius: 0; min-height: 100vh; }
  .arserv-login-brand { clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%); padding: 34px 24px 44px; flex: 0 0 auto; }
  .arserv-login-brand-dot { top: auto; bottom: 8px; right: 50%; transform: translateX(50%) rotate(90deg); }
  .arserv-login-form-side { padding: 28px 22px 40px; }
  .sys-page { padding: 12px 10px 36px; }
  #arserv-toast-host { right: 10px; left: 10px; max-width: none; }
}

/* ===== Workspace Portal (trang chủ /) — hero gọn + nhóm chức năng dạng panel ===== */
.portal-page { padding-top: 16px; }
.portal-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap;
  padding: 20px 26px; margin-bottom: 18px; border-radius: 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(236,72,153,0.55) 0%, rgba(236,72,153,0) 55%),
              linear-gradient(120deg, #3b0764 0%, #5b21b6 45%, #7c3aed 100%);
  box-shadow: 0 12px 30px rgba(91, 33, 182, 0.22);
}
.portal-hero-main { min-width: 0; }
.portal-hero-tag {
  display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; letter-spacing: .3px;
  padding: 3px 11px; border-radius: 999px; background: rgba(255,255,255,0.14); margin-bottom: 8px;
}
.portal-hero-title { font-weight: 800; font-size: 22px; margin: 0 0 10px; letter-spacing: -.2px; }
.portal-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.portal-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22);
}
.portal-hero-search { position: relative; flex: 0 1 400px; min-width: 240px; }
.portal-hero-search > .bi-search { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #64748b; }
.portal-hero-search input {
  width: 100%; height: 44px; border: 0; border-radius: 12px; padding: 0 40px 0 42px; font-size: 14px; color: #0f172a;
  background: #fff; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18); outline: none;
}
.portal-hero-search input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,0.45), 0 6px 18px rgba(15,23,42,0.18); }
.portal-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: #f1f5f9;
  color: #475569; width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px;
}

.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.portal-group {
  --tone: #7c3aed; --tone-soft: #f5f3ff; --tone-line: #ddd6fe;
  background: #fff; border: 1px solid var(--ui-line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); border-top: 3px solid var(--tone);
}
.portal-group.tone-blue    { --tone: #2563eb; --tone-soft: #eff6ff; --tone-line: #bfdbfe; }
.portal-group.tone-emerald { --tone: #059669; --tone-soft: #ecfdf5; --tone-line: #a7f3d0; }
.portal-group.tone-amber   { --tone: #d97706; --tone-soft: #fffbeb; --tone-line: #fde68a; }
.portal-group.tone-rose    { --tone: #e11d48; --tone-soft: #fff1f2; --tone-line: #fecdd3; }
.portal-group.tone-cyan    { --tone: #0891b2; --tone-soft: #ecfeff; --tone-line: #a5f3fc; }
.portal-group.tone-indigo  { --tone: #4f46e5; --tone-soft: #eef2ff; --tone-line: #c7d2fe; }
.portal-group-head { display: flex; align-items: center; gap: 11px; padding: 13px 15px 11px; border-bottom: 1px solid #f1f5f9; }
.portal-group-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--tone); color: #fff; font-size: 16px; box-shadow: 0 4px 10px -3px var(--tone);
}
.portal-group-crumb { font-size: 11px; font-weight: 600; color: var(--ui-subtle); text-transform: uppercase; letter-spacing: .4px; line-height: 1.2; }
.portal-group-title { font-size: 15px; font-weight: 800; color: var(--ui-ink); line-height: 1.3; }
.portal-group-count {
  font-size: 12px; font-weight: 700; min-width: 26px; height: 22px; padding: 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; background: var(--tone-soft); color: var(--tone); border: 1px solid var(--tone-line);
}
.portal-group-list { padding: 6px; }
.portal-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
  text-decoration: none !important; color: var(--ui-ink-2) !important; transition: background .15s ease;
}
.portal-item + .portal-item { margin-top: 2px; }
.portal-item-icon {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--tone-soft); color: var(--tone); font-size: 15px; border: 1px solid var(--tone-line);
}
.portal-item-label { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.portal-item-go { font-size: 20px; color: var(--ui-line-strong); transition: transform .15s ease, color .15s ease; }
.portal-item:hover { background: var(--tone-soft); }
.portal-item:hover .portal-item-label { color: var(--tone); }
.portal-item:hover .portal-item-go { color: var(--tone); transform: translateX(3px); }
.portal-empty {
  background: #fff; border: 1px dashed var(--ui-line-strong); border-radius: 16px; padding: 44px 20px; text-align: center; color: var(--ui-subtle);
}
.portal-empty > .bi { font-size: 34px; display: block; margin-bottom: 8px; color: var(--primary-color); opacity: .5; }
@media (max-width: 768px) {
  .portal-hero { padding: 16px 16px; border-radius: 14px; }
  .portal-hero-title { font-size: 19px; }
  .portal-hero-search { flex-basis: 100%; min-width: 0; }
  .portal-grid { grid-template-columns: 1fr; gap: 12px; }
}
