:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-raised: #ffffff;
  --panel: var(--surface);
  --panel-2: var(--surface-soft);
  --line: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --soft: #374151;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --accent: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --warning: #f59e0b;
  --shadow: 0 14px 38px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --sidebar-width: 248px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #111827;
  --surface-soft: #1f2937;
  --surface-raised: #182235;
  --panel: var(--surface);
  --panel-2: var(--surface-soft);
  --line: #273449;
  --text: #f9fafb;
  --muted: #9ca3af;
  --soft: #d1d5db;
  --blue: #60a5fa;
  --blue-2: #93c5fd;
  --accent: #60a5fa;
  --green: #4ade80;
  --red: #f87171;
  --warning: #fbbf24;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body.amo-settings-mode {
  overflow: hidden;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button, input, textarea, select { max-width: 100%; }
img, svg, video, canvas { max-width: 100%; }
h1, h2, h3, p, span, b, strong, small, button, input, textarea, select, li {
  overflow-wrap: anywhere;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
}

.login-screen.hidden { display: none; }
html.auth-restoring .login-screen { display: none; }
html.auth-restoring .app-shell { visibility: hidden; }

.login-card {
  width: min(520px, 100%);
  margin: auto 0;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card.register-only {
  margin: 0;
}

.login-card h1 { margin-bottom: 12px; }
.login-card small { display: block; color: var(--muted); margin-top: 16px; }
.login-card.register-only #loginForm,
.login-card.register-only #loginAccessNote,
.login-card.register-only #backToLoginBtn {
  display: none !important;
}
.login-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.login-form input,
.login-form select {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
}
.login-form button {
  min-height: 56px;
}
.login-register-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  text-decoration: none;
}
.login-error {
  min-height: 20px;
  color: var(--red);
  font-size: 14px;
  font-weight: 800;
}
.registration-form[hidden] {
  display: none;
}
.registration-note {
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line));
  background: var(--panel-2);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--soft);
  line-height: 1.45;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

body.sidebar-collapsed {
  --sidebar-width: 42px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.drawer-backdrop {
  display: none;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 4px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: url("brand-icon.png?v=20260624-01") center / cover no-repeat;
  color: transparent;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .24);
}

.brand-title { font-size: 15px; font-weight: 900; line-height: 1.1; }
.brand-subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }
.brand > div:last-child { min-width: 0; }

.sidebar-collapse {
  margin-left: auto;
}

body.sidebar-collapsed .brand-mark,
body.sidebar-collapsed .brand > div,
body.sidebar-collapsed .role-panel,
body.sidebar-collapsed .nav {
  display: none;
}

body.sidebar-collapsed .sidebar {
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  scrollbar-gutter: auto;
}

body.sidebar-collapsed .brand {
  width: 100%;
  height: 100vh;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 0 0;
}

body.sidebar-collapsed .sidebar-collapse {
  width: 30px;
  height: 38px;
  min-width: 0;
  margin: 0;
  border-radius: 12px;
  transform: rotate(180deg);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

body.sidebar-collapsed .role-panel,
body.sidebar-collapsed .nav,
body.sidebar-collapsed .nav-item {
  width: 100%;
}

.role-panel {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.role-panel span { color: var(--accent); font-weight: 900; }
.role-panel button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--soft);
  padding: 6px 8px;
  font-weight: 800;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 9px 10px;
  text-align: left;
  font-weight: 800;
  font-size: 14px;
  transition: .18s ease;
  min-width: 0;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--blue) 22%, var(--line));
}

.main {
  width: min(1280px, 100%);
  padding: 28px;
  margin: 0 auto;
  min-width: 0;
  max-width: 100%;
}

body.amo-settings-mode .main {
  width: 100%;
  max-width: none;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -28px -28px 22px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.topbar p {
  margin-top: 3px;
  font-size: 13px;
}

body.amo-settings-mode .topbar {
  margin: 0 -28px 8px;
  padding: 8px 28px;
}

body.amo-settings-mode .topbar h1 {
  font-size: 20px;
}

body.amo-settings-mode .topbar p {
  margin-top: 2px;
}

body.amo-settings-mode .topbar-actions {
  gap: 8px;
}

body.amo-settings-mode .theme-switcher select {
  height: 34px;
}

.mobile-menu-btn {
  display: none;
}

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.theme-switcher select {
  height: 38px;
  min-width: 128px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

.notifications {
  position: relative;
}

.notification-btn {
  position: relative;
}

.notification-btn span {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.notification-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.notification-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 12px;
}

.notification-item + .notification-item {
  border-top: 1px solid var(--line);
}

.view { display: none; animation: fade .2s ease; min-width: 0; }
.view.active { display: block; }
.view:not(.active) { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-kicker {
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 14px;
}

.dashboard-actions {
  display: none;
  grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr);
  gap: 16px;
  margin-bottom: 16px;
}

.staff-mode .dashboard-actions { grid-template-columns: 1fr; }
.staff-mode #openLeadModal,
.staff-mode #quickBalance,
.staff-mode .details-btn.agent-only-hidden { display: none; }

.outline-tab,
.primary-btn,
.secondary-btn,
.filter-btn,
.filter-chip,
.details-btn {
  border: none;
  border-radius: 15px;
  padding: 12px 16px;
  font-weight: 850;
  transition: .18s ease;
}

.outline-tab,
.secondary-btn,
.filter-btn,
.filter-chip,
.details-btn {
  background: var(--surface);
  color: var(--soft);
  border: 1px solid var(--line);
}

.primary-btn {
  color: #fff;
  background: var(--blue);
  box-shadow: var(--shadow-soft);
}

.primary-btn:hover,
.secondary-btn:hover,
.details-btn:hover {
  transform: translateY(-1px);
}

.filter-btn.active {
  background: color-mix(in srgb, var(--blue) 11%, var(--surface));
  color: var(--text);
  border-color: color-mix(in srgb, var(--blue) 30%, var(--line));
}

.admin-only { display: none; }
.role-admin .admin-only { display: inline-flex; }
.role-manager .admin-only { display: none; }
.view.admin-only { display: none; }
.role-admin .view.admin-only.active { display: block; }
.role-admin .view.admin-only:not(.active) { display: none !important; }
.role-admin .nav-item.admin-only { display: block; width: 100%; }

.hero-card,
.panel,
.withdraw-card,
.metric-card,
.info-card,
.stage-help,
.balance-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 24px;
  margin-bottom: 16px;
}

.hero-card::before {
  display: none;
}

.hero-card::after {
  display: none;
}

.hero-card > * { position: relative; z-index: 1; }
.hero-card h1 {
  max-width: 860px;
  margin-top: 16px;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}
.hero-list {
  display: grid;
  gap: 8px;
  max-width: 820px;
  margin-top: 22px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}
.hero-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  min-width: 0;
}
.hero-list li::before {
  content: "";
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}
.hero-list b {
  color: var(--text);
}

.badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 22%, var(--line));
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  font-size: 38px;
  line-height: 1.08;
  margin: 18px 0 14px;
  letter-spacing: 0;
}

h2, h3 { margin: 0 0 8px; }
p { color: var(--muted); line-height: 1.5; margin: 0; }

.progress-wrap { margin-top: 28px; max-width: 560px; }
.progress-head { display: flex; justify-content: space-between; color: var(--soft); margin-bottom: 10px; font-size: 14px; }
.progress-bar { height: 11px; border-radius: 999px; background: color-mix(in srgb, var(--line) 70%, transparent); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }

.withdraw-card {
  padding: 26px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: none;
}

.withdraw-card strong {
  display: block;
  font-size: 36px;
  margin: 8px 0 14px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card { padding: 20px; box-shadow: none; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin: 8px 0 5px; font-size: 26px; letter-spacing: 0; }
.metric-card small { color: var(--green); }

.panel {
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: none;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.period-filter {
  min-width: 180px;
  display: grid;
  gap: 7px;
}

.period-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.period-filter select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--soft);
  padding: 0 12px;
  font-weight: 850;
  outline: none;
}

.funnel { display: grid; gap: 12px; }
.funnel-row {
  display: grid;
  grid-template-columns: 190px 1fr 42px;
  gap: 13px;
  align-items: center;
  padding: 13px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.funnel-row b { color: var(--soft); }
.funnel-row strong { text-align: right; }
.funnel-track { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--line) 70%, transparent); overflow: hidden; }
.funnel-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }

.details-btn {
  display: none;
  width: 240px;
  margin: 8px auto 0;
  text-align: center;
}

.role-panel span,
.role-panel button,
.theme-switcher span,
.theme-switcher select,
.nav-label,
.topbar-actions button {
  white-space: nowrap;
  overflow-wrap: normal;
}

.role-panel span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  flex-shrink: 0;
}

.clients-head,
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
  padding: 26px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.clients-head h1,
.section-title h1 { margin: 0 0 8px; }

.client-filters {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.clients-layout { display: block; }
.table-panel {
  overflow-x: auto;
  max-width: 100%;
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(156px, 1.15fr) minmax(128px, .9fr) minmax(120px, .82fr) minmax(120px, .82fr) minmax(180px, 1.1fr) minmax(88px, .6fr);
  gap: 6px;
  margin-bottom: 10px;
}

.filter-control {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 66px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-soft);
}

.filter-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.filter-control input,
.filter-control select,
.filter-control button {
  height: 36px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--soft);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
  outline: none;
}

.filter-control button {
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-control input:focus,
.filter-control select:focus {
  border-color: rgba(88,180,255,.46);
  box-shadow: 0 0 0 4px rgba(88,180,255,.1);
}

.range-filter {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 6px;
}

.table-head {
  display: grid;
  grid-template-columns: minmax(156px, 1.2fr) minmax(170px, 1.1fr) minmax(92px, .62fr) minmax(138px, .9fr) minmax(104px, .68fr) minmax(92px, .62fr) 42px;
  gap: 6px;
  margin-bottom: 6px;
}

.table-head span {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.table-action-label button:hover {
  color: #fff;
  background: var(--blue);
}

.client-table { display: grid; gap: 8px; }
.client-row {
  display: grid;
  grid-template-columns: minmax(156px, 1.2fr) minmax(170px, 1.1fr) minmax(92px, .62fr) minmax(138px, .9fr) minmax(104px, .68fr) minmax(92px, .62fr) 42px;
  gap: 6px;
  align-items: center;
}

.staff-table .table-toolbar,
.staff-table .table-head,
.staff-table .client-row {
  grid-template-columns: minmax(132px, 1.22fr) minmax(126px, 1fr) minmax(96px, .7fr) minmax(142px, 1.1fr) minmax(96px, .68fr) minmax(86px, .6fr) 42px;
}

.staff-table .filter-control {
  padding: 7px;
}

.staff-table .client-row > *,
.staff-table .table-head span {
  font-size: 13px;
}

.staff-table .client-row > * {
  padding: 7px;
}

.staff-table .status-select {
  padding-left: 8px;
  padding-right: 24px;
  background-position:
    calc(100% - 14px) 50%,
    calc(100% - 9px) 50%,
    0 0;
}
.client-row > * {
  width: 100%;
  height: 56px;
  min-width: 0;
  border: 1px solid var(--line);
  color: var(--soft);
  background: var(--surface);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  text-align: center;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.18;
  overflow: hidden;
}
.client-row span small {
  display: block;
  width: 100%;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-badge {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--green) 22%, var(--line));
}
.client-row button:hover { border-color: rgba(88,180,255,.35); color: var(--text); }
.client-name { color: var(--text); background: rgba(88,180,255,.13); }

.empty-table {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.status-select {
  appearance: none;
  height: 70px;
  padding-right: 30px;
  text-align: center;
  text-align-last: center;
  font-weight: 850;
  white-space: normal;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    var(--surface);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%,
    0 0;
  background-size:
    5px 5px,
    5px 5px,
    100% 100%;
  background-repeat: no-repeat;
}

.chat-layout,
.withdraw-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
}

.chat-list { display: grid; gap: 8px; }
.chat-item {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  color: var(--soft);
  text-align: left;
  border-radius: 16px;
  padding: 13px;
}
.chat-item b, .chat-item span { display: block; }
.chat-item span { color: var(--muted); font-size: 13px; margin-top: 4px; }
.chat-item.active { border-color: rgba(88,180,255,.35); background: rgba(88,180,255,.11); color: var(--text); }
.chat-panel { min-height: 560px; display: flex; flex-direction: column; }
.chat-head { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.messages { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 18px 0; }
.message { max-width: 78%; padding: 13px 15px; border-radius: 17px; line-height: 1.45; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.message.agent { align-self: flex-end; background: rgba(88,180,255,.16); border-color: rgba(88,180,255,.22); }

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-dialog.open {
  display: flex;
}
.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.68);
  backdrop-filter: blur(8px);
}
.confirm-card {
  position: relative;
  width: min(460px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #121926;
  box-shadow: 0 26px 80px rgba(0,0,0,.42);
  padding: 26px;
}
.confirm-card h2 {
  margin-bottom: 10px;
}
.confirm-card p {
  color: var(--muted);
  line-height: 1.5;
}
.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.danger-btn {
  border: 1px solid rgba(255,143,143,.28);
  border-radius: 14px;
  background: linear-gradient(135deg, #ff6f6f, #d9364a);
  color: #fff;
  font-weight: 900;
}
.message small { display: block; margin-top: 7px; color: var(--muted); }
.message-form { display: flex; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.message-form input { flex: 1; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.edit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.edit-actions .secondary-btn { padding: 9px 12px; }

.agent-list,
.manager-list {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.agent-list-head,
.agent-list-row,
.manager-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(110px, .8fr) minmax(80px, .55fr) minmax(130px, .85fr) minmax(120px, .85fr) minmax(100px, .65fr);
  gap: 8px;
  align-items: center;
}

.agent-list-head span {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.agent-list-row {
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.035);
  color: var(--soft);
  text-align: left;
  padding: 8px;
}

.agent-list-row:hover {
  border-color: rgba(88,180,255,.35);
  background: rgba(88,180,255,.09);
}

.agent-list-row > *,
.manager-row > * {
  min-width: 0;
}

.agent-list-row strong,
.agent-list-row span,
.agent-list-row em,
.manager-row strong,
.manager-row span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-list-row strong small,
.manager-row strong small {
  margin-top: 4px;
  color: var(--red);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.agent-list-row.is-disabled,
.manager-row.is-disabled {
  opacity: .62;
  border-color: rgba(255,143,143,.2);
}

.agent-list-row em {
  justify-content: center;
  font-style: normal;
  color: var(--red);
  border: 1px solid rgba(255,143,143,.22);
}

.manager-row {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.035);
}

.manager-list .agent-list-head,
.manager-row {
  min-width: 0;
}

.agent-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.agent-modal.open { display: flex; }

.agent-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.64);
  backdrop-filter: blur(8px);
}

.agent-modal-card {
  position: relative;
  width: min(1040px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(25,33,45,.98), rgba(18,25,36,.98));
  box-shadow: var(--shadow);
  padding: 24px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.compact-metrics {
  margin-bottom: 16px;
}
.info-card { padding: 20px; min-height: 190px; box-shadow: none; }
.info-card p { margin-bottom: 18px; }
.telegram-settings-card {
  display: grid;
  gap: 14px;
}
.telegram-settings-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.telegram-settings-head p {
  margin-bottom: 0;
}
.telegram-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(120, 130, 145, .12);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.telegram-status.is-connected {
  background: rgba(33, 150, 83, .13);
  color: #187443;
}
.telegram-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.telegram-link-row input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.telegram-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.telegram-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
  font-weight: 700;
}
.telegram-toggle input {
  width: 18px;
  height: 18px;
}
.telegram-muted {
  color: var(--muted);
}
.company-info-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.company-info-row:last-child {
  border-bottom: 0;
}
.company-info-row a {
  color: var(--blue);
  font-weight: 900;
}

.support-panel,
.text-panel { max-width: 780px; }
.referral-panel {
  width: 100%;
  max-width: none;
}
.support-panel { display: grid; gap: 12px; }
.integration-layout {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr);
  gap: 16px;
}
.integration-shortcuts {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 28px 36px;
}
.amo-shortcut {
  width: 312px;
  min-height: 164px;
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  text-align: left;
}
.amo-shortcut:hover {
  border-color: rgba(47, 97, 255, .45);
  transform: translateY(-1px);
}
.amo-shortcut strong,
.amo-shortcut small {
  display: block;
  line-height: 1.2;
}
.amo-shortcut strong {
  font-size: 20px;
}
.amo-shortcut small {
  max-width: 150px;
  margin-top: 8px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.amo-shortcut i {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(47, 97, 255, .12);
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}
.amo-shortcut.is-configured i {
  background: rgba(11, 181, 118, .12);
  color: #0bb576;
}
.amo-logo {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #2f61ff, #19b7ff);
  color: #fff;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: 0;
}
.crm-list,
.crm-board {
  display: grid;
  gap: 12px;
}
.crm-item,
.crm-column,
.action-menu {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  border-radius: 14px;
}
.crm-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
}
.crm-item small,
.crm-column small {
  color: var(--muted);
}
.crm-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.small-dots {
  width: 34px;
  height: 34px;
  font-size: 18px;
}
.crm-board {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.crm-column {
  padding: 14px;
}
.crm-column h3 {
  margin-bottom: 10px;
}
.crm-mapping {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(88,180,255,.1);
  color: var(--blue);
  font-weight: 800;
}
.crm-mapping button {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,143,143,.24);
  border-radius: 8px;
  background: rgba(255,143,143,.08);
  color: #ff9b9b;
  font-weight: 900;
}
.crm-mapping-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.crm-mapping-form h3 {
  margin-bottom: 8px;
}
.crm-map-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 0 12px;
  margin-bottom: 14px;
}
.amo-settings-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
#amoSettingsView.active {
  height: var(--amo-settings-height, calc(100vh - 170px));
  overflow: hidden;
}
#amoSettingsBoard {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.amo-settings-head h1 {
  margin: 0 0 2px;
  font-size: 34px;
  line-height: 1.08;
}
.amo-settings-head p {
  color: var(--muted);
  line-height: 1.25;
}
.amo-settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: .48;
  cursor: not-allowed;
  transform: none;
}
.amo-settings-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  margin: 0 0 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.amo-settings-tabs button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}
.amo-settings-tabs button.active {
  background: color-mix(in srgb, var(--blue) 12%, var(--surface-soft));
  color: var(--text);
}
.amo-deal-target {
  display: grid;
  gap: 16px;
  max-width: 760px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.amo-deal-target-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.amo-deal-target-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.15;
}
.amo-deal-target-head p {
  max-width: 520px;
  color: var(--muted);
}
.amo-deal-target-head > span {
  flex: 0 0 auto;
  max-width: 240px;
  padding: 7px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 10%, var(--surface-soft));
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.amo-deal-target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}
.amo-deal-target-preview {
  display: grid;
  gap: 3px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.amo-deal-target-preview small {
  color: var(--muted);
}
.amo-deal-target-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.amo-webhook-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.amo-webhook-line span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.amo-webhook-line input {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--soft);
}
.amo-webhook-line button {
  min-height: 30px;
  padding: 0 12px;
}
.amo-map-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  padding-bottom: 6px;
  scrollbar-gutter: stable;
}
.amo-space-pan .amo-map-scroll {
  cursor: grab;
  user-select: none;
}
.amo-map-scroll.is-panning {
  cursor: grabbing;
}
.amo-map-grid {
  min-width: max(880px, calc(360px + var(--amo-status-count) * 260px));
  height: 100%;
  display: grid;
  grid-template-columns: 340px repeat(var(--amo-status-count), minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
}
.amo-source-column,
.amo-status-column,
.amo-status-empty {
  height: 100%;
  min-height: 360px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.amo-source-column {
  position: sticky;
  left: 0;
  z-index: 2;
}
.amo-column-title {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}
.amo-column-title strong {
  font-size: 16px;
}
.amo-column-title small {
  color: var(--muted);
}
.amo-source-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.amo-source-tools input,
.amo-source-tools select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.amo-stage-list,
.amo-status-dropzone {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}
.amo-stage-list {
  max-height: calc(100% - 142px);
}
.amo-status-dropzone {
  max-height: calc(100% - 54px);
}
.amo-pipeline-group {
  display: grid;
  gap: 8px;
}
.amo-pipeline-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 2px;
  background: var(--surface);
}
.amo-pipeline-heading strong {
  font-size: 13px;
}
.amo-pipeline-heading small {
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 10%, var(--surface-soft));
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.amo-stage-card,
.amo-mapped-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.amo-stage-card {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  grid-template-areas: "copy action";
  gap: 8px;
  align-items: center;
  cursor: grab;
}
.amo-stage-copy {
  grid-area: copy;
  min-width: 0;
}
.amo-stage-actions {
  position: relative;
  grid-area: action;
  justify-self: end;
}
.amo-stage-card strong,
.amo-stage-card small,
.amo-mapped-card strong,
.amo-mapped-card small {
  display: block;
}
.amo-stage-card strong {
  line-height: 1.2;
}
.amo-stage-card small,
.amo-mapped-card small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}
.amo-stage-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
}
.amo-stage-actions .amo-stage-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 45;
  min-width: 230px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
}
.amo-stage-actions .amo-stage-menu[hidden] {
  display: none;
}
.amo-stage-actions .amo-stage-menu button.active {
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
}
.amo-status-column.is-over {
  border-color: rgba(47, 97, 255, .58);
  box-shadow: 0 0 0 3px rgba(47, 97, 255, .12);
}
.amo-status-dropzone {
  min-height: 0;
  align-content: start;
}
.amo-status-dropzone > p {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}
.amo-mapped-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.amo-mapped-card button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(239, 68, 68, .2);
  border-radius: 9px;
  background: rgba(239, 68, 68, .08);
  color: #ef4444;
  font-weight: 900;
}
.status-settings-list {
  display: grid;
  gap: 10px;
}
.status-settings-row {
  display: grid;
  grid-template-columns: minmax(180px, .85fr) minmax(260px, 1.25fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.status-settings-row strong,
.status-settings-row small {
  display: block;
}
.status-settings-row small,
.status-settings-row p {
  color: var(--muted);
  line-height: 1.4;
}
.status-settings-row p {
  margin: 0;
}
.status-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.danger-text {
  color: #ff9b9b;
  border-color: rgba(255,143,143,.22);
}
.row-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
}
.dots-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}
.action-menu {
  position: fixed;
  z-index: 130;
  min-width: 190px;
  padding: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.action-menu button {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 800;
}
.action-menu button:hover {
  background: rgba(88,180,255,.12);
}
.action-menu .danger {
  color: #ff9b9b;
}
.user-actions-dialog {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.user-actions-dialog.open {
  display: flex;
}
.action-card {
  width: min(420px, 100%);
}
.action-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.action-list button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  color: var(--text);
  text-align: left;
  padding: 0 16px;
  font-weight: 900;
}
.action-list button:hover {
  border-color: rgba(88,180,255,.35);
  background: rgba(88,180,255,.11);
}
.action-list .danger {
  color: #ff9b9b;
  border-color: rgba(255,143,143,.22);
}
.edit-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.edit-card {
  width: min(680px, 100%);
}
.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}
.edit-field.full-field {
  grid-column: 1 / -1;
}
.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.checkbox-field input {
  width: 20px;
  height: 20px;
  padding: 0;
}
.assignment-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.assignment-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  color: var(--text);
}
.assignment-item input {
  width: 18px;
  height: 18px;
  padding: 0;
}
.assignment-item span {
  display: grid;
  gap: 3px;
  font-size: 14px;
  font-weight: 900;
}
.assignment-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.instruction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}
.instruction-card h2 {
  margin-bottom: 14px;
}
.instruction-card ul,
.instruction-card ol {
  display: grid;
  gap: 10px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}
