﻿/* AgenticsAdmin - professional light/dark design system */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --font-sans: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --sidebar-width: 260px;
  --topbar-height: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --transition: 0.18s ease;

  /* Light theme */
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-muted: #eef1f6;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --bg-sidebar-active: rgba(13, 148, 136, 0.22);
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-on-sidebar: #cbd5e1;
  --text-on-sidebar-active: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.12);
  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.12);
  --focus-ring: 0 0 0 3px rgba(13, 148, 136, 0.35);
  --auth-panel: rgba(255, 255, 255, 0.92);
  --auth-bg-1: #0f172a;
  --auth-bg-2: #134e4a;
  --table-stripe: #f8fafc;
  --input-bg: #ffffff;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-elevated: #111827;
  --bg-muted: #1e293b;
  --bg-sidebar: #020617;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
  --bg-sidebar-active: rgba(45, 212, 191, 0.18);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-sidebar: #94a3b8;
  --text-on-sidebar-active: #f8fafc;
  --border: #1e293b;
  --border-strong: #334155;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.12);
  --focus-ring: 0 0 0 3px rgba(45, 212, 191, 0.35);
  --auth-panel: rgba(17, 24, 39, 0.92);
  --auth-bg-1: #020617;
  --auth-bg-2: #042f2e;
  --table-stripe: #0f172a;
  --input-bg: #0f172a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* --- App shell --- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-on-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.sidebar-brand:hover {
  color: #fff;
}

.sidebar-brand > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 11rem;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.brand-mark.brand-logo {
  padding: 0;
  object-fit: cover;
  background: #0f172a;
}

.profile-logo-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-logo-preview {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #0f172a;
}

.profile-logo-fallback {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  font-size: 1.1rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(148, 163, 184, 0.7);
  padding: 0.5rem 0.75rem 0.35rem;
  margin-top: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.2rem;
  border-radius: var(--radius-sm);
  color: var(--text-on-sidebar);
  font-weight: 500;
  font-size: 0.92rem;
  transition: background var(--transition), color var(--transition);
}

.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-on-sidebar-active);
}

.sidebar-link.active {
  background: var(--bg-sidebar-active);
  color: var(--text-on-sidebar-active);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.65);
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-height);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.page-title-bar {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 220px;
  padding: 0.28rem 0.55rem 0.28rem 0.28rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.user-menu-trigger:hover,
.user-menu.is-open .user-menu-trigger {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.user-menu-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

[data-theme="dark"] .user-menu-avatar {
  background: var(--accent);
  color: #042f2e;
}

.user-menu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.user-menu-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.user-menu.is-open .user-menu-chevron {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: 260px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 1100;
}

.user-menu-dropdown[hidden] {
  display: none !important;
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 0.95rem;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
}

.user-menu-header-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.user-menu-header-email {
  font-size: 0.78rem;
  color: var(--text-secondary);
  word-break: break-all;
  margin-top: 0.1rem;
}

.user-menu-section {
  padding: 0.35rem;
}

.user-menu-section + .user-menu-section {
  border-top: 1px solid var(--border);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.user-menu-item:hover {
  background: var(--bg-muted);
  color: var(--text);
  text-decoration: none;
}

.user-menu-item-danger {
  color: var(--danger);
}

.user-menu-item-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.user-menu-section-danger form {
  margin: 0;
}

.app-content {
  flex: 1;
  padding: 1.5rem 1.75rem 2.5rem;
}

.app-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.sidebar-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1035;
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

/* --- Auth / public layout --- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(13, 148, 136, 0.25), transparent),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(15, 23, 42, 0.35), transparent),
    linear-gradient(145deg, var(--auth-bg-1), var(--auth-bg-2));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--auth-panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-brand p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.auth-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.auth-card .auth-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.auth-top-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.auth-shell {
  position: relative;
}

.otp-header {
  text-align: center;
  margin-bottom: 0.25rem;
}

.otp-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.otp-inputs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.5rem 0 1.25rem;
}

.otp-digit {
  width: 2.75rem;
  height: 3.1rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.otp-digit:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.btn.is-loading {
  position: relative;
  pointer-events: none;
  cursor: wait;
}

.btn .btn-spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  margin-left: 0.45rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: btn-spin 0.65s linear infinite;
}

[data-theme="dark"] .btn-primary .btn-spinner {
  border-color: rgba(4, 47, 46, 0.3);
  border-top-color: #042f2e;
}

.btn.is-loading .btn-spinner {
  display: inline-block;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.otp-footer {
  text-align: center;
  margin-top: 0.25rem;
}

.public-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.public-content {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* --- Theme toggle --- */
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
  width: 18px;
  height: 18px;
}

[data-theme="light"] .theme-toggle .icon-moon,
html:not([data-theme]) .theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* --- Page primitives --- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1,
.page-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.25;
}

.page-header .subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.card-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}

