@font-face {
  font-family: Inter;
  src: url("../assets/fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: Inter;
  src: url("../assets/fonts/Inter-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: Inter;
  src: url("../assets/fonts/Inter-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: optional;
}

:root {
  --blue-900: #111111;
  --blue-700: #BE0F0E;
  --blue-500: #d32524;
  --blue-100: #fce8e8;
  --primary: #BE0F0E;
  --gray-50: #f7f7f8;
  --gray-200: #e2e8f0;
  --gray-500: #64748b;
  --gray-800: #1e293b;
  --radius: 16px;
  --shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  --font-sans: Inter, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

html {
  font-family: var(--font-sans);
  font-size: 16px;
}

body {
  margin: 0;
  font-family: inherit;
  color: var(--gray-800);
  line-height: 1.5;
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, button, .btn { font-family: inherit; }

/* —— Sign in (same pattern as P2P login) —— */
.login-page {
  min-height: 100vh;
  background: #1f1f1f;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) 1.1fr;
  min-height: 100vh;
  background: #fff;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
  background: #1f1f1f;
  color: #fff;
  overflow: hidden;
}

.login-brand-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-brand-shape {
  position: absolute;
  display: block;
  transform: skewX(-18deg);
  border-radius: 4px;
}

.login-brand-shape--a {
  right: -1.5rem;
  top: 8%;
  width: 6.5rem;
  height: 16rem;
  background: linear-gradient(180deg, rgba(200, 0, 0, 0.5), rgba(200, 0, 0, 0.05));
  animation: login-drift-a 9s ease-in-out infinite;
}

.login-brand-shape--b {
  right: 4.5rem;
  top: 22%;
  width: 4.25rem;
  height: 12rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(200, 0, 0, 0.22));
  animation: login-drift-b 11s ease-in-out infinite;
}

.login-brand-shape--c {
  left: 8%;
  bottom: 6%;
  width: 5.5rem;
  height: 10rem;
  background: linear-gradient(180deg, rgba(200, 0, 0, 0.28), transparent);
  animation: login-drift-c 13s ease-in-out infinite;
}

.login-brand-glow {
  position: absolute;
  right: -20%;
  bottom: -15%;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 0, 0, 0.45), transparent 68%);
  animation: login-glow 8s ease-in-out infinite;
}

@keyframes login-drift-a {
  0%, 100% { transform: skewX(-18deg) translate(0, 0); }
  50% { transform: skewX(-18deg) translate(-14px, 20px); }
}

@keyframes login-drift-b {
  0%, 100% { transform: skewX(-18deg) translate(0, 0); }
  50% { transform: skewX(-18deg) translate(12px, -16px); }
}

@keyframes login-drift-c {
  0%, 100% { transform: skewX(-18deg) translate(0, 0); }
  50% { transform: skewX(-18deg) translate(10px, 12px); }
}

@keyframes login-glow {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .login-brand-shape,
  .login-brand-glow,
  .sidebar-art-shape,
  .sidebar-art-glow {
    animation: none;
  }
}

.login-brand-kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 1.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f3b4b4;
}

.login-brand h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

.login-brand h2 span { color: #ffd6d6; }

.login-brand-copy {
  position: relative;
  z-index: 1;
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 4rem;
  text-align: center;
}

.login-card h1,
.login-card form {
  width: 100%;
  max-width: 24rem;
  text-align: left;
}

.login-logo-wrap {
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.login-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.08);
}

.login-card h1 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue-900);
  text-align: center;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 1rem;
}

#login-form input {
  border-radius: 999px;
  padding-left: 1rem;
  padding-right: 1rem;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.password-field input {
  margin-bottom: 0;
  padding-right: 2.75rem;
  border-radius: 999px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 0.35rem;
  display: inline-flex;
}

.password-toggle:hover { color: var(--primary); }
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-shown .icon-eye { display: none; }
.password-toggle.is-shown .icon-eye-off { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--blue-700);
  color: #fff;
  min-height: 2.75rem;
}

.login-card .btn-primary {
  width: 100%;
}