.instruction-card b {
  color: var(--text);
}

input, textarea, select {
  width: 100%;
  background: rgba(255,255,255,.055);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
select option { color: #111827; }
input:focus, textarea:focus, select:focus { border-color: rgba(88,180,255,.46); box-shadow: 0 0 0 4px rgba(88,180,255,.1); }

.balance-panel { padding: 24px; }
.balance-panel span { color: var(--muted); }
.balance-panel strong { display: block; font-size: 44px; margin: 10px 0 18px; }
.history-row,
.top-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.top-row { grid-template-columns: 40px 1fr auto auto; }
.history-row:last-child,
.top-row:last-child { border-bottom: none; }
.history-row small,
.top-row small { color: var(--muted); }

.withdrawal-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(110px, auto) minmax(130px, .7fr) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  margin-bottom: 8px;
}
.withdrawal-row strong,
.withdrawal-row small {
  display: block;
}
.withdrawal-row small {
  color: var(--muted);
  margin-top: 4px;
}
.withdrawal-row b {
  color: var(--text);
}
.withdrawal-row select,
.withdrawal-row input {
  min-height: 42px;
}

.copy-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
  gap: 8px;
  margin: 16px 0;
}

.copy-line input {
  min-width: 0;
}

.modal { display: none; position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.68); backdrop-filter: blur(8px); }
.modal-card {
  position: relative;
  width: min(820px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #121926;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--text); border-radius: 14px; font-size: 26px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; align-items: start; }
.lead-form label { color: var(--muted); font-size: 13px; font-weight: 800; display: grid; gap: 8px; }
.lead-form label:last-child { grid-column: 1 / -1; }
.full { width: 100%; }

.hint-popover {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(8px);
}
.hint-popover.open { display: flex; }
.hint-card {
  position: relative;
  width: min(440px, 100%);
  border: 1px solid rgba(88,180,255,.26);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(25,33,45,.98), rgba(18,25,36,.98));
  box-shadow: var(--shadow);
  padding: 24px;
}
.hint-card h3 { font-size: 24px; margin: 0 42px 12px 0; }
.hint-card p { font-size: 16px; margin-bottom: 14px; }
.hint-card strong { color: var(--accent); font-size: 17px; }
.hint-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(20, 26, 36, .96);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
  z-index: 80;
  max-width: 360px;
}
.toast.show { transform: none; opacity: 1; }

.api-bridge-widget {
  display: none !important;
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 90;
  max-width: min(420px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(13, 17, 24, .82);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.api-bridge-widget .api-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}

.api-bridge-widget strong,
.api-bridge-widget small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-bridge-widget strong {
  font-size: 12px;
  color: var(--text);
}

.api-bridge-widget small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.api-bridge-widget button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.05);
  color: var(--soft);
  font-weight: 900;
}

.api-bridge-widget[data-state="online"] .api-dot { background: var(--accent); }
.api-bridge-widget[data-state="offline"] .api-dot { background: var(--red); }
.api-bridge-widget[data-state="loading"] .api-dot { background: var(--blue); }

.dashboard-workspace,
.quick-actions-grid,
.client-detail-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-workspace {
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
}

.dashboard-column {
  display: grid;
  gap: 12px;
}

.activity-list,
.clean-list {
  display: grid;
  gap: 8px;
}

.activity-row,
.clean-row,
.client-detail-row,
.timeline-row,
.comment-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.activity-row strong,
.clean-row strong {
  color: var(--text);
}

.activity-row small,
.clean-row small,
.timeline-row small,
.comment-row small {
  color: var(--muted);
}

.quick-action {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.quick-action span {
  display: block;
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
}

.empty-state {
  min-height: 170px;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 28px;
  border: 1px dashed color-mix(in srgb, var(--muted) 35%, var(--line));
  border-radius: 16px;
  background: var(--surface-soft);
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.empty-state p {
  max-width: 440px;
}

.empty-state .secondary-btn,
.empty-state .primary-btn {
  margin-top: 4px;
}

.dev-mode-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.client-detail-modal .confirm-card {
  width: min(980px, 100%);
}

.client-detail-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, .72fr);
}

.client-detail-section {
  display: grid;
  gap: 10px;
}

.comment-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.attachment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.attachment-row input {
  max-width: 280px;
  padding: 9px;
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
}

.chat-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.message.manager {
  align-self: flex-start;
}

.modal-card,
.confirm-card,
.agent-modal-card,
.hint-card {
  background: var(--surface);
}

.modal-backdrop,
.confirm-backdrop,
.agent-modal-backdrop,
.hint-popover {
  background: rgba(15, 23, 42, .42);
}

.icon-btn {
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--text);
}

button.mobile-menu-btn {
  display: none;
}

input, textarea, select {
  background: var(--surface);
}

.withdrawal-row,
.agent-list-row,
.manager-row,
.crm-item,
.crm-column,
.action-menu {
  background: var(--surface-soft);
}

.toast {
  background: var(--surface);
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 110;
    width: min(320px, calc(100vw - 48px));
    transform: translateX(-104%);
    transition: transform .22s ease;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    border: 0;
    background: rgba(15, 23, 42, .38);
  }
  body.sidebar-open .drawer-backdrop { display: block; }
  button.mobile-menu-btn { display: grid; }
  .sidebar-collapse { display: none; }
  .main { width: 100%; max-width: 100%; }
  .nav { display: flex; }
  .clients-layout, .chat-layout, .withdraw-grid { grid-template-columns: 1fr; }
  .table-panel { overflow-x: auto; }
  .table-toolbar,
  .table-head,
  .client-row { min-width: 860px; }
  .staff-table .table-toolbar,
  .staff-table .table-head,
  .staff-table .client-row { min-width: 900px; }
}

