:root {
  --brand-black: #0a0a0a;
  --brand-black-soft: #171717;
  --brand-orange: #f97316;
  --brand-orange-dark: #ea580c;
  --brand-orange-light: #fff7ed;
  --brand-orange-muted: #ffedd5;
  /* Light content shell (dashboard + login form) */
  --content-bg: #f4f4f5;
  --content-surface: #ffffff;
  --content-muted: #f9fafb;
  --bg: var(--content-bg);
  --surface: var(--content-surface);
  --border: #e4e4e7;
  --text: #0a0a0a;
  --muted: #71717a;
  --primary: var(--brand-orange);
  --primary-hover: var(--brand-orange-dark);
  --primary-soft: var(--brand-orange-light);
  /* Nav shell (sidebar + login brand) — light theme */
  --sidebar-text: #52525b;
  --sidebar-text-strong: #0a0a0a;
  --sidebar-border: #e4e4e7;
  --sidebar-control-bg: #f4f4f5;
  --sidebar-control-border: #e4e4e7;
  --sidebar-hover-bg: #f4f4f5;
  --sidebar-hover-text: #0a0a0a;
  --sidebar-active-bg: var(--brand-orange-light);
  --sidebar-active-text: var(--brand-orange-dark);
  --sidebar-muted-text: #71717a;
  --role-pill-bg: var(--brand-orange-muted);
  --role-pill-text: var(--brand-orange-dark);
  --danger: #dc2626;
  --yes: var(--brand-orange-dark);
  --failed: #dc2626;
  --focus-ring: rgba(249, 115, 22, 0.28);
  --gradient-brand: linear-gradient(135deg, #fb923c 0%, #f97316 42%, #ea580c 100%);
  --gradient-brand-hover: linear-gradient(135deg, #fdba74 0%, #f97316 40%, #c2410c 100%);
  --gradient-nav: linear-gradient(180deg, #ffffff 0%, #f8f8f8 55%, #f4f4f5 100%);
  --gradient-login-brand: linear-gradient(165deg, #ffffff 0%, #f8f8f8 50%, #f0f0f1 100%);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --table-font-size: 0.8125rem;
  --table-header-size: 0.6875rem;
  --sidebar-width: 260px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --input-bg: var(--content-surface);
  --alert-bg: #fef3f2;
  --alert-border: #fecdca;
  --badge-yes-bg: #ffedd5;
  --badge-pending-bg: #f4f4f5;
  --badge-failed-bg: #fde8e6;
  --loading-overlay-bg: rgba(244, 244, 245, 0.1);
  --loading-panel-bg: #ffffff;
  --loading-panel-border: #e4e4e7;
  --scroll-fade: rgba(255, 255, 255, 0.85);
}

/* Dark theme: dark nav + dark inner content */
[data-theme="dark"] {
  --sidebar-text: #d4d4d8;
  --sidebar-text-strong: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-control-bg: rgba(255, 255, 255, 0.06);
  --sidebar-control-border: rgba(255, 255, 255, 0.15);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --sidebar-hover-text: #ffffff;
  --sidebar-active-bg: rgba(249, 115, 22, 0.22);
  --sidebar-active-text: #ffffff;
  --sidebar-muted-text: #a1a1aa;
  --role-pill-bg: rgba(249, 115, 22, 0.35);
  --role-pill-text: #ffedd5;
  --gradient-nav: linear-gradient(180deg, #0a0a0a 0%, #141414 50%, #1a1a1a 100%);
  --gradient-login-brand: linear-gradient(165deg, #0a0a0a 0%, #171717 50%, #1f1f1f 100%);
  --content-bg: #0c0c0c;
  --content-surface: #161616;
  --content-muted: #1f1f1f;
  --border: #2e2e2e;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --primary-soft: rgba(249, 115, 22, 0.18);
  --input-bg: #1f1f1f;
  --alert-bg: rgba(220, 38, 38, 0.15);
  --alert-border: rgba(220, 38, 38, 0.35);
  --badge-yes-bg: rgba(249, 115, 22, 0.22);
  --badge-pending-bg: #262626;
  --badge-failed-bg: rgba(220, 38, 38, 0.2);
  --loading-overlay-bg: rgba(12, 12, 12, 0.1);
  --loading-panel-bg: #161616;
  --loading-panel-border: #2e2e2e;
  --scroll-fade: rgba(22, 22, 22, 0.9);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
  --focus-ring: rgba(249, 115, 22, 0.35);
}

[data-theme="dark"] .login-page__bg {
  background:
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(249, 115, 22, 0.1), transparent 55%),
    var(--content-bg);
}

[data-theme="dark"] .login-shell {
  border-color: var(--border);
}

[data-theme="dark"] .login-card {
  background: var(--content-surface);
}

[data-theme="dark"] .field__control input {
  background: var(--input-bg);
  color: var(--text);
}

[data-theme="dark"] .login-success {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.35);
  color: #fdba74;
}

[data-theme="dark"] .theme-toggle--corner,
[data-theme="dark"] .theme-toggle--screen-corner,
[data-theme="dark"] .main__mobile-bar .theme-toggle {
  background: var(--content-muted);
  border-color: var(--border);
  color: var(--text);
}


[data-theme="dark"] .toast {
  background: #262626;
  border: 1px solid var(--border);
}

[data-theme="light"] .login-brand,
[data-theme="light"] .login-brand__text,
[data-theme="light"] .login-brand__features li {
  color: var(--sidebar-muted-text);
}

[data-theme="light"] .login-brand__title {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  color: var(--sidebar-text-strong);
}

[data-theme="light"] .login-brand__footer {
  color: var(--muted);
}

[data-theme="light"] .login-brand__badge {
  background: var(--primary-soft);
  border-color: #fdba74;
  color: var(--brand-orange-dark);
}

[data-theme="light"] .login-brand::after {
  opacity: 0.25;
}

[data-theme="dark"] .login-brand__title {
  background: linear-gradient(90deg, #fff 0%, #ffedd5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="dark"] .login-brand__text,
[data-theme="dark"] .login-brand__features li {
  color: rgba(255, 255, 255, 0.88);
}

[data-theme="dark"] .login-brand__footer {
  color: rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] .login-brand__badge {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.35), rgba(255, 255, 255, 0.12));
  border-color: rgba(249, 115, 22, 0.5);
  color: #fff;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--content-bg);
  color: var(--text);
  line-height: 1.45;
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.body--sidebar-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  margin: 0 0 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input:invalid {
  box-shadow: none;
}

input:invalid:focus {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

select {
  appearance: none;
  -webkit-appearance: none;
  color-scheme: inherit;
  width: 100%;
  padding: 0.65rem 2.5rem 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  background-color: var(--input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

select:hover:not(:disabled) {
  border-color: #fdba74;
  background-color: var(--content-muted);
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

select option,
select optgroup {
  background-color: var(--content-surface);
  color: var(--text);
}

[data-theme="dark"] select {
  color-scheme: dark;
  color: var(--text);
  background-color: var(--input-bg);
  border-color: var(--border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

[data-theme="dark"] select:hover:not(:disabled) {
  border-color: rgba(249, 115, 22, 0.55);
  background-color: var(--content-muted);
}

[data-theme="dark"] select option,
[data-theme="dark"] select optgroup {
  background-color: var(--content-surface);
  color: var(--text);
}

.select-wrap {
  position: relative;
  display: block;
  margin-top: 0.35rem;
}

.select-wrap select {
  margin-top: 0;
}

#search {
  min-width: 0;
  max-width: none;
  width: 100%;
}

/* ——— Login page ——— */
.login-page {
  position: relative;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.65rem, var(--safe-top)) max(0.75rem, var(--safe-right)) max(0.65rem, var(--safe-bottom))
    max(0.75rem, var(--safe-left));
  overflow: hidden;
}

.login-page__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(249, 115, 22, 0.06), transparent 55%),
    var(--content-bg);
  z-index: 0;
}

.login-page__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23f97316' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  max-width: 920px;
  width: 100%;
  max-height: calc(100dvh - 1.25rem);
  background: var(--content-surface);
  border-radius: 16px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 24px 48px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.login-shell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-brand);
  z-index: 2;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 1.35rem 1.5rem;
  background: var(--gradient-login-brand);
  color: var(--sidebar-text);
  overflow: hidden;
}

.login-brand::after {
  content: "";
  position: absolute;
  bottom: -40%;
  right: -30%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.35) 0%, transparent 70%);
  pointer-events: none;
}

.login-brand__badge {
  position: relative;
  z-index: 1;
  display: inline-block;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  background: var(--primary-soft);
  border: 1px solid #fdba74;
  color: var(--brand-orange-dark);
  border-radius: 6px;
  margin-bottom: 0.65rem;
}

.login-brand__title {
  position: relative;
  z-index: 1;
  margin: 0 0 0.45rem;
  font-size: clamp(1.35rem, 2.8vh, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--sidebar-text-strong);
}

.login-brand__text {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--sidebar-muted-text);
  max-width: 320px;
}

.login-brand__features {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 0 1 auto;
  min-height: 0;
}

.login-brand__features,
.login-brand__text,
.login-brand__footer {
  position: relative;
  z-index: 1;
}

.login-brand__features li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.32rem;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--sidebar-muted-text);
}

.login-brand__features li:last-child {
  margin-bottom: 0;
}

.login-brand__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.35);
}

.login-brand__footer {
  margin: 0.65rem 0 0;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.login-card {
  position: relative;
  min-height: 0;
  padding: 1.5rem 1.65rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--content-surface);
  overflow-y: auto;
}

.login-card__header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-card__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 14px;
  border: 1px solid var(--brand-orange-muted);
}

.login-card__header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
}

.login-card__header p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.login-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1.25rem;
  background: var(--alert-bg);
  border: 1px solid var(--alert-border);
  border-radius: 10px;
  color: var(--danger);
  font-size: 0.88rem;
  line-height: 1.4;
}

.login-alert svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.login-alert--blocked {
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.28);
  color: #991b1b;
}

.login-alert--blocked svg {
  color: #dc2626;
}

.login-form .field {
  margin-bottom: 1.15rem;
}

.login-form .field label {
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--text);
}

.field__control {
  position: relative;
  display: flex;
  align-items: center;
}

.field__icon {
  position: absolute;
  left: 0.85rem;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.field__control input {
  width: 100%;
  padding: 0.72rem 2.75rem 0.72rem 2.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.25;
  min-height: 46px;
  box-sizing: border-box;
}

.field__control input:focus {
  border-color: var(--primary);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.field__control input::placeholder {
  color: #a1a1aa;
}

/* Prevent browser default heavy outline on empty email fields */
.login-form input[type="email"]:not(:focus):invalid {
  border-color: var(--border);
  box-shadow: none;
}

.field__control--plain input {
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.field__toggle {
  position: absolute;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.field__toggle:hover {
  color: var(--primary);
  background: rgba(249, 115, 22, 0.1);
}

.field__toggle .hidden {
  display: none;
}

.btn-login {
  margin-top: 0.5rem;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4);
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-login:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.45);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
}

.btn-login:disabled {
  transform: none;
  box-shadow: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes loadingFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes loadingPanelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loadingProgress {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(40%); }
  100% { transform: translateX(120%); }
}

@keyframes loadingPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1); opacity: 1; }
}

/* Shared ring spinner */
.loading-ring {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.loading-ring--sm {
  width: 18px;
  height: 18px;
}

.loading-ring__track,
.loading-ring__arc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-sizing: border-box;
}

.loading-ring__track {
  border: 3px solid rgba(249, 115, 22, 0.15);
}

.loading-ring--sm .loading-ring__track {
  border-width: 2px;
  border-color: rgba(255, 255, 255, 0.28);
}

.loading-ring__arc {
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-right-color: rgba(249, 115, 22, 0.45);
  animation: spin 0.85s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.loading-ring--sm .loading-ring__arc {
  border-width: 2px;
  border-top-color: #fff;
  border-right-color: rgba(255, 255, 255, 0.45);
  animation-duration: 0.7s;
}

.btn-login__spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Global loading modal */
.app-loading {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.25rem, var(--safe-top)) max(1.25rem, var(--safe-right))
    max(1.25rem, var(--safe-bottom)) max(1.25rem, var(--safe-left));
  pointer-events: none;
}

.app-loading:not(.hidden) {
  pointer-events: auto;
}

.app-loading__backdrop {
  position: absolute;
  inset: 0;
  background: var(--loading-overlay-bg);
  animation: loadingFadeIn 0.22s ease;
}

.app-loading__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 300px);
  padding: 1.75rem 1.65rem 1.5rem;
  text-align: center;
  background: var(--loading-panel-bg);
  border: 1px solid var(--loading-panel-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: loadingPanelIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.app-loading__panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 18px 18px 0 0;
  background: var(--gradient-brand);
  opacity: 0.9;
}

.app-loading__visual {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 0 auto 1.15rem;
}

.app-loading__rings {
  position: absolute;
  inset: 0;
}

.app-loading__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-left-color: rgba(249, 115, 22, 0.35);
  animation: spin 1.1s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.app-loading__ring--inner {
  inset: 10px;
  border-top-color: var(--brand-orange-dark);
  border-left-color: rgba(249, 115, 22, 0.25);
  animation-duration: 0.75s;
  animation-direction: reverse;
}

.app-loading__core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
  animation: loadingPulse 1.4s ease-in-out infinite;
}

.app-loading__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.app-loading__message {
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.app-loading__progress {
  height: 3px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.2);
  overflow: hidden;
}

.app-loading__progress-bar {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--primary), var(--brand-orange-dark), transparent);
  animation: loadingProgress 1.4s ease-in-out infinite;
}

body.body--loading {
  overflow: hidden;
}

body.body--loading #dashboard-view,
body.body--loading .crm-modal,
body.body--loading .crm-drawer {
  pointer-events: none;
  user-select: none;
}

.app-loading--instant .app-loading__backdrop,
.app-loading--instant .app-loading__panel {
  animation: none;
}

button.btn--pending,
input.btn--pending {
  cursor: wait;
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .app-loading__backdrop,
  .app-loading__panel,
  .app-loading__ring,
  .app-loading__core,
  .app-loading__progress-bar,
  .loading-ring__arc {
    animation: none;
  }

  .app-loading__ring--inner {
    animation: none;
  }
}

.login-shell--narrow {
  grid-template-columns: 1fr;
  max-width: 440px;
}

.login-card--solo {
  grid-column: 1 / -1;
}