.btn-primary:hover { background: var(--blue-500); }

.btn-secondary {
  background: #fff;
  color: var(--blue-700);
  border-color: var(--gray-200);
}

.btn-secondary:hover {
  border-color: var(--blue-700);
  text-decoration: none;
}

.form-error {
  color: #9f1239;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* —— Portal home (P2P app-shell style) —— */
body.portal-page {
  background: #f3f5f9;
}

.portal-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: relative;
  background: #1f1f1f;
  color: #f3f4f6;
  padding: 1.25rem 0.9rem 1.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sidebar-art-shape {
  position: absolute;
  display: block;
  transform: skewX(-18deg);
  border-radius: 4px;
}

.sidebar-art-shape--a {
  right: -1.1rem;
  top: 16%;
  width: 3.1rem;
  height: 11rem;
  background: linear-gradient(180deg, rgba(190, 15, 14, 0.5), rgba(190, 15, 14, 0.05));
  animation: login-drift-a 9s ease-in-out infinite;
}

.sidebar-art-shape--b {
  right: 1.6rem;
  top: 28%;
  width: 2.2rem;
  height: 8rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(190, 15, 14, 0.22));
  animation: login-drift-b 11s ease-in-out infinite;
}

.sidebar-art-glow {
  position: absolute;
  right: -55%;
  bottom: -8%;
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(190, 15, 14, 0.4), transparent 68%);
  animation: login-glow 8s ease-in-out infinite;
}

.sidebar > *:not(.sidebar-art) {
  position: relative;
  z-index: 1;
}

.sidebar-brand-block {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.sidebar .brand-logo-wrap {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.sidebar .brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.08);
}

.sidebar .brand {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.sidebar .brand-sub {
  font-size: 0.8rem;
  margin: 0.15rem 0 0;
  color: #9ca3af;
}

.sidebar-nav-label {
  margin: 0 0 0.5rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
}

.nav-link {
  display: block;
  color: #d1d5db;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 0.2rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.nav-link.active {
  background: rgba(190, 15, 14, 0.25);
  color: #fff;
}

.sidebar-section {
  margin-top: 0.25rem;
}

.sidebar-nav-label--section {
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

.admin-subnav {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin: 0 0 0.5rem;
  padding: 0.15rem 0 0.15rem 0.65rem;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.nav-link--sub {
  padding: 0.5rem 0.75rem 0.5rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #b0b5bd;
  border-radius: 8px;
  text-decoration: none;
}

.nav-link--sub:hover {
  color: #f3f4f6;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.nav-link--sub.active {
  background: rgba(190, 15, 14, 0.28);
  color: #fff;
  box-shadow: inset 3px 0 0 #be0f0e;
}

.admin-page .portal-section-title {
  margin: 0 0 0.35rem;
}

.admin-page-header {
  margin-bottom: 1.25rem;
}

.admin-page-header--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-panel--flat {
  margin-top: 0;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e8eaed;
  border-top: 3px solid var(--primary);
}

.topbar-greeting {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.apps-launcher-menu,
.notifications-menu {
  position: relative;
}

.btn-apps-launcher,
.btn-notifications {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  opacity: 0.95;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn-apps-launcher:hover,
.btn-apps-launcher[aria-expanded="true"],
.btn-notifications:hover,
.btn-notifications[aria-expanded="true"] {
  background: #fce8e8;
  color: var(--primary);
  opacity: 1;
}

.btn-apps-launcher svg,
.btn-notifications svg {
  display: block;
}

.apps-launcher-dropdown,
.notifications-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 200;
  width: min(340px, 92vw);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 12px;
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 12px 28px rgba(15, 23, 42, 0.12);
}

.apps-launcher-dropdown {
  width: min(380px, 92vw);
}

.apps-launcher-header,
.notifications-header {
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--blue-900);
}

.apps-launcher-body {
  padding: 0.75rem;
  max-height: 360px;
  overflow-y: auto;
}

.apps-launcher-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.apps-launcher-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.65rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.apps-launcher-tile:hover {
  border-color: var(--primary);
  background: #fce8e8;
}

.apps-launcher-tile-name {
  line-height: 1.25;
}

.apps-launcher-empty,
.notifications-empty {
  margin: 0;
  padding: 1rem;
  color: var(--gray-500);
  font-size: 0.88rem;
  text-align: center;
}

.notifications-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 0.35rem 0;
}

.account-menu {
  position: relative;
}

.avatar-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #fce8e8;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-lg {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-900);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 220px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  padding: 0.75rem;
  z-index: 50;
}

.account-identity {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.account-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.account-email {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.account-profile-link {
  display: block;
  margin-top: 0.75rem;
  padding: 0.45rem 0 0.1rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a1a1a;
  text-decoration: none;
}

.account-profile-link:hover {
  color: var(--primary);
}

.account-signout {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0 0.1rem;
  border: none;
  border-top: none;
  background: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a1a1a;
  text-align: left;
  cursor: pointer;
}

.account-signout:hover {
  color: var(--primary);
}

.main-content {
  flex: 1;
  padding: 1.5rem 1.75rem 2rem;
}

.portal-section-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--blue-900);
}

.portal-section-hint {
  margin: 0 0 1.25rem;
  color: var(--gray-500);
  font-size: 0.95rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.15rem 1rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.app-card:hover:not(:disabled) {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
  transform: translateY(-2px);
}

.app-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.app-card-name {
  font-weight: 700;
  font-size: 1rem;
}

.app-card-desc {
  font-size: 0.8rem;
  color: var(--gray-500);
  line-height: 1.35;
}

.app-card-badge {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.app-card-badge--open {
  background: var(--blue-100);
  color: var(--blue-700);
}

.app-card-badge--soon {
  background: #f1f5f9;
  color: var(--gray-500);
}

.portal-alert {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--blue-100);
  color: #7f1d1d;
  font-size: 0.9rem;
  border: 1px solid #fecaca;
}

.admin-panel {
  margin-top: 1.75rem;
  padding: 1.25rem 1.15rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
}

.admin-panel-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.admin-module-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-module-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.admin-module-row:last-child {
  border-bottom: none;
}

.admin-module-row strong {
  display: block;
  font-size: 0.95rem;
}

.admin-module-row span {
  display: block;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray-300);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--gray-100);
}