@media (max-width: 760px) {
  .main { padding: 18px; }
  .topbar {
    margin: -18px -18px 18px;
    padding: 14px 18px;
    align-items: flex-start;
  }
  .topbar,
  .topbar-actions {
    flex-wrap: wrap;
  }
  .sidebar { padding: 18px; }
  .dashboard-actions, .metrics-grid, .cards-grid, .instruction-grid, .integration-layout, .crm-board, .dashboard-workspace, .quick-actions-grid, .client-detail-grid, .settings-grid { grid-template-columns: 1fr; }
  .crm-map-grid { grid-template-columns: 1fr; }
  .integration-shortcuts { padding: 4px 0; }
  .amo-settings-head { grid-template-columns: 1fr; }
  .amo-settings-actions { justify-content: flex-start; }
  .amo-deal-target-head,
  .amo-deal-target-actions { align-items: stretch; flex-direction: column; }
  .amo-deal-target-head > span { max-width: 100%; }
  .amo-deal-target-grid { grid-template-columns: 1fr; }
  .amo-webhook-line { grid-template-columns: 1fr; }
  .amo-stage-card {
    grid-template-columns: minmax(0, 1fr) 38px;
    grid-template-areas: "copy action";
  }
  .status-settings-row { grid-template-columns: 1fr; }
  .login-grid { grid-template-columns: 1fr; }
  .agent-list-head,
  .agent-list-row,
  .manager-row { grid-template-columns: 1fr; }
  .edit-grid { grid-template-columns: 1fr; }
  .assignment-list { grid-template-columns: 1fr; }
  .company-info-row { grid-template-columns: 1fr; }
  .copy-line { grid-template-columns: 1fr; }
  .telegram-link-row { grid-template-columns: 1fr; }
  .panel-head { display: grid; }
  .period-filter { min-width: 0; }
  .clients-head, .section-title { display: block; }
  .clients-head .primary-btn { margin-top: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .table-toolbar,
  .staff-table .table-toolbar {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .funnel-row { grid-template-columns: 1fr; }
  .history-row, .top-row { grid-template-columns: 1fr; }
  .withdrawal-row { grid-template-columns: 1fr; }
  .message-form { flex-direction: column; }
  .message { max-width: 92%; }
}

@media (max-width: 620px) {
  .login-card,
  .hero-card,
  .panel,
  .withdraw-card,
  .clients-head,
  .section-title {
    border-radius: 18px;
    padding: 18px;
  }
  .hero-card {
    min-height: auto;
  }
  .hero-card h1,
  h1 {
    font-size: 34px;
    line-height: 1.04;
  }
  .hero-list {
    font-size: 15px;
  }
  .table-toolbar,
  .staff-table .table-toolbar {
    grid-template-columns: 1fr;
  }
  .table-head,
  .client-row {
    min-width: 700px;
  }
  .staff-table .table-head,
  .staff-table .client-row {
    min-width: 740px;
  }
}

/* Kontur-inspired visual refresh. Layout and control positions stay unchanged. */
:root {
  --bg: #f0f0f0;
  --surface: #ffffff;
  --surface-soft: #f6f7f8;
  --surface-raised: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --line: #dbe1e7;
  --text: #222222;
  --muted: #686f77;
  --soft: #2a3846;
  --blue: #1473c8;
  --blue-2: #0f5ea8;
  --accent: #1473c8;
  --green: #12805c;
  --red: #d64242;
  --warning: #d98200;
  --shadow: none;
  --shadow-soft: none;
  --radius: 16px;
  --sidebar-width: 232px;
  --sidebar-bg: #c7dff4;
  --sidebar-hover: rgba(255, 255, 255, .38);
  --nav-active-bg: #ffffff;
  --control-radius: 8px;
  --kontur-font: "Lab Grotesque", -apple-system, BlinkMacSystemFont, Arial, "Liberation Sans", "Nimbus Sans L", sans-serif;
}

body {
  font-family: var(--kontur-font);
  font-size: 14px;
  line-height: 1.57;
  letter-spacing: 0;
  background: var(--bg);
}

h1, h2, h3,
.section-title h1,
.clients-head h1,
.panel h2,
.panel h3,
.topbar h1 {
  font-family: var(--kontur-font);
  letter-spacing: 0;
}

.app-shell {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(33, 62, 88, .12);
  padding: 26px 16px 18px;
  color: #25384a;
  box-shadow: none;
}

.brand {
  gap: 10px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  box-shadow: none;
}

.brand-title {
  font-size: 20px;
  line-height: 1.08;
  font-weight: 800;
  color: #23364a;
}

.brand-subtitle {
  font-size: 18px;
  line-height: 1.25;
  color: #23364a;
  margin-top: 2px;
}

#roleSubtitle {
  display: none;
}

.sidebar-collapse,
.mobile-menu-btn,
.notification-btn,
.icon-btn {
  border-radius: var(--control-radius);
  border-color: rgba(38, 64, 88, .18);
  background: rgba(255,255,255,.25);
  color: #25384a;
  box-shadow: none;
}

.sidebar-collapse:hover,
.mobile-menu-btn:hover,
.notification-btn:hover,
.icon-btn:hover {
  background: rgba(255,255,255,.55);
  border-color: rgba(38, 64, 88, .24);
}

.role-panel {
  padding: 0 0 12px;
  margin-bottom: 8px;
  border: 0;
  border-bottom: 1px solid rgba(33, 62, 88, .12);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.role-panel span {
  color: #25384a;
  font-size: 13px;
  font-weight: 700;
}

.role-panel button {
  height: 34px;
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, .42);
  border: 1px solid rgba(38, 64, 88, .14);
  color: #25384a;
  font-size: 13px;
  font-weight: 700;
}

.nav {
  gap: 0;
}

.nav-item {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: #25384a;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #172a3f;
}

.nav-item.active {
  background: var(--nav-active-bg);
  color: #172a3f;
  box-shadow: none;
}

.nav-item::before {
  content: "";
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  background: currentColor;
  opacity: .95;
  -webkit-mask: var(--nav-icon, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v4l3 2'/%3E%3C/svg%3E")) center / contain no-repeat;
  mask: var(--nav-icon, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v4l3 2'/%3E%3C/svg%3E")) center / contain no-repeat;
}

.nav-item[data-view="dashboard"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11.5 12 4l9 7.5'/%3E%3Cpath d='M5.5 10.5V20h13v-9.5'/%3E%3C/svg%3E"); }
.nav-item[data-view="clients"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5h14v14H5z'/%3E%3Cpath d='M8 9h8M8 13h8M8 17h5'/%3E%3C/svg%3E"); }
.nav-item[data-view="withdrawal"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='6' rx='7' ry='3'/%3E%3Cpath d='M5 6v6c0 1.7 3.1 3 7 3s7-1.3 7-3V6'/%3E%3Cpath d='M5 12v5c0 1.7 3.1 3 7 3s7-1.3 7-3v-5'/%3E%3C/svg%3E"); }
.nav-item[data-view="training"], .nav-item[data-view="materials"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 4h9l3 3v13H6z'/%3E%3Cpath d='M14 4v4h4M8.5 12h7M8.5 16h7'/%3E%3C/svg%3E"); }
.nav-item[data-view="support"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9a2.7 2.7 0 1 1 4.2 2.2c-1 .6-1.7 1.2-1.7 2.3'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E"); }
.nav-item[data-view="agents"], .nav-item[data-view="managers"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3.5 19c.8-3 2.7-5 5.5-5s4.7 2 5.5 5'/%3E%3Cpath d='M16 11a2.5 2.5 0 1 0 0-5'/%3E%3Cpath d='M17 14c1.8.4 3 1.9 3.5 5'/%3E%3C/svg%3E"); }
.nav-item[data-view="chat"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5h14v10H8l-3 4z'/%3E%3Cpath d='M8.5 9h7M8.5 12h4'/%3E%3C/svg%3E"); }
.nav-item[data-view="statuses"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l4 4L19 6'/%3E%3Cpath d='M5 5h10M5 19h14'/%3E%3C/svg%3E"); }
.nav-item[data-view="integrations"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 3v3M12 18v3M4.2 7.5l2.6 1.5M17.2 15l2.6 1.5M4.2 16.5 6.8 15M17.2 9l2.6-1.5'/%3E%3C/svg%3E"); }
.nav-item[data-view="settings"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.nav-item[data-view="logs"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 4h12v16H6z'/%3E%3Cpath d='M9 8h6M9 12h6M9 16h4'/%3E%3C/svg%3E"); }

.main {
  background: var(--bg);
}

.topbar {
  margin: 0;
  padding: 28px 32px 20px;
  border-bottom: 0;
  background: transparent;
  min-height: auto;
}

.topbar h1,
.section-title h1,
.clients-head h1 {
  font-size: 32px;
  line-height: 1.15;
  font-weight: 800;
  color: var(--text);
}

.topbar p,
.section-title p,
.clients-head p {
  margin-top: 4px;
  color: #5f666d;
  font-size: 14px;
}

.theme-switcher {
  gap: 10px;
}

.theme-switcher span {
  color: #5f666d;
  font-size: 14px;
  font-weight: 700;
}

.theme-switcher select,
input,
textarea,
select {
  border-radius: var(--control-radius);
  border: 1px solid #d6dde4;
  background: #ffffff;
  color: var(--text);
  box-shadow: none;
}

.theme-switcher select {
  height: 38px;
  min-width: 138px;
  padding: 0 34px 0 14px;
  font-weight: 700;
}

input,
textarea,
select {
  min-height: 40px;
  padding: 9px 12px;
  font-size: 14px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #8fc7f3;
  box-shadow: 0 0 0 3px rgba(20, 115, 200, .12);
}

.view.active {
  padding: 0 32px 32px;
}

.panel,
.metric-card,
.clients-head,
.section-title,
.hero-card,
.withdraw-card,
.table-panel,
.modal-card,
.login-card,
.amo-source-column,
.amo-status-column,
.amo-status-empty {
  background: #ffffff;
  border: 0;
  border-radius: 16px;
  box-shadow: none;
}

.panel,
.metric-card,
.clients-head,
.section-title,
.table-panel {
  padding: 24px 32px;
}

.panel h2,
.panel h3,
.metric-card strong {
  color: var(--text);
}

.metric-card {
  min-height: 142px;
}

.metric-card span {
  color: #666f77;
  font-size: 14px;
}

.metric-card strong {
  margin: 10px 0 6px;
  font-size: 36px;
  line-height: 1.1;
  font-weight: 800;
}

.metric-card small {
  color: #12805c;
  font-weight: 700;
}

.primary-btn,
.secondary-btn,
.client-row button,
.empty-state button,
.copy-line button,
.status-select,
.filter-btn {
  border-radius: var(--control-radius);
  box-shadow: none;
  letter-spacing: 0;
}

.primary-btn {
  background: #222222;
  color: #ffffff;
  border-color: #222222;
  font-weight: 700;
}

.primary-btn:hover {
  background: #111111;
  border-color: #111111;
  transform: none;
}

.secondary-btn,
.client-row button,
.empty-state button,
.copy-line button {
  background: #ffffff;
  color: #222222;
  border: 1px solid #d6dde4;
  font-weight: 700;
}

.secondary-btn:hover,
.client-row button:hover,
.empty-state button:hover,
.copy-line button:hover {
  border-color: #aeb9c4;
  color: #111111;
  background: #f8fafc;
  transform: none;
}

.table-toolbar,
.staff-table .table-toolbar {
  background: transparent;
  border: 0;
  padding: 0;
}

.table-head {
  color: #606a73;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
}

.client-row,
.agent-list-row,
.manager-row,
.history-row,
.top-row,
.withdrawal-row {
  border-radius: 12px;
  border: 1px solid #e2e7ec;
  background: #ffffff;
  box-shadow: none;
}

.client-row:hover,
.agent-list-row:hover,
.manager-row:hover {
  background: #f8fbff;
  border-color: #c8d8e8;
}

.status-badge,
.filter-btn.active {
  border-radius: 999px;
  background: #e8f4ff;
  color: #135f9b;
  border: 1px solid #c7e4fb;
}

.empty-state {
  border-radius: 16px;
  border-color: #dbe2ea;
  background: #fafafa;
}

.modal {
  backdrop-filter: none;
}

.modal-card {
  border: 0;
  padding: 28px 32px;
}

.modal-head h3 {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
}

.login-screen {
  background: var(--bg);
}

.login-card {
  border: 0;
  color: var(--text);
}

.login-card h1 {
  color: var(--text);
}

body.sidebar-collapsed .sidebar {
  width: 72px;
  background: var(--sidebar-bg);
}

body.sidebar-collapsed .sidebar-collapse {
  background: #ffffff;
}

/* Service-wide Kontur visual pass. Pure skin layer, no control relocation. */
:root {
  --kontur-page: #f0f0f0;
  --kontur-sidebar: #c7dff4;
  --kontur-text: #222222;
  --kontur-muted: #676f77;
  --kontur-line: #e0e4e8;
  --kontur-row: #f7f8f9;
  --kontur-row-hover: #eef7ff;
  --kontur-blue: #1473c8;
  --kontur-focus: #8fc7f3;
}

html,
body {
  background: var(--kontur-page);
  color: var(--kontur-text);
}

.main,
.view.active,
.login-screen,
.app-shell {
  background: var(--kontur-page);
}

.topbar,
body.amo-settings-mode .topbar {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.topbar h1,
.section-title h1,
.clients-head h1,
.amo-settings-head h1,
.login-card h1,
.hero-card h1 {
  color: var(--kontur-text);
  font-size: 32px;
  line-height: 1.14;
  font-weight: 800;
  letter-spacing: 0;
}

.panel h2,
.panel h3,
.modal-head h3,
.confirm-card h2,
.hint-card h3 {
  color: var(--kontur-text);
  font-size: 26px;
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: 0;
}

p,
small,
.topbar p,
.section-title p,
.clients-head p,
.amo-settings-head p,
.login-card p,
.hint-card p {
  color: var(--kontur-muted);
}

.page-kicker {
  color: var(--kontur-blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.panel,
.metric-card,
.info-card,
.stage-help,
.balance-panel,
.withdraw-card,
.hero-card,
.clients-head,
.section-title,
.table-panel,
.modal-card,
.confirm-card,
.agent-modal-card,
.hint-card,
.notification-popover,
.toast,
.amo-source-column,
.amo-status-column,
.amo-status-empty,
.amo-shortcut,
.crm-item,
.crm-column,
.action-menu,
.quick-action,
.empty-state,
.referral-panel,
.support-panel,
.text-panel {
  background: #ffffff;
  border: 0;
  border-radius: 16px;
  box-shadow: none;
  color: var(--kontur-text);
}

.panel,
.metric-card,
.clients-head,
.section-title,
.table-panel,
.confirm-card,
.agent-modal-card,
.hint-card {
  padding: 24px 32px;
}

.hero-card,
.withdraw-card {
  padding: 28px 32px;
}

.metric-card {
  min-height: 118px;
}

.metric-card span,
.filter-control span,
.period-filter span,
.lead-form label,
.edit-field span,
.amo-column-title small,
.amo-webhook-line span {
  color: var(--kontur-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.metric-card strong {
  color: var(--kontur-text);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 800;
}

.metric-card small,
.clean-row small,
.activity-row small,
.client-detail-row small,
.timeline-row small,
.comment-row small,
.history-row small,
.top-row small,
.withdrawal-row small,
.agent-list-row strong small,
.manager-row strong small {
  color: var(--kontur-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.primary-btn,
.secondary-btn,
.outline-tab,
.details-btn,
.filter-btn,
.filter-chip,
.client-row button,
.empty-state button,
.copy-line button,
.quick-action,
.dots-btn,
.amo-stage-menu-btn,
.danger-btn,
.theme-switcher select,
.role-panel button {
  min-height: 38px;
  border-radius: 8px;
  box-shadow: none;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  transform: none;
}

.primary-btn {
  background: #222222;
  border-color: #222222;
  color: #ffffff;
}

.primary-btn:hover {
  background: #111111;
  border-color: #111111;
  transform: none;
}

.secondary-btn,
.outline-tab,
.details-btn,
.filter-btn,
.filter-chip,
.client-row button,
.empty-state button,
.copy-line button,
.theme-switcher select,
.role-panel button {
  background: #ffffff;
  border: 1px solid #d4d9de;
  color: #222222;
}

.secondary-btn:hover,
.outline-tab:hover,
.details-btn:hover,
.filter-btn:hover,
.filter-chip:hover,
.client-row button:hover,
.empty-state button:hover,
.copy-line button:hover,
.quick-action:hover,
.role-panel button:hover {
  background: #f7f8f9;
  border-color: #bac4cc;
  color: #111111;
  transform: none;
}

.filter-btn.active,
.outline-tab.active,
.status-badge,
.badge {
  background: #e8f4ff;
  border: 1px solid #c7e4fb;
  color: #135f9b;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

input,
textarea,
select,
.filter-control input,
.filter-control select,
.filter-control button,
.period-filter select,
.amo-source-tools input,
.amo-source-tools select,
.copy-line input,
.comment-form textarea {
  background: #ffffff;
  border: 1px solid #d6dde4;
  border-radius: 8px;
  color: var(--kontur-text);
  box-shadow: none;
  font-weight: 500;
}

input:focus,
textarea:focus,
select:focus,
.filter-control input:focus,
.filter-control select:focus,
.period-filter select:focus,
.amo-source-tools input:focus,
.amo-source-tools select:focus,
.copy-line input:focus,
.comment-form textarea:focus {
  border-color: var(--kontur-focus);
  box-shadow: 0 0 0 3px rgba(20, 115, 200, .12);
  outline: none;
}

.filter-control {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.table-head span,
.agent-list-head span {
  background: transparent;
  border: 0;
  color: #59636d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.client-row,
.agent-list-row,
.manager-row,
.history-row,
.top-row,
.withdrawal-row,
.clean-row,
.activity-row,
.client-detail-row,
.timeline-row,
.comment-row,
.funnel-row,
.status-settings-row,
.amo-stage-card,
.amo-mapped-card,
.chat-item,
.notification-item {
  background: var(--kontur-row);
  border: 1px solid var(--kontur-line);
  border-radius: 12px;
  box-shadow: none;
  color: var(--kontur-text);
}

.client-row > * {
  background: transparent;
  border: 0;
  color: var(--kontur-text);
}

.client-name {
  background: #e8f4ff;
  color: #135f9b;
}

.client-row:hover,
.agent-list-row:hover,
.manager-row:hover,
.chat-item:hover,
.quick-action:hover,
.amo-stage-card:hover {
  background: var(--kontur-row-hover);
  border-color: #c8d8e8;
}

.funnel-track,
.progress-bar {
  background: #e5e8eb;
}

.funnel-track span,
.progress-bar span {
  background: var(--kontur-blue);
}

.message {
  background: #ffffff;
  border: 1px solid var(--kontur-line);
  color: var(--kontur-text);
}

.message.agent {
  background: #e8f4ff;
  border-color: #c7e4fb;
}

.message-form,
.chat-head {
  border-color: var(--kontur-line);
}

.modal-backdrop,
.confirm-backdrop,
.agent-modal-backdrop,
.hint-popover {
  background: rgba(34, 34, 34, .42);
  backdrop-filter: none;
}

.confirm-actions {
  gap: 10px;
}

.danger-btn {
  background: #d64242;
  border: 1px solid #d64242;
  color: #ffffff;
}

.danger-text {
  color: #c82f2f;
  border-color: #f0c7c7;
}

.action-list button,
.action-menu button {
  color: var(--kontur-text);
  background: transparent;
  border-radius: 8px;
}

.action-list button:hover,
.action-menu button:hover {
  background: #f0f6fb;
}

.dots-btn,
.small-dots,
.amo-stage-menu-btn,
.row-actions button,
.crm-mapping button,
.amo-mapped-card button,
.hint-close {
  background: #ffffff;
  border: 1px solid #d4d9de;
  color: #222222;
  box-shadow: none;
}

.dots-btn:hover,
.small-dots:hover,
.amo-stage-menu-btn:hover,
.row-actions button:hover,
.crm-mapping button:hover,
.amo-mapped-card button:hover,
.hint-close:hover {
  background: #f7f8f9;
  border-color: #bac4cc;
  color: #111111;
}

.amo-logo {
  background: #222222;
  border-radius: 16px;
  color: #ffffff;
}

.amo-shortcut i,
.amo-shortcut.is-configured i {
  background: #e8f4ff;
  color: #135f9b;
}

.amo-status-dropzone > p {
  background: #ffffff;
  border-color: #d8e0e7;
  color: var(--kontur-muted);
}

.amo-stage-actions .amo-stage-menu {
  background: #ffffff;
  border: 1px solid var(--kontur-line);
  box-shadow: 0 12px 32px rgba(34, 34, 34, .12);
}

.empty-state {
  border: 1px dashed #ccd5dd;
  background: #fafafa;
}

.toast {
  border: 0;
  color: var(--kontur-text);
  box-shadow: 0 10px 30px rgba(34, 34, 34, .12);
}

.notification-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: #222222;
}

.notification-btn::before {
  content: "";
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9'/%3E%3Cpath d='M13.7 21a2 2 0 0 1-3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9'/%3E%3Cpath d='M13.7 21a2 2 0 0 1-3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
}

.notification-btn span {
  display: none;
}

.notification-btn:hover {
  background: rgba(255, 255, 255, .5);
  border: 0;
  color: #111111;
}

.notification-popover {
  box-shadow: 0 16px 40px rgba(34, 34, 34, .12);
}

.sidebar {
  background: var(--kontur-sidebar);
}

body.sidebar-collapsed .sidebar {
  background: var(--kontur-sidebar);
}

.sidebar-collapse,
body.sidebar-collapsed .sidebar-collapse,
.sidebar-collapse:hover,
body.sidebar-collapsed .sidebar-collapse:hover {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #25384a;
}

/* Dark theme for the full service skin. */
html[data-theme="dark"] {
  --bg: #181818;
  --surface: #242424;
  --surface-soft: #2b2d30;
  --surface-raised: #2a2a2a;
  --panel: #242424;
  --panel-2: #2b2d30;
  --line: #3d444b;
  --text: #f2f3f4;
  --muted: #a9b0b7;
  --soft: #dfe5ea;
  --blue: #72b9ff;
  --blue-2: #9accff;
  --accent: #72b9ff;
  --green: #62d69f;
  --red: #ff7676;
  --warning: #ffbd6b;
  --sidebar-bg: #22313d;
  --sidebar-hover: rgba(255, 255, 255, .08);
  --nav-active-bg: #334554;
  --kontur-page: #181818;
  --kontur-sidebar: #22313d;
  --kontur-text: #f2f3f4;
  --kontur-muted: #a9b0b7;
  --kontur-line: #3d444b;
  --kontur-row: #2b2d30;
  --kontur-row-hover: #333a42;
  --kontur-blue: #72b9ff;
  --kontur-focus: #72b9ff;
  color-scheme: dark;
}

html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .main,
html[data-theme="dark"] .view.active,
html[data-theme="dark"] .login-screen {
  background: var(--kontur-page);
  color: var(--kontur-text);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] body.sidebar-collapsed .sidebar {
  background: var(--kontur-sidebar);
  border-right-color: rgba(255, 255, 255, .08);
  color: #eef5fa;
}

html[data-theme="dark"] .brand-title,
html[data-theme="dark"] .brand-subtitle,
html[data-theme="dark"] .role-panel span,
html[data-theme="dark"] .nav-item,
html[data-theme="dark"] .sidebar-collapse,
html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse,
html[data-theme="dark"] .sidebar-collapse:hover,
html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse:hover {
  color: #eef5fa;
}

html[data-theme="dark"] .role-panel {
  border-bottom-color: rgba(255, 255, 255, .1);
}

html[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, .08);
  color: #ffffff;
}

html[data-theme="dark"] .nav-item.active {
  background: var(--nav-active-bg);
  color: #ffffff;
}

html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .section-title h1,
html[data-theme="dark"] .clients-head h1,
html[data-theme="dark"] .amo-settings-head h1,
html[data-theme="dark"] .login-card h1,
html[data-theme="dark"] .hero-card h1,
html[data-theme="dark"] .panel h2,
html[data-theme="dark"] .panel h3,
html[data-theme="dark"] .modal-head h3,
html[data-theme="dark"] .confirm-card h2,
html[data-theme="dark"] .hint-card h3,
html[data-theme="dark"] .metric-card strong,
html[data-theme="dark"] .empty-state strong,
html[data-theme="dark"] .activity-row strong,
html[data-theme="dark"] .clean-row strong,
html[data-theme="dark"] .client-detail-row strong,
html[data-theme="dark"] .timeline-row strong,
html[data-theme="dark"] .comment-row strong,
html[data-theme="dark"] .agent-list-row strong,
html[data-theme="dark"] .manager-row strong,
html[data-theme="dark"] .amo-column-title strong,
html[data-theme="dark"] .amo-stage-card strong,
html[data-theme="dark"] .amo-mapped-card strong {
  color: var(--kontur-text);
}

html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] .topbar p,
html[data-theme="dark"] .section-title p,
html[data-theme="dark"] .clients-head p,
html[data-theme="dark"] .amo-settings-head p,
html[data-theme="dark"] .login-card p,
html[data-theme="dark"] .hint-card p,
html[data-theme="dark"] .metric-card span,
html[data-theme="dark"] .filter-control span,
html[data-theme="dark"] .period-filter span,
html[data-theme="dark"] .lead-form label,
html[data-theme="dark"] .edit-field span,
html[data-theme="dark"] .amo-column-title small,
html[data-theme="dark"] .amo-webhook-line span,
html[data-theme="dark"] .amo-stage-card small,
html[data-theme="dark"] .amo-mapped-card small {
  color: var(--kontur-muted);
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .stage-help,
html[data-theme="dark"] .balance-panel,
html[data-theme="dark"] .withdraw-card,
html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .clients-head,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .confirm-card,
html[data-theme="dark"] .agent-modal-card,
html[data-theme="dark"] .hint-card,
html[data-theme="dark"] .notification-popover,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .amo-source-column,
html[data-theme="dark"] .amo-status-column,
html[data-theme="dark"] .amo-status-empty,
html[data-theme="dark"] .amo-shortcut,
html[data-theme="dark"] .crm-item,
html[data-theme="dark"] .crm-column,
html[data-theme="dark"] .action-menu,
html[data-theme="dark"] .quick-action,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .referral-panel,
html[data-theme="dark"] .support-panel,
html[data-theme="dark"] .text-panel {
  background: var(--surface);
  border-color: transparent;
  color: var(--kontur-text);
}

html[data-theme="dark"] .client-row,
html[data-theme="dark"] .agent-list-row,
html[data-theme="dark"] .manager-row,
html[data-theme="dark"] .history-row,
html[data-theme="dark"] .top-row,
html[data-theme="dark"] .withdrawal-row,
html[data-theme="dark"] .clean-row,
html[data-theme="dark"] .activity-row,
html[data-theme="dark"] .client-detail-row,
html[data-theme="dark"] .timeline-row,
html[data-theme="dark"] .comment-row,
html[data-theme="dark"] .funnel-row,
html[data-theme="dark"] .status-settings-row,
html[data-theme="dark"] .amo-stage-card,
html[data-theme="dark"] .amo-mapped-card,
html[data-theme="dark"] .chat-item,
html[data-theme="dark"] .notification-item,
html[data-theme="dark"] .empty-table {
  background: var(--kontur-row);
  border-color: var(--kontur-line);
  color: var(--kontur-text);
}

html[data-theme="dark"] .client-row:hover,
html[data-theme="dark"] .agent-list-row:hover,
html[data-theme="dark"] .manager-row:hover,
html[data-theme="dark"] .chat-item:hover,
html[data-theme="dark"] .quick-action:hover,
html[data-theme="dark"] .amo-stage-card:hover {
  background: var(--kontur-row-hover);
  border-color: #53616e;
}

html[data-theme="dark"] .client-row > * {
  background: transparent;
  border-color: transparent;
  color: var(--kontur-text);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .filter-control input,
html[data-theme="dark"] .filter-control select,
html[data-theme="dark"] .filter-control button,
html[data-theme="dark"] .period-filter select,
html[data-theme="dark"] .amo-source-tools input,
html[data-theme="dark"] .amo-source-tools select,
html[data-theme="dark"] .copy-line input,
html[data-theme="dark"] .comment-form textarea {
  background: #2a2d30;
  border-color: var(--kontur-line);
  color: var(--kontur-text);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #7f8992;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] .filter-control input:focus,
html[data-theme="dark"] .filter-control select:focus,
html[data-theme="dark"] .period-filter select:focus,
html[data-theme="dark"] .amo-source-tools input:focus,
html[data-theme="dark"] .amo-source-tools select:focus,
html[data-theme="dark"] .copy-line input:focus,
html[data-theme="dark"] .comment-form textarea:focus {
  border-color: var(--kontur-focus);
  box-shadow: 0 0 0 3px rgba(114, 185, 255, .16);
}

html[data-theme="dark"] .primary-btn {
  background: #f4f5f6;
  border-color: #f4f5f6;
  color: #1b1b1b;
}

html[data-theme="dark"] .primary-btn:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #111111;
}

html[data-theme="dark"] .secondary-btn,
html[data-theme="dark"] .outline-tab,
html[data-theme="dark"] .details-btn,
html[data-theme="dark"] .filter-btn,
html[data-theme="dark"] .filter-chip,
html[data-theme="dark"] .client-row button,
html[data-theme="dark"] .empty-state button,
html[data-theme="dark"] .copy-line button,
html[data-theme="dark"] .theme-switcher select,
html[data-theme="dark"] .role-panel button,
html[data-theme="dark"] .dots-btn,
html[data-theme="dark"] .small-dots,
html[data-theme="dark"] .amo-stage-menu-btn,
html[data-theme="dark"] .row-actions button,
html[data-theme="dark"] .crm-mapping button,
html[data-theme="dark"] .amo-mapped-card button,
html[data-theme="dark"] .hint-close {
  background: #2a2d30;
  border-color: var(--kontur-line);
  color: var(--kontur-text);
}

html[data-theme="dark"] .secondary-btn:hover,
html[data-theme="dark"] .outline-tab:hover,
html[data-theme="dark"] .details-btn:hover,
html[data-theme="dark"] .filter-btn:hover,
html[data-theme="dark"] .filter-chip:hover,
html[data-theme="dark"] .client-row button:hover,
html[data-theme="dark"] .empty-state button:hover,
html[data-theme="dark"] .copy-line button:hover,
html[data-theme="dark"] .quick-action:hover,
html[data-theme="dark"] .role-panel button:hover,
html[data-theme="dark"] .dots-btn:hover,
html[data-theme="dark"] .small-dots:hover,
html[data-theme="dark"] .amo-stage-menu-btn:hover,
html[data-theme="dark"] .row-actions button:hover,
html[data-theme="dark"] .hint-close:hover {
  background: #33373b;
  border-color: #58616a;
  color: #ffffff;
}

html[data-theme="dark"] .filter-btn.active,
html[data-theme="dark"] .outline-tab.active,
html[data-theme="dark"] .status-badge,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .amo-shortcut i,
html[data-theme="dark"] .amo-shortcut.is-configured i {
  background: rgba(114, 185, 255, .16);
  border-color: rgba(114, 185, 255, .32);
  color: #9accff;
}

html[data-theme="dark"] .client-name {
  background: rgba(114, 185, 255, .14);
  color: #d7ecff;
}

html[data-theme="dark"] .table-head span,
html[data-theme="dark"] .agent-list-head span {
  color: #a9b0b7;
}

html[data-theme="dark"] .progress-bar,
html[data-theme="dark"] .funnel-track {
  background: #3a3f44;
}

html[data-theme="dark"] .progress-bar span,
html[data-theme="dark"] .funnel-track span {
  background: var(--kontur-blue);
}

html[data-theme="dark"] .message {
  background: #2a2d30;
  border-color: var(--kontur-line);
  color: var(--kontur-text);
}

html[data-theme="dark"] .message.agent {
  background: rgba(114, 185, 255, .16);
  border-color: rgba(114, 185, 255, .28);
}

html[data-theme="dark"] .message-form,
html[data-theme="dark"] .chat-head {
  border-color: var(--kontur-line);
}

html[data-theme="dark"] .modal-backdrop,
html[data-theme="dark"] .confirm-backdrop,
html[data-theme="dark"] .agent-modal-backdrop,
html[data-theme="dark"] .hint-popover {
  background: rgba(0, 0, 0, .58);
}

html[data-theme="dark"] .danger-btn {
  background: #e35454;
  border-color: #e35454;
  color: #ffffff;
}

html[data-theme="dark"] .danger-text {
  color: #ff8d8d;
  border-color: rgba(255, 141, 141, .28);
}

html[data-theme="dark"] .action-list button,
html[data-theme="dark"] .action-menu button {
  color: var(--kontur-text);
}

html[data-theme="dark"] .action-list button:hover,
html[data-theme="dark"] .action-menu button:hover {
  background: #333a42;
}

html[data-theme="dark"] .amo-logo {
  background: #f4f5f6;
  color: #1b1b1b;
}

html[data-theme="dark"] .amo-status-dropzone > p,
html[data-theme="dark"] .empty-state {
  background: #242424;
  border-color: #4a525a;
  color: var(--kontur-muted);
}

html[data-theme="dark"] .amo-stage-actions .amo-stage-menu,
html[data-theme="dark"] .notification-popover {
  background: #242424;
  border-color: var(--kontur-line);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .38);
}

html[data-theme="dark"] .notification-btn,
html[data-theme="dark"] .notification-btn:hover {
  background: transparent;
  border: 0;
  color: #f2f3f4;
}

html[data-theme="dark"] .sidebar-collapse,
html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse,
html[data-theme="dark"] .sidebar-collapse:hover,
html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse:hover {
  background: transparent;
  border: 0;
  color: #eef5fa;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #5b626a;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #26292d;
}

@media (min-width: 1101px) {
  .app-shell {
    display: block;
    min-height: 100vh;
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--sidebar-width);
    height: 100vh;
    max-height: 100vh;
  }

  .main {
    width: min(1280px, calc(100% - var(--sidebar-width)));
    margin-left: calc(var(--sidebar-width) + max(0px, calc((100% - var(--sidebar-width) - 1280px) / 2)));
    margin-right: 0;
  }

  body.amo-settings-mode .main {
    width: calc(100% - var(--sidebar-width));
    max-width: none;
    margin-left: var(--sidebar-width);
    margin-right: 0;
  }
}

/* Balance Agent gradient visual skin. References: dashboard + agent-view HTML mockups. */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-raised: #ffffff;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e5ebf3;
  --line-strong: #d8e1ec;
  --text: #172033;
  --muted: #718096;
  --muted-2: #9aa7b8;
  --soft: #344154;
  --blue: #316cff;
  --blue-2: #6f58f7;
  --accent: #316cff;
  --green: #16a36a;
  --red: #df5361;
  --warning: #d98916;
  --shadow: 0 14px 36px rgba(25, 44, 77, .11);
  --shadow-soft: 0 1px 2px rgba(21, 34, 56, .04), 0 10px 26px rgba(34, 52, 84, .055);
  --radius: 18px;
  --sidebar-bg: rgba(255, 255, 255, .92);
  --sidebar-hover: rgba(49, 108, 255, .07);
  --nav-active-bg: #edf3ff;
  --control-radius: 11px;
  --kontur-page: #f4f7fb;
  --kontur-sidebar: rgba(255, 255, 255, .92);
  --kontur-text: #172033;
  --kontur-muted: #718096;
  --kontur-line: #e5ebf3;
  --kontur-row: #ffffff;
  --kontur-row-hover: #f6faff;
  --kontur-blue: #316cff;
  --kontur-focus: #97b8ff;
  --grad-violet: rgba(111, 88, 247, .14);
  --grad-blue: rgba(49, 108, 255, .12);
  --grad-mint: rgba(48, 196, 178, .12);
  --grad-gold: rgba(255, 196, 82, .10);
  --block-glow: rgba(255, 255, 255, .68);
  --gradient-card:
    radial-gradient(circle at 100% 0%, var(--grad-violet), transparent 38%),
    radial-gradient(circle at 0% 100%, var(--grad-mint), transparent 36%),
    linear-gradient(125deg, color-mix(in srgb, #edf3ff 26%, var(--surface)) 0%, color-mix(in srgb, var(--surface) 96%, #fff) 54%, color-mix(in srgb, var(--surface-soft) 92%, #fff) 100%);
}

html,
body,
.app-shell,
.main,
.view.active,
.login-screen {
  background:
    radial-gradient(circle at 72% -20%, rgba(74, 116, 255, .10), transparent 33%),
    radial-gradient(circle at 14% 112%, rgba(48, 196, 178, .08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  color: var(--text);
}

.main {
  background: transparent;
}

.topbar,
body.amo-settings-mode .topbar {
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  box-shadow: none;
  backdrop-filter: blur(15px);
}

.sidebar,
body.sidebar-collapsed .sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: blur(18px);
  color: var(--text);
}

.brand {
  gap: 11px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(49, 108, 255, .24);
}

.brand-title {
  color: var(--text);
  font-size: 18px;
  line-height: 1.04;
  font-weight: 820;
  letter-spacing: -.02em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

#roleSubtitle {
  display: none;
}

.role-panel {
  padding: 12px 0 13px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
}

.role-panel span,
.nav-item,
.sidebar-collapse,
body.sidebar-collapsed .sidebar-collapse,
.sidebar-collapse:hover,
body.sidebar-collapsed .sidebar-collapse:hover {
  color: var(--soft);
}

.sidebar-collapse,
.sidebar-collapse:hover,
body.sidebar-collapsed .sidebar-collapse,
body.sidebar-collapsed .sidebar-collapse:hover {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.role-panel button,
.mobile-menu-btn,
.icon-btn:not(.sidebar-collapse):not(.notification-btn) {
  border: 1px solid color-mix(in srgb, var(--line) 75%, rgba(62, 112, 255, .16));
  background:
    radial-gradient(circle at 85% 10%, var(--grad-blue), transparent 40%),
    linear-gradient(135deg, color-mix(in srgb, #edf3ff 36%, var(--surface)) 0%, var(--surface) 100%);
  border-radius: var(--control-radius);
  box-shadow: var(--shadow-soft);
}

.notification-btn,
.notification-btn:hover {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--text);
}

.notification-btn::before {
  width: 24px;
  height: 24px;
}

.nav {
  gap: 4px;
}

.nav-item {
  min-height: 42px;
  border-radius: 11px;
  font-weight: 620;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--text);
  transform: translateX(1px);
}

.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--blue);
  font-weight: 760;
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: -16px;
  width: 3px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: var(--blue);
}

.topbar h1,
.section-title h1,
.clients-head h1,
.amo-settings-head h1,
.login-card h1,
.hero-card h1 {
  color: var(--text);
  font-size: 32px;
  line-height: 1.14;
  font-weight: 800;
  letter-spacing: -.025em;
}

p,
small,
.topbar p,
.section-title p,
.clients-head p,
.amo-settings-head p,
.login-card p,
.hint-card p,
.panel-sub,
.muted,
.empty-state p {
  color: var(--muted);
}

.panel,
.metric-card,
.info-card,
.stage-help,
.balance-panel,
.withdraw-card,
.hero-card,
.clients-head,
.section-title,
.table-panel,
.modal-card,
.login-card,
.confirm-card,
.agent-modal-card,
.hint-card,
.notification-popover,
.toast,
.amo-source-column,
.amo-status-column,
.amo-status-empty,
.amo-shortcut,
.crm-item,
.crm-column,
.action-menu,
.quick-action,
.empty-state,
.referral-panel,
.support-panel,
.text-panel,
.amo-deal-target,
.chat-list,
.chat-thread,
.chat-detail,
.details-card,
.client-detail-card {
  border: 1px solid color-mix(in srgb, var(--line) 74%, rgba(62, 112, 255, .16));
  border-radius: var(--radius);
  background: var(--gradient-card);
  box-shadow: var(--shadow-soft);
  color: var(--text);
}

.hero-card,
.clients-head,
.section-title {
  background:
    radial-gradient(circle at 80% 30%, rgba(122, 95, 255, .17), transparent 32%),
    radial-gradient(circle at 61% 100%, rgba(41, 190, 166, .14), transparent 31%),
    linear-gradient(115deg, color-mix(in srgb, #edf3ff 65%, var(--surface)) 0%, var(--surface) 55%, color-mix(in srgb, #edf3ff 54%, var(--surface)) 100%);
}

.panel::before,
.metric-card::before,
.hero-card::before,
.clients-head::before,
.section-title::before,
.amo-source-column::before,
.amo-status-column::before {
  background: none;
}

.panel:hover,
.metric-card:hover,
.quick-action:hover,
.amo-stage-card:hover,
.amo-shortcut:hover,
.crm-item:hover {
  border-color: color-mix(in srgb, var(--blue) 18%, var(--line));
  box-shadow: 0 14px 30px rgba(28, 48, 82, .08);
}

.metric-card {
  min-height: 128px;
  overflow: hidden;
}

.metric-card span,
.filter-control span,
.period-filter span,
.lead-form label,
.edit-field span,
.amo-column-title small,
.amo-webhook-line span,
.table-head span,
.agent-list-head span {
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.metric-card strong {
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  font-weight: 790;
  letter-spacing: -.035em;
}

.metric-card small {
  color: var(--green);
  font-weight: 760;
}

.primary-btn {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  color: #fff;
  box-shadow: 0 8px 20px rgba(49, 108, 255, .20);
  border-radius: 10px;
}

.primary-btn:hover {
  background: linear-gradient(135deg, #275ef0, #604ee8);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 11px 24px rgba(49, 108, 255, .28);
  transform: translateY(-1px);
}

.secondary-btn,
.outline-tab,
.details-btn,
.filter-btn,
.filter-chip,
.client-row button,
.empty-state button,
.copy-line button,
.theme-switcher select,
.dots-btn,
.small-dots,
.amo-stage-menu-btn,
.row-actions button,
.crm-mapping button,
.amo-mapped-card button,
.hint-close,
.text-btn {
  border: 1px solid color-mix(in srgb, var(--line) 80%, rgba(62, 112, 255, .18));
  background:
    radial-gradient(circle at 100% 0%, var(--grad-violet), transparent 44%),
    linear-gradient(120deg, color-mix(in srgb, #edf3ff 26%, var(--surface)) 0%, var(--surface) 100%);
  color: var(--text);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.secondary-btn:hover,
.outline-tab:hover,
.details-btn:hover,
.filter-btn:hover,
.filter-chip:hover,
.client-row button:hover,
.empty-state button:hover,
.copy-line button:hover,
.quick-action:hover,
.role-panel button:hover,
.dots-btn:hover,
.small-dots:hover,
.amo-stage-menu-btn:hover,
.row-actions button:hover,
.hint-close:hover {
  border-color: color-mix(in srgb, var(--blue) 24%, var(--line));
  color: var(--text);
  transform: translateY(-1px);
}

input,
textarea,
select,
.filter-control input,
.filter-control select,
.filter-control button,
.period-filter select,
.amo-source-tools input,
.amo-source-tools select,
.copy-line input,
.comment-form textarea {
  background: radial-gradient(circle at 100% 0%, rgba(111, 88, 247, .06), transparent 42%), var(--surface);
  border: 1px solid color-mix(in srgb, var(--line) 78%, rgba(62, 112, 255, .16));
  border-radius: 11px;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

input:focus,
textarea:focus,
select:focus,
.filter-control input:focus,
.filter-control select:focus,
.period-filter select:focus,
.amo-source-tools input:focus,
.amo-source-tools select:focus,
.copy-line input:focus,
.comment-form textarea:focus {
  border-color: var(--kontur-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent);
  outline: none;
}

.filter-btn.active,
.outline-tab.active,
.status-badge,
.badge,
.amo-settings-tabs button.active {
  border: 1px solid color-mix(in srgb, var(--blue) 20%, #c7e4fb);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  color: var(--blue);
  border-radius: 999px;
}

.client-row,
.agent-list-row,
.manager-row,
.history-row,
.top-row,
.withdrawal-row,
.clean-row,
.activity-row,
.client-detail-row,
.timeline-row,
.comment-row,
.funnel-row,
.status-settings-row,
.amo-stage-card,
.amo-mapped-card,
.chat-item,
.notification-item,
.empty-table {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: radial-gradient(circle at 100% 0%, rgba(49, 108, 255, .07), transparent 38%), var(--surface);
  box-shadow: none;
  color: var(--text);
}

.client-row:hover,
.agent-list-row:hover,
.manager-row:hover,
.chat-item:hover,
.notification-item:hover,
.amo-stage-card:hover {
  background: radial-gradient(circle at 100% 0%, rgba(111, 88, 247, .08), transparent 40%), var(--surface-soft);
  border-color: color-mix(in srgb, var(--blue) 20%, var(--line));
}

.progress-bar,
.funnel-track {
  background: #e5ebf3;
}

.progress-bar span,
.funnel-track span {
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
}

.message {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.message.agent {
  background: color-mix(in srgb, var(--blue) 11%, var(--surface));
  border-color: color-mix(in srgb, var(--blue) 22%, var(--line));
}

.message.manager {
  background: radial-gradient(circle at 100% 0%, rgba(111, 88, 247, .10), transparent 40%), var(--surface-soft);
}

.modal-backdrop,
.confirm-backdrop,
.agent-modal-backdrop,
.hint-popover {
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(6px);
}

.notification-popover,
.action-menu,
.amo-stage-actions .amo-stage-menu {
  box-shadow: var(--shadow);
}

.amo-logo {
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
  color: #fff;
  box-shadow: 0 9px 22px rgba(49, 108, 255, .22);
}

.amo-settings-tabs {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.amo-status-dropzone > p,
.empty-state {
  border-color: color-mix(in srgb, var(--line) 85%, rgba(49, 108, 255, .18));
  background: color-mix(in srgb, var(--surface-soft) 88%, var(--surface));
  color: var(--muted);
}

html[data-theme="dark"] {
  --bg: #0d1421;
  --surface: #141e2e;
  --surface-soft: #192537;
  --surface-raised: #182947;
  --panel: #141e2e;
  --panel-2: #192537;
  --line: #25344a;
  --line-strong: #314158;
  --text: #eef4ff;
  --muted: #9baac0;
  --muted-2: #75849a;
  --soft: #d7e2f2;
  --blue: #6d93ff;
  --blue-2: #9a80ff;
  --accent: #6d93ff;
  --green: #55d7a0;
  --red: #ff7b87;
  --warning: #f0b35c;
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
  --shadow-soft: 0 8px 25px rgba(0, 0, 0, .12);
  --sidebar-bg: rgba(17, 25, 39, .94);
  --sidebar-hover: rgba(255, 255, 255, .08);
  --nav-active-bg: #1d3158;
  --kontur-page: #0d1421;
  --kontur-sidebar: rgba(17, 25, 39, .94);
  --kontur-text: #eef4ff;
  --kontur-muted: #9baac0;
  --kontur-line: #25344a;
  --kontur-row: #192537;
  --kontur-row-hover: #20304a;
  --kontur-blue: #6d93ff;
  --kontur-focus: #6d93ff;
  --grad-violet: rgba(154, 128, 255, .18);
  --grad-blue: rgba(109, 147, 255, .16);
  --grad-mint: rgba(85, 215, 160, .12);
  --grad-gold: rgba(240, 179, 92, .12);
  --block-glow: rgba(255, 255, 255, .035);
  color-scheme: dark;
}

html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .main,
html[data-theme="dark"] .view.active,
html[data-theme="dark"] .login-screen {
  background:
    radial-gradient(circle at 72% -20%, rgba(109, 147, 255, .16), transparent 33%),
    radial-gradient(circle at 14% 112%, rgba(85, 215, 160, .08), transparent 30%),
    var(--bg);
  color: var(--text);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] body.sidebar-collapsed .sidebar {
  background: var(--sidebar-bg);
  border-right-color: rgba(255, 255, 255, .08);
  color: var(--text);
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] body.amo-settings-mode .topbar {
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom-color: var(--line);
}

html[data-theme="dark"] .brand-title,
html[data-theme="dark"] .brand-subtitle,
html[data-theme="dark"] .role-panel span,
html[data-theme="dark"] .nav-item,
html[data-theme="dark"] .sidebar-collapse,
html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse,
html[data-theme="dark"] .sidebar-collapse:hover,
html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse:hover {
  color: var(--soft);
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .stage-help,
html[data-theme="dark"] .balance-panel,
html[data-theme="dark"] .withdraw-card,
html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .clients-head,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .confirm-card,
html[data-theme="dark"] .agent-modal-card,
html[data-theme="dark"] .hint-card,
html[data-theme="dark"] .notification-popover,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .amo-source-column,
html[data-theme="dark"] .amo-status-column,
html[data-theme="dark"] .amo-status-empty,
html[data-theme="dark"] .amo-shortcut,
html[data-theme="dark"] .crm-item,
html[data-theme="dark"] .crm-column,
html[data-theme="dark"] .action-menu,
html[data-theme="dark"] .quick-action,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .referral-panel,
html[data-theme="dark"] .support-panel,
html[data-theme="dark"] .text-panel,
html[data-theme="dark"] .amo-deal-target,
html[data-theme="dark"] .chat-list,
html[data-theme="dark"] .chat-thread,
html[data-theme="dark"] .chat-detail,
html[data-theme="dark"] .details-card,
html[data-theme="dark"] .client-detail-card {
  background:
    radial-gradient(circle at 100% 0%, var(--grad-violet), transparent 38%),
    radial-gradient(circle at 0% 100%, var(--grad-mint), transparent 36%),
    linear-gradient(125deg, color-mix(in srgb, #1d3158 26%, var(--surface)) 0%, var(--surface) 58%, var(--surface-soft) 100%);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .clients-head,
html[data-theme="dark"] .section-title {
  background:
    radial-gradient(circle at 80% 30%, rgba(154, 128, 255, .18), transparent 32%),
    radial-gradient(circle at 61% 100%, rgba(85, 215, 160, .12), transparent 31%),
    linear-gradient(115deg, color-mix(in srgb, #1d3158 65%, var(--surface)) 0%, var(--surface) 55%, color-mix(in srgb, #1d3158 54%, var(--surface)) 100%);
}

html[data-theme="dark"] .primary-btn {
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(109, 147, 255, .18);
}

html[data-theme="dark"] .primary-btn:hover {
  background: linear-gradient(135deg, #7da0ff, #a98dff);
  border-color: transparent;
  color: #ffffff;
}

html[data-theme="dark"] .secondary-btn,
html[data-theme="dark"] .outline-tab,
html[data-theme="dark"] .details-btn,
html[data-theme="dark"] .filter-btn,
html[data-theme="dark"] .filter-chip,
html[data-theme="dark"] .client-row button,
html[data-theme="dark"] .empty-state button,
html[data-theme="dark"] .copy-line button,
html[data-theme="dark"] .theme-switcher select,
html[data-theme="dark"] .role-panel button,
html[data-theme="dark"] .dots-btn,
html[data-theme="dark"] .small-dots,
html[data-theme="dark"] .amo-stage-menu-btn,
html[data-theme="dark"] .row-actions button,
html[data-theme="dark"] .crm-mapping button,
html[data-theme="dark"] .amo-mapped-card button,
html[data-theme="dark"] .hint-close,
html[data-theme="dark"] .text-btn {
  background:
    radial-gradient(circle at 100% 0%, var(--grad-violet), transparent 44%),
    linear-gradient(120deg, color-mix(in srgb, #1d3158 35%, var(--surface)) 0%, var(--surface-soft) 100%);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .filter-control input,
html[data-theme="dark"] .filter-control select,
html[data-theme="dark"] .filter-control button,
html[data-theme="dark"] .period-filter select,
html[data-theme="dark"] .amo-source-tools input,
html[data-theme="dark"] .amo-source-tools select,
html[data-theme="dark"] .copy-line input,
html[data-theme="dark"] .comment-form textarea {
  background: radial-gradient(circle at 100% 0%, rgba(154, 128, 255, .08), transparent 42%), var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .client-row,
html[data-theme="dark"] .agent-list-row,
html[data-theme="dark"] .manager-row,
html[data-theme="dark"] .history-row,
html[data-theme="dark"] .top-row,
html[data-theme="dark"] .withdrawal-row,
html[data-theme="dark"] .clean-row,
html[data-theme="dark"] .activity-row,
html[data-theme="dark"] .client-detail-row,
html[data-theme="dark"] .timeline-row,
html[data-theme="dark"] .comment-row,
html[data-theme="dark"] .funnel-row,
html[data-theme="dark"] .status-settings-row,
html[data-theme="dark"] .amo-stage-card,
html[data-theme="dark"] .amo-mapped-card,
html[data-theme="dark"] .chat-item,
html[data-theme="dark"] .notification-item,
html[data-theme="dark"] .empty-table {
  background: radial-gradient(circle at 100% 0%, rgba(109, 147, 255, .08), transparent 38%), var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .notification-btn,
html[data-theme="dark"] .notification-btn:hover {
  background: transparent;
  border: 0;
  color: var(--text);
}

html[data-theme="dark"] .amo-status-dropzone > p,
html[data-theme="dark"] .empty-state {
  background: color-mix(in srgb, var(--surface-soft) 88%, var(--surface));
  border-color: var(--line);
  color: var(--muted);
}

html[data-theme="dark"] .progress-bar,
html[data-theme="dark"] .funnel-track {
  background: #22314a;
}

html[data-theme="dark"] .progress-bar span,
html[data-theme="dark"] .funnel-track span {
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #4d5d75;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #101827;
}

/* Exact dashboard shell pass from the provided mockup. */
:root {
  --sidebar-width: 315px;
  --ba-frame-bg: #f3f6fc;
  --ba-sidebar-bg: rgba(255, 255, 255, .94);
  --ba-card-bg: rgba(255, 255, 255, .82);
  --ba-text: #08152d;
  --ba-muted: #74839c;
  --ba-line: #dfe7f4;
  --ba-active: #eaf1ff;
  --ba-primary: #326dff;
  --ba-primary-2: #6a4df5;
}

html[data-theme="light"],
html[data-theme="light"] body,
html[data-theme="light"] .app-shell,
html[data-theme="light"] .main,
html[data-theme="light"] .view.active {
  background:
    radial-gradient(circle at 84% 10%, rgba(115, 91, 246, .12), transparent 28%),
    radial-gradient(circle at 45% 84%, rgba(53, 202, 178, .08), transparent 28%),
    var(--ba-frame-bg);
  color: var(--ba-text);
}

@media (min-width: 1101px) {
  .app-shell {
    display: block;
    min-height: 100vh;
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    height: 100vh;
    max-height: 100vh;
    z-index: 40;
  }

  .main,
  body.amo-settings-mode .main {
    width: calc(100% - var(--sidebar-width));
    max-width: none;
    margin-left: var(--sidebar-width);
    margin-right: 0;
  }

  body.sidebar-collapsed {
    --sidebar-width: 86px;
  }
}

.sidebar {
  padding: 31px 18px 16px;
  gap: 0;
  background: var(--ba-sidebar-bg);
  border-right: 1px solid var(--ba-line);
  box-shadow: none;
  backdrop-filter: blur(18px);
  scrollbar-gutter: auto;
}

.brand {
  position: relative;
  height: 64px;
  gap: 14px;
  padding: 0 12px;
  margin: 0 0 22px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--ba-primary), var(--ba-primary-2));
  box-shadow: 0 18px 32px rgba(58, 105, 255, .26);
}

.brand-mark::before {
  content: "";
  width: 25px;
  height: 25px;
  display: block;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 7V5.8A2.8 2.8 0 0 1 10.8 3h2.4A2.8 2.8 0 0 1 16 5.8V7'/%3E%3Cpath d='M4.5 8.5h15v10.2a1.8 1.8 0 0 1-1.8 1.8H6.3a1.8 1.8 0 0 1-1.8-1.8z'/%3E%3Cpath d='M9 13h6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 7V5.8A2.8 2.8 0 0 1 10.8 3h2.4A2.8 2.8 0 0 1 16 5.8V7'/%3E%3Cpath d='M4.5 8.5h15v10.2a1.8 1.8 0 0 1-1.8 1.8H6.3a1.8 1.8 0 0 1-1.8-1.8z'/%3E%3Cpath d='M9 13h6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.brand-title {
  font-size: 20px;
  line-height: 1.06;
  font-weight: 820;
  color: #152238;
  letter-spacing: -.03em;
}

.brand-subtitle {
  display: block !important;
  margin-top: 4px;
  color: var(--ba-muted);
  font-size: 16px;
  line-height: 1.15;
  font-weight: 500;
}

.sidebar-collapse {
  position: absolute;
  right: 12px;
  top: 65px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--ba-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .9);
  color: #26364d;
  box-shadow: 0 8px 18px rgba(35, 53, 84, .08);
  font-size: 0;
  z-index: 45;
}

.sidebar-collapse::before {
  content: "‹";
  display: block;
  color: currentColor;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.sidebar-collapse:hover {
  background: #fff;
  border-color: #cdd9ed;
  transform: translateY(-1px);
}

body.sidebar-collapsed .sidebar-collapse::before {
  content: "›";
}

.sidebar-collapse::after,
body.sidebar-collapsed .sidebar-collapse::after {
  content: none !important;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-caption {
  margin: 18px 12px 9px;
  color: #9aa8ba;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  min-height: 54px;
  padding: 0 14px;
  gap: 16px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #73839d;
  font-size: 18px;
  font-weight: 540;
}

.nav-item::before {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.nav-item:hover {
  background: rgba(234, 241, 255, .7);
  color: #2b6dff;
  transform: none;
}

.nav-item.active {
  background: var(--ba-active);
  color: #2f6dff;
  font-weight: 720;
}

.nav-item.active::after {
  left: -18px;
  height: 28px;
  width: 4px;
  border-radius: 0 5px 5px 0;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  margin-left: auto;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #2f6dff;
  background: #fff;
  border: 1px solid #dce7fb;
  font-size: 13px;
  font-weight: 780;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 14px;
  padding-top: 18px;
}

.system-card,
.role-panel {
  min-height: 68px;
  padding: 13px 15px;
  border: 1px solid var(--ba-line);
  border-radius: 17px;
  background:
    radial-gradient(circle at 100% 0%, rgba(112, 88, 247, .10), transparent 42%),
    linear-gradient(135deg, rgba(238, 246, 255, .9), rgba(255, 255, 255, .88));
  box-shadow: 0 10px 24px rgba(26, 44, 74, .05);
}

.system-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-card strong,
.role-panel span {
  display: block;
  color: #172033;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 780;
}

.system-card small,
.role-panel small {
  display: block;
  margin-top: 3px;
  color: var(--ba-muted);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 500;
}

.system-dot {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 12px;
  background: #e8fbf3;
  position: relative;
}

.system-dot::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: #20b979;
  box-shadow: 0 0 0 5px rgba(32, 185, 121, .12);
}

.role-panel {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  border-bottom: 1px solid var(--ba-line);
}

.role-panel::before {
  content: "АБ";
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #516dff, #8162e8);
  font-size: 14px;
  font-weight: 850;
}

.role-panel button {
  grid-row: 1 / 3;
  grid-column: 3;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--ba-line);
  color: #1b273b;
  font-weight: 760;
}

.topbar {
  min-height: 95px;
  height: 95px;
  padding: 0 34px 0 38px;
  background: rgba(247, 250, 255, .82);
  border-bottom: 1px solid var(--ba-line);
  backdrop-filter: blur(18px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
  color: #111b31;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 820;
  letter-spacing: -.02em;
}

.topbar p {
  margin-top: 7px;
  color: var(--ba-muted);
  font-size: 15px;
  line-height: 1.2;
}

.topbar-actions {
  gap: 12px;
}

.topbar-search {
  width: clamp(280px, 24vw, 350px);
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 0 15px;
  border: 1px solid #dfe7f7;
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0%, rgba(106, 77, 245, .12), transparent 42%),
    rgba(255, 255, 255, .86);
  box-shadow: 0 12px 32px rgba(35, 56, 95, .08);
}

.topbar-search-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  background: #73839d;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.topbar-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #152238;
  font-size: 15px;
}

.topbar-search input::placeholder {
  color: #7c8698;
}

.topbar-search kbd {
  min-width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border: 1px solid #e2e8f7;
  border-radius: 10px;
  background: rgba(239, 235, 255, .72);
  color: #9aa2b6;
  font: 13px/1 Inter, sans-serif;
}

.theme-switcher {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 2px solid #111827;
  border-radius: 17px;
  background: #fff;
  box-shadow: none;
}

.theme-switcher span {
  display: none;
}

.theme-switcher::before {
  content: "";
  width: 24px;
  height: 24px;
  background: #101827;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E") center / contain no-repeat;
}

.theme-switcher select {
  position: absolute;
  inset: 0;
  width: 100%;
  min-width: 0;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.notification-btn {
  width: 48px;
  height: 48px;
  border: 1px solid #e1e8f6;
  border-radius: 16px;
  background: rgba(255, 255, 255, .86);
  color: #111827;
  box-shadow: 0 12px 24px rgba(35, 56, 95, .08);
}

.notification-btn::before {
  width: 23px;
  height: 23px;
}

.notification-btn span {
  display: block;
  top: 11px;
  right: 11px;
  width: 10px;
  height: 10px;
  color: transparent;
  background: #e85a6a;
  border: 2px solid #fff;
}

#dashboardView.active {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(340px, .95fr);
  gap: 20px;
  padding: 31px 32px 34px 38px;
  max-width: none;
}

#dashboardView .page-kicker,
#quickBalance,
#dashboardView .details-btn,
#dashboardView #agentSummary {
  display: none !important;
}

#heroCard,
#metricsGrid {
  grid-column: 1 / -1;
}

#dashboardView > .panel {
  grid-column: 1;
}

#dashboardWorkspace {
  grid-column: 2;
  display: block;
  margin: 0;
}

#dashboardWorkspace .panel:not(:first-child) {
  display: none;
}

#dashboardWorkspace .panel {
  height: 100%;
}

.hero-card {
  min-height: 267px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  align-items: center;
  gap: 28px;
  padding: 34px 34px 34px 36px;
  border-radius: 26px;
  border: 1px solid #d8e4ff;
  background:
    radial-gradient(circle at 88% 10%, rgba(117, 91, 246, .18), transparent 34%),
    radial-gradient(circle at 47% 84%, rgba(45, 201, 177, .10), transparent 34%),
    linear-gradient(118deg, rgba(255, 255, 255, .84), rgba(248, 251, 255, .72));
  box-shadow: 0 14px 36px rgba(30, 54, 95, .08);
}

.hero-card::after {
  display: block;
  content: "";
  position: absolute;
  right: -90px;
  top: -145px;
  width: 430px;
  height: 430px;
  border-radius: 50%;
  border: 1px solid rgba(73, 112, 255, .18);
  box-shadow:
    0 0 0 45px rgba(87, 117, 255, .055),
    0 0 0 88px rgba(87, 117, 255, .035);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.hero-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2f6dff;
  font-size: 14px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.hero-card .badge::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dff8ef;
  box-shadow: inset 0 0 0 5px #dff8ef;
  border: 5px solid #dff8ef;
}

.hero-card .badge::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #24b982;
}

.hero-card h1 {
  max-width: 720px;
  margin: 18px 0 11px;
  color: #07142b;
  font-size: 32px;
  line-height: 1.14;
  font-weight: 860;
  letter-spacing: -.045em;
}

.hero-card p,
.hero-card #heroText p {
  max-width: 760px;
  margin: 0;
  color: #6f7d98;
  font-size: 16px;
  line-height: 1.45;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.dashboard-actions .primary-btn,
.dashboard-actions .secondary-btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 780;
}

.dashboard-actions .primary-btn::before {
  content: "+";
  margin-right: 3px;
  font-size: 24px;
  line-height: 1;
  font-weight: 400;
}

.hero-health {
  position: relative;
  z-index: 1;
  min-height: 198px;
  padding: 26px 22px 22px;
  border: 1px solid #dfe7f4;
  border-radius: 21px;
  background:
    radial-gradient(circle at 0% 100%, rgba(52, 205, 181, .12), transparent 45%),
    rgba(255, 255, 255, .75);
  box-shadow: 0 18px 42px rgba(35, 56, 95, .11);
  backdrop-filter: blur(12px);
}

.hero-health-top,
.hero-health dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-health-top strong {
  color: #172033;
  font-size: 16px;
  font-weight: 820;
}

.hero-health-top span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #10a96b;
  background: #e9fbf2;
  font-size: 12px;
  font-weight: 850;
}

.hero-health-top i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.hero-health dl {
  display: grid;
  gap: 0;
  margin: 19px 0 0;
}

.hero-health dl div {
  min-height: 38px;
  border-top: 1px dashed #dae4f2;
}

.hero-health dl div:first-child {
  border-top: 0;
}

.hero-health dt,
.hero-health dd {
  margin: 0;
  font-size: 15px;
}

.hero-health dt {
  color: #75839a;
}

.hero-health dd {
  color: #172033;
  font-weight: 800;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  min-height: 165px;
  padding: 24px 23px;
  border-radius: 22px;
  border: 1px solid #dfe7f4;
  background:
    radial-gradient(circle at 88% 24%, rgba(50, 109, 255, .10), transparent 28%),
    rgba(255, 255, 255, .78);
  box-shadow: 0 14px 32px rgba(32, 53, 88, .075);
}

.metric-card:nth-child(2) {
  background:
    radial-gradient(circle at 88% 24%, rgba(33, 187, 126, .12), transparent 28%),
    rgba(255, 255, 255, .78);
}

.metric-card:nth-child(3) {
  background:
    radial-gradient(circle at 88% 24%, rgba(239, 168, 43, .13), transparent 28%),
    rgba(255, 255, 255, .78);
}

.metric-card:nth-child(4) {
  background:
    radial-gradient(circle at 88% 24%, rgba(232, 90, 106, .12), transparent 28%),
    rgba(255, 255, 255, .78);
}

.metric-card span {
  color: #74839c;
  font-size: 15px;
  font-weight: 720;
}

.metric-card strong {
  margin: 9px 0 10px;
  color: #07142b;
  font-size: 34px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: -.045em;
}

.metric-card small {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  color: #10a96b;
  font-size: 13px;
  font-weight: 760;
}

.metric-card::before {
  content: "";
  position: absolute;
  right: 24px;
  top: 23px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(50, 109, 255, .08);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 136px;
  height: 42px;
  background: #477bff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 44'%3E%3Cpath d='M2 34 C18 34 20 24 34 24 C48 24 50 34 64 31 C78 28 82 17 96 21 C110 25 113 28 124 20 C130 15 135 12 138 11' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 44'%3E%3Cpath d='M2 34 C18 34 20 24 34 24 C48 24 50 34 64 31 C78 28 82 17 96 21 C110 25 113 28 124 20 C130 15 135 12 138 11' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

#dashboardView > .panel,
#dashboardWorkspace .panel {
  margin: 0;
  min-height: 337px;
  padding: 27px 26px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(106, 77, 245, .08), transparent 34%),
    radial-gradient(circle at 0% 100%, rgba(51, 202, 178, .09), transparent 33%),
    rgba(255, 255, 255, .78);
}

#dashboardView .panel-head {
  margin-bottom: 21px;
}

#dashboardView .panel-head h2 {
  color: #07142b;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 850;
}

#dashboardView .panel-head p {
  margin-top: 7px;
  color: #74839c;
  font-size: 14px;
}

.funnel {
  gap: 15px;
}

.funnel-row {
  grid-template-columns: 140px minmax(0, 1fr) 44px;
  gap: 18px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.funnel-row b {
  color: #74839c;
  font-size: 14px;
  font-weight: 560;
}

.funnel-track {
  height: 11px;
  background: rgba(232, 238, 248, .92);
}

.funnel-track span {
  background: linear-gradient(90deg, #326dff, #6a4df5);
}

.activity-list,
.clean-list {
  gap: 12px;
}

.activity-row,
.clean-row {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  padding: 0 0 0 49px;
  position: relative;
}

.activity-row::before,
.clean-row::before {
  content: "+";
  position: absolute;
  left: 0;
  top: 4px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #edf3ff;
  color: #326dff;
  font-size: 20px;
}

.activity-row strong,
.clean-row strong {
  color: #07142b;
  font-size: 14px;
  line-height: 1.2;
}

.activity-row small,
.clean-row small {
  color: #74839c;
  font-size: 12px;
  line-height: 1.25;
}

body.sidebar-collapsed .brand > div,
body.sidebar-collapsed .brand-mark,
body.sidebar-collapsed .nav-caption,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .sidebar-bottom {
  display: none !important;
}

body.sidebar-collapsed .sidebar {
  padding: 0;
  background: #f4f7fb;
  border-right-color: #dfe7f4;
}

body.sidebar-collapsed .brand {
  height: 100vh;
  justify-content: center;
  padding: 18px 0 0;
}

body.sidebar-collapsed .sidebar-collapse {
  position: static;
  margin: 0 auto;
}

@media (max-width: 1300px) {
  :root {
    --sidebar-width: 272px;
  }

  .nav-item {
    font-size: 16px;
  }

  #dashboardView.active {
    grid-template-columns: 1fr;
  }

  #dashboardView > .panel,
  #dashboardWorkspace {
    grid-column: 1;
  }
}

/* Annotation polish: compact sidebar, visible controls, restored brand mark. */
.sidebar {
  padding: 24px 16px 14px;
  overflow-x: hidden;
  overflow-y: auto;
}

.brand {
  height: 54px;
  gap: 12px;
  padding: 0 10px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 15px;
  background: url("brand-icon.png?v=20260624-01") center / cover no-repeat;
  box-shadow: 0 14px 28px rgba(49, 108, 255, .20);
}

.brand-mark::before {
  display: none;
}

.brand-title {
  font-size: 18px;
}

.brand-subtitle {
  font-size: 14px;
}

.sidebar-collapse,
.sidebar-collapse:hover,
body.sidebar-collapsed .sidebar-collapse,
body.sidebar-collapsed .sidebar-collapse:hover {
  position: fixed;
  left: calc(var(--sidebar-width) - 18px);
  top: 92px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  margin: 0;
  border: 1px solid #c9d7ed;
  border-radius: 13px;
  background: #ffffff;
  color: #326dff;
  box-shadow: 0 10px 24px rgba(35, 56, 95, .14);
  z-index: 90;
}

.sidebar-collapse:hover,
body.sidebar-collapsed .sidebar-collapse:hover {
  border-color: #8fb2ff;
  color: #1d57e8;
  transform: translateY(-1px);
}

.nav {
  gap: 4px;
}

.nav-caption {
  margin: 12px 12px 6px;
  font-size: 11px;
  line-height: 1.2;
}

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  gap: 12px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.15;
}

.nav-item::before {
  width: 19px;
  height: 19px;
  flex-basis: 19px;
}

.nav-item.active::after {
  left: -16px;
  height: 24px;
  width: 4px;
}

.nav-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  font-size: 12px;
}

.sidebar-bottom {
  gap: 10px;
  padding-top: 12px;
}

.system-card,
.role-panel {
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 15px;
}

.system-card {
  gap: 10px;
}

.system-dot {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.system-dot::after {
  inset: 10px;
  box-shadow: 0 0 0 4px rgba(32, 185, 121, .12);
}

.system-card strong,
.role-panel span {
  font-size: 14px;
}

.system-card small,
.role-panel small {
  font-size: 12px;
}

.role-panel {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.role-panel::before {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.role-panel button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.theme-switcher {
  cursor: pointer;
}

.theme-switcher select {
  pointer-events: none;
}

html[data-theme="dark"] .theme-switcher {
  border-color: #dce7ff;
  background: #172337;
}

html[data-theme="dark"] .theme-switcher::before {
  background: #edf4ff;
}

.notification-btn span {
  display: none;
}

.notification-btn.has-unread span {
  display: block;
}

.metric-card,
#dashboardWorkspace .panel {
  position: relative;
  overflow: hidden;
}

#dashboardWorkspace .panel::after {
  display: none !important;
}

.activity-row,
.clean-row {
  overflow: hidden;
}

body.sidebar-collapsed .brand {
  padding-top: 14px;
}

/* Annotation pass 06: readable notifications, metric icons, compact menu. */
.sidebar-collapse,
.sidebar-collapse:hover,
body.sidebar-collapsed .sidebar-collapse,
body.sidebar-collapsed .sidebar-collapse:hover {
  left: calc(var(--sidebar-width) - 48px);
  top: 88px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: 2px solid #8fb2ff;
  border-radius: 15px;
  background: #ffffff;
  color: #2368ff;
  box-shadow: 0 12px 28px rgba(35, 90, 210, .20);
  font-size: 28px;
  font-weight: 700;
}

.nav-item {
  min-height: 40px;
  padding: 0 12px;
  gap: 11px;
  font-size: 14px;
}

.nav-item::before {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.nav-badge {
  display: none !important;
}

.notification-popover {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 18px 42px rgba(35, 56, 95, .16);
}

.notification-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 4px 8px;
}

.notification-popover-head span {
  display: inline-flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.notification-popover-head strong {
  color: #07142b;
  font-size: 15px;
  font-weight: 850;
}

.notification-popover-head button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #dbe6f6;
  border-radius: 10px;
  background: #edf3ff;
  color: #2368ff;
  font-size: 12px;
  font-weight: 780;
  cursor: pointer;
}

.notification-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  border: 1px solid #dfe7f4;
  border-radius: 13px;
  background: rgba(255, 255, 255, .82);
  color: #07142b;
  text-align: left;
  cursor: pointer;
}

.notification-item:hover {
  border-color: #9bbcff;
  background: #f5f8ff;
}

.notification-item strong {
  font-size: 14px;
  line-height: 1.2;
}

.notification-item small {
  color: #74839c;
  font-size: 12px;
  line-height: 1.25;
}

.notification-history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 20px 24px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(8px);
}

.notification-history-backdrop[hidden] {
  display: none !important;
}

.notification-history-panel {
  width: min(680px, 100%);
  max-height: min(720px, calc(100vh - 110px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.notification-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.notification-history-head div {
  display: grid;
  gap: 4px;
}

.notification-history-head strong {
  font-size: 18px;
  font-weight: 950;
}

.notification-history-head small {
  color: var(--muted);
  font-weight: 750;
}

.notification-history-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.metric-card {
  min-width: 0;
}

.metric-card::before {
  display: none;
}

.metric-card span,
.metric-card strong,
.metric-card small {
  position: relative;
  z-index: 2;
}

.metric-card span {
  display: block;
  max-width: calc(100% - 58px);
  line-height: 1.25;
}

.metric-card strong {
  max-width: calc(100% - 30px);
  overflow-wrap: anywhere;
}

.metric-icon {
  position: absolute;
  right: 22px;
  top: 22px;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background:
    radial-gradient(circle at 100% 0%, rgba(106, 77, 245, .12), transparent 46%),
    #edf3ff;
  z-index: 2;
}

.metric-icon::before {
  content: "";
  position: absolute;
  inset: 10px;
  background: #326dff;
  -webkit-mask: var(--metric-mask) center / contain no-repeat;
  mask: var(--metric-mask) center / contain no-repeat;
}

.metric-icon-1 {
  --metric-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l2 2 4-5'/%3E%3Cpath d='M5 4h14v16H5z'/%3E%3Cpath d='M9 4a3 3 0 0 1 6 0'/%3E%3C/svg%3E");
}

.metric-icon-2 {
  --metric-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}

.metric-icon-3 {
  background:
    radial-gradient(circle at 100% 0%, rgba(239, 168, 43, .16), transparent 46%),
    #fff6df;
  --metric-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='13' rx='2'/%3E%3Cpath d='M3 10h18M16 15h2'/%3E%3C/svg%3E");
}

.metric-icon-3::before {
  background: #d98916;
}

.metric-icon-4 {
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 90, 106, .16), transparent 46%),
    #fff0f2;
  --metric-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 8v5'/%3E%3Cpath d='M12 17h.01'/%3E%3Cpath d='M10.3 3.9 2.7 18a2 2 0 0 0 1.8 3h15a2 2 0 0 0 1.8-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3C/svg%3E");
}

.metric-icon-4::before {
  background: #df5361;
}

#dashboardView > .panel,
#dashboardWorkspace .panel,
.hero-card,
.metric-card {
  overflow: hidden;
}

#dashboardWorkspace .panel {
  padding-right: 26px;
}

.activity-row,
.clean-row {
  min-width: 0;
}

.activity-row strong,
.clean-row strong,
.activity-row small,
.clean-row small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

html[data-theme="dark"] .notification-popover,
html[data-theme="dark"] .notification-item {
  background: rgba(20, 30, 46, .96);
  border-color: #25344a;
}

html[data-theme="dark"] .notification-popover-head strong,
html[data-theme="dark"] .notification-item strong {
  color: #eef4ff;
}

html[data-theme="dark"] .notification-popover-head button {
  background: #1d3158;
  border-color: #314158;
  color: #9db9ff;
}

/* Annotation pass 07: final dark-theme sweep and visible sidebar arrow. */
.sidebar-collapse,
.sidebar-collapse:hover,
body.sidebar-collapsed .sidebar-collapse,
body.sidebar-collapsed .sidebar-collapse:hover {
  z-index: 10020 !important;
  left: calc(var(--sidebar-width) - 58px);
  top: 88px;
  display: grid;
  place-items: center;
  color: #2368ff;
  line-height: 1;
}

html[data-theme="dark"] .sidebar-collapse,
html[data-theme="dark"] .sidebar-collapse:hover,
html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse,
html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse:hover {
  background: #182742;
  border-color: #6d93ff;
  color: #eef4ff;
  box-shadow: 0 14px 32px rgba(0, 0, 0, .38);
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] body.amo-settings-mode .topbar {
  background: rgba(13, 20, 33, .94);
  border-bottom-color: #25344a;
}

html[data-theme="dark"] .topbar-search,
html[data-theme="dark"] .theme-switcher,
html[data-theme="dark"] .notification-btn,
html[data-theme="dark"] .icon-btn:not(.sidebar-collapse) {
  background: #141e2e;
  border-color: #25344a;
  color: #eef4ff;
}

html[data-theme="dark"] .topbar-search input,
html[data-theme="dark"] .topbar-search input::placeholder {
  color: #9baac0;
}

html[data-theme="dark"] .topbar-search kbd,
html[data-theme="dark"] .theme-switcher select {
  background: #1d3158;
  border-color: #314158;
  color: #d7e2f2;
}

html[data-theme="dark"] .sidebar-bottom .system-card,
html[data-theme="dark"] .sidebar-bottom .role-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(109, 147, 255, .15), transparent 42%),
    linear-gradient(135deg, #141e2e, #192537);
  border: 1px solid #25344a;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .sidebar-bottom .system-card strong,
html[data-theme="dark"] .sidebar-bottom .role-panel span {
  color: #eef4ff;
}

html[data-theme="dark"] .sidebar-bottom .system-card small,
html[data-theme="dark"] .sidebar-bottom .role-panel small {
  color: #9baac0;
}

html[data-theme="dark"] .sidebar-bottom .role-panel button {
  background: #1d3158;
  border-color: #314158;
  color: #eef4ff;
}

html[data-theme="dark"] #dashboardView > .panel,
html[data-theme="dark"] #dashboardWorkspace .panel,
html[data-theme="dark"] .hero-health {
  background:
    radial-gradient(circle at 100% 0%, rgba(154, 128, 255, .13), transparent 36%),
    radial-gradient(circle at 0% 100%, rgba(85, 215, 160, .10), transparent 34%),
    linear-gradient(125deg, #141e2e, #192537);
  border-color: #25344a;
  color: #eef4ff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .20);
}

html[data-theme="dark"] .hero-health-top strong,
html[data-theme="dark"] .hero-health dd,
html[data-theme="dark"] #dashboardView .panel-head h2,
html[data-theme="dark"] .activity-row strong,
html[data-theme="dark"] .clean-row strong,
html[data-theme="dark"] .funnel-row b {
  color: #eef4ff;
}

html[data-theme="dark"] .hero-health dt,
html[data-theme="dark"] #dashboardView .panel-head p,
html[data-theme="dark"] .activity-row small,
html[data-theme="dark"] .clean-row small {
  color: #9baac0;
}

html[data-theme="dark"] .hero-health dl div {
  border-top-color: #25344a;
}

html[data-theme="dark"] .funnel-track {
  background: #20304a;
}

html[data-theme="dark"] .activity-row,
html[data-theme="dark"] .clean-row {
  background: transparent;
}

html[data-theme="dark"] .activity-row::before,
html[data-theme="dark"] .clean-row::before {
  background: #1d3158;
  color: #9db9ff;
}

html[data-theme="dark"] .nav-badge {
  display: none !important;
}

/* Reward levels and agent income calculator. */
.lead-type-panel,
.qualification-fields,
.reward-detail-section,
.income-stats,
.calculator-result,
.reward-levels {
  border: 1px solid #dfe7f4;
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(106, 77, 245, .08), transparent 40%),
    rgba(255, 255, 255, .76);
}

.lead-type-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.lead-type-panel > span,
.qualification-fields h4,
.calculator-grid span,
.reward-summary span,
.qualification-list span,
.income-stats span,
.reward-levels span {
  color: #74839c;
  font-size: 13px;
  font-weight: 780;
}

.lead-type-option {
  display: grid !important;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 2px 10px !important;
  align-items: start;
  padding: 12px;
  border: 1px solid #dfe7f4;
  border-radius: 14px;
  background: rgba(255, 255, 255, .74);
  cursor: pointer;
}

.lead-type-option input {
  grid-row: span 2;
  margin-top: 2px;
}

.lead-type-option strong,
.qualification-fields h4,
.reward-summary strong,
.calculator-result strong,
.income-stats strong,
.reward-levels strong {
  color: #07142b;
  font-weight: 850;
}

.lead-type-option small,
.qualification-fields p,
.reward-note,
.calculator-note,
.qualification-list small,
.reward-levels small {
  color: #74839c;
  line-height: 1.35;
}

.qualification-fields {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.qualification-fields[hidden] {
  display: none;
}

.qualification-fields h4,
.qualification-fields p {
  margin: 0;
}

.reward-detail-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-top: 14px;
}

.reward-detail-section h3 {
  margin: 0;
}

.reward-summary,
.income-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.reward-summary div,
.income-stats div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.reward-summary strong,
.income-stats strong {
  overflow-wrap: anywhere;
}

.qualification-list {
  display: grid;
  gap: 9px;
}

.qualification-list div {
  display: grid;
  gap: 3px;
  padding-top: 9px;
  border-top: 1px dashed #dfe7f4;
}

.reward-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reward-actions button {
  min-height: 40px;
}

.agent-income-panel,
.income-calculator-panel,
.increase-percent-panel {
  display: grid;
  gap: 18px;
}

.agent-income-panel > small {
  color: #74839c;
}

.calculator-grid {
  display: grid;
  gap: 12px;
}

.calculator-grid label {
  display: grid;
  gap: 8px;
}

.calculator-grid input[type="number"] {
  width: 100%;
}

.calculator-grid label:has(input[type="range"]) {
  grid-template-columns: minmax(0, 1fr) 56px;
  align-items: center;
}

.calculator-grid label:has(input[type="range"]) span,
.calculator-grid label:has(input[type="range"]) input {
  grid-column: 1 / -1;
}

.calculator-grid b {
  justify-self: end;
  color: #07142b;
}

.calculator-result {
  display: grid;
  gap: 7px;
  padding: 16px;
}

.calculator-result strong {
  font-size: 28px;
  line-height: 1.05;
}

.calculator-result small {
  color: #74839c;
}

.reward-levels {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.reward-levels div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #dfe7f4;
}

.reward-levels div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.reward-levels small {
  grid-column: 1 / -1;
}

html[data-theme="dark"] .lead-type-panel,
html[data-theme="dark"] .qualification-fields,
html[data-theme="dark"] .reward-detail-section,
html[data-theme="dark"] .income-stats,
html[data-theme="dark"] .calculator-result,
html[data-theme="dark"] .reward-levels,
html[data-theme="dark"] .lead-type-option {
  background:
    radial-gradient(circle at 100% 0%, rgba(109, 147, 255, .12), transparent 38%),
    #192537;
  border-color: #25344a;
}

html[data-theme="dark"] .lead-type-option strong,
html[data-theme="dark"] .qualification-fields h4,
html[data-theme="dark"] .reward-summary strong,
html[data-theme="dark"] .calculator-result strong,
html[data-theme="dark"] .income-stats strong,
html[data-theme="dark"] .reward-levels strong,
html[data-theme="dark"] .calculator-grid b {
  color: #eef4ff;
}

html[data-theme="dark"] .lead-type-panel > span,
html[data-theme="dark"] .calculator-grid span,
html[data-theme="dark"] .reward-summary span,
html[data-theme="dark"] .qualification-list span,
html[data-theme="dark"] .income-stats span,
html[data-theme="dark"] .reward-levels span,
html[data-theme="dark"] .lead-type-option small,
html[data-theme="dark"] .qualification-fields p,
html[data-theme="dark"] .reward-note,
html[data-theme="dark"] .calculator-note,
html[data-theme="dark"] .qualification-list small,
html[data-theme="dark"] .reward-levels small,
html[data-theme="dark"] .agent-income-panel > small,
html[data-theme="dark"] .calculator-result small {
  color: #9baac0;
}

html[data-theme="dark"] .qualification-list div,
html[data-theme="dark"] .reward-levels div {
  border-color: #25344a;
}

/* Responsive pass 09: fit real browser windows without changing the mockup style. */
@media (min-width: 1101px) and (max-width: 1700px) {
  :root {
    --sidebar-width: 285px;
  }

  .sidebar {
    padding: 26px 16px 14px;
  }

  .brand {
    height: 54px;
    margin-bottom: 16px;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .brand-title {
    font-size: 17px;
  }

  .brand-subtitle {
    font-size: 13px;
  }

  .nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: thin;
  }

  .nav-caption {
    margin: 11px 12px 6px;
  }

  .nav-item {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  .sidebar-bottom {
    flex: 0 0 auto;
    gap: 8px;
    padding-top: 10px;
  }

  .system-card,
  .role-panel {
    min-height: 54px;
    padding: 9px 12px;
  }

  .system-card strong,
  .role-panel span {
    font-size: 13px;
  }

  .system-card small,
  .role-panel small {
    font-size: 11px;
    line-height: 1.2;
  }

  .system-dot {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .role-panel {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }

  .role-panel::before {
    width: 36px;
    height: 36px;
  }

  .role-panel button {
    min-height: 34px;
    padding: 0 11px;
  }

  .sidebar-collapse,
  .sidebar-collapse:hover,
  body.sidebar-collapsed .sidebar-collapse,
  body.sidebar-collapsed .sidebar-collapse:hover {
    left: calc(var(--sidebar-width) - 22px);
    top: 204px;
  }

  .topbar {
    padding-right: 40px;
    padding-left: 44px;
  }

  #dashboardView.active {
    padding: 31px 40px 34px 48px;
  }

  .hero-card {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 22px;
    padding: 34px 30px 34px 34px;
  }

  .hero-copy {
    min-width: 0;
  }

  .hero-card h1 {
    max-width: min(100%, 690px);
    font-size: clamp(30px, 2.2vw, 38px);
    line-height: 1.13;
    overflow-wrap: anywhere;
  }

  .hero-card p,
  .hero-card #heroText p,
  #heroText {
    max-width: min(100%, 680px);
  }

  .hero-health {
    min-width: 0;
    padding: 24px 22px 20px;
  }

  .metrics-grid {
    gap: 16px;
  }

  .metric-card {
    min-height: 150px;
    padding: 22px 22px;
  }
}

@media (min-width: 1101px) and (max-width: 1380px) {
  :root {
    --sidebar-width: 260px;
  }

  .topbar {
    min-height: 86px;
    height: auto;
    padding: 22px 34px 18px 38px;
  }

  .topbar-actions {
    gap: 10px;
  }

  .topbar-search {
    width: min(100%, 360px);
  }

  #dashboardView.active {
    grid-template-columns: 1fr;
    padding: 28px 32px 32px 38px;
  }

  #dashboardView > .panel,
  #dashboardWorkspace {
    grid-column: 1 / -1;
  }

  #dashboardWorkspace {
    display: grid;
  }

  .hero-card {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
    min-height: 242px;
  }

  .hero-card h1 {
    max-width: 620px;
    font-size: 32px;
  }

  .hero-card p,
  .hero-card #heroText p,
  #heroText {
    max-width: 610px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (min-width: 1101px) and (max-height: 900px) {
  .sidebar {
    padding-top: 22px;
    padding-bottom: 12px;
  }

  .brand {
    height: 50px;
    margin-bottom: 12px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .nav-caption {
    margin-top: 8px;
    margin-bottom: 4px;
  }

  .nav-item {
    min-height: 35px;
    font-size: 13px;
  }

  .nav-item::before {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }

  .sidebar-bottom {
    gap: 7px;
    padding-top: 8px;
  }

  .system-card,
  .role-panel {
    min-height: 50px;
    padding: 8px 11px;
    border-radius: 14px;
  }

  .role-panel {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .role-panel::before {
    width: 34px;
    height: 34px;
  }

  .role-panel button {
    min-height: 32px;
  }
}

@media (min-width: 1101px) and (max-height: 790px) {
  .sidebar-bottom .system-card {
    display: none;
  }

  .sidebar-bottom .role-panel small {
    display: none;
  }

  .nav-item {
    min-height: 32px;
  }

  .nav-caption {
    margin-top: 6px;
  }
}

/* Responsive pass 10: denser sidebar, compact topbar, visible theme/collapse controls. */
@media (min-width: 1101px) {
  .main,
  body.amo-settings-mode .main {
    padding: 0 !important;
  }

  .topbar,
  body.amo-settings-mode .topbar {
    min-height: 70px;
    height: 70px;
    padding: 0 30px 0 36px;
    margin: 0;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.08;
  }

  .topbar p {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.2;
  }

  .topbar-actions {
    gap: 9px;
  }

  .topbar-search {
    width: clamp(260px, 24vw, 340px);
    height: 42px;
    border-radius: 13px;
  }

  .topbar-search input {
    font-size: 14px;
  }

  .topbar-search kbd {
    min-width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 12px;
  }

  .notification-btn,
  .theme-switcher {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
  }

  .notification-btn::before {
    width: 20px;
    height: 20px;
  }

  .notification-btn span {
    top: 7px;
    right: 7px;
  }

  .theme-switcher {
    border-width: 2px;
  }

  .theme-switcher::before {
    width: 22px;
    height: 22px;
  }

  html[data-theme="dark"] .theme-switcher::before {
    background: #edf4ff;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 14.8A8.2 8.2 0 0 1 9.2 3 7.2 7.2 0 1 0 21 14.8z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 14.8A8.2 8.2 0 0 1 9.2 3 7.2 7.2 0 1 0 21 14.8z'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .sidebar {
    padding: 22px 14px 12px;
  }

  .brand {
    height: 48px;
    margin-bottom: 14px;
    padding: 0 8px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .brand-title {
    font-size: 16px;
    line-height: 1.05;
  }

  .brand-subtitle {
    font-size: 12px;
    line-height: 1.15;
  }

  .nav {
    display: flex !important;
    flex-direction: column;
    gap: 2px;
    align-content: stretch;
  }

  .nav-caption {
    margin: 9px 10px 5px;
    font-size: 10px;
    line-height: 1.1;
  }

  .nav-item {
    min-height: 32px;
    padding: 0 10px;
    gap: 10px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.1;
  }

  .nav-item::before {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .nav-item.active::after {
    left: -14px;
    height: 22px;
  }

  .sidebar-bottom {
    gap: 7px;
    padding-top: 8px;
  }

  .system-card {
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
    padding: 7px 10px;
    gap: 8px;
    border-radius: 13px;
  }

  .system-dot {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .system-dot::after {
    inset: 8px;
  }

  .system-card strong {
    font-size: 12px;
    line-height: 1.1;
  }

  .system-card small {
    font-size: 10px;
    line-height: 1.1;
  }

  .role-panel {
    box-sizing: border-box;
    height: 42px;
    min-height: 42px;
    padding: 6px 8px;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    column-gap: 8px;
    border-radius: 13px;
  }

  .role-panel::before {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .role-panel span {
    font-size: 12px;
    line-height: 1.1;
  }

  .role-panel small {
    display: none !important;
  }

  .role-panel button {
    min-height: 28px;
    padding: 0 10px;
    border-radius: 9px;
    font-size: 12px;
  }

  .sidebar-collapse,
  .sidebar-collapse:hover,
  body.sidebar-collapsed .sidebar-collapse,
  body.sidebar-collapsed .sidebar-collapse:hover {
    position: fixed;
    left: calc(var(--sidebar-width) - 22px) !important;
    top: 196px !important;
    width: 42px;
    height: 42px;
    min-width: 42px;
    display: grid;
    place-items: center;
    border: 2px solid #326dff;
    border-radius: 999px;
    background: #ffffff;
    color: #2368ff;
    box-shadow: 0 14px 30px rgba(35, 90, 210, .28), 0 0 0 5px rgba(255, 255, 255, .86);
    font-size: 0;
    z-index: 20000 !important;
    opacity: 1;
  }

  .sidebar-collapse::after {
    content: "";
    width: 10px;
    height: 10px;
    border-left: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: translateX(2px) rotate(45deg);
  }

  body.sidebar-collapsed .sidebar-collapse::after {
    transform: translateX(-2px) rotate(225deg);
  }

  .sidebar-collapse:hover {
    background: #f4f8ff;
    color: #0f5df0;
  }

  html[data-theme="dark"] .sidebar-collapse,
  html[data-theme="dark"] .sidebar-collapse:hover,
  html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse,
  html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse:hover {
    background: #edf4ff;
    border-color: #7fa6ff;
    color: #0f5df0;
    box-shadow: 0 16px 34px rgba(0, 0, 0, .35), 0 0 0 5px rgba(12, 20, 33, .82);
  }

  #dashboardView.active {
    padding-top: 24px;
  }
}

@media (min-width: 1101px) and (max-width: 1380px) {
  .topbar,
  body.amo-settings-mode .topbar {
    min-height: 64px;
    height: 64px;
    padding: 0 28px 0 36px;
  }

  .topbar-search {
    width: clamp(240px, 27vw, 320px);
  }

  .sidebar-collapse,
  .sidebar-collapse:hover,
  body.sidebar-collapsed .sidebar-collapse,
  body.sidebar-collapsed .sidebar-collapse:hover {
    left: calc(var(--sidebar-width) - 20px) !important;
    top: 198px !important;
  }
}

/* Control polish pass 11: calm sidebar chevron and clean theme glyphs. */
@media (min-width: 1101px) {
  .sidebar-collapse,
  .sidebar-collapse:hover,
  body.sidebar-collapsed .sidebar-collapse,
  body.sidebar-collapsed .sidebar-collapse:hover {
    position: fixed;
    left: calc(var(--sidebar-width) - 48px) !important;
    top: 28px !important;
    width: 30px;
    height: 30px;
    min-width: 30px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(136, 157, 190, .42);
    border-radius: 10px;
    background: rgba(255, 255, 255, .82);
    color: #50627d;
    box-shadow: 0 8px 18px rgba(35, 56, 95, .08);
    font-size: 22px !important;
    line-height: 1;
    font-weight: 700;
    z-index: 20000 !important;
    opacity: 1;
    transform: none;
  }

  .sidebar-collapse::after {
    display: none !important;
  }

  .sidebar-collapse:hover,
  body.sidebar-collapsed .sidebar-collapse:hover {
    border-color: rgba(50, 109, 255, .48);
    background: #ffffff;
    color: #2368ff;
  }

  body.sidebar-collapsed .sidebar-collapse,
  body.sidebar-collapsed .sidebar-collapse:hover {
    left: 27px !important;
    transform: rotate(180deg);
  }

  html[data-theme="dark"] .sidebar-collapse,
  html[data-theme="dark"] .sidebar-collapse:hover,
  html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse,
  html[data-theme="dark"] body.sidebar-collapsed .sidebar-collapse:hover {
    background: #142039;
    border-color: #2d4163;
    color: #dce8ff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .24);
  }

  .theme-switcher::before {
    width: 22px;
    height: 22px;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23101827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 22px 22px !important;
    -webkit-mask: none !important;
    mask: none !important;
  }

  html[data-theme="dark"] .theme-switcher::before {
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23eef4ff' stroke-width='2.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.99 12.49A9 9 0 1 1 11.51 3c.41-.02.62.46.4.8a6 6 0 0 0 8.29 8.29c.34-.22.81 0 .79.4Z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 21px 21px !important;
    -webkit-mask: none !important;
    mask: none !important;
  }
}

/* Collapsed menu pass 12: keep compact icons at the top and remove search shortcut badge. */
@media (min-width: 1101px) {
  .topbar-search kbd {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: var(--sidebar-width);
    padding: 22px 8px 12px !important;
    overflow: visible;
  }

  body.sidebar-collapsed .brand {
    display: block;
    height: 32px;
    min-height: 32px;
    padding: 0;
    margin: 0 0 14px;
  }

  body.sidebar-collapsed .brand-mark,
  body.sidebar-collapsed .brand > div {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-collapse,
  body.sidebar-collapsed .sidebar-collapse:hover {
    position: static;
    width: 30px;
    height: 30px;
    min-width: 30px;
    margin: 0 auto;
    transform: rotate(180deg);
  }

  body.sidebar-collapsed .nav {
    display: flex !important;
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    gap: 7px;
    padding: 0;
  }

  body.sidebar-collapsed .nav-caption {
    display: none !important;
  }

  body.sidebar-collapsed .nav-item {
    width: 42px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 11px;
  }

  body.sidebar-collapsed .nav-item::before {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
  }

  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-badge {
    display: none !important;
  }

  body.sidebar-collapsed .nav-item.active::after {
    left: -8px;
    width: 4px;
    height: 22px;
  }

body.sidebar-collapsed .sidebar-bottom {
    display: none !important;
  }
}

/* Dashboard cleanup pass 13: compact system summary and cleaner work panels. */
#copyDashboardWebhook {
  display: none !important;
}

.panel-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.panel-collapse-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(136, 157, 190, .42);
  border-radius: 11px;
  background: rgba(255, 255, 255, .82);
  color: #50627d;
  box-shadow: 0 8px 18px rgba(35, 56, 95, .08);
  font-size: 24px;
  line-height: 1;
  font-weight: 750;
  cursor: pointer;
}

.panel-collapse-btn:hover {
  border-color: rgba(50, 109, 255, .48);
  color: #2368ff;
}

body.funnel-panel-collapsed .panel-collapse-btn {
  transform: rotate(180deg);
}

body.funnel-panel-collapsed #funnelPanel {
  min-height: 0 !important;
}

body.funnel-panel-collapsed #funnel {
  display: none !important;
}

.metric-card::after {
  display: none !important;
}

@media (min-width: 1101px) {
  #heroCard {
    min-height: 0 !important;
    grid-template-columns: 1fr !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  #heroCard::before,
  #heroCard::after,
  #heroCard .hero-copy {
    display: none !important;
  }

  #heroCard .hero-health {
    width: 100%;
    min-height: 0;
    padding: 18px 22px;
    border-radius: 22px;
  }

  #heroCard .hero-health-top {
    min-height: 28px;
  }

  #heroCard .hero-health dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 18px;
    margin-top: 14px;
  }

  #heroCard .hero-health dl div {
    min-height: 36px;
    border-top: 1px dashed #dae4f2;
  }

  #heroCard .hero-health dl div:first-child {
    border-top: 1px dashed #dae4f2;
  }

  #dashboardView > .panel,
  #dashboardWorkspace {
    grid-column: 1 / -1 !important;
  }

  #dashboardWorkspace {
    width: 100%;
    display: block !important;
  }

  #dashboardWorkspace .panel {
    width: 100%;
    max-width: none;
    min-height: 240px;
    height: auto;
  }

  #dashboardWorkspace .activity-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  #dashboardWorkspace .activity-row {
    min-height: 70px;
  }
}

@media (max-width: 1100px) {
  #heroCard .hero-copy {
    display: none !important;
  }

  #heroCard {
    min-height: 0 !important;
  }

  #heroCard .hero-health {
    min-height: 0;
  }

  .panel-head {
    gap: 14px;
  }

  .panel-actions {
    width: 100%;
    justify-content: space-between;
  }
}

html[data-theme="dark"] .panel-collapse-btn {
  border-color: #2d4163;
  background: #142039;
  color: #dce8ff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .24);
}

html[data-theme="dark"] .panel-collapse-btn:hover {
  border-color: #7fa6ff;
  color: #eff6ff;
}

html[data-theme="dark"] #heroCard .hero-health dl div,
html[data-theme="dark"] #heroCard .hero-health dl div:first-child {
  border-top-color: #25344a;
}

/* Agent dashboard pass 14: calculator-first summary. */
body.role-agent #heroCard.agent-calculator-card {
  display: block !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.role-agent #heroCard.agent-calculator-card::before,
body.role-agent #heroCard.agent-calculator-card::after {
  display: none !important;
}

body.role-agent #heroCard.agent-calculator-card .income-calculator-panel {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 24px 26px;
  border-radius: 22px;
}

body.role-agent .income-calculator-panel .panel-head {
  align-items: flex-start;
}

body.role-agent .income-calculator-panel .panel-head h2,
body.role-agent .referral-income .panel-head h2 {
  margin: 0;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.08;
}

body.role-agent .income-calculator-panel .panel-head p,
body.role-agent .referral-income .panel-head p {
  max-width: 760px;
}

body.role-agent .income-calculator-panel .calculator-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

body.role-agent .income-calculator-panel .calculator-grid label {
  padding: 13px 14px;
  border: 1px solid rgba(139, 157, 188, .25);
  border-radius: 16px;
  background: rgba(255, 255, 255, .62);
}

body.role-agent .income-calculator-panel .calculator-grid span {
  color: #6f7e96;
  font-size: 13px;
  font-weight: 800;
}

body.role-agent .income-calculator-panel input,
body.role-agent .income-calculator-panel select {
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #07142b;
  font-size: 22px;
  font-weight: 850;
  outline: 0;
}

body.role-agent .income-calculator-panel .calculator-result {
  min-height: 106px;
  border: 1px solid rgba(111, 141, 255, .24);
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 20%, rgba(111, 141, 255, .16), transparent 34%),
    linear-gradient(135deg, rgba(234, 255, 248, .78), rgba(247, 249, 255, .9));
}

body.role-agent .income-calculator-panel .calculator-result span {
  color: #66768f;
  font-weight: 800;
}

body.role-agent .income-calculator-panel .calculator-result strong {
  color: #06132b;
  font-size: clamp(34px, 4vw, 48px);
}

body.role-agent .income-calculator-panel .calculator-note {
  margin: 0;
  color: #75839a;
  font-size: 13px;
}

body.role-agent #metricsGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.role-agent .referral-income {
  min-height: 0;
}

.reward-rules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.reward-rules-grid div {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid rgba(139, 157, 188, .25);
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(111, 141, 255, .13), transparent 38%),
    rgba(255, 255, 255, .6);
}

.reward-rules-grid span {
  width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(35, 104, 255, .12);
  color: #2368ff;
  font-size: 18px;
  font-weight: 900;
}

.reward-rules-grid strong {
  color: #07142b;
  font-size: 16px;
}

.reward-rules-grid small {
  color: #6f7e96;
  line-height: 1.45;
}

html[data-theme="dark"] body.role-agent .income-calculator-panel .calculator-grid label,
html[data-theme="dark"] .reward-rules-grid div {
  border-color: rgba(126, 158, 220, .22);
  background:
    radial-gradient(circle at 100% 0%, rgba(110, 141, 255, .11), transparent 38%),
    rgba(17, 28, 48, .72);
}

html[data-theme="dark"] body.role-agent .income-calculator-panel input,
html[data-theme="dark"] body.role-agent .income-calculator-panel select,
html[data-theme="dark"] .reward-rules-grid strong {
  color: #f2f7ff;
}

html[data-theme="dark"] body.role-agent .income-calculator-panel .calculator-result {
  border-color: rgba(126, 158, 220, .22);
  background:
    radial-gradient(circle at 92% 20%, rgba(111, 141, 255, .18), transparent 34%),
    linear-gradient(135deg, rgba(18, 54, 60, .84), rgba(25, 31, 58, .88));
}

html[data-theme="dark"] body.role-agent .income-calculator-panel .calculator-result strong {
  color: #f2f7ff;
}

html[data-theme="dark"] body.role-agent .income-calculator-panel .calculator-note,
html[data-theme="dark"] .reward-rules-grid small {
  color: #a7b5cc;
}

@media (max-width: 1180px) {
  body.role-agent #metricsGrid,
  body.role-agent .income-calculator-panel .calculator-grid,
  .reward-rules-grid {
    grid-template-columns: 1fr;
  }
}

/* Agent navigation and controls pass 16. */
body.funnel-panel-collapsed .panel-collapse-btn {
  transform: none;
}

html[data-theme="dark"] select option,
html[data-theme="dark"] select optgroup {
  background: #101827;
  color: #f2f7ff;
}

body.role-agent .income-calculator-panel .calculator-grid label {
  border-color: rgba(121, 145, 184, .42);
  background: rgba(255, 255, 255, .92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .86),
    0 10px 24px rgba(40, 67, 120, .07);
}

body.role-agent .income-calculator-panel input,
body.role-agent .income-calculator-panel select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(177, 190, 214, .5);
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
}

html[data-theme="dark"] body.role-agent .income-calculator-panel input,
html[data-theme="dark"] body.role-agent .income-calculator-panel select {
  border-color: rgba(126, 158, 220, .34);
  background: rgba(10, 18, 32, .78);
  color: #f2f7ff;
}

.role-panel small.is-copyable {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  margin-top: 3px;
  padding: 2px 7px;
  border: 1px solid rgba(109, 147, 255, .26);
  border-radius: 999px;
  color: #2f6dff;
  background: rgba(47, 109, 255, .08);
  cursor: pointer;
  user-select: none;
}

.role-panel small.is-copyable:hover {
  border-color: rgba(47, 109, 255, .48);
  background: rgba(47, 109, 255, .14);
}

.role-panel button {
  justify-self: end;
  align-self: center;
}

html[data-theme="dark"] .role-panel small.is-copyable {
  border-color: rgba(126, 158, 220, .32);
  color: #cfe0ff;
  background: rgba(109, 147, 255, .13);
}

@media (max-height: 780px), (max-width: 1400px) {
  .role-panel small.is-copyable {
    display: inline-flex !important;
    font-size: 10px;
    line-height: 1;
  }
}

/* Agent home pass 17: top action, overview, cleaner sidebar. */
.topbar-lead-btn {
  min-height: 44px;
  padding: 0 18px;
  white-space: nowrap;
}

body.role-agent .topbar-lead-btn[hidden] {
  display: none !important;
}

body.role-agent .system-card {
  display: none !important;
}

body.role-agent .role-panel {
  min-height: 58px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  column-gap: 10px;
  padding: 10px 12px;
}

body.role-agent .role-panel::before {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

body.role-agent .role-panel span {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.role-agent .role-panel small.is-copyable,
body.role-agent .role-panel small.is-copyable:hover {
  grid-column: 2;
  grid-row: 2;
  display: block !important;
  width: auto;
  max-width: 100%;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #5e708a;
  font-size: 12px;
  line-height: 1.15;
  cursor: pointer;
}

body.role-agent .role-panel small.is-copyable:hover {
  color: #2468ff;
  text-decoration: underline;
}

body.role-agent .role-panel button {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: end;
  min-height: 34px;
  padding: 0 12px;
}

html[data-theme="dark"] body.role-agent .role-panel small.is-copyable,
html[data-theme="dark"] body.role-agent .role-panel small.is-copyable:hover {
  background: transparent;
  color: #9fb3d3;
}

html[data-theme="dark"] body.role-agent .role-panel small.is-copyable:hover {
  color: #d8e5ff;
}

/* Agent sidebar profile pass 28: name-only profile with centered logout. */
body.role-agent .role-panel {
  min-height: 48px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 1px;
  padding: 8px 10px;
}

body.role-agent .role-panel::before {
  content: none;
  display: none;
}

body.role-agent .role-panel span {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  min-width: 0;
}

body.role-agent .role-panel small.is-copyable,
body.role-agent .role-panel small.is-copyable:hover {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  margin: 0;
  line-height: 1.1;
}

body.role-agent .role-panel button {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: end;
  min-height: 32px;
}

.agent-overview-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, .9fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid rgba(184, 205, 255, .75);
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 8%, rgba(139, 112, 255, .14), transparent 34%),
    radial-gradient(circle at 8% 100%, rgba(65, 210, 176, .12), transparent 34%),
    rgba(255, 255, 255, .82);
  box-shadow: 0 18px 44px rgba(48, 83, 145, .08);
}

.agent-overview-copy {
  display: grid;
  gap: 8px;
}

.agent-overview-copy span {
  width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(35, 104, 255, .10);
  color: #2368ff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.agent-overview-copy h2 {
  margin: 0;
  color: #07142b;
  font-size: clamp(24px, 2.6vw, 36px);
  line-height: 1.05;
}

.agent-overview-copy p {
  max-width: 620px;
  margin: 0;
  color: #65758e;
  line-height: 1.45;
}

.agent-overview-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.agent-overview-stats div {
  min-height: 92px;
  padding: 14px;
  border: 1px solid rgba(139, 157, 188, .26);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
}

.agent-overview-stats small,
.agent-overview-stats span {
  display: block;
  color: #6f7e96;
  font-weight: 750;
}

.agent-overview-stats strong {
  display: block;
  margin: 8px 0 5px;
  color: #06132b;
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1;
}

.nav-item[data-view="referral"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8.5' cy='8' r='3.5'/%3E%3Cpath d='M3 20c.7-3.5 2.5-5.5 5.5-5.5s4.8 2 5.5 5.5'/%3E%3Cpath d='M18.5 7v7M22 10.5h-7'/%3E%3C/svg%3E");
}

.nav-item[data-view="training"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m10 8 6 4-6 4z'/%3E%3C/svg%3E");
}

.nav-item[data-view="materials"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v14H7z'/%3E%3Cpath d='M14 3v5h4M9.5 12h5M9.5 16h5'/%3E%3C/svg%3E");
}

.nav-item[data-view="support"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12a7 7 0 0 1 14 0'/%3E%3Cpath d='M5 12v3a2 2 0 0 0 2 2h1v-6H7a2 2 0 0 0-2 2M19 12v3a2 2 0 0 1-2 2h-1v-6h1a2 2 0 0 1 2 2'/%3E%3Cpath d='M14 19h-2a3 3 0 0 1-3-3'/%3E%3C/svg%3E");
}

.nav-item[data-view="managers"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2'/%3E%3Cpath d='M5 7h14v12H5z'/%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .agent-overview-card {
  border-color: rgba(126, 158, 220, .24);
  background:
    radial-gradient(circle at 92% 8%, rgba(139, 112, 255, .16), transparent 34%),
    radial-gradient(circle at 8% 100%, rgba(65, 210, 176, .11), transparent 34%),
    rgba(17, 28, 48, .78);
}

html[data-theme="dark"] .agent-overview-copy h2,
html[data-theme="dark"] .agent-overview-stats strong {
  color: #f2f7ff;
}

html[data-theme="dark"] .agent-overview-copy p,
html[data-theme="dark"] .agent-overview-stats small,
html[data-theme="dark"] .agent-overview-stats span {
  color: #a7b5cc;
}

html[data-theme="dark"] .agent-overview-stats div {
  border-color: rgba(126, 158, 220, .22);
  background: rgba(10, 18, 32, .54);
}

@media (max-width: 1400px) {
  .agent-overview-card {
    grid-template-columns: 1fr;
  }

  .agent-overview-card .primary-btn {
    width: max-content;
  }
}

@media (max-width: 820px) {
  .topbar-lead-btn {
    width: 100%;
  }

  .agent-overview-stats {
    grid-template-columns: 1fr;
  }
}

/* Clients table pass 18: compact rows without text pills. */
#clientTable.client-table {
  gap: 0;
}

#clientTable .client-row {
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(188, 203, 224, .55);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#clientTable .client-row:hover {
  background: rgba(68, 122, 255, .045);
  border-color: rgba(188, 203, 224, .75);
}

#clientTable .client-row > * {
  min-height: 40px;
  height: auto;
  padding: 6px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111b31;
  font-size: 13px;
  line-height: 1.15;
  box-shadow: none;
}

#clientTable .client-name {
  justify-content: flex-start;
  color: #0d55b8;
  text-align: left;
  font-weight: 820;
}

#clientTable .client-row span {
  justify-content: flex-start;
  text-align: left;
}

#clientTable .client-row span small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
}

#clientTable .status-badge {
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: #2368ff;
  font-weight: 820;
}