.card-panel h5,
.card-panel .card-title {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}

.stat-card .label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-card .value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-card .meta {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Profile --- */
.profile-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  width: 100%;
  max-width: none;
}

.profile-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  width: 100%;
}

.profile-card {
  margin-bottom: 0;
  width: 100%;
}

.profile-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.profile-divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

.password-hint {
  margin: 0 0 0.75rem;
}

.profile-summary {
  text-align: center;
  padding: 1.5rem 1.25rem;
  margin-bottom: 0;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.28);
}

.profile-logo-upload {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 0.35rem;
  padding: 0;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  background: transparent;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.22);
  transition: transform var(--transition), box-shadow var(--transition);
}

.profile-logo-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.3);
}

.profile-logo-upload:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.profile-logo-upload__visual {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
}

.profile-logo-upload__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-logo-upload__fallback {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.profile-logo-upload__camera {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.profile-logo-upload-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.profile-logo-upload-status {
  margin: 0 0 1rem;
  font-size: 0.78rem;
}

.profile-logo-upload-status:empty {
  display: none;
  margin: 0;
}

.profile-logo-upload.is-uploading {
  pointer-events: none;
  opacity: 0.85;
}

.profile-logo-upload.is-uploading .profile-logo-upload__visual::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(15, 23, 42, 0.35);
}

.profile-logo-upload.is-uploading .profile-logo-upload__visual {
  position: relative;
}

.profile-logo-upload.is-uploading .profile-logo-upload__camera {
  border-color: var(--accent);
  color: var(--accent);
  animation: btn-spin 0.65s linear infinite;
}

.profile-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  word-break: break-word;
}

.profile-email {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.profile-badge {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-hover);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .profile-badge {
  color: var(--accent);
}

.profile-meta-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--border);
  text-align: left;
}

.profile-meta-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  font-size: 0.82rem;
}

.profile-meta-list .meta-label {
  color: var(--text-muted);
  font-weight: 500;
}

.profile-meta-list .meta-value {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

.profile-section-head {
  margin-bottom: 1rem;
}

.profile-section-head .card-title {
  margin: 0 0 0.25rem;
}

.profile-section-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.profile-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.profile-field-grid > div {
  min-width: 0;
}

.profile-readonly {
  position: relative;
}

.profile-readonly .form-control:disabled {
  padding-right: 2.5rem;
  opacity: 1;
  background: var(--bg-muted);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.profile-lock {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}

.password-panel-head .card-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.password-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.85rem;
  line-height: 1.4;
}

.password-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.password-forgot-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent) !important;
  text-decoration: none;
}

.password-forgot-link:hover {
  text-decoration: underline;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap .form-control {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  z-index: 2;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--text, #0f172a);
  background: rgba(148, 163, 184, 0.15);
  outline: none;
}

.password-toggle .icon-eye,
.password-toggle .icon-eye-off {
  pointer-events: none;
}

/*
  State-first icons (clear before any click):
  - masked  → slashed eye (password is hidden)
  - visible → open eye (password is shown)
*/
.password-toggle .icon-eye {
  display: none;
}

.password-toggle .icon-eye-off {
  display: block;
}

.password-toggle.is-revealed .icon-eye {
  display: block;
  color: var(--accent, #0d9488);
}

.password-toggle.is-revealed .icon-eye-off {
  display: none;
}

.password-input-wrap .form-control.is-invalid {
  background-image: none;
}

.password-panel .invalid-feedback {
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

@media (max-width: 767.98px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-field-grid {
    grid-template-columns: 1fr;
  }

  .profile-card-footer {
    justify-content: stretch;
  }

  .profile-card-footer .btn {
    width: 100%;
  }
}

.admin-create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.85rem;
  align-items: end;
}

.admin-create-submit {
  min-width: 140px;
}

@media (max-width: 767.98px) {
  .admin-create-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Platform agencies --- */
.agency-detail-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  max-width: none;
  width: 100%;
}

.agency-summary {
  text-align: center;
  margin-bottom: 0;
  padding: 1.5rem 1.25rem;
}

.agency-summary-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.28);
}