.admin-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  font-weight: 700;
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-panel-head .admin-panel-title {
  margin: 0;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

.admin-link-danger {
  color: #b91c1c;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.admin-modal[hidden] {
  display: none !important;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.admin-modal-card {
  position: relative;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.15rem 1.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.admin-modal-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.admin-form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font: inherit;
}

.admin-form fieldset {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.65rem 0.75rem 0.75rem;
  margin: 0 0 0.75rem;
}

.admin-form legend {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0 0.25rem;
}

.admin-check-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 200px;
  overflow-y: auto;
}

.admin-check {
  font-weight: 400;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.admin-check input {
  width: auto;
  margin: 0;
}

.admin-perm-group {
  margin: 0.65rem 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gray-500);
}

.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* —— Admin lists (modern / compact) —— */
.admin-page .admin-hero,
.admin-page .page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.admin-page .admin-hero-main {
  flex: 1 1 12rem;
  min-width: 0;
}

.admin-page .page-header h1,
.admin-page .admin-hero h1 {
  margin: 0 0 0.25rem;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

.admin-page .page-intro {
  margin: 0;
  max-width: 36rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: #6e6e73;
}

.admin-page .btn-page-add,
.admin-page .btn-compact {
  width: auto;
  flex-shrink: 0;
  align-self: center;
  min-height: 2.125rem;
  padding: 0.45rem 1.05rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 980px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.admin-page .btn-page-add:hover {
  box-shadow: 0 2px 8px rgba(190, 15, 14, 0.22);
}

.admin-page .list-panel {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 24px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.admin-page .list-panel-head {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #fafafa;
  flex-wrap: wrap;
}

.admin-page .ios-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 14rem;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  margin: 0;
  border-radius: 10px;
  background: rgba(120, 120, 128, 0.12);
  transition: background 0.15s ease, box-shadow 0.15s ease;
  cursor: text;
}

.admin-page .ios-search:focus-within {
  background: rgba(120, 120, 128, 0.08);
  box-shadow: 0 0 0 3px rgba(190, 15, 14, 0.12);
}

.admin-page .ios-search svg {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  color: #86868b;
}

.admin-page .ios-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: 1rem;
  color: #1d1d1f;
  background: transparent;
  appearance: none;
}

.admin-page .ios-search-input::placeholder {
  color: #86868b;
}

.admin-page .ios-search-input:focus {
  outline: none;
}

.admin-page .list-meta {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #86868b;
  white-space: nowrap;
}

.admin-page .table-wrap {
  overflow-x: auto;
}

.admin-page .data-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-page .data-table th,
.admin-page .data-table td,
.admin-page .list-panel table th,
.admin-page .list-panel table td {
  text-align: left;
  vertical-align: middle;
}

.admin-page .data-table th,
.admin-page .list-panel table thead th {
  padding: 0.55rem 1.15rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #86868b;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}

.admin-page .data-table td,
.admin-page .list-panel table tbody td {
  padding: 0.8rem 1.15rem;
  font-size: 0.9375rem;
  color: #1d1d1f;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.admin-page .data-table tbody tr:last-child td,
.admin-page .list-panel tbody tr:last-child td {
  border-bottom: none;
}

.admin-page .data-table tbody tr {
  transition: background-color 0.12s ease;
}

.admin-page .data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.admin-page td.table-actions,
.admin-page th.table-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.admin-page td.table-actions .btn-icon + .btn-icon {
  margin-left: 0.15rem;
}

.admin-page tr.row-inactive td {
  color: #86868b;
}

.admin-page tr.row-inactive .user-row-primary {
  color: #636366;
}

.admin-page .empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: #86868b;
  font-size: 0.9375rem;
}

.admin-page .user-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.admin-page .user-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #3a3a3c;
  background: linear-gradient(160deg, #f2f2f7 0%, #e5e5ea 100%);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.admin-page .user-row-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.admin-page .user-row-primary {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1d1d1f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-page .user-row-secondary {
  font-size: 0.8125rem;
  color: #86868b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-page .cell-branch {
  color: #424245;
  font-size: 0.9375rem;
}

.admin-page .status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
}

.admin-page .status-pill--active {
  background: rgba(52, 199, 89, 0.14);
  color: #248a3d;
}

.admin-page .status-pill--inactive {
  background: rgba(142, 142, 147, 0.18);
  color: #636366;
}

.admin-page .pr-code-status {
  display: inline-block;
  font-weight: 700;
  font-size: 0.875rem;
}

.admin-page .pr-code-status--on { color: #15803d; }
.admin-page .pr-code-status--off { color: #64748b; }

.admin-page .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #424245;
  cursor: pointer;
  line-height: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.admin-page .btn-icon:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1d1d1f;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.side-drawer .btn-primary,
.side-drawer .btn-secondary {
  width: auto;
  min-height: 2.125rem;
  font-size: 0.875rem;
}

.admin-page .btn-icon-danger { color: #b91c1c; }
.admin-page .btn-icon-danger:hover { background: #fee2e2; }

.admin-page .btn-danger {
  background: #b91c1c;
  color: #fff;
  border: none;
}

.admin-page .btn-danger:hover {
  background: #991b1b;
}

.admin-page .card {
  background: #fff;
}

/* Drawers mount on body (outside .admin-page) — own stack + solid surface */
body.portal-drawer-open {
  overflow: hidden;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9000;
}

.dialog-overlay.dialog-overlay--center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9100;
}

.card.side-drawer,
.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9001;
  width: min(680px, 100%);
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  border-radius: 0;
  border-left: 1px solid var(--gray-200);
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.18);
  background: #fff;
  overflow-y: auto;
  padding: 1.25rem 1.35rem;
  box-sizing: border-box;
  animation: side-drawer-in 0.2s ease-out forwards;
  isolation: isolate;
}

.side-drawer.side-drawer--details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.side-drawer.side-drawer--details .side-drawer-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.side-drawer.side-drawer--user {
  width: min(440px, 100%);
}

.side-drawer-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem 0.85rem;
  border-bottom: 1px solid var(--gray-200);
  background: #fff;
}

.side-drawer-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.side-drawer-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.4;
}

.side-drawer-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: -0.15rem -0.35rem 0 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--gray-500);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.side-drawer-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1d1d1f;
}