#clientTable .client-row button:not(.client-name) {
  justify-content: center;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #172033;
  font-weight: 780;
}

#clientTable .client-row button:not(.client-name):hover {
  border-color: rgba(35, 104, 255, .24);
  background: rgba(35, 104, 255, .07);
  color: #0d55b8;
}

#clientTable .status-select {
  min-height: 36px;
  height: 36px;
  padding-top: 4px;
  padding-bottom: 4px;
  border: 1px solid rgba(188, 203, 224, .48);
  border-radius: 9px;
  background-color: rgba(255, 255, 255, .72);
}

html[data-theme="dark"] #clientTable .client-row {
  border-bottom-color: rgba(126, 158, 220, .20);
  background: transparent;
}

html[data-theme="dark"] #clientTable .client-row:hover {
  background: rgba(88, 142, 255, .08);
  border-color: rgba(126, 158, 220, .30);
}

html[data-theme="dark"] #clientTable .client-row > * {
  background: transparent;
  color: #eef5ff;
}

html[data-theme="dark"] #clientTable .client-name,
html[data-theme="dark"] #clientTable .status-badge {
  color: #8fb7ff;
}

html[data-theme="dark"] #clientTable .client-row button:not(.client-name) {
  color: #d8e5ff;
}

html[data-theme="dark"] #clientTable .client-row button:not(.client-name):hover {
  border-color: rgba(143, 183, 255, .25);
  background: rgba(143, 183, 255, .08);
  color: #ffffff;
}