.login-forgot {
  text-align: center;
  margin: 1rem 0 0;
  font-size: 0.9rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--primary-hover);
}

.login-success {
  padding: 0.75rem 0.9rem;
  margin-bottom: 1.25rem;
  background: var(--brand-orange-light);
  border: 1px solid var(--brand-orange-muted);
  border-radius: 10px;
  color: var(--yes);
  font-size: 0.88rem;
}

/* ——— App layout (dashboard) ——— */
.app-layout {
  display: flex;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--content-bg);
}

.app-layout.hidden {
  display: none !important;
}

.sidebar {
  position: relative;
  width: 260px;
  flex-shrink: 0;
  height: 100%;
  max-height: 100dvh;
  background: var(--gradient-nav);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.6rem;
  transition: width 0.22s ease, background 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--brand-orange), transparent);
  opacity: 0.85;
  pointer-events: none;
}

.sidebar--collapsed {
  width: 72px;
  padding: 0.65rem 0.45rem;
}

.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0 0.25rem 0.55rem;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar--collapsed .sidebar__top {
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.sidebar--collapsed .sidebar__brand {
  flex: none;
  justify-content: center;
}

.sidebar__brand-text {
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.22s ease;
}

.sidebar--collapsed .sidebar__brand-text {
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar__toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--sidebar-control-border);
  border-radius: 8px;
  background: var(--sidebar-control-bg);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar__toggle:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
  border-color: var(--brand-orange);
}

.sidebar__toggle .hidden {
  display: none;
}

.app-screen-logo {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  z-index: 120;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.app-screen-logo .company-logo {
  height: 2.5rem;
  width: auto;
  max-width: min(11rem, 42vw);
  object-fit: contain;
  object-position: left center;
}

.sidebar__logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  text-decoration: none;
}

.sidebar__logo-img {
  height: 2.15rem;
  width: auto;
  max-width: 8.5rem;
  object-fit: contain;
  object-position: left center;
}

.sidebar--collapsed .sidebar__logo-img {
  height: 2rem;
  max-width: 2rem;
  object-fit: cover;
  object-position: left center;
  border-radius: 8px;
}

.main__mobile-logo-link {
  display: none;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  text-decoration: none;
}

.main__mobile-logo {
  height: 1.85rem;
  width: auto;
  max-width: 6.5rem;
  object-fit: contain;
  object-position: left center;
}

.sidebar__brand-text strong {
  display: block;
  color: var(--sidebar-text-strong);
  font-size: 0.88rem;
  white-space: nowrap;
}

.sidebar__brand-text span {
  font-size: 0.68rem;
  color: var(--sidebar-muted-text);
  white-space: nowrap;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar__link-text {
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.22s ease;
}

.sidebar--collapsed .sidebar__link-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar--collapsed .sidebar__link {
  justify-content: center;
  padding: 0.65rem;
}

.sidebar__section {
  padding: 0.85rem 0.95rem 0.35rem;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sidebar--collapsed .sidebar__section {
  display: none;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--sidebar-text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar__link:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
}

.sidebar__link--active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-orange);
}

.sidebar__link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  background: var(--sidebar-control-bg);
  color: var(--sidebar-text);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar__link:hover .sidebar__link-icon {
  background: color-mix(in srgb, var(--brand-orange) 12%, var(--sidebar-control-bg));
  color: var(--sidebar-hover-text);
}

.sidebar__link--active .sidebar__link-icon {
  background: color-mix(in srgb, var(--brand-orange) 18%, var(--sidebar-control-bg));
  color: var(--brand-orange-dark);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-orange) 22%, transparent);
}

[data-theme="dark"] .sidebar__link--active .sidebar__link-icon {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.2);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.28);
}

.sidebar__link-icon svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.sidebar__footer {
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.2rem 0.4rem;
}

.sidebar--collapsed .sidebar__user {
  justify-content: center;
  padding: 0.5rem 0;
}

.sidebar__user-info {
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.22s ease;
}

.sidebar--collapsed .sidebar__user-info {
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sidebar__user-btn {
  width: 100%;
  margin: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.sidebar__user-btn:hover,
.sidebar__user-btn:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.sidebar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.35);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar__user-info strong {
  display: block;
  color: var(--sidebar-text-strong);
  font-size: 0.75rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-pill {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--role-pill-bg);
  color: var(--role-pill-text);
  border-radius: 4px;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.25rem;
  width: 100%;
  padding: 0.38rem 0.65rem;
  border: 1px solid var(--sidebar-control-border);
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar--collapsed .sidebar__logout {
  justify-content: center;
  padding: 0.55rem;
}

.sidebar__logout:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
  border-color: var(--brand-orange);
}

.sidebar__logout svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
}

.main__mobile-bar {
  display: none;
}

.main__mobile-title {
  color: var(--text);
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: var(--content-bg);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 1.75rem 2rem;
  padding-top: max(1.5rem, var(--safe-top));
  padding-right: max(1.75rem, var(--safe-right));
  padding-bottom: max(2rem, var(--safe-bottom));
  padding-left: max(1.75rem, var(--safe-left));
  overflow-x: hidden;
}

.main__header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.main__header h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.main__header h1::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-top: 0.35rem;
  border-radius: 2px;
  background: var(--gradient-brand);
}

.main__header-intro {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.main__header-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1.25rem;
}

.tasks-section-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.tasks-section-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--content-surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tasks-section-tab:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.tasks-section-tab--active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, var(--content-surface));
}

.tasks-section-pane.hidden {
  display: none;
}

.task-categories-table .task-category-color {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.45rem;
  vertical-align: middle;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.main__subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.main__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 100%;
}

.main__toolbar.hidden {
  display: none !important;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 12rem;
  background: var(--content-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 0.85rem;
  min-width: 0;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.search-box svg {
  color: var(--muted);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: transparent;
  padding: 0.6rem 0;
  box-shadow: none !important;
  min-width: 0;
}

.search-box input:focus {
  outline: none;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  overflow: hidden;
  background: var(--content-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--stat-accent, var(--border));
  opacity: 0.85;
}

.stat-card:hover {
  border-color: color-mix(in srgb, var(--stat-accent, var(--border)) 35%, var(--border));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.stat-card--leads {
  --stat-accent: var(--brand-orange);
  --stat-icon-bg: var(--brand-orange-light);
  --stat-icon-color: var(--brand-orange-dark);
}

.stat-card--page {
  --stat-accent: #3b82f6;
  --stat-icon-bg: #eff6ff;
  --stat-icon-color: #1d4ed8;
}

.stat-card--access {
  --stat-accent: var(--brand-orange);
  --stat-icon-bg: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  --stat-icon-color: var(--brand-orange-dark);
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(249, 115, 22, 0.08), transparent 55%),
    var(--content-surface);
  border-color: color-mix(in srgb, var(--brand-orange) 28%, var(--border));
}

[data-theme="dark"] .stat-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .stat-card:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .stat-card--leads {
  --stat-icon-bg: rgba(249, 115, 22, 0.18);
  --stat-icon-color: #fdba74;
}

[data-theme="dark"] .stat-card--page {
  --stat-accent: #60a5fa;
  --stat-icon-bg: rgba(59, 130, 246, 0.18);
  --stat-icon-color: #93c5fd;
}

[data-theme="dark"] .stat-card--access {
  --stat-icon-bg: linear-gradient(135deg, rgba(249, 115, 22, 0.22) 0%, rgba(234, 88, 12, 0.12) 100%);
  --stat-icon-color: #fdba74;
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(249, 115, 22, 0.14), transparent 55%),
    var(--content-surface);
  border-color: rgba(249, 115, 22, 0.35);
}

.stat-card__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--stat-icon-bg);
  color: var(--stat-icon-color);
}

.stat-card--access .stat-card__icon {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.stat-card__body {
  min-width: 0;
  flex: 1;
}

.stat-card__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.stat-card__value {
  display: block;
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-card__value--role {
  display: inline-flex;
  align-items: center;
  margin-top: 0.1rem;
  padding: 0.2rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: capitalize;
  color: var(--role-pill-text);
  background: var(--role-pill-bg);
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand-orange) 25%, transparent);
}

.card {
  background: var(--content-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--content-surface);
}

.card__head--compact {
  padding-bottom: 0.5rem;
  border-bottom: none;
}

.card__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.card__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.card__head-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.leads-columns-picker {
  position: relative;
  flex-shrink: 0;
}

.leads-columns-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 30;
  width: min(16.5rem, calc(100vw - 2rem));
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--content-surface);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.leads-columns-menu__title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.leads-columns-menu__list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 16rem;
  overflow: auto;
}

.leads-columns-menu__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.35rem;
  border-radius: 0.45rem;
  font-size: 0.84rem;
  cursor: pointer;
}

.leads-columns-menu__item:hover {
  background: var(--content-muted);
}

.leads-columns-menu__item input {
  margin: 0;
}

.leads-columns-menu__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.leads-col--hidden {
  display: none !important;
}

.card__hint {
  margin: 0 1.25rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.table-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-height: min(calc(100dvh - 320px), 70vh);
}

.table-scroll--leads {
  position: relative;
}

.table-scroll--leads::after {
  content: "";
  position: sticky;
  right: 0;
  bottom: 0;
  float: right;
  width: 2rem;
  height: 100%;
  margin-right: -2rem;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--scroll-fade));
  opacity: 0;
}

.table-scroll--short {
  max-height: min(280px, 50vh);
}

.data-table--stack {
  min-width: 640px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--table-font-size);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--content-muted);
  font-size: var(--table-header-size);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  line-height: 1.3;
}

.data-table thead th:first-child {
  padding-left: 1rem;
}

.data-table thead th:last-child {
  padding-right: 1rem;
}

.data-table thead th.th-sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 1.35rem;
}

.data-table thead th.th-sortable::after {
  content: "↕";
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.7em;
  opacity: 0.35;
  vertical-align: middle;
}

.data-table thead th.th-sortable:hover {
  color: var(--text);
}

.data-table thead th.th-sortable--active {
  color: var(--text);
}

.data-table thead th.th-sortable--active::after {
  opacity: 0.9;
}

.data-table thead th.th-sortable--active[aria-sort="ascending"]::after {
  content: "↑";
}

.data-table thead th.th-sortable--active[aria-sort="descending"]::after {
  content: "↓";
}

.data-table tbody td.col-datetime {
  font-size: 0.85em;
  color: var(--muted);
  white-space: nowrap;
  max-width: 11rem;
}

.data-table tbody td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.4;
  color: var(--text);
  max-width: 220px;
}

.data-table tbody td:first-child {
  padding-left: 1rem;
  font-weight: 500;
  color: var(--text);
}

.data-table tbody td:last-child {
  padding-right: 1rem;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: var(--primary-soft);
}

.data-table tbody tr:nth-child(even) td {
  background: var(--content-muted);
}

.data-table tbody tr:nth-child(even):hover td {
  background: var(--primary-soft);
}

.data-table .col-email {
  color: var(--text);
  font-size: 0.78rem;
}