.agency-summary-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.agency-summary-email {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.agency-summary-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.agency-detail-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.agency-detail-card {
  margin-bottom: 0;
}

.agency-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.agency-stat {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
}

.agency-stat .label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.agency-stat .value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.agency-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.agency-action-form {
  margin: 0;
}

.agency-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: none;
}

.agency-list-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.agency-list-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.agency-list-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.agency-list-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
  flex-shrink: 0;
}

.agency-list-info {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.35rem 1rem;
  min-width: 0;
}

.agency-list-identity {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
}

.agency-list-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.agency-list-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.agency-list-email {
  font-size: 0.82rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.agency-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  justify-content: flex-end;
}

.agency-list-muted {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .agency-detail-layout {
    grid-template-columns: 1fr;
  }

  .agency-stat-grid {
    grid-template-columns: 1fr;
  }

  .agency-list-card {
    grid-template-columns: 1fr;
  }

  .agency-list-info {
    grid-template-columns: 1fr;
  }

  .agency-list-meta {
    justify-content: flex-start;
  }

  .agency-list-email {
    white-space: normal;
  }

  .agency-actions .btn {
    width: 100%;
  }

  .agency-action-form {
    width: 100%;
  }
}

/* --- Forms --- */
.form-label {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-select {
  --form-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--input-bg);
  background-image: var(--form-select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px 14px;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 2.15rem 0.55rem 0.75rem;
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--input-bg);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: var(--focus-ring);
}

.form-select:focus {
  background-image: var(--form-select-chevron);
}

[data-theme="dark"] .form-select {
  --form-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
}

.form-control:disabled,
.form-control[readonly] {
  background: var(--bg-muted);
  color: var(--text-secondary);
  opacity: 1;
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.form-check-input:focus {
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}

.form-check-label {
  color: var(--text);
}

/* --- Buttons --- */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-primary:disabled,
.btn-primary.disabled,
.btn-primary.is-loading,
.btn-primary:disabled:hover,
.btn-primary.is-loading:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  opacity: 0.92;
}

[data-theme="dark"] .btn-primary {
  color: #042f2e;
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-primary:disabled,
[data-theme="dark"] .btn-primary.is-loading {
  color: #042f2e;
}

.btn-outline-primary {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border-strong);
  background: transparent;
}

.btn-outline-secondary:hover {
  background: var(--bg-muted);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-outline-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-muted);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text);
}

.btn-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.table {
  margin: 0;
  color: var(--text);
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--table-stripe);
  --bs-table-hover-bg: var(--accent-soft);
}

.table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}

.table td {
  padding: 0.8rem 1rem;
  vertical-align: middle;
  border-color: var(--border);
  font-size: 0.9rem;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: var(--table-stripe);
}

/* --- Alerts & badges --- */
.alert {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
}

.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

/* Soft collapse when auto-hiding — message stays readable in-card, then gently closes */
.alert-success.alert-dismissing {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  max-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0;
  overflow: hidden;
}

.alert-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: transparent;
}

.alert-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: transparent;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

.badge-soft.success { background: var(--success-soft); color: var(--success); }
.badge-soft.warning { background: var(--warning-soft); color: var(--warning); }
.badge-soft.danger { background: var(--danger-soft); color: var(--danger); }
.badge-soft.info { background: var(--info-soft); color: var(--info); }
.badge-soft.neutral { background: var(--bg-muted); color: var(--text-secondary); }