/* Chat workspace pass 19: compact list and inline attachments. */
#chatView.view.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 72px);
}

#chatView .section-title {
  flex: 0 0 auto;
}

#chatView .chat-layout {
  flex: 1 1 auto;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  align-items: stretch;
  min-height: calc(100vh - 220px);
}

#chatView .chat-layout > .panel {
  min-height: 0;
}

#chatView .chat-layout > .panel:first-child {
  overflow: hidden;
  padding: 14px;
}

#chatView .chat-list {
  align-content: start;
  height: 100%;
  max-height: calc(100vh - 250px);
  overflow: auto;
  gap: 8px;
}

#chatView .chat-item {
  min-height: 50px;
  padding: 8px 10px;
  border-radius: 12px;
}

#chatView .chat-item b {
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chatView .chat-item span span {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

#chatView .chat-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 250px);
  max-height: calc(100vh - 190px);
}

#chatView .messages {
  flex: 1 1 auto;
  min-height: 220px;
  overflow: auto;
}

#chatView .empty-state {
  min-height: 180px;
}

#chatView .message-form {
  align-items: center;
  position: relative;
}

.message-input-shell {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.message-input-shell input#messageInput {
  width: 100%;
  min-height: 48px;
  padding-left: 50px;
}

.chat-attach-btn {
  position: absolute;
  top: 50%;
  left: 10px;
  z-index: 2;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid rgba(35, 104, 255, .18);
  border-radius: 999px;
  background: rgba(35, 104, 255, .08);
  color: #2368ff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.chat-attach-btn:hover,
.chat-attach-btn[aria-expanded="true"] {
  border-color: rgba(35, 104, 255, .35);
  background: rgba(35, 104, 255, .14);
}

.chat-attach-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 12;
  min-width: 180px;
  padding: 6px;
  border: 1px solid rgba(188, 203, 224, .7);
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 42px rgba(48, 83, 145, .16);
}