.side-drawer.side-drawer--details .side-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.15rem 1.35rem 1.35rem;
  background: #f8fafc;
  position: relative;
}

.side-drawer.side-drawer--details .side-drawer-footer {
  flex: 0 0 auto;
  padding: 0.85rem 1.35rem;
  border-top: 1px solid var(--gray-200);
  background: #fff;
}

.side-drawer-footer--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.side-drawer-footer-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.side-drawer .btn-ghost {
  background: #fff;
  border: 1px solid var(--gray-200);
  color: #334155;
  min-height: 2.125rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.875rem;
}

.side-drawer .btn-ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.um-drawer-hero {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.15rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
}

.um-drawer-avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: linear-gradient(145deg, #1e293b, #334155);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.um-drawer-hero-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
}

.um-drawer-hero-email {
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
  color: var(--gray-500);
  word-break: break-word;
}

.um-drawer-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.um-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.um-field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  margin: 0;
}

.side-drawer--user .um-field input:not([type="checkbox"]),
.side-drawer--user .um-field select,
.side-drawer--user .um-field textarea {
  margin-bottom: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.9375rem;
  border-radius: 8px;
  border-color: #e2e8f0;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}

.side-drawer--user .um-field input:focus,
.side-drawer--user .um-field select:focus,
.side-drawer--user .um-field textarea:focus {
  outline: none;
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.25);
}