.data-table .col-phone {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.data-table .col-company {
  font-weight: 500;
}

.data-table .col-owner {
  font-size: 0.78rem;
  min-width: 110px;
}

.lead-owner-select {
  width: 100%;
  min-width: 0;
  max-width: 140px;
  padding: 0.28rem 1.5rem 0.28rem 0.45rem;
  font-size: 0.72rem;
}

.state-cell {
  text-align: center;
  padding: 2.5rem 1rem !important;
  color: var(--muted);
}

.empty-state {
  padding: 1rem;
  color: var(--muted);
}

.empty-state--error {
  color: var(--danger);
}

.state-cell--placeholder {
  font-size: 0.88rem;
  color: var(--muted);
}

.cell-desc {
  max-width: 180px;
  word-break: break-word;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.data-table .col-products {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 160px;
}

.cell-muted {
  color: #a1a1aa;
}

.dashboard-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dashboard-panel.hidden {
  display: none !important;
}

.panel-intro {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

.analytics-section {
  margin-bottom: 1.75rem;
}

.analytics-section:last-child {
  margin-bottom: 0;
}

.analytics-section__head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.analytics-section__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.analytics-section__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.analytics-export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.filter-bar {
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background:
    linear-gradient(180deg, rgba(249, 115, 22, 0.04) 0%, transparent 42%),
    var(--content-surface);
  box-shadow: var(--shadow);
}

.filter-bar__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.filter-preset {
  padding: 0.38rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--content-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.filter-preset:hover {
  border-color: rgba(249, 115, 22, 0.35);
  color: var(--text);
}

.filter-preset--active {
  border-color: rgba(249, 115, 22, 0.45);
  background: var(--primary-soft);
  color: var(--primary-hover);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.12);
}

.filter-bar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.filter-bar__fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.75rem;
  flex: 1 1 18rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 10.5rem;
}

.filter-field--wide {
  min-width: 12.5rem;
  flex: 1 1 14rem;
}

.filter-field__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-field__control {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.filter-field__control:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.filter-field__icon {
  flex-shrink: 0;
  color: var(--muted);
}

.filter-field__control--date {
  min-width: 15rem;
}

.filter-field__control--date .flatpickr-wrapper {
  flex: 1;
  min-width: 0;
}

.filter-field__control--date input,
.filter-field__control--date .flatpickr-input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
}

.filter-field__control--date input::placeholder,
.filter-field__control--date .flatpickr-input::placeholder {
  color: var(--muted);
}

.filter-field__control--date input:focus,
.filter-field__control--date .flatpickr-input:focus {
  outline: none;
  box-shadow: none;
}

.filter-field__control--select {
  position: relative;
  padding-right: 2rem;
}

.filter-field__control--select::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.filter-field__control--select select {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  appearance: none;
  cursor: pointer;
}

.filter-field__control--select select:focus {
  outline: none;
}

.filter-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-bar__clear {
  padding: 0.62rem 0.95rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.filter-bar__clear:hover {
  color: var(--text);
  background: var(--content-muted);
}

.filter-bar__apply {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1rem;
  font-size: 0.84rem;
  white-space: nowrap;
}

.flatpickr-calendar {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--content-surface);
  box-shadow: var(--shadow);
  font-family: var(--font);
}

.flatpickr-months {
  padding: 0.35rem 0.25rem 0;
}

.flatpickr-current-month {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.flatpickr-weekdays {
  margin-top: 0.25rem;
}

span.flatpickr-weekday {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
}

.flatpickr-day {
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
  background: var(--primary-soft);
  border-color: transparent;
}

.flatpickr-day.today {
  border-color: rgba(249, 115, 22, 0.45);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.flatpickr-day.inRange {
  background: var(--primary-soft);
  border-color: transparent;
  box-shadow: none;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  border-radius: 8px;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
  fill: var(--primary);
}

[data-theme="dark"] .filter-bar {
  background:
    linear-gradient(180deg, rgba(249, 115, 22, 0.08) 0%, transparent 42%),
    var(--content-surface);
}

[data-theme="dark"] .filter-preset {
  background: var(--content-muted);
}

[data-theme="dark"] .flatpickr-calendar {
  background: var(--content-surface);
}

[data-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months,
[data-theme="dark"] .flatpickr-current-month input.cur-year {
  background: transparent;
  color: var(--text);
}

.stats-row--4 {
  grid-template-columns: repeat(4, 1fr);
}

.stats-row--2 {
  grid-template-columns: repeat(2, 1fr);
}

.stat-card--lost {
  --stat-accent: #ef4444;
  --stat-icon-bg: #fee2e2;
  --stat-icon-color: #b91c1c;
}

[data-theme="dark"] .stat-card--lost {
  --stat-icon-bg: rgba(239, 68, 68, 0.18);
  --stat-icon-color: #fca5a5;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.card__head--compact h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.analytics-card {
  margin-bottom: 0;
}

.analytics-chart-wrap {
  position: relative;
  height: 280px;
  padding: 0.75rem 1rem 1.25rem;
}

.analytics-chart-wrap--bar {
  height: 320px;
}

.analytics-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.analytics-chart-wrap canvas.hidden {
  display: none;
}

.analytics-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.analytics-empty.hidden {
  display: none;
}

.analytics-share {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 8rem;
}

.analytics-share__bar {
  flex: 1;
  height: 6px;
  max-width: 7rem;
  border-radius: 999px;
  background: var(--gradient-brand);
  min-width: 0;
}

.analytics-share__bar--status.analytics-share__bar--new {
  background: #a1a1aa;
}

.analytics-share__bar--status.analytics-share__bar--contacted {
  background: #3b82f6;
}

.analytics-share__bar--status.analytics-share__bar--engaged {
  background: #8b5cf6;
}

.analytics-share__bar--status.analytics-share__bar--qualified {
  background: var(--gradient-brand);
}

.analytics-share__bar--status.analytics-share__bar--nurturing {
  background: #f59e0b;
}

.analytics-share__bar--status.analytics-share__bar--closed_won {
  background: #22c55e;
}

.analytics-share__bar--status.analytics-share__bar--closed_lost {
  background: #ef4444;
}

.analytics-share span {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.analytics-hint {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.stat-card__value--role#analytics-top {
  font-size: 0.75rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1024px) {
  .stats-row--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .analytics-chart-wrap--bar {
    height: 280px;
  }
}

@media (max-width: 640px) {
  .stats-row--4,
  .stats-row--2 {
    grid-template-columns: 1fr;
  }

  .analytics-section__top {
    flex-direction: column;
    align-items: stretch;
  }

  .analytics-export {
    width: 100%;
  }

  .filter-bar__row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar__fields,
  .filter-bar__actions {
    width: 100%;
  }

  .filter-field,
  .filter-field--wide,
  .filter-field__control--date {
    width: 100%;
    min-width: 0;
  }

  .filter-bar__apply,
  .filter-bar__clear {
    flex: 1 1 auto;
  }
}

.users-panel-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 1100px) {
  .users-panel-layout {
    grid-template-columns: minmax(16rem, 0.42fr) minmax(0, 1.58fr);
  }
}

.teams-panel {
  overflow: hidden;
}

.teams-panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem 1rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--content-surface);
}

.teams-panel-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.teams-panel-tab:hover {
  color: var(--text);
  background: var(--content-muted);
}

.teams-panel-tab--active {
  color: var(--text);
  background: var(--content-surface);
  border-color: var(--border);
  box-shadow: inset 0 2px 0 var(--primary);
}

.teams-panel-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--content-muted);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.teams-panel-tab--active .teams-panel-tab__count {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.teams-panel-pane {
  display: none;
}

.teams-panel-pane--active {
  display: block;
}

.teams-panel-pane .card--flush {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.request-forms-panel {
  overflow: hidden;
}

.request-forms-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--content-surface);
}

.request-forms-add-btn {
  margin-left: auto;
  margin-bottom: 0.35rem;
}

.request-forms-panel--workspace .request-forms-tabs {
  display: none;
}

.request-forms-panel--workspace .request-forms-workspace {
  padding-top: 1rem;
}

.request-forms-workspace {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1rem 1.25rem;
  min-height: min(72vh, 640px);
}

.request-forms-workspace__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1rem;
  padding-top: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
}

.request-forms-workspace__back {
  flex-shrink: 0;
}

.request-forms-workspace__titles {
  flex: 1 1 12rem;
  min-width: 0;
}

.request-forms-workspace__titles h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.request-forms-workspace__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-left: auto;
}

.request-forms-workspace__event {
  margin-top: -0.25rem;
}

.request-forms-event-grid {
  display: grid;
  gap: 0.85rem;
  padding: 0 1.25rem 1.25rem;
}

.request-form-fields-card--workspace {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.request-form-fields-list--workspace {
  flex: 1 1 auto;
  min-height: 18rem;
  max-height: none;
  padding: 0 0 2rem;
}

/* Google Forms–style builder */
.request-form-builder {
  padding: 0 0.5rem 1rem;
  min-height: min(72vh, 640px);
}

.request-form-builder__canvas {
  min-width: 0;
  padding: 0 0.25rem;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(249, 115, 22, 0.035), transparent 120px),
    var(--content-muted);
}

.request-form-builder__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.5rem 0.75rem;
}

.request-form-builder__head h3 {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
}

.request-form-builder__rail {
  position: fixed;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--content-surface);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
}

.request-form-builder__rail.hidden {
  display: none;
}

.request-form-builder__rail-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.request-form-builder__rail-divider {
  height: 1px;
  margin: 0.15rem 0.2rem;
  background: var(--border);
}

.request-form-rail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.request-form-rail-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.request-form-rail-btn:hover:not(:disabled) {
  color: var(--primary-hover);
  background: rgba(249, 115, 22, 0.08);
  border-color: rgba(249, 115, 22, 0.2);
}

.request-form-rail-btn--primary {
  color: var(--primary-hover);
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.22);
}

.request-form-rail-btn--primary:hover:not(:disabled) {
  background: rgba(249, 115, 22, 0.16);
}

.request-form-fields-list.request-form-fields-list--workspace {
  display: grid;
  gap: 0.85rem;
  padding: 0 0.5rem;
  max-width: 42rem;
  margin: 0 auto;
  max-height: none;
  overflow: visible;
}

.rf-block {
  position: relative;
  display: grid;
  grid-template-columns: 6px 1fr;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--content-surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rf-block:focus-within {
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: 0 2px 12px rgba(249, 115, 22, 0.1);
}

.rf-block--selected {
  border-color: var(--primary);
  box-shadow: 0 4px 18px rgba(249, 115, 22, 0.14);
}

.rf-block--selected .rf-block__accent {
  background: var(--primary);
}

.request-form-fields-empty__add {
  margin-top: 0.35rem;
}

.rf-block__accent {
  border-radius: 10px 0 0 10px;
  background: transparent;
  transition: background 0.15s ease;
}

.rf-block:focus-within .rf-block__accent {
  background: var(--primary);
}

.rf-block__inner {
  min-width: 0;
  padding: 1.1rem 1.15rem 0.65rem;
}

.rf-block__question-head {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.rf-block__question-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.rf-block__question-input {
  width: 100%;
  padding: 0.15rem 0 0.35rem;
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

.rf-block:focus-within .rf-block__question-input {
  border-bottom-color: var(--border);
}

.rf-block__required-mark {
  display: none;
}

.rf-block__type-select {
  min-width: 9.5rem;
  max-width: 11rem;
  height: 2.25rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text);
}

.rf-block__description-input {
  width: 100%;
  padding: 0.2rem 0;
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--muted);
  outline: none;
}

.rf-block:focus-within .rf-block__description-input {
  border-bottom-color: var(--border);
}

.rf-block__section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 0.65rem;
}

.rf-block__section-title {
  width: 100%;
  padding: 0.15rem 0 0.35rem;
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  resize: vertical;
  font-size: 1.35rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.35;
  color: var(--text);
  outline: none;
}

.rf-block--description .rf-block__section-title {
  font-size: 0.95rem;
  font-weight: 500;
}

.rf-block:focus-within .rf-block__section-title {
  border-bottom-color: var(--border);
}

.rf-block__preview {
  margin-bottom: 0.75rem;
  padding-top: 0.15rem;
}

.rf-block__preview-input {
  width: 100%;
  padding: 0.35rem 0 0.55rem;
  border: none;
  border-bottom: 1px dotted rgba(100, 116, 139, 0.45);
  border-radius: 0;
  background: transparent;
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--muted);
}

.rf-block__preview-input--long {
  min-height: 4.5rem;
  padding: 0.65rem 0;
  border-bottom-style: solid;
  border-bottom-color: var(--border);
  color: var(--muted);
}

.rf-block__preview--solutions {
  display: grid;
  gap: 0.45rem;
}

.rf-block__preview-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.rf-block__preview-check-box {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(100, 116, 139, 0.45);
  border-radius: 2px;
}

.rf-block__preview-note {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.rf-block__meta-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.45rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.rf-block__meta-row input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text);
}

.rf-block__meta-row--placeholder {
  opacity: 0.85;
}

.rf-block__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.55rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.rf-block__footer-left,
.rf-block__footer-right {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.rf-block__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.rf-block__action:hover:not(:disabled) {
  color: var(--text);
  background: var(--content-muted);
}

.rf-block__action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.rf-block__action[data-field-action="remove"]:hover:not(:disabled) {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

.rf-block__required {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.rf-block__required input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rf-block__required-ui {
  position: relative;
  width: 2.1rem;
  height: 1.2rem;
  border-radius: 999px;
  background: var(--content-muted);
  border: 1px solid var(--border);
  transition: background 0.15s ease;
}

.rf-block__required-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--content-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease;
}

.rf-block__required input:checked + .rf-block__required-ui {
  background: rgba(249, 115, 22, 0.85);
  border-color: transparent;
}

.rf-block__required input:checked + .rf-block__required-ui::after {
  transform: translateX(0.9rem);
}

.request-forms-panel--workspace .request-forms-pane {
  display: none;
}

.request-forms-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.request-forms-tab--active {
  color: var(--text);
  background: var(--content-surface);
  border-color: var(--border);
  box-shadow: inset 0 2px 0 var(--primary);
}

.request-forms-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--content-muted);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.request-forms-pane {
  display: none;
}

.request-forms-pane--active {
  display: block;
}

.request-forms-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1rem;
  padding: 1rem 1.25rem 1.25rem;
}

.request-forms-section-title {
  margin: 1rem 0 0.35rem;
  font-size: 0.92rem;
}

.request-form-fields-card__head {
  align-items: flex-start;
}

.request-form-fields-count {
  flex-shrink: 0;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: var(--content-muted);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.request-form-fields-toolbar {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(249, 115, 22, 0.04), transparent),
    var(--content-surface);
}

.request-form-fields-toolbar__label {
  margin: 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.request-form-quick-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.request-form-quick-add__btn {
  padding: 0.38rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--content-surface);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.request-form-quick-add__btn:hover {
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.06);
  transform: translateY(-1px);
}

.request-form-field-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.request-form-field-add select {
  flex: 1 1 11rem;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 0.65rem;
  background: var(--input-bg);
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text);
}

.request-form-fields-list {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.25rem 1.15rem;
  max-height: min(32rem, calc(100vh - 16rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.request-form-fields-empty {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--content-muted);
  text-align: center;
}

.request-form-fields-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 0.25rem;
  border-radius: 14px;
  background: var(--content-surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.request-form-fields-empty__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.request-form-fields-empty__text {
  margin: 0;
  max-width: 18rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

.request-form-field {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--content-surface);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.request-form-field:hover {
  border-color: rgba(249, 115, 22, 0.28);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.request-form-field__rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem 0.65rem;
  border-right: 1px solid var(--border);
  background: var(--content-muted);
}

.request-form-field__index {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.request-form-field__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: var(--content-surface);
  border: 1px solid var(--border);
  color: var(--primary-hover);
}

.request-form-field__icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.request-form-field--content .request-form-field__icon {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.18);
}

.request-form-field--picker .request-form-field__icon {
  color: #0d9488;
  background: rgba(13, 148, 136, 0.08);
  border-color: rgba(13, 148, 136, 0.18);
}

.request-form-field__body {
  min-width: 0;
  padding: 0.8rem 0.9rem 0.9rem;
}

.request-form-field__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.request-form-field__meta {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.request-form-field__type-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: var(--content-muted);
  border: 1px solid var(--border);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.request-form-field__preview {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.request-form-field__actions {
  display: inline-flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.request-form-field__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--content-muted);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.request-form-field__action:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.06);
}

.request-form-field__action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.request-form-field__action[data-field-action="remove"]:hover:not(:disabled) {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.06);
}

.request-form-field__settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
  align-items: start;
}

.request-form-field__settings--single {
  grid-template-columns: 1fr;
}

.request-form-field__editor {
  display: grid;
  gap: 0.3rem;
  margin: 0;
}

.request-form-field__editor--wide {
  grid-column: 1 / -1;
}

.request-form-field__editor-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
}

.request-form-field__editor-hint {
  font-size: 0.68rem;
  color: var(--muted);
}

.request-form-field__editor input,
.request-form-field__editor textarea {
  width: 100%;
  padding: 0.58rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.request-form-field__editor input:focus,
.request-form-field__editor textarea:focus {
  outline: none;
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.request-form-field__editor textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.request-form-field__callout {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.18);
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text);
}

.request-form-field__required {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  align-self: end;
  margin: 0;
  padding: 0.45rem 0.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.request-form-field__required input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.request-form-field__required-ui {
  position: relative;
  width: 2.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--content-muted);
  border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.request-form-field__required-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: calc(100% - 4px);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}

.request-form-field__required input:checked + .request-form-field__required-ui {
  background: rgba(249, 115, 22, 0.85);
  border-color: rgba(249, 115, 22, 0.55);
}

.request-form-field__required input:checked + .request-form-field__required-ui::after {
  transform: translateX(1rem);
}