.chat-attach-menu[hidden],
.chat-attachment-preview[hidden] {
  display: none;
}

.chat-attach-menu button {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #10213d;
  text-align: left;
  font-weight: 800;
}

.chat-attach-menu button:hover {
  background: rgba(35, 104, 255, .08);
}

.message-input-shell.is-dragover input#messageInput {
  border-color: #2368ff;
  background: rgba(35, 104, 255, .08);
  box-shadow: 0 0 0 3px rgba(35, 104, 255, .12);
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.chat-attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
}

.chat-file-chip {
  display: inline-flex;
  max-width: min(100%, 320px);
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 11px;
  border: 1px solid rgba(35, 104, 255, .18);
  border-radius: 999px;
  background: rgba(35, 104, 255, .08);
  color: #10213d;
  font-size: 12px;
  font-weight: 800;
}

.chat-file-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-file-chip small {
  margin-left: 6px;
  color: #6f7e96;
  font-weight: 700;
}

.chat-file-chip button {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(35, 104, 255, .10);
  color: #2368ff;
  font-size: 16px;
  line-height: 1;
}

.message-file {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(35, 104, 255, .18);
  border-radius: 999px;
  background: rgba(35, 104, 255, .08);
  color: #2368ff;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.message-file:hover {
  border-color: rgba(35, 104, 255, .35);
  background: rgba(35, 104, 255, .13);
}