.um-drawer-section {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid #e2e8f0;
}

.um-drawer-section-title {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.um-drawer-section-lead {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.um-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
}

.um-toggle-label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
}

.um-toggle-hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 400;
}

.um-switch {
  position: relative;
  flex-shrink: 0;
  display: inline-block;
  width: 2.75rem;
  height: 1.625rem;
  cursor: pointer;
}

.um-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.um-switch-track {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.um-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.25rem;
  height: 1.25rem;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease;
}

.um-switch input:checked + .um-switch-track {
  background: #16a34a;
}

.um-switch input:checked + .um-switch-track::after {
  transform: translateX(1.125rem);
}

.um-switch input:focus-visible + .um-switch-track {
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.35);
}

.um-drawer-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 1rem;
  padding: 0;
  border-bottom: 1px solid #e2e8f0;
  background: transparent;
}

.um-drawer-tab {
  flex: 0 1 auto;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 0;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.um-drawer-tab:hover {
  color: #334155;
}

.um-drawer-tab.is-active {
  color: #be0f0e;
  border-bottom-color: #be0f0e;
}

.um-drawer-tabpanels {
  min-height: 0;
}

.um-drawer-tabpanel[hidden] {
  display: none !important;
}

.um-drawer-section--flush {
  margin-top: 0.5rem;
  padding-top: 0;
  border-top: none;
}

.um-role-sections {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.um-role-section {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
}

.um-role-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.um-role-section-title::-webkit-details-marker {
  display: none;
}

.um-role-section-title::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.4rem;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.um-role-section[open] .um-role-section-title::before {
  transform: rotate(45deg);
}

.um-role-grid--section {
  border: none;
  border-top: 1px solid var(--gray-200);
  border-radius: 0;
  max-height: none;
}

.um-role-readonly-block {
  margin-bottom: 1rem;
}

.um-role-readonly-heading {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.um-role-readonly-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  color: #334155;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.um-role-group-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.um-role-grid {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
}

.um-role-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.875rem;
  padding: 0.65rem 0.75rem;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #334155;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s ease;
  margin: 0;
}

.um-role-item:hover {
  background: #f1f5f9;
}

.um-role-item input[type="checkbox"] {
  flex: 0 0 1.125rem;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: #be0f0e;
  vertical-align: middle;
}

.um-role-item-text {
  flex: 1;
  line-height: 1.25;
  padding: 0;
}

.side-drawer .form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin-bottom: 0.25rem;
}