.request-forms-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.col-request-form-url {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teams-create-form {
  padding: 0 1.25rem 1.25rem;
  max-width: 52rem;
}

.teams-create-form__actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.85rem;
  padding: 0 1.25rem 1.25rem;
}

.user-tile {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--content-muted);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.user-tile:hover {
  border-color: rgba(249, 115, 22, 0.28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.user-tile--inactive {
  opacity: 0.82;
}

.user-tile__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.user-tile__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: rgba(249, 115, 22, 0.12);
  color: var(--primary-hover);
  font-size: 0.95rem;
  font-weight: 800;
}

.user-tile__identity {
  min-width: 0;
}

.user-tile__email {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-tile__name {
  margin: 0.12rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-tile__status {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-tile__status--active {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.22);
}

.user-tile__status--inactive {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.user-tile__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.user-tile__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--content-surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.user-tile__chip--muted {
  color: var(--muted);
}

.team-roster-picker {
  display: grid;
  gap: 0.9rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--content-surface);
}

.team-roster-picker__section {
  display: grid;
  gap: 0.55rem;
}

.team-roster-picker__section--managers {
  padding-left: 0.7rem;
  border-left: 3px solid rgba(249, 115, 22, 0.75);
}

.team-roster-picker__section--members {
  padding-left: 0.7rem;
  border-left: 3px solid rgba(37, 99, 235, 0.55);
}

.team-roster-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.team-roster-picker__title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.team-roster-picker__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--content-muted);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.team-roster-picker__list {
  display: grid;
  gap: 0.55rem;
}

.team-roster-picker__empty {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--content-muted);
}

.team-roster-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "avatar body badge"
    "avatar actions actions";
  gap: 0.45rem 0.7rem;
  align-items: center;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--content-muted);
}

.team-roster-card--manager {
  border-color: rgba(249, 115, 22, 0.28);
  background: rgba(249, 115, 22, 0.06);
}

.team-roster-card__avatar {
  grid-area: avatar;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 11px;
  background: rgba(249, 115, 22, 0.12);
  color: var(--primary-hover);
  font-size: 0.82rem;
  font-weight: 800;
}

.team-roster-card__body {
  grid-area: body;
  min-width: 0;
}

.team-roster-card__name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-roster-card__email {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-roster-card__badge {
  grid-area: badge;
  align-self: start;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-roster-card__badge--manager {
  background: rgba(249, 115, 22, 0.16);
  color: var(--primary-hover);
  border: 1px solid rgba(249, 115, 22, 0.24);
}

.team-roster-card__badge--member {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.team-roster-card__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.team-roster-picker__add {
  display: grid;
  gap: 0.55rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.team-roster-picker__add-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.team-roster-picker__search {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--content-muted);
  color: var(--text);
  font: inherit;
}

.team-roster-picker__candidates {
  display: grid;
  gap: 0.4rem;
  max-height: 11rem;
  overflow: auto;
}

.team-roster-candidate {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--content-muted);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.team-roster-candidate:hover {
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.05);
}

.team-roster-candidate__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
}

.team-roster-candidate__body {
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}

.team-roster-candidate__name {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-roster-candidate__email {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-roster-candidate__add {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary-hover);
}

.user-tile__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
}

.user-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.62rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--content-surface);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.user-action-btn:hover:not(:disabled) {
  border-color: rgba(249, 115, 22, 0.35);
  color: var(--primary-hover);
  background: rgba(249, 115, 22, 0.06);
}

.user-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.user-action-btn--warn {
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.22);
}

.user-action-btn--warn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

.user-action-btn--success {
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.22);
}

.user-action-btn--success:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.35);
}

.mfa-method-tabs {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.mfa-method-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--content-surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.mfa-method-tab--active {
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.08);
  color: var(--primary-hover);
}

.mfa-setup-panel {
  display: grid;
  gap: 0.85rem;
  justify-items: center;
  margin-bottom: 1rem;
}

.mfa-setup-qr-wrap {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.mfa-setup-qr {
  display: block;
  width: 11rem;
  height: 11rem;
}

.mfa-setup-hint,
.user-mfa-intro {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.mfa-setup-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
  margin: 0 1.25rem 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(249, 115, 22, 0.28);
  border-radius: 14px;
  background: rgba(249, 115, 22, 0.08);
}

.mfa-setup-banner__copy p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.user-mfa-options {
  display: grid;
  gap: 0.75rem;
}

.user-mfa-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--content-muted);
  cursor: pointer;
}

.user-mfa-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.user-mfa-option__title {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}

.user-mfa-option__hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.user-mfa-switch {
  position: relative;
  width: 2.6rem;
  height: 1.45rem;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.15s ease;
}

.user-mfa-switch::after {
  content: "";
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 1.08rem;
  height: 1.08rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.user-mfa-option input:checked + .user-mfa-switch {
  background: var(--primary);
}

.user-mfa-option input:checked + .user-mfa-switch::after {
  transform: translateX(1.15rem);
}

.user-mfa-status {
  margin: 0.85rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.user-tile__chip--mfa {
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.08);
}

.user-tile__chip--mfa-pending {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.1);
}

.users-table-mfa {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.users-table-mfa .user-tile__chip {
  font-size: 0.62rem;
}

.data-table .col-user-actions {
  width: 1%;
  white-space: nowrap;
}

.user-actions {
  flex-wrap: nowrap;
}

.user-row--inactive td {
  opacity: 0.82;
}

.btn-action--edit {
  color: #334155;
  background: #f8fafc;
  border-color: rgba(100, 116, 139, 0.28);
}

.btn-action--password {
  color: #b45309;
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.35);
}

.btn-action--welcome {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.35);
}

.btn-action--mfa {
  color: #6d28d9;
  background: #f5f3ff;
  border-color: rgba(139, 92, 246, 0.35);
}

.btn-action--warn {
  color: #dc2626;
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.28);
}

.btn-action--warn:hover:not(:disabled) {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.btn-action--success {
  color: #16a34a;
  background: #f0fdf4;
  border-color: rgba(34, 197, 94, 0.28);
}

.btn-action--success:hover:not(:disabled) {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.activity-user {
  display: grid;
  gap: 0.1rem;
}

.activity-user__email {
  font-size: 0.72rem;
  color: var(--muted);
}

.activity-event {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--content-muted);
  border: 1px solid var(--border);
}

.activity-event--login_success,
.activity-event--user_activated {
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.08);
}

.activity-event--login_failed,
.activity-event--login_blocked,
.activity-event--user_deactivated,
.activity-event--logout {
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
}

.activity-event--tab_view,
.activity-event--ui_click {
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.08);
}

.btn-action--edit:hover:not(:disabled),
.btn-action--password:hover:not(:disabled),
.btn-action--welcome:hover:not(:disabled),
.btn-action--mfa:hover:not(:disabled) {
  transform: translateY(-1px);
}

.roles-panel-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.role-card {
  overflow: hidden;
}

.role-card__hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.35rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse 120% 80% at 0% 0%, rgba(249, 115, 22, 0.12), transparent 55%),
    linear-gradient(180deg, var(--content-muted), var(--content-surface));
}

.role-card__hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: rgba(249, 115, 22, 0.12);
  color: var(--primary-hover);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.role-card__hero-copy h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.role-card__hero-copy p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 34rem;
}

.role-card__summary {
  display: grid;
  justify-items: end;
  gap: 0.1rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: var(--content-surface);
  border: 1px solid var(--border);
  min-width: 7.5rem;
}

.role-card__summary-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary-hover);
  font-variant-numeric: tabular-nums;
}

.role-card__summary-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.role-card__form {
  display: grid;
  gap: 1.15rem;
  padding: 1.25rem 1.5rem 1.5rem;
}

.role-card__identity {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 0.85rem;
}

.role-field {
  display: grid;
  gap: 0.35rem;
}

.role-field__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.role-field input {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.role-field input:focus {
  outline: none;
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.role-field__hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.role-field input.role-field__input--locked {
  background: var(--content-muted);
  color: var(--muted);
  cursor: not-allowed;
}

.role-card__matrix-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.role-card__matrix-head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.role-card__matrix-head p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.role-card__matrix-tools {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role-search {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--input-bg);
  min-width: min(100%, 15rem);
}

.role-search svg {
  color: var(--muted);
  flex-shrink: 0;
}

.role-search input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
}

.role-search input:focus {
  outline: none;
}

.role-card__presets {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.role-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.role-card__footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.role-card--edit {
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow: 0 12px 36px rgba(249, 115, 22, 0.08);
}

.role-card__footer-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.role-card__footer-hint--ready {
  color: #16a34a;
}

.perm-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
  gap: 0.9rem;
  align-content: start;
  max-height: min(34rem, calc(100vh - 20rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.2rem;
  scrollbar-width: thin;
}

.perm-group {
  display: flex;
  flex-direction: column;
  height: 20rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--content-surface);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.perm-group--collapsed {
  height: auto;
}

.perm-group:hover {
  border-color: rgba(249, 115, 22, 0.28);
}

.perm-group--active {
  border-color: rgba(249, 115, 22, 0.42);
  box-shadow: 0 10px 28px rgba(249, 115, 22, 0.08);
}

.perm-group--collapsed .perm-group__actions {
  display: none;
}

.perm-group--hidden {
  display: none;
}

.perm-group__head {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 0.7rem;
  align-items: center;
  flex-shrink: 0;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.04), transparent);
}

.perm-group__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 12px;
  background: var(--content-muted);
  color: var(--primary-hover);
  border: 1px solid var(--border);
}

.perm-group__copy {
  min-width: 0;
}

.perm-group__title {
  display: block;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.perm-group__meta {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.perm-group__count {
  flex-shrink: 0;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--content-muted);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.perm-group__count--active {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.28);
  color: var(--primary-hover);
}

.perm-group__toggle-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.perm-group__toggle-all input {
  accent-color: var(--primary);
}

.perm-group__collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--content-muted);
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.2s ease, color 0.15s ease;
}

.perm-group__collapse:hover {
  color: var(--primary-hover);
  border-color: rgba(249, 115, 22, 0.35);
}

.perm-group--collapsed .perm-group__collapse {
  transform: rotate(-90deg);
}

.perm-group__progress {
  flex-shrink: 0;
  height: 3px;
  background: var(--content-muted);
}

.perm-group__progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  transition: width 0.25s ease;
}

.perm-group__actions {
  display: grid;
  gap: 0.45rem;
  flex: 1;
  min-height: 0;
  padding: 0.85rem 1rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.perm-action {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--content-muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.perm-action:hover {
  border-color: rgba(249, 115, 22, 0.28);
}

.perm-action--on {
  background: rgba(249, 115, 22, 0.08);
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.08);
}

.perm-action input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.perm-switch {
  position: relative;
  width: 2.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s ease;
}

.perm-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.perm-action--on .perm-switch {
  background: var(--primary);
}

.perm-action--on .perm-switch::after {
  transform: translateX(1rem);
}

.perm-action__text {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.perm-action__label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.perm-action__hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.perm-action__key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.18rem 0.42rem;
  border-radius: 6px;
  background: var(--content-surface);
  border: 1px solid var(--border);
}

.roles-table .col-role-access {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .col-role-actions {
  width: 8.5rem;
  white-space: nowrap;
}

.role-row--inactive td {
  opacity: 0.72;
}

.role-row--selected td {
  background: rgba(249, 115, 22, 0.06);
}

.role-table__type {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--content-muted);
  border: 1px solid var(--border);
  color: var(--muted);
}

.role-table__type--system {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
  color: #1d4ed8;
}

.role-table__type--locked {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.28);
  color: var(--primary-hover);
}

.role-card--view .role-card__matrix-tools {
  opacity: 0.72;
  pointer-events: none;
}

.btn-action--view {
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.06);
}

.btn-action--view:hover:not(:disabled) {
  transform: translateY(-1px);
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.85rem;
  padding: 0 1.25rem 1.25rem;
}

.role-tile {
  display: grid;
  gap: 0.65rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--content-muted);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.role-tile:hover {
  border-color: rgba(249, 115, 22, 0.3);
  transform: translateY(-1px);
}

.role-tile--active {
  border-color: rgba(249, 115, 22, 0.45);
  background: rgba(249, 115, 22, 0.06);
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.1);
}

.role-tile--locked {
  opacity: 0.88;
}

.role-tile__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.role-tile__edit {
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--content-surface);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.role-tile__edit:hover {
  border-color: rgba(249, 115, 22, 0.4);
  color: var(--primary-hover);
  background: rgba(249, 115, 22, 0.06);
}

.role-tile__locked {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}

.role-tile__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.role-tile__name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  text-transform: capitalize;
}

.role-tile__badge {
  flex-shrink: 0;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(249, 115, 22, 0.12);
  color: var(--primary-hover);
  border: 1px solid rgba(249, 115, 22, 0.22);
}

.role-tile__badge--system {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.22);
}

.role-tile__desc {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  min-height: 2.2em;
}

.role-tile__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text);
  background: var(--content-surface);
  border: 1px solid var(--border);
}

.role-chip--muted {
  color: var(--muted);
}

.muted-text {
  color: var(--muted);
  font-size: 0.82rem;
}

.templates-panel {
  margin-bottom: 0;
  overflow: hidden;
}

.templates-panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem 1rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--content-surface);
}

.templates-panel-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.templates-panel-tab:hover {
  color: var(--text);
  background: var(--content-muted);
}

.templates-panel-tab--active {
  color: var(--text);
  background: var(--content-surface);
  border-color: var(--border);
  box-shadow: inset 0 2px 0 var(--primary);
}

.templates-panel-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--content-muted);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.templates-panel-tab--active .templates-panel-tab__count {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.templates-panel-pane {
  display: none;
}

.templates-panel-pane--active {
  display: block;
}

.templates-editor-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  height: calc(100dvh - 10rem);
  min-height: calc(100dvh - 10rem);
  overflow: hidden;
}

.template-list-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  align-self: stretch;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--content-muted);
}

.template-list-card__head {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--content-surface);
}

.template-list-card__hint {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
}

.template-scope-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.2rem;
  border-radius: 0.55rem;
  background: var(--content-muted);
  border: 1px solid var(--border);
}

.template-scope-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.55rem;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.template-scope-tab:hover {
  color: var(--text);
}