.attachment-row {
  display: none;
}

html[data-theme="dark"] .chat-attach-btn {
  border-color: rgba(143, 183, 255, .25);
  background: rgba(143, 183, 255, .12);
  color: #9fc1ff;
}

html[data-theme="dark"] .chat-attach-menu {
  border-color: var(--line);
  background: rgba(20, 30, 46, .98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] .chat-attach-menu button,
html[data-theme="dark"] .chat-file-chip {
  color: #eef5ff;
}

html[data-theme="dark"] .chat-attach-menu button:hover {
  background: rgba(143, 183, 255, .10);
}

html[data-theme="dark"] .chat-file-chip {
  border-color: rgba(143, 183, 255, .22);
  background: rgba(143, 183, 255, .10);
}

html[data-theme="dark"] .chat-file-chip small {
  color: #9baac0;
}

html[data-theme="dark"] .message-file {
  border-color: rgba(143, 183, 255, .24);
  background: rgba(143, 183, 255, .10);
  color: #9fc1ff;
}

@media (max-width: 1100px) {
  #chatView .chat-layout {
    min-height: auto;
  }

  #chatView .chat-list {
    max-height: 260px;
  }

  #chatView .chat-panel {
    min-height: 560px;
    max-height: none;
  }
}

@media (max-width: 760px) {
  #chatView .message-form {
    align-items: stretch;
  }

  #chatView .message-form .primary-btn {
    width: 100%;
  }

  .message-input-shell {
    width: 100%;
  }
}

/* Withdrawals: keep the request history visible across the screen height. */
#withdrawalView.view.active {
  min-height: calc(100vh - 72px);
}

#withdrawalView .withdraw-grid {
  align-items: start;
}

#withdrawalView .balance-panel {
  align-self: start;
}

#withdrawalView .withdraw-grid > .panel:nth-child(2) {
  display: flex;
  flex-direction: column;
  min-height: max(420px, calc(100vh - 205px));
  overflow: hidden;
}

#withdrawHistory {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

@media (max-width: 940px) {
  #withdrawalView .withdraw-grid > .panel:nth-child(2) {
    min-height: max(360px, calc(100vh - 260px));
  }
}

/* Support desk MVP: compact request form plus ticket workspace. */
.support-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.support-layout .support-panel,
.support-layout .support-ticket-panel {
  max-width: none;
}

.support-create-card {
  gap: 10px;
  padding: 20px;
}

.support-create-card h2,
.support-ticket-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.15;
}

.support-create-card p,
.support-ticket-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.support-create-card textarea {
  min-height: 76px;
  resize: vertical;
}

.support-ticket-panel {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 16px;
  min-height: max(500px, calc(100vh - 230px));
  overflow: hidden;
}

.support-ticket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.support-ticket-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.support-ticket-list-head span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(35, 104, 255, .10);
  color: #2368ff;
}

.support-ticket-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .42);
  color: var(--text);
  text-align: left;
  padding: 12px;
  cursor: pointer;
}

.support-ticket-item strong,
.support-ticket-item small {
  display: block;
}

.support-ticket-item small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.support-ticket-item.active {
  border-color: rgba(35, 104, 255, .38);
  background: rgba(35, 104, 255, .10);
}

.support-ticket-chat {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.support-ticket-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.support-ticket-head span {
  display: block;
  margin-bottom: 7px;
  color: #2368ff;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.support-messages {
  flex: 1 1 auto;
  min-height: 260px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 0;
}

.support-message {
  max-width: 84%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .56);
  color: var(--text);
}

.support-message p {
  margin: 6px 0;
  color: var(--text);
  line-height: 1.45;
}

.support-message small {
  color: var(--muted);
  font-size: 12px;
}

.support-message-user {
  align-self: flex-end;
  background: rgba(35, 104, 255, .10);
  border-color: rgba(35, 104, 255, .24);
}

.support-message-support {
  align-self: flex-start;
}

.support-message-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

html[data-theme="dark"] .support-ticket-item,
html[data-theme="dark"] .support-message {
  background: rgba(143, 183, 255, .08);
}

html[data-theme="dark"] .support-ticket-item.active,
html[data-theme="dark"] .support-message-user {
  background: rgba(88, 151, 255, .14);
}

@media (max-width: 1100px) {
  .support-layout,
  .support-ticket-panel {
    grid-template-columns: 1fr;
  }

  .support-ticket-panel {
    min-height: auto;
  }

  .support-ticket-list {
    max-height: 240px;
  }
}

@media (max-width: 760px) {
  .support-message-form {
    grid-template-columns: 1fr;
  }

  .support-message {
    max-width: 92%;
  }
}

/* Dark gradient polish: keep one continuous canvas and soften panel fills. */
html[data-theme="dark"] {
  --ba-dark-canvas: #09111e;
  --ba-dark-panel-a: rgba(23, 38, 63, .94);
  --ba-dark-panel-b: rgba(15, 27, 46, .96);
  --ba-dark-panel-c: rgba(18, 54, 61, .34);
  --ba-dark-border: rgba(132, 166, 224, .22);
  --ba-dark-border-soft: rgba(132, 166, 224, .14);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  min-height: 100%;
  background:
    radial-gradient(ellipse 980px 620px at 78% -10%, rgba(96, 127, 232, .18), transparent 64%),
    radial-gradient(ellipse 760px 520px at 34% 105%, rgba(43, 193, 176, .12), transparent 66%),
    linear-gradient(180deg, #0d1625 0%, var(--ba-dark-canvas) 54%, #07111b 100%) fixed !important;
}

html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .main,
html[data-theme="dark"] .view.active,
html[data-theme="dark"] .login-screen {
  background: transparent !important;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] body.amo-settings-mode .topbar {
  background: rgba(9, 17, 30, .72) !important;
  border-bottom-color: rgba(132, 166, 224, .14);
  backdrop-filter: blur(18px);
}

html[data-theme="dark"] .clients-head,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .hero-health,
html[data-theme="dark"] .withdraw-card,
html[data-theme="dark"] .balance-panel,
html[data-theme="dark"] .referral-panel,
html[data-theme="dark"] .support-panel,
html[data-theme="dark"] .support-ticket-panel,
html[data-theme="dark"] .text-panel,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .stage-help,
html[data-theme="dark"] .agent-overview-card,
html[data-theme="dark"] .income-calculator-panel,
html[data-theme="dark"] .increase-percent-panel,
html[data-theme="dark"] .lead-type-panel,
html[data-theme="dark"] .qualification-fields,
html[data-theme="dark"] .reward-detail-section,
html[data-theme="dark"] .income-stats,
html[data-theme="dark"] .reward-levels,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .confirm-card,
html[data-theme="dark"] .agent-modal-card,
html[data-theme="dark"] .hint-card,
html[data-theme="dark"] .empty-state {
  border: 1px solid transparent !important;
  background:
    linear-gradient(145deg, var(--ba-dark-panel-a), var(--ba-dark-panel-b)) padding-box,
    linear-gradient(145deg, rgba(143, 183, 255, .30), rgba(65, 210, 176, .12), rgba(154, 128, 255, .16)) border-box !important;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .22) !important;
}