.side-drawer label:not(.perm-item):not(.um-role-item):not(.um-switch) {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.side-drawer label.um-role-item {
  display: flex;
  font-weight: 500;
  margin-bottom: 0;
}

.side-drawer input:not([type="checkbox"]),
.side-drawer select,
.side-drawer textarea {
  display: block;
  width: 100%;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-family: inherit;
}

.side-drawer .perm-intro,
.side-drawer .field-hint,
.admin-page .field-hint {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin: 0.5rem 0;
}

.side-drawer .perm-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.15rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}

.side-drawer .perm-panel--scroll {
  max-height: min(50vh, 420px);
  overflow-y: auto;
  display: block;
  grid-template-columns: 1fr;
}

.side-drawer .perm-panel--scroll .perm-column-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.side-drawer .perm-group-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-500);
  margin: 0.75rem 0 0.35rem;
}

.side-drawer .perm-group-title:first-child {
  margin-top: 0;
}

.side-drawer .perm-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
}

.side-drawer .perm-item input[type="checkbox"] {
  width: auto;
  margin: 0.2rem 0 0;
}

.side-drawer .user-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.25rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
}

.side-drawer--user .user-detail-grid {
  grid-template-columns: 1fr;
}

.side-drawer .user-detail-item--full {
  grid-column: 1 / -1;
}

.side-drawer .user-detail-label {
  display: block;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 0.2rem;
}

.side-drawer .user-detail-value {
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-word;
}

.side-drawer .pr-code-sidebar-status-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.side-drawer .pr-code-onoff {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.side-drawer .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.role-dialog.confirm-dialog {
  position: relative;
  z-index: 9101;
  max-width: 420px;
  width: calc(100% - 2rem);
  padding: 1.35rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  background: #fff;
}

.confirm-dialog .confirm-message {
  margin: 0.75rem 0 0;
  color: var(--gray-800);
}

.confirm-dialog .confirm-hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.confirm-dialog .actions {
  justify-content: center;
  margin-top: 1rem;
}

.temp-password-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.temp-password-input {
  flex: 1;
  font-family: ui-monospace, monospace;
}

@keyframes side-drawer-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* —— Users: SaaS user-management layout (reference) —— */
.um-page {
  max-width: 1200px;
}

.um-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: #667085;
}

.um-breadcrumb a {
  color: #667085;
  text-decoration: none;
}

.um-breadcrumb a:hover {
  color: #344054;
  text-decoration: underline;
}

.um-breadcrumb-sep {
  color: #d0d5dd;
}

.um-title-block {
  margin-bottom: 1.25rem;
}

.um-title {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #101828;
  line-height: 1.25;
}

.um-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0.1rem 0.45rem;
  margin-left: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #344054;
  background: #f2f4f7;
  border: 1px solid #eaecf0;
  border-radius: 999px;
  vertical-align: middle;
}

.um-lead {
  margin: 0;
  font-size: 0.9375rem;
  color: #667085;
  line-height: 1.5;
}

.um-card {
  background: #fff;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  overflow: hidden;
}

.um-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #eaecf0;
  flex-wrap: wrap;
}

.um-search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 16rem;
  max-width: 22rem;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.um-search-field:focus-within {
  border-color: #98a2b3;
  box-shadow: 0 0 0 3px rgba(152, 162, 179, 0.25);
}

.um-search-field svg {
  color: #667085;
  flex-shrink: 0;
}

.um-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: 0.9375rem;
  color: #101828;
  background: transparent;
}

.um-search-input:focus {
  outline: none;
}

.um-search-input::placeholder {
  color: #98a2b3;
}

.um-btn-add {
  width: auto;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: none;
}

.um-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #f2f4f7;
  flex-wrap: wrap;
}

.um-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.um-chip {
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #344054;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.um-chip:hover {
  background: #f9fafb;
}