.template-scope-tab--active {
  background: var(--content-surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.template-source-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  overflow: auto;
  flex: 1;
}

.template-source-list.hidden,
.template-list.hidden {
  display: none;
}

.template-source-list__item .template-list__meta {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
}

.email-settings-panel,
.email-notifications-panel {
  max-width: 36rem;
}

.template-editor-section__hint {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.template-editor-section--cc {
  padding-bottom: 0.25rem;
}

.template-cc-picker__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.template-cc-picker__head .template-editor-section__title {
  margin-bottom: 0.15rem;
}

.template-cc-picker__head .template-editor-section__hint {
  margin: 0;
}

.template-cc-picker__badge {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-fg, #fff);
  background: var(--accent, #1b6b3a);
  border-radius: 999px;
  white-space: nowrap;
}

.template-cc-picker__badge:empty,
.template-cc-picker__badge[data-count="0"] {
  background: var(--border);
  color: var(--muted);
}

.template-cc-picker {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface-elevated, var(--card));
  overflow: hidden;
}

.template-cc-picker__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 92%, var(--muted) 8%);
}

.template-cc-picker__search {
  flex: 1 1 12rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--muted);
}

.template-cc-picker__search:focus-within {
  border-color: var(--accent, #1b6b3a);
  color: var(--text);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #1b6b3a) 20%, transparent);
}

.template-cc-picker__search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.84rem;
  color: var(--text);
  outline: none;
}

.template-cc-picker__search input::placeholder {
  color: var(--muted);
}

.template-cc-picker__actions {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
}

.template-cc-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.55rem;
  padding: 0.75rem;
  max-height: 16.5rem;
  overflow-y: auto;
}

.template-cc-picker__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.25rem 0.5rem;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
}

.template-cc-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 0.65rem;
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.template-cc-card:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent, #1b6b3a) 45%, var(--border));
  background: color-mix(in srgb, var(--accent, #1b6b3a) 4%, var(--card));
}

.template-cc-card--selected {
  border-color: var(--accent, #1b6b3a);
  background: color-mix(in srgb, var(--accent, #1b6b3a) 8%, var(--card));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #1b6b3a) 25%, transparent);
}

.template-cc-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.template-cc-card__avatar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent, #1b6b3a);
  background: color-mix(in srgb, var(--accent, #1b6b3a) 12%, var(--card));
}

.template-cc-card--selected .template-cc-card__avatar {
  color: var(--accent-fg, #fff);
  background: var(--accent, #1b6b3a);
}

.template-cc-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.template-cc-card__email {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-cc-card__label {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-cc-card__status {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.template-cc-card__check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 1.5px solid var(--border);
  border-radius: 0.35rem;
  color: transparent;
  background: var(--card);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.template-cc-card--selected .template-cc-card__check {
  border-color: var(--accent, #1b6b3a);
  background: var(--accent, #1b6b3a);
  color: var(--accent-fg, #fff);
}

.template-cc-card__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .template-cc-picker__head {
    flex-direction: column;
    align-items: stretch;
  }

  .template-cc-picker__badge {
    align-self: flex-start;
  }

  .template-cc-picker__grid {
    grid-template-columns: 1fr;
    max-height: 14rem;
  }
}

.email-settings-test-form {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.email-settings-form__actions {
  margin-top: 0.25rem;
}

.email-notifications-panel .stack-form label.checkbox-label {
  margin-bottom: 0.75rem;
}

.email-cc-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 11rem);
  max-width: 52rem;
}

.email-cc-panel--full,
#templates-addresses-pane .email-cc-panel {
  width: 100%;
  max-width: none;
  gap: 0;
}

.email-cc-panel__hint {
  margin: 0;
  padding: 0.85rem 1.25rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.email-addresses-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--card);
}

.email-addresses-card .card__head {
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.email-addresses-card .card__head h2 {
  font-size: 0.9rem;
  font-weight: 700;
}

.email-addresses-table-wrap {
  flex: 1;
  min-height: 12rem;
  max-height: calc(100dvh - 18rem);
}

.email-addresses-table.data-table--stack {
  min-width: 0;
  width: 100%;
  table-layout: auto;
}

.email-addresses-table thead th,
.email-addresses-table tbody td {
  text-align: left;
  vertical-align: middle;
  padding: 0.5rem 0.4rem;
}

.email-addresses-table thead th:first-child,
.email-addresses-table tbody td:first-child {
  padding-left: 1rem;
  padding-right: 0.5rem;
}

.email-addresses-table thead th:last-child,
.email-addresses-table tbody td:last-child {
  padding-right: 1rem;
  padding-left: 0.5rem;
}

.email-addresses-table tbody td {
  max-width: none;
}

.email-addresses-table .col-address {
  width: auto;
  min-width: 0;
  padding-right: 0.75rem;
}

.email-addresses-table .col-name {
  width: auto;
  min-width: 0;
  max-width: 12rem;
  font-weight: 500;
  padding-left: 0.35rem;
  padding-right: 0.75rem;
}

.email-addresses-table .col-status {
  width: 1%;
  white-space: nowrap;
  padding-left: 0.35rem;
  padding-right: 0.5rem;
}

.email-addresses-table .col-actions {
  width: 1%;
  text-align: left !important;
  white-space: nowrap;
  padding-left: 0.35rem;
}

.email-addresses-table .col-actions .action-group,
.email-addresses-table .email-cc-actions {
  justify-content: flex-start;
}

.email-address-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.email-address-cell__avatar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent, #1b6b3a);
  background: color-mix(in srgb, var(--accent, #1b6b3a) 12%, var(--card));
}

.email-address-cell__email {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
  min-width: 0;
}

.email-address-cell__name {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.email-address-cell__name--empty {
  color: var(--muted);
  font-weight: 400;
}

.email-cc-row--inactive .email-address-cell__email,
.email-cc-row--inactive .email-address-cell__avatar {
  opacity: 0.65;
}

.email-addresses-table .email-cc-actions {
  justify-content: flex-start;
}

.email-cc-add-form .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.card__hint--compact {
  margin-bottom: 0.65rem !important;
  font-size: 0.76rem !important;
  line-height: 1.4 !important;
}

.template-list-card__head .btn-sm,
.template-list-card__head .btn-secondary {
  align-self: flex-start;
  padding: 0.35rem 0.65rem;
  font-size: 0.76rem;
}


.template-editor-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  align-self: stretch;
  height: 100%;
  background: var(--content-surface);
}

.template-editor-card__title {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.template-editor-card__title .card__meta {
  font-size: 0.76rem;
}

.template-editor-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.template-editor-body.stack-form {
  flex: 1;
  padding: 0 1.25rem;
  overflow-y: auto;
}

.template-editor-section {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.template-editor-section:first-child {
  padding-top: 0.25rem;
}

.template-editor-section:last-child {
  border-bottom: none;
  padding-bottom: 0.5rem;
}

.template-editor-pane__note {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
}

.template-editor-options--identity {
  margin: 0.15rem 0 0.65rem;
}

.template-editor-pane textarea[readonly],
input.is-disabled,
input:disabled {
  background: var(--content-muted);
  color: var(--text);
  cursor: default;
}

.template-editor-section__title {
  margin: 0 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.template-editor-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: -0.15rem;
}

.template-editor-options .checkbox-label {
  margin-bottom: 0 !important;
  font-size: 0.8rem !important;
}

.template-editor-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--content-surface);
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.template-editor-card .card__head--compact {
  padding: 0.75rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.template-editor-card .card__head h2 {
  font-size: 0.9rem;
  font-weight: 700;
}

.email-cc-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 0.55rem;
  padding: 0.85rem 1.25rem 1rem;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--content-surface);
  width: 100%;
}

.email-cc-add-form input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
}

.email-cc-add-form .btn {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
}

.template-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.template-list > li {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.template-list__item {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 8px;
  background: var(--content-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.template-list__item:hover {
  border-color: rgba(249, 115, 22, 0.28);
  background: var(--content-surface);
}

.template-list__item--active {
  border-color: rgba(249, 115, 22, 0.4);
  border-left-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.1);
}

.template-list__name {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.template-list__meta {
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.template-list__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.template-badge {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--content-surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.template-badge--default {
  background: var(--primary-soft);
  border-color: rgba(249, 115, 22, 0.35);
  color: var(--primary-hover);
}

.template-list__empty {
  padding: 0.5rem 0.75rem 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.template-editor-body.stack-form label {
  margin-bottom: 0.7rem;
  font-size: 0.8rem;
}

.template-editor-meta-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.65rem;
}

.template-editor-tabs {
  display: flex;
  gap: 0.2rem;
  margin: 0.15rem 0 0.65rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--content-muted);
}

.template-editor-tab {
  flex: 1;
  padding: 0.42rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.template-editor-tab:hover {
  color: var(--text);
}

.template-editor-tab--active {
  background: var(--content-surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.template-editor-pane {
  display: none;
}

.template-format-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0.45rem 0 0.5rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--content-muted);
}

.template-format-toolbar__sep {
  width: 1px;
  height: 1.25rem;
  margin: 0 0.15rem;
  background: var(--border);
}

.template-format-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--content-surface);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.template-format-btn:hover {
  border-color: var(--border);
  background: #fff;
}

.template-format-btn__underline {
  text-decoration: underline;
}

.template-format-hint {
  margin: 0.45rem 0 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted);
}

.template-format-hint code {
  font-size: 0.72rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: var(--content-muted);
}

.template-editor-pane--active {
  display: block;
}

.template-editor-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text);
  background: var(--input-bg);
  resize: vertical;
  min-height: 14rem;
}

.template-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--content-surface);
}

.template-preview__subject {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.template-preview__frame {
  display: block;
  width: 100%;
  min-height: 18rem;
  border: 0;
  background: #fff;
}

.template-placeholders__hint {
  margin: -0.35rem 0 0.55rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.template-placeholders__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.template-placeholder-chip {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--content-muted);
  color: var(--text);
  font-size: 0.74rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
}

.template-placeholder-chip:hover {
  border-color: rgba(249, 115, 22, 0.45);
  background: var(--primary-soft);
}

.template-editor-actions .btn-primary,
.template-editor-actions .btn-secondary {
  width: auto;
  min-width: 7rem;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
}

.solutions-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  max-width: 52rem;
  padding: 0.85rem 1rem 1rem;
}

.solutions-products-panel {
  overflow: hidden;
}

.solutions-products-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem 1rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--content-surface);
}

.solutions-products-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.solutions-products-tab:hover {
  color: var(--text);
  background: var(--content-muted);
}

.solutions-products-tab--active {
  color: var(--text);
  background: var(--content-surface);
  border-color: var(--border);
  box-shadow: inset 0 2px 0 var(--primary);
}

.solutions-products-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--content-muted);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.solutions-products-tab--active .solutions-products-tab__count {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.solutions-products-pane {
  display: none;
}

.solutions-products-pane--active {
  display: block;
}

.products-panel {
  padding: 0.85rem 1rem 1rem;
}

.products-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.products-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex-shrink: 0;
}

.products-panel__head h2 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
}

.products-table .col-product-image {
  width: 4.5rem;
}

.products-table__image {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--content-muted);
  overflow: hidden;
}

.products-table__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.products-table__image--empty {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.products-table .teams-table-actions {
  flex-wrap: nowrap;
}

.products-table__select-col {
  width: 2.5rem;
  padding-right: 0.25rem;
}

.products-table__select-all,
.products-table__row-select-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.products-table__row-select,
.products-table__select-all input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent, #f97316);
  cursor: pointer;
}

#product-delete-selected-btn:not(:disabled) {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

#product-delete-selected-btn:not(:disabled):hover {
  border-color: #fca5a5;
  background: #fee2e2;
}

.products-table__image--large {
  width: 5.5rem;
  height: 5.5rem;
}

.product-view-modal__image-wrap {
  margin-bottom: 0.85rem;
}

.product-view-modal__meta {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.product-view-modal__meta div {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0.5rem;
}

.product-view-modal__meta dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.product-view-modal__meta dd {
  margin: 0;
  font-size: 0.86rem;
}

.product-bulk-progress {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-elevated, var(--card-bg));
}

.product-bulk-progress__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  font-size: 0.875rem;
}

.product-bulk-progress__count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.product-bulk-progress__track {
  height: 8px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.16);
  overflow: hidden;
}

.product-bulk-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--brand-orange-dark));
  transition: width 0.25s ease;
}

.product-bulk-warnings {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: var(--text);
  font-size: 0.82rem;
}

.product-bulk-warnings li + li {
  margin-top: 0.35rem;
}

.product-bulk-status--ready {
  color: var(--success, #15803d);
}

.product-bulk-status--missing_image {
  color: #b45309;
}

.product-bulk-status--error {
  color: var(--danger, #b91c1c);
}

.product-bulk-images-field {
  display: grid;
  gap: 0.55rem;
}

.product-bulk-images-field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.product-bulk-images-field__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.product-bulk-images-field__count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--content-muted);
}

.product-bulk-image-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  padding: 0.65rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: linear-gradient(180deg, var(--content-muted) 0%, transparent 100%);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.product-bulk-image-grid--dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.product-bulk-image-slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  min-height: 5.5rem;
}

.product-bulk-image-slot--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  height: 100%;
  padding: 0.35rem;
  border: 1px dashed color-mix(in srgb, var(--border) 85%, var(--muted));
  background: var(--content-surface);
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.product-bulk-image-slot--empty:hover {
  border-color: var(--primary);
  color: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.product-bulk-image-slot--empty:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.product-bulk-image-slot__icon {
  display: inline-flex;
  opacity: 0.72;
}

.product-bulk-image-slot__label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.product-bulk-image-slot__index {
  position: absolute;
  top: 0.35rem;
  left: 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}

.product-bulk-image-slot--filled {
  border: 1px solid var(--border);
  background: var(--content-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.product-bulk-image-slot__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-bulk-image-slot__name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.35rem 0.35rem 0.3rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-bulk-image-slot__remove {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 1.35rem;
  height: 1.35rem;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.product-bulk-image-slot__remove:hover {
  background: rgba(185, 28, 28, 0.92);
}

.solutions-layout .card {
  margin-bottom: 0;
}

.solutions-card__head {
  align-items: center;
}

.solutions-card__title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.solutions-card .card__head--compact {
  padding: 0.5rem 0.7rem 0.25rem;
}

.solutions-card .card__head h2 {
  font-size: 0.88rem;
  margin: 0;
}

.solutions-card .card__meta {
  font-size: 0.74rem;
}

.info-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--content-muted);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.info-icon-btn:hover,
.info-icon-btn:focus-visible {
  border-color: rgba(249, 115, 22, 0.45);
  background: var(--primary-soft);
  color: var(--primary-hover);
  outline: none;
}

.solutions-help-modal {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text);
}

.solutions-help-modal p {
  margin: 0 0 0.75rem;
}

.solutions-help-modal ul {
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
}

.solutions-help-modal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
}

.solutions-list {
  list-style: none;
  margin: 0;
  padding: 0.3rem 0.65rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.solutions-list > li {
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  min-width: 0;
}

.solutions-list__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.3rem;
  align-items: center;
  padding: 0.28rem 0.38rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--content-muted);
  min-width: 0;
}