/* --- Filters --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

/* --- Empty / list --- */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-secondary);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.list-item .title {
  font-weight: 600;
  color: var(--text);
}

.list-item .meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.feature-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.65rem;
}

.feature-check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.feature-check:hover {
  border-color: var(--border-strong);
}

/* Already entitled — green / locked */
.feature-check.is-owned {
  cursor: default;
  border-color: transparent;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.28);
}

.feature-check.is-owned:hover {
  border-color: transparent;
}

.feature-check.is-owned .form-check-input {
  accent-color: #0d9488;
  pointer-events: none;
}

/* Newly selected for request — soft amber */
.feature-check.is-requestable.is-new-select,
.feature-check.is-requestable:has(.feature-request-cb:checked) {
  border-color: transparent;
  background: rgba(245, 158, 11, 0.14);
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.35);
}

.feature-check.is-requestable .form-check-input {
  accent-color: #d97706;
}

/* Optional active module unchecked — request removal */
.feature-check.is-owned-optional {
  cursor: pointer;
}

.feature-check.is-revoke-select {
  border-color: transparent;
  background: rgba(239, 68, 68, 0.1);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.28);
}

.feature-status-pill.is-revoke {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.18);
}

.feature-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.feature-check .form-check-input {
  margin-top: 0.2rem;
}

.feature-check-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.feature-check-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.feature-check-name {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.feature-check-key {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.feature-status-pill {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.feature-status-pill.is-owned {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.18);
}

.feature-status-pill.is-new {
  color: #b45309;
  background: rgba(245, 158, 11, 0.22);
}

.feature-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.feature-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.feature-legend-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.feature-legend-swatch.is-owned {
  border-color: transparent;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.28);
}

.feature-legend-swatch.is-new {
  border-color: transparent;
  background: rgba(245, 158, 11, 0.28);
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.35);
}

.feature-legend-swatch.is-revoke {
  border-color: transparent;
  background: rgba(239, 68, 68, 0.22);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.3);
}

[data-theme="dark"] .feature-check.is-owned {
  background: rgba(13, 148, 136, 0.18);
}

[data-theme="dark"] .feature-check.is-requestable.is-new-select,
[data-theme="dark"] .feature-check.is-requestable:has(.feature-request-cb:checked) {
  background: rgba(245, 158, 11, 0.16);
}

[data-theme="dark"] .feature-status-pill.is-owned {
  color: #5eead4;
  background: rgba(13, 148, 136, 0.28);
}

[data-theme="dark"] .feature-status-pill.is-new {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.28);
}

/* --- Team --- */
.team-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
  max-width: 960px;
}

.team-stat-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-sm);
}

.team-stat-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.team-stat-card .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.team-stat-soft {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.team-stat-card .meta {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.team-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.team-stat-icon.soft {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.team-stat-wide {
  display: block;
}

.team-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
  margin-top: 0.55rem;
}

.team-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: inherit;
}

.team-empty {
  text-align: center;
  max-width: 520px;
  padding: 2.5rem 1.75rem;
}

.team-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.team-empty h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.team-empty p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin: 0 0 1.15rem;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: none;
}

.team-member-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.team-member-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.team-member-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.team-member-info {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.35rem 1rem;
  min-width: 0;
}

.team-member-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
  min-width: 0;
}

.team-member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
  flex-shrink: 0;
}

.team-member-avatar.lg {
  width: 64px;
  height: 64px;
  font-size: 1.45rem;
  border-radius: 16px;
  margin: 0 auto;
}

.team-member-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.team-member-email {
  font-size: 0.82rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.team-member-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  justify-content: flex-end;
}

.team-member-joined {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.team-form-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  max-width: none;
  width: 100%;
}

.team-form-aside {
  padding: 1.35rem 1.25rem;
}

.team-edit-summary {
  text-align: center;
  position: sticky;
  top: calc(var(--topbar-height) + 1rem);
}

.team-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.team-form .profile-section,
.team-form .edit-form-footer {
  margin-bottom: 0;
}

.team-aside-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.team-form-aside h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.team-steps {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
}