html[data-theme="dark"] .clients-head,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .agent-overview-card,
html[data-theme="dark"] body.role-agent .income-calculator-panel,
html[data-theme="dark"] .support-ticket-panel,
html[data-theme="dark"] #withdrawalView .withdraw-grid > .panel:nth-child(2) {
  background:
    radial-gradient(ellipse 720px 360px at 92% -8%, rgba(139, 112, 255, .16), transparent 68%) padding-box,
    radial-gradient(ellipse 680px 360px at 7% 105%, rgba(65, 210, 176, .12), transparent 64%) padding-box,
    linear-gradient(145deg, var(--ba-dark-panel-a), var(--ba-dark-panel-b)) padding-box,
    linear-gradient(145deg, rgba(143, 183, 255, .32), rgba(65, 210, 176, .14), rgba(154, 128, 255, .16)) border-box !important;
}

html[data-theme="dark"] .metric-card {
  background:
    radial-gradient(ellipse 210px 160px at 88% 22%, rgba(88, 142, 255, .14), transparent 72%) padding-box,
    linear-gradient(145deg, rgba(23, 38, 63, .93), rgba(15, 27, 46, .96)) padding-box,
    linear-gradient(145deg, rgba(143, 183, 255, .24), rgba(65, 210, 176, .08)) border-box !important;
}

html[data-theme="dark"] .metric-card:nth-child(2) {
  background:
    radial-gradient(ellipse 210px 160px at 88% 22%, rgba(65, 210, 176, .15), transparent 72%) padding-box,
    linear-gradient(145deg, rgba(23, 38, 63, .93), rgba(15, 27, 46, .96)) padding-box,
    linear-gradient(145deg, rgba(143, 183, 255, .24), rgba(65, 210, 176, .08)) border-box !important;
}

html[data-theme="dark"] .metric-card:nth-child(3) {
  background:
    radial-gradient(ellipse 210px 160px at 88% 22%, rgba(240, 179, 92, .15), transparent 72%) padding-box,
    linear-gradient(145deg, rgba(23, 38, 63, .93), rgba(15, 27, 46, .96)) padding-box,
    linear-gradient(145deg, rgba(143, 183, 255, .24), rgba(65, 210, 176, .08)) border-box !important;
}

html[data-theme="dark"] .metric-card:nth-child(4) {
  background:
    radial-gradient(ellipse 210px 160px at 88% 22%, rgba(232, 90, 106, .14), transparent 72%) padding-box,
    linear-gradient(145deg, rgba(23, 38, 63, .93), rgba(15, 27, 46, .96)) padding-box,
    linear-gradient(145deg, rgba(143, 183, 255, .24), rgba(65, 210, 176, .08)) border-box !important;
}

html[data-theme="dark"] .client-row,
html[data-theme="dark"] .agent-list-row,
html[data-theme="dark"] .manager-row,
html[data-theme="dark"] .history-row,
html[data-theme="dark"] .top-row,
html[data-theme="dark"] .withdrawal-row,
html[data-theme="dark"] .clean-row,
html[data-theme="dark"] .activity-row,
html[data-theme="dark"] .client-detail-row,
html[data-theme="dark"] .timeline-row,
html[data-theme="dark"] .comment-row,
html[data-theme="dark"] .funnel-row,
html[data-theme="dark"] .status-settings-row,
html[data-theme="dark"] .amo-stage-card,
html[data-theme="dark"] .amo-mapped-card,
html[data-theme="dark"] .chat-item,
html[data-theme="dark"] .notification-item,
html[data-theme="dark"] .support-ticket-item,
html[data-theme="dark"] .support-message,
html[data-theme="dark"] .empty-table {
  border-color: var(--ba-dark-border-soft) !important;
  background: rgba(14, 25, 43, .58) !important;
}

html[data-theme="dark"] .client-row:hover,
html[data-theme="dark"] .agent-list-row:hover,
html[data-theme="dark"] .manager-row:hover,
html[data-theme="dark"] .chat-item:hover,
html[data-theme="dark"] .support-ticket-item:hover {
  background: rgba(35, 58, 94, .72) !important;
  border-color: var(--ba-dark-border) !important;
}

html[data-theme="dark"] #clientTable .client-row {
  background: transparent !important;
  border-bottom-color: rgba(132, 166, 224, .17) !important;
}

html[data-theme="dark"] #clientTable .client-row:hover {
  background: rgba(88, 142, 255, .07) !important;
}

html[data-theme="dark"] .calculator-result,
html[data-theme="dark"] .reward-rules-grid div,
html[data-theme="dark"] .lead-type-option,
html[data-theme="dark"] .hero-health dl div,
html[data-theme="dark"] .support-ticket-head,
html[data-theme="dark"] .support-message-form {
  border-color: var(--ba-dark-border-soft) !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .topbar-search,
html[data-theme="dark"] .theme-switcher,
html[data-theme="dark"] .notification-btn {
  background: rgba(13, 24, 42, .72) !important;
  border-color: var(--ba-dark-border) !important;
}

/* Grade rewards, manual top agents and notification popups. */
.grade-rules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grade-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(93, 111, 255, .10), transparent 42%),
    var(--surface);
}

.grade-card.is-active {
  border-color: color-mix(in srgb, var(--blue) 54%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 22%, transparent);
}

.grade-card span,
.referral-grade-note {
  width: max-content;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.grade-card strong {
  color: var(--text);
  font-size: 16px;
}

.grade-card small {
  color: var(--muted);
  line-height: 1.45;
}

.grade-progress-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 260px) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--blue) 24%, var(--line));
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(93, 111, 255, .12), transparent 44%),
    color-mix(in srgb, var(--surface) 82%, transparent);
}

.grade-progress-card div:first-child {
  display: grid;
  gap: 4px;
}

.grade-progress-card strong {
  color: var(--text);
  font-size: 15px;
}

.grade-progress-card small {
  color: var(--muted);
  line-height: 1.4;
}

.grade-progress-card b {
  color: var(--blue);
  white-space: nowrap;
}

.grade-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 12%, var(--line));
}

.grade-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2368ff, #6f58f7);
}

.custom-top-editor {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-soft) 76%, transparent);
}

.custom-top-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.custom-top-editor-head > div {
  display: grid;
  gap: 4px;
}

.custom-top-editor-head small {
  color: var(--muted);
  line-height: 1.4;
}

.manual-top-tools,
.manual-top-saved {
  display: grid;
  gap: 10px;
}

.manual-top-tools {
  grid-template-columns: repeat(3, minmax(0, auto));
  justify-content: end;
}

.manual-top-saved {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.manual-top-saved-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.manual-top-saved-head strong {
  color: var(--text);
}

.manual-top-saved-head small,
.manual-top-empty,
.manual-top-card small {
  color: var(--muted);
  line-height: 1.35;
}

.manual-top-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.manual-top-card div {
  display: grid;
  gap: 4px;
}

.manual-top-card button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 850;
  cursor: pointer;
}

.manual-top-card button:hover {
  border-color: color-mix(in srgb, var(--blue) 34%, var(--line));
  color: var(--blue);
}

.custom-top-rows {
  display: grid;
  gap: 10px;
}

.custom-top-row {
  display: grid;
  grid-template-columns: 86px minmax(180px, 1fr) 120px 150px 44px;
  gap: 10px;
  align-items: end;
}

.custom-top-order {
  display: grid;
  grid-template-columns: 1fr 32px 32px;
  gap: 6px;
  align-items: end;
}

.custom-top-order strong,
.custom-top-order button {
  display: grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
}

.custom-top-order button {
  cursor: pointer;
}

.custom-top-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.custom-top-row input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.custom-top-remove {
  width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.custom-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.top-agents-list {
  display: grid;
  gap: 8px;
}

.top-row > strong:first-child {
  padding-left: 10px;
}

.top-row > small:last-child {
  padding-right: 14px;
  text-align: right;
}

.top-motivation {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(20, 184, 166, 0.10));
  color: var(--text);
  box-shadow: 0 16px 36px rgba(59, 130, 246, 0.10);
}

.top-motivation strong {
  font-size: 16px;
  font-weight: 900;
}

.top-motivation span {
  color: var(--muted);
  font-weight: 700;
}

.top-motivation.is-success {
  border-color: rgba(16, 185, 129, 0.28);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.13), rgba(59, 130, 246, 0.10));
}

.top-agent-name,
.withdrawal-agent-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.top-agent-name:hover,
.withdrawal-agent-link:hover {
  color: var(--blue);
}

.top-agent-name.is-static {
  cursor: default;
}

.top-agent-name.is-static:hover {
  color: var(--text);
}

.withdrawal-row {
  grid-template-columns: minmax(150px, 1fr) minmax(96px, auto) !important;
  align-items: center;
}

.withdrawal-row > select {
  grid-column: 1;
}

.withdrawal-row > input {
  grid-column: 2;
}

.withdrawal-row > .withdrawal-confirm-btn {
  grid-column: 1 / -1;
  width: 100%;
}

.withdrawal-confirm-btn {
  min-height: 42px;
  padding-inline: 14px;
  white-space: nowrap;
}

#withdrawHistory {
  overflow-x: visible;
}

.notification-toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  width: min(340px, calc(100vw - 32px));
  pointer-events: none;
}

.notification-toast {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--blue) 36%, var(--line));
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(93, 111, 255, .16), transparent 42%),
    var(--surface);
  color: var(--text);
  box-shadow: 0 18px 44px rgba(15, 30, 60, .18);
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
}

.notification-toast strong {
  font-size: 15px;
  font-weight: 900;
}

.notification-toast small {
  color: var(--muted);
  line-height: 1.4;
}

.notification-popover {
  right: 0;
  width: min(360px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  overflow: hidden;
}

.notification-popover-head,
.notification-item {
  min-width: 0;
}

.notification-item {
  overflow: hidden;
  text-align: left;
}

.notification-item strong,
.notification-item small,
.notification-toast strong,
.notification-toast small {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.lead-general-section {
  margin-top: 12px;
}

.contact-methods-field {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  align-self: start;
}

#leadForm > .form-grid > label:has(input[name="desired_contact_time"]) {
  grid-column: 2;
  grid-row: 2;
}

.contact-methods-field legend {
  flex: 0 0 100%;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.contact-methods-field label {
  display: inline-flex;
  width: auto;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.contact-methods-field input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.lead-grade-preview,
.agent-profile-grid,
.agent-modal-clients {
  display: grid;
  gap: 10px;
}

.lead-grade-preview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.lead-grade-preview:empty {
  display: none;
}

.lead-grade-preview div,
.agent-profile-grid div,
.agent-modal-client-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.lead-grade-preview div,
.agent-profile-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.lead-grade-preview span,
.agent-profile-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.lead-grade-preview strong,
.agent-profile-grid strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.lead-grade-preview small {
  color: var(--muted);
  line-height: 1.35;
}

.agent-profile-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0;
}

.agent-modal-section-head,
.agent-modal-client-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.agent-modal-section-head {
  margin-top: 14px;
}

.agent-modal-client-row {
  grid-template-columns: minmax(150px, 1fr) minmax(160px, 1fr) auto auto;
  padding: 10px;
}

.agent-modal-client-row button:first-child {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.agent-modal-client-row small {
  color: var(--muted);
}

html[data-theme="dark"] .grade-card,
html[data-theme="dark"] .grade-progress-card,
html[data-theme="dark"] .custom-top-editor,
html[data-theme="dark"] .manual-top-saved,
html[data-theme="dark"] .manual-top-card,
html[data-theme="dark"] .notification-toast,
html[data-theme="dark"] .lead-grade-preview div,
html[data-theme="dark"] .agent-profile-grid div,
html[data-theme="dark"] .agent-modal-client-row {
  border-color: var(--ba-dark-border-soft);
  background:
    radial-gradient(ellipse 300px 180px at 92% 0%, rgba(111, 141, 255, .14), transparent 68%),
    linear-gradient(145deg, var(--ba-dark-panel-a), var(--ba-dark-panel-b));
}

html[data-theme="dark"] .grade-card.is-active {
  border-color: rgba(92, 157, 255, .78);
}

@media (max-width: 1180px) {
  .grade-rules-grid {
    grid-template-columns: 1fr;
  }

  .lead-grade-preview,
  .agent-profile-grid,
  .grade-progress-card {
    grid-template-columns: 1fr;
  }

  .withdrawal-row {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 760px) {
  .custom-top-editor-head {
    flex-direction: column;
    align-items: stretch;
  }

  .manual-top-tools,
  .manual-top-card {
    grid-template-columns: 1fr;
  }

  .custom-top-row {
    grid-template-columns: 1fr;
  }

  .custom-top-order,
  .agent-modal-section-head,
  .agent-modal-client-row {
    grid-template-columns: 1fr;
  }

  .custom-top-remove {
    width: 100%;
  }
}

.sidebar-collapse,
.sidebar-collapse:hover,
body.sidebar-collapsed .sidebar-collapse,
body.sidebar-collapsed .sidebar-collapse:hover {
  display: grid !important;
  place-items: center !important;
  justify-content: center !important;
  align-content: center !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
}

.sidebar-collapse {
  font-size: 0 !important;
}

.sidebar-collapse::after {
  content: "‹";
  display: block;
  font-size: 22px;
  line-height: 1;
  transform: translateY(-1px);
}

body.sidebar-collapsed .sidebar-collapse,
body.sidebar-collapsed .sidebar-collapse:hover {
  position: static !important;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  margin: 0 auto 14px !important;
  transform: none !important;
}

body.sidebar-collapsed .sidebar-collapse::after {
  content: "›";
  transform: translateY(-1px);
}

.sidebar-collapse::before,
.sidebar-collapse:hover::before,
body.sidebar-collapsed .sidebar-collapse::before,
body.sidebar-collapsed .sidebar-collapse:hover::before {
  content: none !important;
  display: none !important;
}

.sidebar-collapse::after,
.sidebar-collapse:hover::after {
  content: "‹" !important;
  display: block !important;
}

body.sidebar-collapsed .sidebar-collapse::after,
body.sidebar-collapsed .sidebar-collapse:hover::after {
  content: "›" !important;
}

.offer-acceptance-field {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.55);
}

.offer-acceptance-field input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.offer-acceptance-field span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.offer-acceptance-field a {
  color: #2563eb;
  font-weight: 800;
}

.registration-legal-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.45);
}

.registration-legal-block details {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.registration-legal-block summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.registration-legal-block ul {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 18px;
}

.registration-legal-block a {
  color: #2563eb;
  font-weight: 700;
}

.balance-meta,
.verification-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.balance-meta span,
.verification-summary span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(97,128,255,.18);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(239,246,255,.78);
  color: #50617a;
  font-size: 12px;
  font-weight: 800;
}

.partner-verification-dialog {
  width: min(820px, calc(100vw - 32px));
}

.verification-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.verification-state {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(97,128,255,.2);
  border-radius: 14px;
  background: rgba(239,246,255,.82);
}

.verification-state strong {
  color: var(--text);
}

.verification-state span {
  color: var(--muted);
}

.verification-state.approved {
  border-color: rgba(16,185,129,.35);
  background: rgba(236,253,245,.9);
}

.verification-state.rejected {
  border-color: rgba(248,113,113,.35);
  background: rgba(254,242,242,.9);
}

.partner-verification-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.partner-verification-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, .7fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.62);
}

.partner-verification-row strong,
.partner-verification-row small {
  display: block;
}

.partner-verification-row small {
  margin-top: 4px;
  color: var(--muted);
}

.partner-verification-row input {
  min-height: 42px;
}

.documents-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.document-card {
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.66);
}

.document-card strong {
  color: var(--text);
}

.document-card span {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 860px) {
  .verification-form,
  .partner-verification-row,
  .documents-grid {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .offer-acceptance-field,
html[data-theme="dark"] .registration-legal-block,
html[data-theme="dark"] .partner-verification-row,
html[data-theme="dark"] .document-card,
html[data-theme="dark"] .verification-state,
html[data-theme="dark"] .balance-meta span,
html[data-theme="dark"] .verification-summary span {
  background: rgba(255,255,255,.06);
}

/* Fix sidebar collapse control: single centered chevron, no duplicated glyph layers. */
@media (min-width: 1101px) {
  .sidebar-collapse,
  .sidebar-collapse:hover,
  body.sidebar-collapsed .sidebar-collapse,
  body.sidebar-collapsed .sidebar-collapse:hover {
    position: fixed !important;
    left: calc(var(--sidebar-width) - 45px) !important;
    top: 28px !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    padding: 0 !important;
    display: grid !important;
    place-items: center !important;
    border: 1px solid rgba(98, 140, 210, .45) !important;
    border-radius: 10px !important;
    background: rgba(18, 32, 54, .92) !important;
    color: #dbe8ff !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .18) !important;
    transform: none !important;
    font-size: 0 !important;
    line-height: 0 !important;
    z-index: 10030 !important;
  }

  .sidebar-collapse:hover,
  body.sidebar-collapsed .sidebar-collapse:hover {
    border-color: rgba(127, 166, 255, .78) !important;
    background: rgba(24, 42, 72, .98) !important;
    color: #ffffff !important;
  }

  .sidebar-collapse::before,
  .sidebar-collapse:hover::before {
    content: "" !important;
    display: block !important;
    width: 8px !important;
    height: 8px !important;
    border-left: 2px solid currentColor !important;
    border-bottom: 2px solid currentColor !important;
    transform: translateX(2px) rotate(45deg) !important;
  }

  body.sidebar-collapsed .sidebar-collapse::before,
  body.sidebar-collapsed .sidebar-collapse:hover::before {
    transform: translateX(-2px) rotate(225deg) !important;
  }

  .sidebar-collapse::after,
  .sidebar-collapse:hover::after,
  body.sidebar-collapsed .sidebar-collapse::after,
  body.sidebar-collapsed .sidebar-collapse:hover::after {
    content: none !important;
    display: none !important;
  }
}

/* Fix collapsed sidebar control visibility. */
@media (min-width: 1101px) {
  body.sidebar-collapsed .sidebar-collapse,
  body.sidebar-collapsed .sidebar-collapse:hover {
    position: fixed !important;
    left: 41px !important;
    top: 28px !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    display: grid !important;
    place-items: center !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  body.sidebar-collapsed .sidebar-collapse::before,
  body.sidebar-collapsed .sidebar-collapse:hover::before {
    content: "" !important;
    display: block !important;
    width: 8px !important;
    height: 8px !important;
    border-left: 2px solid currentColor !important;
    border-bottom: 2px solid currentColor !important;
    transform: translateX(-2px) rotate(225deg) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  body.sidebar-collapsed .sidebar-collapse::after,
  body.sidebar-collapsed .sidebar-collapse:hover::after {
    content: none !important;
    display: none !important;
  }
}

/* Agent partnership explainer under reward grades. */
.partner-info {
  margin-top: 20px;
}

.partner-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.partner-info-grid article {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line));
  border-radius: 14px;
  background: radial-gradient(circle at 100% 0%, rgba(47, 109, 255, .10), transparent 42%), color-mix(in srgb, var(--surface) 88%, transparent);
}

.partner-info-grid strong {
  color: var(--text);
  font-size: 16px;
}

.partner-info-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

html[data-theme="dark"] .partner-info-grid article {
  background: radial-gradient(circle at 100% 0%, rgba(109, 147, 255, .10), transparent 42%), var(--surface-soft);
  border-color: var(--line);
}

@media (max-width: 900px) {
  .partner-info-grid {
    grid-template-columns: 1fr;
  }
}

/* Proposed clients handoff. */
.proposed-clients-panel {
  display: grid;
  gap: 20px;
}

.proposed-client-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.proposed-client-form .form-section-title,
.proposed-client-form .wide {
  grid-column: 1 / -1;
}

.proposed-client-form textarea,
.proposal-comment-input textarea {
  min-height: 92px;
  resize: vertical;
}

.proposed-client-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.proposed-client-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.proposed-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.proposed-card-head h3 {
  margin: 0;
  font-size: 20px;
}

.proposed-card-head p,
.proposal-request,
.proposal-comment p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.proposal-status {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.proposal-status.info {
  color: #1d4ed8;
  background: rgba(96, 165, 250, .18);
}

.proposal-status.success {
  color: #047857;
  background: rgba(52, 211, 153, .18);
}

.proposal-status.danger {
  color: #be123c;
  background: rgba(251, 113, 133, .18);
}

.proposal-status.muted {
  color: var(--muted);
  background: rgba(148, 163, 184, .16);
}

.proposal-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.proposal-meta div,
.proposal-comment {
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.proposal-meta dt {
  color: var(--muted);
  font-size: 12px;
}

.proposal-meta dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.proposal-comment-input {
  display: grid;
  gap: 8px;
}

.proposal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-btn.danger {
  border-color: rgba(251, 113, 133, .35);
  color: #be123c;
}

html[data-theme="dark"] .proposal-status.info {
  color: #bfdbfe;
}

html[data-theme="dark"] .proposal-status.success {
  color: #bbf7d0;
}

html[data-theme="dark"] .proposal-status.danger,
html[data-theme="dark"] .secondary-btn.danger {
  color: #fecdd3;
}

@media (max-width: 980px) {
  .proposed-client-form,
  .proposed-client-grid,
  .proposal-meta {
    grid-template-columns: 1fr;
  }
}