.solutions-list__item--inactive {
  opacity: 0.62;
}

.solutions-list__order {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-shrink: 0;
}

.solutions-list__order-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 0.95rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--content-surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.62rem;
  line-height: 1;
}

.solutions-list__order-btn:hover:not(:disabled) {
  border-color: rgba(249, 115, 22, 0.45);
  color: var(--primary-hover);
}

.solutions-list__order-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.solutions-list__title {
  width: 100%;
  min-width: 0;
  padding: 0.18rem 0.36rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.68rem;
  line-height: 1.25;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
}

.solutions-list__actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.solutions-list__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.solutions-list__toggle input {
  accent-color: var(--primary);
}

.solutions-list__delete {
  padding: 0.15rem 0.3rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--danger);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
}

.solutions-list__delete:hover {
  background: rgba(220, 38, 38, 0.08);
}

.solutions-list__empty {
  padding: 0.25rem 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.solutions-add-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem 0.5rem;
  border-top: 1px solid var(--border);
}

.solutions-add-form input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
}

.solutions-add-form .btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.76rem;
}

.stack-form {
  padding: 0 1.25rem;
}

.stack-form label {
  display: block;
  margin-bottom: 0.85rem;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
}

.stack-form input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stack-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.stack-form select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
}

.stack-form .select-wrap {
  margin-top: 0.35rem;
}

.stack-form .select-wrap select {
  margin-top: 0;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500 !important;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

.admin-grid .btn-primary,
.stack-form > .btn-primary {
  width: 100%;
}

.stack-form .crm-modal__foot .btn {
  width: auto;
}

.stack-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  resize: vertical;
  min-height: 4.5rem;
}

.stack-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ——— File inputs ——— */
.file-field {
  position: relative;
  display: block;
  width: 100%;
}

.stack-form label > .file-field {
  margin-top: 0.35rem;
}

.file-field__input,
.stack-form .file-field__input {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
  color: transparent;
}

.file-field__input:focus-visible + .file-field__ui {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.file-field__ui {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.file-field:hover .file-field__ui {
  border-color: rgba(249, 115, 22, 0.45);
  background: var(--primary-soft);
}

.file-field--has-file .file-field__ui {
  border-style: solid;
}

.file-field__icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--muted);
}

.file-field--has-file .file-field__icon {
  color: var(--primary);
}

.file-field__action {
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--content-muted);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.file-field:hover .file-field__action {
  border-color: rgba(249, 115, 22, 0.45);
  color: var(--brand-orange-dark);
}

.file-field__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--muted);
}

.file-field--has-file .file-field__name {
  color: var(--text);
  font-weight: 500;
}

[data-theme="dark"] .file-field__ui {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .file-field__action {
  background: #1f1f1f;
}

[data-theme="dark"] .file-field:hover .file-field__ui {
  background: rgba(249, 115, 22, 0.08);
}

.form-field-group {
  display: block;
  margin-bottom: 0.85rem;
}

.form-field-group__label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
}

.input-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.65rem;
  align-items: end;
  margin-top: 0.35rem;
}

.input-range__field {
  min-width: 0;
}

.input-range__hint {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-range__sep {
  padding-bottom: 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-range__field--date .flatpickr-wrapper,
.input-range__field--time .flatpickr-wrapper {
  display: block;
  width: 100%;
}

.input-range .flatpickr-input {
  display: block;
  width: 100%;
  margin-top: 0;
  padding: 0.65rem 2.35rem 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background-color: var(--input-bg);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.05rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.input-range__field--date .flatpickr-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}

.input-range__field--time .flatpickr-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}

.input-range .flatpickr-input:hover:not(:disabled) {
  border-color: rgba(249, 115, 22, 0.45);
}

.input-range .flatpickr-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input-range .flatpickr-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

[data-theme="dark"] .input-range__field--date .flatpickr-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}

[data-theme="dark"] .input-range__field--time .flatpickr-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}

.form-field-preview {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.landing-editor-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
}

.card__head--compact .card__link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.card__head--compact .card__link:hover {
  text-decoration: underline;
}

.landing-preview {
  display: grid;
  gap: 1.25rem;
  padding: 0 1.25rem 1.25rem;
}

.landing-preview__block {
  display: grid;
  gap: 0.65rem;
}

.landing-preview__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.landing-preview__img {
  width: 100%;
  max-height: 10rem;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--content-muted);
}

.landing-preview__img--bg {
  max-height: 8rem;
  object-fit: cover;
}

.landing-upload-form {
  display: grid;
  gap: 0.5rem;
}

.profile-editor-grid,
.ecard-editor-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
}

.profile-photo-block {
  display: grid;
  gap: 1rem;
  padding: 0 1.25rem 1.25rem;
}

.profile-photo-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.profile-photo-preview,
.profile-photo-initial {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  background: var(--content-muted);
}

.profile-photo-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  font-weight: 700;
  color: #fff;
  background: var(--gradient-brand);
}

.profile-reset-hint {
  margin-top: 1rem;
}

.ecard-preview {
  display: grid;
  gap: 1.5rem;
  padding: 0 1.25rem 1.25rem;
}

.ecard-preview__block {
  display: grid;
  gap: 0.65rem;
}

.ecard-preview__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ecard-preview__photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  background: var(--content-muted);
}

.ecard-preview__empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ecard-preview__qr {
  width: 180px;
  height: 180px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.5rem;
}

.ecard-upload-form {
  display: grid;
  gap: 0.5rem;
}

.ecard-public-url {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.ecard-public-url__input {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--content-muted);
  color: var(--text);
}