.team-steps li + li {
  margin-top: 0.35rem;
}

.team-aside-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  line-height: 1.45;
}

.module-tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.module-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  margin: 0;
}

.module-tile:hover {
  border-color: var(--border-strong);
}

.module-tile:has(input:checked) {
  border-color: transparent;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.35);
}

[data-theme="dark"] .module-tile:has(input:checked) {
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.35);
}

.module-tile .form-check-input {
  margin-top: 0.35rem;
  flex-shrink: 0;
}

.module-tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--bg-muted);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.module-tile:has(input:checked) .module-tile-icon {
  background: rgba(255, 255, 255, 0.55);
  color: var(--accent-hover);
}

[data-theme="dark"] .module-tile:has(input:checked) .module-tile-icon {
  background: rgba(0, 0, 0, 0.2);
  color: var(--accent);
}

.module-tile-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.module-tile-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
}

.module-tile-key {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.team-active-check {
  padding: 0.75rem 0.9rem;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
}

@media (max-width: 767.98px) {
  .team-stats {
    grid-template-columns: 1fr;
  }

  .team-form-layout {
    grid-template-columns: 1fr;
  }

  .module-tile-grid {
    grid-template-columns: 1fr;
  }

  .team-member-card {
    grid-template-columns: 1fr;
  }

  .team-member-info {
    grid-template-columns: 1fr;
  }

  .team-member-meta {
    justify-content: flex-start;
  }

  .team-member-email {
    white-space: normal;
  }
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.detail-item .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.detail-item .value {
  font-weight: 500;
  color: var(--text);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

.danger-zone {
  border: 1px solid rgba(220, 38, 38, 0.28);
  background: var(--danger-soft);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.danger-zone h5 {
  color: var(--danger);
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.danger-zone p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
}

.danger-zone-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* --- Edit agency --- */
.edit-agency-layout {
  max-width: none;
}

.edit-kpi-grid {
  margin-bottom: 0;
}

.kpi-value-sm {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
  margin-top: 0.15rem;
  line-height: 1.35;
}

/* Word labels in KPI cards (not numeric stats) */
.kpi-value-sm:not(.status-value) {
  color: var(--text);
}

/* Status words inside KPIs should not use number-style compression */
.kpi-value.status-value,
.kpi-value-sm.status-value {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

.edit-agency-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.edit-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--table-stripe);
}

.edit-toggle-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
}

.edit-toggle-desc {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.edit-switch .form-check-input {
  width: 2.5rem;
  height: 1.3rem;
  margin-left: 0;
  cursor: pointer;
}

.edit-switch .form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.edit-switch .form-check-label {
  margin-left: 0.55rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 1.75rem;
}

.edit-form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0;
}

.status-text.success { color: var(--success); }
.status-text.warning { color: var(--warning); }
.status-text.danger { color: var(--danger); }
.status-text.info { color: var(--info); }
.status-text.neutral { color: var(--text-secondary); }

.status-value {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  letter-spacing: 0;
  font-size: 0.92rem;
}

.status-value.success { color: var(--success); }
.status-value.warning { color: var(--warning); }
.status-value.danger { color: var(--danger); }
.status-value.info { color: var(--info); }
.status-value.neutral { color: var(--text); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* --- Modals --- */
.modal-content {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.modal-header,
.modal-footer {
  border-color: var(--border);
}

.modal-title {
  font-weight: 700;
}

/* --- Home hero --- */
.home-hero {
  text-align: center;
  padding: 3.5rem 1rem 2rem;
}

.home-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.home-hero p {
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 1.5rem;
  font-size: 1.05rem;
}

.home-hero .cta-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* --- Registry / Agency Owners list --- */
.registry-header {
  margin-bottom: 1.35rem;
}

.registry-breadcrumb {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.registry-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.registry-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.kpi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.kpi-icon {
  color: var(--text-muted);
  display: inline-flex;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-status-wrap {
  min-height: 2rem;
  display: flex;
  align-items: center;
  margin: 0.15rem 0 0.15rem;
}

.kpi-status-wrap .badge-soft {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.28rem 0.7rem;
}

.kpi-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-muted);
  margin: 0.75rem 0 0.55rem;
  overflow: hidden;
}

.kpi-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
}

.kpi-bar-info > span {
  background: linear-gradient(90deg, var(--info), #38bdf8);
}

.kpi-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.registry-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1rem;
  padding: 0.95rem 1.1rem;
  margin-bottom: 1rem;
}

.registry-search {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}

.registry-search svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.registry-search .form-control {
  padding-left: 2.35rem;
}

.registry-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.registry-filter-chips {
  flex: 1 1 100%;
  margin: 0;
}

.feature-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.request-reject-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.request-reject-form .form-control {
  min-width: 220px;
  width: auto;
  flex: 1 1 220px;
}

.registry-toolbar .filter-bar {
  margin-bottom: 0;
}

.registry-filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  min-width: 140px;
}

.registry-filter > span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.registry-filter .form-select {
  min-width: 150px;
}

.registry-table-wrap {
  padding: 0;
  overflow: hidden;
  position: relative;
}

.registry-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.registry-table thead th {
  padding: 0.85rem 1.1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--table-stripe);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.registry-table tbody td {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  font-size: 0.9rem;
}

.registry-table tbody tr:last-child td {
  border-bottom: none;
}

.registry-table tbody tr:hover td {
  background: var(--table-stripe);
}

.registry-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.registry-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
}

.registry-user-name {
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.registry-user-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.registry-email {
  color: var(--text);
  font-weight: 500;
}

.registry-email:hover {
  color: var(--accent);
}

.registry-muted {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.company-chip {
  display: inline-flex;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
}

.registry-joined {
  font-weight: 500;
  color: var(--text);
}

.registry-status-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.registry-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.registry-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.registry-switch-ui {
  width: 2.45rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}

.registry-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: #94a3b8;
  transition: transform var(--transition), background var(--transition);
}

.registry-switch input:checked + .registry-switch-ui {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.registry-switch input:checked + .registry-switch-ui::after {
  transform: translateX(1.05rem);
  background: var(--accent);
}

.registry-switch input:focus-visible + .registry-switch-ui {
  box-shadow: var(--focus-ring);
}

.registry-switch input:disabled + .registry-switch-ui {
  opacity: 0.6;
  cursor: wait;
}

.registry-status-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.registry-status-label.is-active {
  color: var(--success);
}

.registry-status-label.is-inactive {
  color: var(--danger);
}

.registry-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.registry-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.registry-action-btn:hover {
  color: var(--accent);
  border-color: transparent;
  background: var(--accent-soft);
}

.registry-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--table-stripe);
}

.registry-footer-left {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.registry-footer-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.registry-page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.registry-page-size .form-select {
  width: auto;
  min-width: 4.5rem;
}

.registry-pager {
  display: inline-flex;
  gap: 0.3rem;
}

.registry-page-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.registry-page-btn:hover,
.registry-page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.registry-filter-empty {
  position: absolute;
  inset: 3.5rem 0 0;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  text-align: center;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 2rem 1rem;
}

.registry-filter-empty[hidden] {
  display: none !important;
}

.registry-modal .modal-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
}

.registry-modal .modal-title {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

.registry-modal-desc {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.registry-modal .modal-content {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.registry-modal .modal-footer {
  border-top: 1px solid var(--border);
}

.page-actions .btn svg {
  margin-right: 0.35rem;
  vertical-align: -2px;
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .registry-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .registry-filters {
    width: 100%;
  }

  .registry-filter {
    flex: 1 1 140px;
  }
}

/* --- Suspended --- */
.suspended-panel {
  max-width: 480px;
  margin: 3rem auto;
  text-align: center;
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .app-content {
    padding: 1.15rem 1rem 2rem;
  }
}

@media (max-width: 575.98px) {
  .user-menu-label {
    display: none;
  }

  .user-menu-trigger {
    padding-right: 0.35rem;
  }

  .auth-card {
    padding: 1.5rem 1.15rem;
  }

  .otp-digit {
    width: 2.35rem;
    height: 2.75rem;
    font-size: 1.1rem;
  }

  .otp-inputs {
    gap: 0.35rem;
  }
}