.um-chip.is-active {
  background: #f9fafb;
  border-color: #98a2b3;
  color: #101828;
}

.um-filter-select-wrap {
  margin: 0;
}

.um-filter-select {
  min-height: 2.125rem;
  padding: 0.35rem 2rem 0.35rem 0.75rem;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #344054;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23667085' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
  appearance: none;
}

.um-table-wrap {
  overflow-x: auto;
}

.um-table {
  width: 100%;
  border-collapse: collapse;
}

.um-table thead th {
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #667085;
  text-align: left;
  background: #fcfcfd;
  border-bottom: 1px solid #eaecf0;
  white-space: nowrap;
}

.um-table tbody td {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  color: #101828;
  border-bottom: 1px solid #f2f4f7;
  vertical-align: middle;
}

.um-table tbody tr:last-child td {
  border-bottom: none;
}

.um-table tbody tr:hover {
  background: #fcfcfd;
}

.um-row-inactive td {
  color: #667085;
}

.um-col-check {
  width: 2.5rem;
  padding-left: 1rem !important;
}

.um-col-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.um-col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.um-person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.um-person-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.um-person-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #101828;
  line-height: 1.3;
}

.um-person-sub {
  font-size: 0.8125rem;
  color: #667085;
  line-height: 1.3;
}

.um-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #344054;
  background: #f2f4f7;
  border: 1px solid #eaecf0;
}

.um-name-btn,
.um-email-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.um-name-btn {
  font-weight: 500;
  color: #101828;
}

.um-name-btn:hover {
  color: var(--primary);
}

.um-email-btn {
  color: #344054;
  text-decoration: underline;
  text-decoration-color: #d0d5dd;
  text-underline-offset: 2px;
}

.um-email-btn:hover {
  color: var(--primary);
  text-decoration-color: currentColor;
}

.um-cell-muted {
  color: #475467;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.um-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #344054;
}

.um-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.um-status-dot--on {
  background: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.18);
}

.um-status-dot--off {
  background: #f04438;
  box-shadow: 0 0 0 3px rgba(240, 68, 56, 0.15);
}

.um-row-actions {
  display: inline-flex;
  gap: 0.35rem;
  justify-content: flex-end;
}

.um-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0 0.65rem;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #344054;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.um-row-btn:hover {
  background: #f9fafb;
  border-color: #98a2b3;
}

.um-row-btn--danger {
  color: #b42318;
  border-color: #fecdca;
}

.um-row-btn--danger:hover {
  background: #fef3f2;
  border-color: #fda29b;
}

.um-row-btn svg {
  width: 14px;
  height: 14px;
}

.um-empty {
  text-align: center;
  padding: 2.5rem 1rem !important;
  color: #667085;
}

.um-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #eaecf0;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: #667085;
}

.um-page-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.um-page-size label {
  font-size: 0.875rem;
  color: #667085;
}

.um-page-size-select {
  min-height: 2rem;
  padding: 0.25rem 1.75rem 0.25rem 0.5rem;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font: inherit;
  font-size: 0.875rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23667085' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 0.5rem center;
  appearance: none;
}

.um-page-range {
  margin: 0;
  flex: 1 1 auto;
  text-align: center;
}

.um-page-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.um-page-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.35rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.um-page-btn:hover:not(:disabled) {
  background: #f2f4f7;
  color: #344054;
}

.um-page-btn.is-current {
  background: #f2f4f7;
  color: #101828;
  font-weight: 600;
}

.um-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.um-page-btn--icon {
  font-size: 1rem;
  line-height: 1;
}

.um-page-ellipsis {
  padding: 0 0.25rem;
  color: #98a2b3;
}

@media (max-width: 640px) {
  .side-drawer { width: 100%; }
  .side-drawer .form-grid-2,
  .side-drawer .user-detail-grid,
  .side-drawer .perm-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 1.75rem 1.35rem 1.25rem; }
  .login-brand h2 { font-size: 1.35rem; }
  .login-card { padding: 1.75rem 1.35rem 2rem; }

  .portal-shell { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: 1rem; }
  .main-content { padding: 1rem; }
}