@media (max-width: 960px) {
  .landing-editor-grid,
  .request-forms-editor-grid,
  .profile-editor-grid,
  .ecard-editor-grid {
    grid-template-columns: 1fr;
  }

  .request-forms-workspace__head {
    flex-direction: column;
  }

  .request-forms-workspace__actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .request-form-builder__rail {
    position: fixed;
    flex-direction: column;
    max-width: calc(100vw - 24px);
  }

  .request-form-builder__rail-group {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .request-form-builder__rail-divider {
    width: 1px;
    height: auto;
    min-height: 2rem;
    margin: 0.2rem;
  }

  .rf-block__question-row,
  .rf-block__section-head {
    grid-template-columns: 1fr;
  }

  .rf-block__type-select {
    max-width: none;
    width: 100%;
  }

  .rf-block__meta-row {
    grid-template-columns: 1fr;
  }

  .request-form-field__settings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .input-range {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .input-range__sep {
    display: none;
  }

  .landing-preview__img {
    max-height: 12rem;
    object-fit: cover;
  }
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.pager__range {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.pager__range strong {
  color: var(--brand-orange-dark);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-yes {
  background: var(--badge-yes-bg);
  color: var(--brand-orange-dark);
}

[data-theme="dark"] .badge-yes {
  color: #fdba74;
}

.badge-failed {
  background: var(--badge-failed-bg);
  color: var(--failed);
}

.badge-pending {
  background: var(--badge-pending-bg);
  color: var(--muted);
}

.data-table .col-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
  padding: 0.35rem 0.5rem 0.35rem 0.35rem !important;
  vertical-align: middle;
}

.action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.25rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--content-muted);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn-action:hover:not(:disabled) {
  border-color: #fdba74;
  color: var(--brand-orange-dark);
  background: var(--primary-soft);
}

.btn-action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn-action--status {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.35);
}

.btn-action--history {
  color: #6d28d9;
  background: #f5f3ff;
  border-color: rgba(139, 92, 246, 0.35);
}

[data-theme="dark"] .btn-action {
  background: #1f1f1f;
  color: var(--text);
}

[data-theme="dark"] .btn-action--status {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .btn-action--history {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.15);
}

.badge-status-new {
  background: var(--badge-pending-bg);
  color: var(--muted);
}

.badge-status-contacted {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-status-engaged {
  background: #ede9fe;
  color: #6d28d9;
}

.badge-status-qualified {
  background: #ffedd5;
  color: #c2410c;
}

.badge-status-nurturing {
  background: #fef3c7;
  color: #b45309;
}

.badge-status-won {
  background: #dcfce7;
  color: #15803d;
}

.badge-status-lost {
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .badge-status-contacted {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

[data-theme="dark"] .badge-status-engaged {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

[data-theme="dark"] .badge-status-qualified {
  background: rgba(249, 115, 22, 0.22);
  color: #fdba74;
}

[data-theme="dark"] .badge-status-nurturing {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

[data-theme="dark"] .badge-status-won {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

[data-theme="dark"] .badge-status-lost {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.btn-action.btn-resend {
  color: var(--brand-orange-dark);
  background: rgba(249, 115, 22, 0.08);
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow: none;
}

.btn-action__icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.btn-action__icon svg {
  width: 14px;
  height: 14px;
}

.btn-action.btn-resend:hover:not(:disabled) {
  color: #fff;
  background: var(--gradient-brand);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.38);
  transform: translateY(-1px);
}

.btn-action.btn-resend:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(249, 115, 22, 0.28);
}

.btn-action.btn-resend:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn-action.btn-resend:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

[data-theme="dark"] .btn-action.btn-resend {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.4);
}

[data-theme="dark"] .btn-action.btn-resend:hover:not(:disabled) {
  color: #fff;
}

.btn-action.btn-resend--loading {
  pointer-events: none;
  color: var(--muted);
  background: var(--content-muted);
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

[data-theme="dark"] .btn-action.btn-resend--loading {
  color: var(--muted);
}

.btn-action.btn-resend--loading .btn-action__icon svg {
  display: none;
}

.btn-action.btn-resend--loading .btn-action__icon::after {
  content: "";
  display: block;
  width: 11px;
  height: 11px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.toast {
  position: fixed;
  bottom: max(1.5rem, var(--safe-bottom));
  right: max(1.5rem, var(--safe-right));
  left: auto;
  z-index: 500;
  background: var(--text);
  color: #fff;
  padding: 0.85rem 1.15rem;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  max-width: min(380px, calc(100vw - 2rem));
  font-size: 0.9rem;
}

.toast.error {
  background: var(--danger);
}

/* ——— Error modal & in-modal alerts ——— */
.crm-modal__panel--narrow {
  width: min(calc(100vw - 2rem), 28rem);
}

.app-error-modal__head {
  align-items: flex-start;
  gap: 0.85rem;
}

.app-error-modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.app-error-modal__detail {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
}

.modal-form-alert {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.06);
  color: var(--text);
}

.modal-form-alert strong {
  font-size: 0.84rem;
  color: var(--danger);
}

.modal-form-alert p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.crm-modal__body > .modal-form-alert:first-child,
.stack-form > .modal-form-alert:first-child {
  margin-top: 0;
}

/* ——— Responsive ——— */

@media (max-height: 740px) {
  .login-brand__features,
  .login-brand__text {
    display: none;
  }

  .login-brand {
    padding: 1rem 1.25rem;
  }

  .login-brand__badge {
    margin-bottom: 0.5rem;
  }

  .login-brand__title {
    margin-bottom: 0;
  }

  .login-brand__footer {
    margin-top: 0.5rem;
  }

  .login-card {
    padding: 1.25rem 1.35rem;
  }
}

@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card:last-child {
    grid-column: 1 / -1;
  }

  .users-panel-layout,
  .role-card__identity {
    grid-template-columns: 1fr;
  }

  .role-card__hero {
    grid-template-columns: auto 1fr;
  }

  .role-card__summary {
    grid-column: 1 / -1;
    justify-items: start;
  }

  .role-card__matrix-tools {
    width: 100%;
    justify-content: stretch;
  }

  .role-search {
    flex: 1;
  }

  .perm-matrix {
    grid-template-columns: 1fr;
    max-height: min(28rem, calc(100vh - 16rem));
  }

  .perm-group {
    height: 18rem;
  }

  .perm-group--collapsed {
    height: auto;
  }

  .perm-group__head {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "icon copy count"
      "icon toggle collapse";
  }

  .perm-group__toggle-all {
    grid-area: toggle;
  }

  .perm-group__collapse {
    grid-area: collapse;
    justify-self: end;
  }

  .templates-editor-workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .template-list-card {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .email-cc-panel {
    min-height: 0;
    max-width: none;
  }

  .template-editor-meta-grid,
  .solutions-layout {
    grid-template-columns: 1fr;
  }

  .solutions-list__item {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "order title"
      "order actions";
    padding: 0.35rem 0.4rem;
  }

  .solutions-list__order {
    grid-area: order;
  }

  .solutions-list__title {
    grid-area: title;
  }

  .solutions-list__actions {
    grid-area: actions;
    justify-content: flex-start;
    padding-left: 0;
  }

  .products-panel__head {
    flex-direction: column;
    align-items: stretch;
  }

  .products-panel__head .btn {
    align-self: flex-start;
  }

  .product-bulk-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main__header h1 {
    font-size: 1.45rem;
  }
}

@media (max-width: 900px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 350;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
  }

  .sidebar-backdrop.hidden {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 400;
    width: min(var(--sidebar-width), 88vw);
    height: 100vh;
    height: 100dvh;
    padding-top: max(1rem, var(--safe-top));
    padding-bottom: max(1rem, var(--safe-bottom));
    padding-left: max(0.75rem, var(--safe-left));
    transform: translateX(-105%);
    transition: transform 0.25s ease, background 0.2s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
  }

  [data-theme="light"] .sidebar {
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.08);
  }

  .sidebar.sidebar--open {
    transform: translateX(0);
  }

  .sidebar--collapsed {
    width: min(var(--sidebar-width), 88vw);
  }

  .main__mobile-bar {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.45rem 0.5rem;
    margin: -0.25rem 0 0.85rem;
    padding: 0.35rem 0;
  }

  .main__mobile-logo-link {
    display: inline-flex;
    min-width: 0;
  }

  .main__mobile-logo {
    max-width: 5.5rem;
    height: 1.65rem;
  }

  .main__menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }

  .main__menu-btn--ghost {
    margin-left: 0;
    border-color: transparent;
    background: transparent;
    color: var(--muted);
  }

  .main__menu-btn:hover {
    background: var(--content-muted);
    color: var(--text);
  }

  .main__mobile-title {
    flex: 1;
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .main {
    padding: 1rem;
    padding-top: max(0.75rem, var(--safe-top));
    padding-right: max(1rem, var(--safe-right));
    padding-bottom: max(1.25rem, var(--safe-bottom));
    padding-left: max(1rem, var(--safe-left));
  }

  .main__header {
    margin-bottom: 0.85rem;
  }

  .main__header > div:first-child {
    display: none;
  }

  .main__header:has(.main__toolbar.hidden) {
    display: none;
  }

  .main__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .main__toolbar--leads {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .main__toolbar--leads .leads-filters {
    flex-wrap: wrap;
    overflow: visible;
  }

  .main__toolbar--leads .leads-filter__select {
    min-width: calc(50% - 0.25rem);
    max-width: none;
    flex: 1 1 calc(50% - 0.25rem);
  }

  .main__toolbar--leads #refresh-btn {
    width: 100%;
    justify-content: center;
  }

  .main__toolbar--leads #refresh-btn .btn-icon__label {
    display: inline;
  }

  .search-box {
    flex: 1 1 auto;
    width: 100%;
  }

  .btn-icon {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .card__head {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .card__meta {
    width: 100%;
  }

  .pager {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .pager .btn {
    flex: 1 1 8rem;
    min-height: 44px;
  }

  .pager__range {
    order: -1;
    width: 100%;
    flex: none;
    text-align: center;
    padding-bottom: 0.15rem;
  }

  .table-scroll {
    max-height: none;
    overflow-x: visible;
    margin-left: 0;
    margin-right: 0;
  }

  .data-table--stack {
    min-width: 0 !important;
  }

  .action-group,
  .user-actions {
    flex-wrap: wrap !important;
    justify-content: flex-end;
    gap: 0.35rem;
    max-width: 100%;
  }

  .data-table--stack .col-actions,
  .data-table--stack .col-user-actions {
    white-space: normal;
  }

  .data-table--stack tbody td.col-actions,
  .data-table--stack tbody td.col-user-actions {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .data-table--stack tbody td.col-actions .action-group,
  .data-table--stack tbody td.col-user-actions .action-group {
    justify-content: flex-start;
  }

  .data-table--stack .analytics-share {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }

  .filter-bar {
    padding: 0.75rem 0.85rem 0.9rem;
  }

  .analytics-section__head {
    margin-bottom: 0.85rem;
  }

  .mfa-setup-banner {
    margin-left: 0;
    margin-right: 0;
  }

  .role-card__hero {
    grid-template-columns: 1fr;
    padding: 1.1rem 1rem;
  }

  .role-card__summary {
    justify-self: start;
  }

  .role-card__matrix-head {
    flex-direction: column;
    align-items: stretch;
  }

  .role-card__matrix-tools {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .role-search {
    width: 100%;
  }

  .role-card__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .role-card__footer-actions {
    width: 100%;
  }

  .role-card__footer-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .ecard-public-url {
    flex-direction: column;
    align-items: stretch;
  }

  .ecard-public-url .btn {
    width: 100%;
    justify-content: center;
  }

  .templates-panel-tabs {
    padding: 0.65rem 0.75rem 0;
    gap: 0.25rem;
  }

  .templates-panel-tab {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
  }

  .email-cc-add-form {
    grid-template-columns: 1fr;
  }

  .email-addresses-card {
    margin: 0 0.75rem;
  }

  .email-addresses-table-wrap {
    max-height: none;
  }

  .email-addresses-table .col-address,
  .email-addresses-table .col-name,
  .email-addresses-table .col-status,
  .email-addresses-table .col-actions {
    width: auto;
    min-width: 0;
  }

  .email-addresses-table.data-table--stack tbody td {
    display: grid;
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: 0.35rem 0.75rem;
    align-items: center;
    justify-content: start;
    text-align: left;
  }

  .email-addresses-table.data-table--stack tbody td::before {
    flex: none;
    max-width: none;
    width: auto;
    text-align: left;
    align-self: center;
  }

  .email-addresses-table.data-table--stack tbody td.col-actions {
    justify-content: start;
    padding-right: 0.35rem !important;
  }

  .email-addresses-table.data-table--stack .col-actions .action-group,
  .email-addresses-table.data-table--stack .email-cc-actions {
    justify-content: flex-start;
    width: auto;
  }
}

@media (max-width: 720px) {
  .app-screen-logo .company-logo {
    height: 2rem;
    max-width: min(8.5rem, 40vw);
  }

  .login-page {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow-y: auto;
    padding-top: 3.25rem;
  }

  .login-shell {
    grid-template-columns: 1fr;
    max-width: 100%;
    max-height: none;
    border-radius: 14px;
  }

  .login-brand {
    padding: 1.1rem 1.25rem;
  }

  .login-brand__features,
  .login-brand__text {
    display: none;
  }

  .login-brand__title {
    font-size: 1.5rem;
    margin-bottom: 0;
  }

  .login-brand__badge {
    margin-bottom: 0.75rem;
  }

  .login-card {
    padding: 2rem 1.35rem 2.25rem;
  }

  .login-shell--narrow {
    max-width: 100%;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .stat-card:last-child {
    grid-column: auto;
  }

  .main__header h1 {
    font-size: 1.3rem;
  }

  .main__subtitle {
    font-size: 0.85rem;
  }

  .stat-card {
    padding: 0.9rem 1rem;
    gap: 0.75rem;
  }

  .stat-card__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9px;
  }

  .stat-card__icon svg {
    width: 18px;
    height: 18px;
  }

  .stat-card__value {
    font-size: 1.4rem;
  }

  .btn-icon__label {
    display: inline;
  }
}

@media (max-width: 900px) {
  .data-table--stack {
    min-width: 0;
  }

  .data-table--stack thead {
    display: none;
  }

  .data-table--stack tbody tr {
    display: block;
    margin: 0.65rem 1rem;
    padding: 0.35rem 0.5rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  }

  .data-table--stack tbody tr:hover td {
    background: transparent;
  }

  .data-table--stack tbody tr:nth-child(even) td {
    background: transparent;
  }

  .data-table--stack tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    max-width: none;
    padding: 0.45rem 0.35rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
    word-break: break-word;
  }

  .data-table--stack tbody td:last-child {
    border-bottom: none;
  }

  .data-table--stack tbody td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    max-width: 42%;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding-top: 0.1rem;
  }

  .data-table--stack tbody td:first-child {
    font-weight: 600;
    padding-top: 0.55rem;
  }

  .data-table--stack .col-actions {
    justify-content: flex-end;
    padding-right: 0.35rem !important;
  }

  .data-table--stack .col-actions::before {
    align-self: center;
  }

  .data-table--stack .cell-desc {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .data-table--stack .cell-desc::before {
    margin-bottom: 0.25rem;
  }

  .data-table--stack .col-owner {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .data-table--stack .col-owner .lead-owner-select {
    max-width: none;
    width: 100%;
  }

  .table-scroll--leads::after {
    display: none;
  }
}

@media (max-width: 640px) {
  .state-cell {
    display: block !important;
    margin: 1rem;
    text-align: center;
  }

  .state-cell::before {
    display: none !important;
  }

  .card__head,
  .card__hint,
  .stack-form {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .stack-form {
    padding-bottom: 0.25rem;
  }

  .toast {
    left: max(1rem, var(--safe-left));
    right: max(1rem, var(--safe-right));
    max-width: none;
  }

  .mfa-setup-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .mfa-setup-banner .btn {
    width: 100%;
    justify-content: center;
  }

  .template-editor-actions {
    flex-direction: column;
  }

  .template-editor-actions .btn-primary,
  .template-editor-actions .btn-secondary {
    width: 100%;
    min-width: 0;
  }

  .template-editor-tabs {
    flex-wrap: wrap;
  }

  .analytics-export-btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    justify-content: center;
  }

  .roles-grid,
  .users-grid {
    grid-template-columns: 1fr;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .landing-preview,
  .ecard-preview {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .perm-group__head {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "icon copy collapse"
      "icon count toggle";
    gap: 0.5rem 0.65rem;
  }

  .perm-group__toggle-all {
    grid-area: toggle;
    justify-self: end;
  }

  .perm-group__collapse {
    grid-area: collapse;
  }

  .perm-group__count {
    grid-area: count;
  }
}

@media (max-width: 480px) {
  .main__mobile-logo-link {
    display: none;
  }

  .main__mobile-bar {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .login-page {
    align-items: flex-start;
    padding: 3rem 0.75rem 0.75rem;
  }

  .login-shell {
    border-radius: 12px;
    margin: auto 0;
  }

  .login-brand {
    padding: 1.25rem 1.15rem;
  }

  .login-card {
    padding: 1.65rem 1.15rem 1.85rem;
  }

  .login-brand__footer {
    display: none;
  }


  .data-table--stack tbody tr {
    margin-left: 0.65rem;
    margin-right: 0.65rem;
  }
}

@media (min-width: 901px) {
  .data-table--stack:not(.data-table--stack-2) {
    min-width: 720px;
  }

  .data-table--stack-2 {
    min-width: 320px;
  }
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.35);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.btn-login,
.login-form .btn-primary {
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--gradient-brand-hover);
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.45);
}

.btn-secondary {
  background: var(--content-surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-soft);
  border-color: #fdba74;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.05);
}

.btn-sm {
  padding: 0.42rem 0.75rem;
  font-size: 0.78rem;
  border-radius: 999px;
}

.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;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle__icon.hidden {
  display: none;
}

.theme-toggle--corner,
.theme-toggle--screen-corner {
  position: fixed;
  top: max(1rem, var(--safe-top));
  right: max(1rem, var(--safe-right));
  z-index: 500;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--content-muted);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.theme-toggle--corner {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
}

.theme-toggle--screen-corner {
  display: inline-flex;
}

@media (max-width: 900px) {
  .theme-toggle--screen-corner {
    display: none !important;
  }
}

.theme-toggle--corner:hover,
.theme-toggle--screen-corner:hover {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
  background: var(--primary-soft);
}

.main__mobile-bar .theme-toggle {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--content-surface);
  color: var(--text);
}

.main__mobile-bar .theme-toggle:hover {
  background: var(--primary-soft);
  border-color: #fdba74;
}

/* CRM modals + lead history */
.crm-modal,
.crm-drawer {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
}

.crm-modal.hidden,
.crm-drawer.hidden {
  display: none !important;
}

.crm-modal__backdrop,
.crm-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.crm-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  margin: auto;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--content-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.crm-modal__head,
.crm-drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.crm-modal__head h2,
.crm-drawer__head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.crm-modal__subtitle,
.crm-drawer__subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.crm-modal__close,
.crm-drawer__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: var(--content-muted);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.crm-modal__close:hover,
.crm-drawer__close:hover {
  color: var(--text);
  background: var(--primary-soft);
}

.crm-modal__body {
  padding: 1rem 1.15rem 0.25rem;
}

.crm-modal__body .field {
  display: block;
  margin-bottom: 0.85rem;
}

.crm-modal__body .field__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.crm-modal__body textarea,
.crm-note-form textarea,
.crm-modal__body select {
  width: 100%;
  min-height: 0;
  padding: 0.55rem 2.25rem 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

.crm-modal__body textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.crm-modal__body .select-wrap {
  display: block;
  margin-top: 0;
}

.crm-modal__body .select-wrap select {
  margin-top: 0;
}

.crm-modal__body textarea:focus,
.crm-note-form textarea:focus,
.crm-modal__body select:focus {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

[data-theme="dark"] .crm-modal__body select {
  color-scheme: dark;
  background-color: var(--input-bg);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .crm-modal__body select:hover:not(:disabled) {
  background-color: var(--content-muted);
  border-color: rgba(249, 115, 22, 0.55);
}

/* Theme-aware custom select (CRM modals) */
.custom-select-wrap {
  position: relative;
}

.custom-select {
  position: relative;
}

.custom-select__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.custom-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.custom-select__trigger:hover {
  border-color: #fdba74;
  background: var(--content-muted);
}

.custom-select--open .custom-select__trigger,
.custom-select__trigger:focus-visible {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.custom-select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select__chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.custom-select--open .custom-select__chevron {
  transform: rotate(180deg);
}

.custom-select__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  overflow: hidden;
  background: var(--content-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.custom-select__menu--scrollable {
  max-height: 14rem;
  overflow-y: auto;
  scrollbar-width: none;
}

.custom-select__menu--scrollable::-webkit-scrollbar {
  display: none;
}

.custom-select__menu.hidden {
  display: none;
}

.custom-select__option {
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.custom-select__option:hover {
  background: var(--content-muted);
}

.custom-select__option--active {
  background: var(--primary-soft);
  color: var(--brand-orange-dark);
  font-weight: 600;
}

[data-theme="dark"] .custom-select__option--active {
  color: #fdba74;
}

.custom-select__option--placeholder {
  color: var(--muted);
}

.custom-select__search-item {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.45rem 0.5rem 0.5rem;
  margin: 0;
  list-style: none;
  background: var(--content-surface);
  border-bottom: 1px solid var(--border);
}

.custom-select__search {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}

.custom-select__search:focus {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.custom-select__option.hidden {
  display: none;
}

.crm-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.15rem 1rem;
}

.crm-modal__foot--split {
  justify-content: space-between;
  align-items: center;
}

.crm-modal__foot-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-danger-text {
  color: #b42318;
}

.btn-danger-text:hover:not(:disabled) {
  color: #912018;
  background: rgba(180, 35, 24, 0.08);
}

.teams-table-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.25rem;
}

.crm-drawer__panel {
  position: relative;
  z-index: 1;
  margin-left: auto;
  width: min(100%, 26rem);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--content-surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}

.crm-drawer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.25rem 0.75rem;
}

.lead-linked-tasks {
  padding: 0 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.lead-linked-tasks__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.lead-linked-tasks__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.lead-linked-tasks__count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.lead-linked-tasks__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.lead-linked-tasks__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--content-muted);
}

.lead-linked-tasks__item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.lead-linked-tasks__item-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.lead-linked-tasks__item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.lead-linked-tasks__empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.lead-contributors {
  padding: 0 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.lead-contributors__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.lead-contributors__title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.lead-contributors__count {
  font-size: 0.72rem;
  color: var(--muted);
}

.lead-contributors__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lead-contributors__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--content-muted);
  font-size: 0.82rem;
}

.lead-contributors__item-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.lead-contributors__empty {
  margin: 0;
  font-size: 0.82rem;
}

.contributor-picker {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 16rem;
  overflow-y: auto;
}

.contributor-picker__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.contributor-picker__item strong {
  display: block;
  font-size: 0.86rem;
}

.contributor-picker__item span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.crm-drawer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 1.25rem 0.75rem;
}

.lead-lifecycle-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.25rem 0.75rem;
}

.lead-lifecycle-summary__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--content-muted);
  border: 1px solid var(--border);
  color: var(--text);
}

.lead-lifecycle-summary__pill--handoff {
  background: #eef6ff;
  border-color: #c5ddf5;
}

.lead-lifecycle__heading {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.crm-timeline__item--handoff_started .crm-timeline__dot,
.crm-timeline__item--handoff_to_team .crm-timeline__dot {
  background: #3b82f6;
}

.crm-timeline__item--handoff_claimed .crm-timeline__dot {
  background: #8b5cf6;
}

.crm-timeline__item--handoff_completed .crm-timeline__dot,
.crm-timeline__item--task_status_changed .crm-timeline__dot {
  background: var(--yes);
}

.crm-timeline__item--task_assigned .crm-timeline__dot {
  background: #f97316;
}

.email-notifications-panel__section {
  margin: 0.35rem 0 0.15rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.sync-task-picker {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--content-muted);
}

.sync-task-picker__item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.84rem;
}

.sync-task-picker__item strong {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.sync-task-picker__meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.crm-drawer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--content-muted);
}

.crm-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--content-surface);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
}

.crm-meta-pill strong {
  color: var(--text);
  font-weight: 600;
}

.crm-drawer__body {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.15rem;
}

.crm-drawer__foot {
  padding: 0.85rem 1.15rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--content-muted);
}

.crm-note-form .field {
  margin-bottom: 0.65rem;
}

.crm-note-form__notify {
  margin: 0 0 0.7rem;
  font-size: 0.86rem;
  color: var(--text);
}

.crm-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.crm-timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 1rem 1fr;
  gap: 0.75rem;
  padding-bottom: 1.1rem;
}

.crm-timeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 1rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.crm-timeline__dot {
  width: 0.9rem;
  height: 0.9rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  background: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.crm-timeline__item--created .crm-timeline__dot {
  background: #71717a;
}

.crm-timeline__item--status_changed .crm-timeline__dot {
  background: #3b82f6;
}

.crm-timeline__item--closed_won .crm-timeline__dot,
.crm-timeline__item--status_changed:has(+ *) .crm-timeline__dot {
  background: #22c55e;
}

.crm-timeline__item--note_added .crm-timeline__dot {
  background: #8b5cf6;
}

.crm-timeline__item--email_sent .crm-timeline__dot,
.crm-timeline__item--email_resent .crm-timeline__dot {
  background: var(--brand-orange);
}

.crm-timeline__item--email_failed .crm-timeline__dot {
  background: #ef4444;
}

.crm-timeline__content {
  min-width: 0;
}

.crm-timeline__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.crm-timeline__head strong {
  font-size: 0.84rem;
}

.crm-timeline__head time {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.crm-timeline__user {
  margin: 0.15rem 0 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.crm-timeline__note,
.crm-timeline__reason {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.45;
}

.crm-timeline__empty {
  padding: 1rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 640px) {
  .action-group {
    width: 100%;
    justify-content: flex-start;
  }

  .crm-drawer__panel {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
  }

  .crm-modal__panel {
    width: calc(100% - 1.5rem);
    max-width: calc(100vw - 1.5rem);
    margin: auto 0.75rem;
    max-height: calc(100dvh - 1.5rem);
    overflow-y: auto;
  }

  .crm-modal__foot,
  .crm-drawer__foot {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .crm-modal__foot .btn,
  .crm-drawer__foot .btn {
    width: 100%;
    min-height: 44px;
  }

  .user-mfa-option {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .user-mfa-option .user-mfa-switch {
    justify-self: start;
  }
}

.main__toolbar--leads {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem 0.55rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.main__toolbar--leads .search-box--compact {
  flex: none;
  width: 100%;
  max-width: none;
  min-height: 34px;
  padding: 0 0.55rem;
  border-radius: 8px;
  box-shadow: none;
}

.main__toolbar--leads .search-box--compact svg {
  width: 14px;
  height: 14px;
}

.main__toolbar--leads .search-box--compact input {
  padding: 0.35rem 0;
  font-size: 0.8rem;
}

.leads-filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 1px;
}

.leads-filter {
  flex: 0 0 auto;
}

.leads-filter__select {
  min-width: 7.75rem;
  max-width: 9.5rem;
  height: 34px;
  padding: 0 1.6rem 0 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--content-surface);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.2;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
}

.main__toolbar--leads #refresh-btn {
  flex-shrink: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 0.7rem;
  font-size: 0.78rem;
}

.main__toolbar--leads #refresh-btn .btn-icon__label {
  display: none;
}

.main__toolbar--leads #refresh-btn svg {
  margin: 0;
}

.leads-clear-filters {
  flex: 0 0 auto;
  height: 34px;
  min-height: 34px;
  padding: 0 0.55rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

.leads-clear-filters.hidden {
  display: none;
}

.lead-row--deleted {
  opacity: 0.72;
}

.lead-row--deleted td {
  color: var(--muted);
}

@media (min-width: 1100px) {
  .main__toolbar--leads {
    grid-template-columns: 12.5rem minmax(0, 1fr) auto;
  }

  .main__toolbar--leads #refresh-btn .btn-icon__label {
    display: inline;
  }
}

.badge--source {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
}

[data-theme="dark"] .badge--source {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.integrations-card {
  width: 100%;
}

.integrations-card__head {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1rem;
}

.integrations-card__intro {
  flex: 1 1 14rem;
  min-width: 0;
}

.integrations-card__intro .card__meta {
  margin-top: 0.2rem;
}

.table-scroll--integrations {
  max-height: min(calc(100dvh - 240px), 72vh);
}

.integrations-table {
  width: 100%;
  table-layout: fixed;
}

.integrations-table__access {
  min-width: 8rem;
}

.integrations-table__access-cell .source-access-link {
  font-size: 0.82rem;
  text-align: left;
}

.lead-source-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.45rem;
  max-height: 14rem;
  overflow: auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--content-muted);
}

.lead-source-picker--modal {
  max-height: 18rem;
}

.lead-source-picker__item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.6rem;
  border-radius: 0.5rem;
  background: var(--content-surface);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  cursor: pointer;
}

.lead-source-picker__item:hover {
  border-color: var(--accent, #2f6f3a);
}

.lead-source-picker__item input {
  margin-top: 0.15rem;
}

.lead-source-picker__item span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.lead-source-picker__meta {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.lead-source-picker__empty {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.source-access-form__hint {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.source-access-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.source-access-form__section-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.team-edit-form__sources {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .source-access-form__grid {
    grid-template-columns: 1fr;
  }
}

.integrations-table thead th,
.integrations-table tbody td {
  text-align: left;
  vertical-align: middle;
}

.integrations-table thead th {
  padding-left: 1rem;
  padding-right: 0.7rem;
}

.integrations-table tbody td {
  padding-left: 1rem;
  padding-right: 0.7rem;
}

.integrations-table__name {
  width: 38%;
}

.integrations-table__type {
  width: 16%;
}

.integrations-table__status {
  width: 14%;
}

.integrations-table__leads {
  width: 10%;
}

.integrations-table__actions {
  width: 18%;
  text-align: left;
}

.integration-actions-cell {
  text-align: left;
}

.integration-actions-cell .action-group {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.integration-actions .btn-action {
  flex-shrink: 0;
}

.integrations-table tbody td {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.integrations-table tbody td:first-child .muted-text {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.integrations-docs-body {
  display: grid;
  gap: 1rem;
}

.integration-docs-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.integration-code,
.integration-code-block {
  display: block;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.04);
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="dark"] .integration-code,
[data-theme="dark"] .integration-code-block {
  background: rgba(255, 255, 255, 0.06);
}

.integration-form {
  padding-bottom: 0;
}

.crm-modal__panel--integration {
  width: min(56rem, calc(100vw - 2rem));
  max-width: none;
}

.integration-form__body {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  align-items: start;
}

.integration-form__side {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100%;
  padding-left: 1.5rem;
  border-left: 1px solid var(--border);
}

.integration-form__section {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.integration-form__section--primary {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.integration-form__side .integration-form__section {
  border-bottom: 1px solid var(--border);
}

.integration-form__section--last {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0.25rem;
}

.integration-form__section-title {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.integration-form__row {
  display: grid;
  gap: 0.75rem;
}

.integration-form__row--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.integration-form__row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.integration-form .field {
  margin-bottom: 0.75rem;
}

.integration-form .field:last-child {
  margin-bottom: 0;
}

.integration-form .field__optional {
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.integration-form .field__hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
}

.integration-form .field__hint code {
  font-size: 0.74rem;
}

.integration-form input[type="text"],
.integration-form input[type="url"] {
  width: 100%;
  min-height: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

.integration-form input[type="text"]:focus,
.integration-form input[type="url"]:focus {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.integration-auth-picker {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0.75rem;
}

.integration-auth-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.integration-auth-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.integration-auth-option__card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  height: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--content-muted);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.integration-auth-option:hover .integration-auth-option__card {
  border-color: rgba(249, 115, 22, 0.35);
}

.integration-auth-option--active .integration-auth-option__card,
.integration-auth-option input:checked + .integration-auth-option__card {
  border-color: var(--brand-orange);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.integration-auth-option__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.integration-auth-option__hint {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
}

.integration-form__toggles {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.integration-toggle {
  display: block;
  height: 100%;
  cursor: pointer;
}

.integration-toggle__card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  height: 100%;
  min-height: 5.25rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--content-muted);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.integration-toggle:has(.integration-toggle__checkbox:checked) .integration-toggle__card {
  border-color: rgba(249, 115, 22, 0.45);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.integration-toggle__checkbox {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.1rem 0 0;
  accent-color: var(--brand-orange);
  cursor: pointer;
}

.integration-toggle__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
  min-height: 3.5rem;
}

.integration-toggle__title {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
}

.integration-toggle__hint {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.4;
  min-height: 2.8em;
}

.integration-form__foot {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.integration-key-box {
  padding: 0.85rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  word-break: break-all;
  white-space: pre-wrap;
}

.crm-modal__panel--wide {
  width: min(calc(100vw - 2rem), 42rem);
}

.crm-modal__panel--team {
  width: min(calc(100vw - 2rem), 72rem);
  max-height: calc(100vh - 1.5rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crm-modal__panel--team .crm-modal__head {
  flex-shrink: 0;
}

.crm-modal__panel--team .team-edit-form {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.team-edit-form {
  display: grid;
  grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr);
  grid-template-areas:
    "details roster"
    "foot foot";
  column-gap: 1.35rem;
  align-items: start;
}

.team-edit-form__details {
  grid-area: details;
}

.team-edit-form__roster {
  grid-area: roster;
  min-width: 0;
}

.team-edit-form__roster .field {
  margin-bottom: 0;
}

.team-edit-form__foot {
  grid-area: foot;
  margin: 0.85rem -1.15rem 0;
  padding-left: 1.15rem;
  padding-right: 1.15rem;
  border-top: 1px solid var(--border);
}

.crm-modal__panel--team .team-roster-picker {
  max-height: min(62vh, 34rem);
  overflow: auto;
}

@media (max-width: 820px) {
  .crm-modal__panel--team {
    width: calc(100vw - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
  }

  .team-edit-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      "details"
      "roster"
      "foot";
    row-gap: 0.25rem;
  }

  .crm-modal__panel--team .team-roster-picker {
    max-height: min(42vh, 22rem);
  }
}

@media (max-width: 900px) {
  .integration-form__body {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .integration-form__side {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
    padding-top: 1rem;
  }

  .integration-form__section--primary {
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }
}

@media (max-width: 700px) {
  .crm-modal__panel--integration {
    width: calc(100vw - 1.5rem);
  }

  .integration-form__row--2,
  .integration-form__row--3,
  .integration-auth-picker,
  .integration-form__toggles {
    grid-template-columns: 1fr;
  }
}

/* ——— Tasks ——— */
.tasks-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.tasks-view-toggle {
  display: inline-flex;
  gap: 0.25rem;
}

.tasks-view-btn--active {
  border-color: var(--primary);
  color: var(--brand-orange-dark);
  background: var(--primary-soft);
}

.tasks-filters {
  padding: 0 1.15rem 0.85rem;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tasks-filters .filter-bar__row {
  margin: 0;
}

.tasks-filters .filter-bar__fields {
  align-items: flex-end;
}

.tasks-filter-overdue {
  align-self: flex-end;
  padding-bottom: 0.35rem;
  min-width: auto;
}

.tasks-table .task-priority {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: capitalize;
}

.task-priority--high {
  color: #b42318;
  background: rgba(180, 35, 24, 0.1);
}

.task-priority--medium {
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
}

.task-priority--low {
  color: #475569;
  background: rgba(100, 116, 139, 0.12);
}

.task-status-badge {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--content-muted);
}

.task-status-badge--overdue {
  color: #b42318;
  background: rgba(180, 35, 24, 0.1);
}

.tasks-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 0.75rem;
  padding: 0 1.15rem 1.15rem;
  overflow-x: auto;
}

.tasks-kanban__column {
  min-width: 220px;
  background: var(--content-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.tasks-kanban__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.tasks-kanban__head h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.tasks-kanban__count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.tasks-kanban__drop {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem;
  flex: 1;
  min-height: 120px;
}

.tasks-kanban__drop--drag-over {
  background: var(--primary-soft);
  outline: 2px dashed rgba(249, 115, 22, 0.45);
  outline-offset: -4px;
}

.tasks-kanban-card {
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--content-surface);
  cursor: grab;
}

.tasks-kanban-card:active {
  cursor: grabbing;
}

.tasks-kanban-card__title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.tasks-kanban-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
}

.lead-assign-task-fields {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--content-muted);
}

.stat-card--warn .stat-card__value {
  color: #b42318;
}

@media (max-width: 1100px) {
  .tasks-kanban {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 700px) {
  .tasks-kanban {
    grid-template-columns: 1fr;
  }
}

