:root {
  --bg: #0a0c10;
  --panel: #111318;
  --surface: #111318;
  --surface2: #181c24;
  --border: #252b38;
  --border2: #2e3547;
  --accent: #4f8aff;
  --green: #22d3a0;
  --yellow: #f5c842;
  --red: #ff4f6a;
  --purple: #c084fc;
  --orange: #fb923c;
  --text: #e8ecf4;
  --text2: #8b94a8;
  --text3: #4f5a6e;
  --shadow: 0 22px 58px rgba(0, 0, 0, .46);
  --mono: "Space Mono", monospace;
  --sans: "DM Sans", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(79, 138, 255, .03) 40px, rgba(79, 138, 255, .03) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(79, 138, 255, .03) 40px, rgba(79, 138, 255, .03) 41px),
    radial-gradient(ellipse at 30% 50%, #0d1a35, var(--bg) 65%);
}

.login-screen.hidden {
  display: none;
}

.login-box {
  width: min(420px, calc(100vw - 32px));
  padding: 42px 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(79, 138, 255, .08);
}

.login-logo,
.top-logo {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0;
}

.login-logo {
  margin-bottom: 4px;
  font-size: 22px;
}

.login-logo span,
.top-logo span {
  color: var(--text3);
  font-weight: 400;
}

.login-sub {
  margin-bottom: 28px;
  color: var(--text2);
  font-size: 13px;
}

.field {
  margin-bottom: 13px;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
}

.select {
  padding-right: 30px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234f5a6e' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.select option {
  background: var(--surface2);
}

.select[multiple] {
  min-height: 150px;
  padding-right: 12px;
  background-image: none;
}

.input-compact,
.select-compact {
  min-width: 110px;
  padding: 6px 8px;
  font-size: 11px;
}

.select-compact {
  padding-right: 28px;
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
}

.login-error {
  min-height: 17px;
  margin-top: 10px;
  color: var(--red);
  font-size: 12px;
  text-align: center;
}

.app {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  height: auto;
  gap: 10px 16px;
  flex-wrap: wrap;
  padding: 10px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top-left,
.top-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.top-left {
  flex: 1 1 620px;
  flex-wrap: wrap;
  row-gap: 8px;
}

.top-right {
  flex: 0 0 auto;
}

.top-logo {
  font-size: 15px;
  white-space: nowrap;
}

.top-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.role-badge,
.api-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.role-admin,
.role-system_admin {
  color: var(--purple);
  background: rgba(192, 132, 252, .08);
  border-color: rgba(192, 132, 252, .35);
}

.role-shift,
.role-shift_sales,
.role-shift_ret {
  color: var(--yellow);
  background: rgba(245, 200, 66, .08);
  border-color: rgba(245, 200, 66, .3);
}

.role-team_sales,
.role-head_sale {
  color: var(--yellow);
  background: rgba(245, 200, 66, .08);
  border-color: rgba(245, 200, 66, .3);
}

.role-team_retention,
.role-head_ret {
  color: var(--green);
  background: rgba(34, 211, 160, .08);
  border-color: rgba(34, 211, 160, .3);
}

.role-psp {
  color: var(--orange);
  background: rgba(251, 146, 60, .08);
  border-color: rgba(251, 146, 60, .3);
}

.role-buyer,
.role-buying {
  color: var(--text2);
  background: rgba(148, 163, 184, .08);
  border-color: rgba(148, 163, 184, .3);
}

.role-sales,
.role-sale {
  color: var(--accent);
  background: rgba(79, 138, 255, .08);
  border-color: rgba(79, 138, 255, .3);
}

.role-retention,
.role-ret {
  color: var(--green);
  background: rgba(34, 211, 160, .08);
  border-color: rgba(34, 211, 160, .3);
}

.role-support,
.role-compliance,
.role-finance {
  color: var(--orange);
  background: rgba(251, 146, 60, .08);
  border-color: rgba(251, 146, 60, .3);
}

.api-badge {
  color: var(--text3);
  background: var(--surface2);
  border-color: var(--border);
}

.debug-role-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 5px 3px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.debug-role-control.active {
  border-color: rgba(255, 79, 106, .45);
  box-shadow: 0 0 0 1px rgba(255, 79, 106, .08) inset;
}

.debug-role-label {
  color: var(--text3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .7px;
}

.debug-role-control.active .debug-role-label {
  color: var(--red);
}

.debug-role-control .select {
  width: 168px;
  min-width: 168px;
}

.impersonation-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 3px 5px 3px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.impersonation-control.active {
  border-color: rgba(79, 138, 255, .4);
  box-shadow: 0 0 0 1px rgba(79, 138, 255, .08) inset;
}

.impersonation-label {
  color: var(--text3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .7px;
  white-space: nowrap;
}

.impersonation-control strong {
  max-width: 150px;
  overflow: hidden;
  color: var(--accent);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.impersonation-control .select {
  width: 230px;
  min-width: 230px;
}

.impersonation-stop {
  min-height: 24px;
  padding: 3px 9px;
  color: var(--text);
  background: rgba(79, 138, 255, .12);
  border: 1px solid rgba(79, 138, 255, .32);
  border-radius: 6px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.impersonation-stop:hover {
  border-color: rgba(79, 138, 255, .6);
}

.api-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--yellow);
}

.api-dot.online {
  background: var(--green);
}

.top-user {
  color: var(--text2);
  font-size: 12px;
  white-space: nowrap;
}

.top-user strong {
  color: var(--text);
}

.layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 54px);
}

.sidebar {
  width: 200px;
  flex: 0 0 200px;
  padding: 10px 8px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width .16s ease, flex-basis .16s ease;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 32px;
  margin-bottom: 8px;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-toggle:hover {
  color: var(--accent);
  border-color: rgba(79, 138, 255, .32);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
}

.sidebar-collapsed .sidebar {
  width: 58px;
  flex-basis: 58px;
  padding-right: 6px;
  padding-left: 6px;
}

.sidebar-collapsed .sidebar-toggle span,
.sidebar-collapsed .sb-label,
.sidebar-collapsed .nav-text {
  display: none;
}

.sidebar-collapsed .nav-item {
  justify-content: center;
  min-height: 38px;
  padding: 9px 6px;
}

.sidebar-collapsed .nav-icon {
  width: 22px;
  height: 22px;
}

.sidebar-collapsed .nav-badge-wrap {
  position: absolute;
  top: 2px;
  right: 2px;
  margin-left: 0;
}

.sb-section {
  margin: 6px 0 12px;
}

.sb-label {
  display: block;
  padding: 0 8px;
  margin-bottom: 4px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--text2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-item.active {
  color: var(--accent);
  background: rgba(79, 138, 255, .1);
  border-color: rgba(79, 138, 255, .2);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text3);
  text-align: center;
}

.emoji-icon,
.title-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 14px;
  line-height: 1;
}

.title-emoji {
  width: auto;
  margin-right: 7px;
  font-size: 20px;
  vertical-align: -2px;
}

.nav-icon svg,
.page-title svg,
.admin-banner-icon svg {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
}

.page-title svg {
  margin-right: 7px;
  color: var(--accent);
}

.nav-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.nav-badge {
  min-width: 18px;
  padding: 1px 6px;
  color: #fff;
  background: var(--accent);
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.nav-unread {
  min-width: 16px;
  padding: 1px 5px;
  color: #fff;
  background: var(--accent);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(79, 138, 255, .14);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.nav-badge-extra {
  margin-left: 0;
}

.nav-unread-blue {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 138, 255, .16);
}

.nav-unread-yellow {
  background: var(--yellow);
  color: #1d1600;
  box-shadow: 0 0 0 2px rgba(245, 194, 87, .18);
}

.nav-unread-green {
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(70, 211, 139, .16);
}

.nav-unread-red {
  background: var(--red);
  box-shadow: 0 0 0 2px rgba(255, 77, 109, .16);
}

.content {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 22px;
  overflow: auto;
  background: var(--bg);
}

.content.is-refreshing {
  cursor: progress;
}

.content.is-refreshing > * {
  opacity: .5;
  filter: grayscale(.24);
  pointer-events: none;
  user-select: none;
  transition: opacity .16s ease, filter .16s ease;
}

.content.is-refreshing::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  min-height: 100%;
  background: rgba(15, 23, 42, .12);
  pointer-events: auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.page-title {
  font-size: 19px;
  font-weight: 700;
}

.page-subtitle {
  margin-top: 3px;
  color: var(--text2);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.stat-label {
  margin-bottom: 6px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.stat-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
}

.blue {
  color: var(--accent);
}

.green {
  color: var(--green);
}

.yellow {
  color: var(--yellow);
}

.red {
  color: var(--red);
}

.purple {
  color: var(--purple);
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 13px;
}

.lead-toolbar {
  position: relative;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.lead-toolbar .search-wrap {
  flex: 1 1 auto;
  min-width: 280px;
  max-width: none;
}

.lead-toolbar-select {
  flex: 0 0 150px;
  min-height: 36px;
  padding: 8px 30px 8px 11px;
  background-color: var(--surface);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
}

.lead-toolbar-brand {
  flex-basis: 116px;
}

.lead-toolbar .btn {
  flex: 0 0 auto;
  min-height: 36px;
}

.client-table-toolbar {
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 2px;
}

.client-table-toolbar .search-wrap {
  flex: 1 0 260px;
  max-width: 420px;
}

.client-table-toolbar .lead-toolbar-select {
  flex-basis: 140px;
}

.assignment-table .assignment-select {
  width: min(220px, 100%);
  min-width: 190px;
  background-color: rgba(2, 6, 23, .34);
  border-color: rgba(79, 138, 255, .24);
}

.assignment-table .assignment-select:disabled {
  cursor: wait;
  opacity: .68;
}

.lead-column-panel {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 32;
  width: min(286px, calc(100vw - 28px));
  padding: 12px;
  color: var(--text);
  background: #12162d;
  border: 1px solid rgba(103, 117, 180, .34);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .34);
}

.lead-column-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.lead-column-panel-head strong {
  display: block;
  font-size: 13px;
}

.lead-column-panel-head span {
  display: block;
  margin-top: 2px;
  color: var(--text3);
  font-size: 11px;
}

.lead-column-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.lead-column-list {
  display: grid;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
}

.lead-column-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 5px 7px;
  color: var(--text2);
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
}

.lead-column-option:hover {
  background: rgba(255, 255, 255, .05);
}

.lead-column-option input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.lead-column-option span {
  flex: 1;
}

.lead-column-option em {
  color: var(--text3);
  font-size: 10px;
  font-style: normal;
  text-transform: uppercase;
}

.lead-column-option.locked {
  cursor: default;
  opacity: .78;
}

.trade-column-panel {
  position: relative;
  top: auto;
  right: auto;
  width: 100%;
  margin-bottom: 12px;
}

.trade-column-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.trade-column-section {
  padding: 10px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid rgba(103, 117, 180, .22);
  border-radius: 8px;
}

.trade-column-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.trade-column-section-head span {
  color: var(--text3);
  font-size: 11px;
}

.trade-column-list {
  max-height: 300px;
  margin-top: 8px;
}

.period-tabs .btn,
.page-head .toolbar .btn {
  flex: 0 0 auto;
}

.filter-panel {
  padding: 14px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-panel-head strong {
  display: block;
  font-size: 13px;
}

.filter-panel-head span {
  display: block;
  margin-top: 2px;
  color: var(--text3);
  font-size: 11px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.filter-backdrop {
  position: fixed;
  inset: 54px 0 0;
  z-index: 34;
  background: rgba(5, 8, 24, .48);
  backdrop-filter: blur(2px);
}

.filter-drawer {
  position: fixed;
  top: 54px;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  width: min(336px, calc(100vw - 24px));
  color: var(--text);
  background: #12162d;
  border-left: 1px solid rgba(103, 117, 180, .34);
  box-shadow: -18px 0 46px rgba(0, 0, 0, .34);
}

.filter-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(103, 117, 180, .24);
}

.filter-drawer-head strong {
  font-size: 14px;
}

.filter-drawer-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 13px;
  padding: 15px 16px;
  overflow-y: auto;
}

.filter-drawer .field {
  margin-bottom: 0;
}

.filter-drawer label {
  color: #b7bee4;
  font-size: 10px;
}

.filter-inline,
.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.range-row {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.range-row span {
  color: var(--text3);
  font-size: 11px;
}

.filter-drawer-foot {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid rgba(103, 117, 180, .24);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .1);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.sort-head {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  line-height: 1.12;
}

.sort-label {
  color: inherit;
  font: inherit;
}

.sort-dir {
  display: block;
  min-width: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .7px;
}

.sort-head.active {
  color: var(--text);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 11px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--text3);
  border-radius: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-wrap::after {
  content: "";
  position: absolute;
  top: calc(50% + 5px);
  left: 21px;
  width: 6px;
  height: 2px;
  background: var(--text3);
  border-radius: 2px;
  transform: rotate(45deg);
  transform-origin: left center;
  pointer-events: none;
}

.search-wrap .input {
  min-height: 36px;
  padding-top: 8px;
  padding-left: 32px;
  padding-bottom: 8px;
  background: var(--surface);
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-primary {
  color: #fff;
  background: var(--accent);
}

.btn-primary:hover {
  background: #3a78f0;
}

.btn-secondary {
  color: var(--text2);
  background: var(--surface);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-danger {
  color: var(--red);
  background: rgba(255, 79, 106, .1);
  border: 1px solid rgba(255, 79, 106, .3);
}

.btn-success {
  color: var(--green);
  background: rgba(34, 211, 160, .1);
  border: 1px solid rgba(34, 211, 160, .3);
}

.refresh-button {
  width: 34px;
  min-width: 34px;
  padding-right: 8px;
  padding-left: 8px;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.refresh-button .refresh-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.refresh-button .refresh-icon svg,
.refresh-button .refresh-icon i {
  width: 16px;
  height: 16px;
}

.refresh-button.is-loading {
  box-shadow: 0 0 0 2px rgba(79, 138, 255, .14);
}

.refresh-button.is-loading .refresh-icon {
  animation: refresh-spin .75s linear infinite;
}

.refresh-button:disabled.is-loading {
  opacity: 1;
}

.refresh-button.is-done {
  box-shadow: 0 0 0 2px rgba(34, 211, 160, .12);
}

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

.btn-small {
  min-height: 26px;
  padding: 4px 9px;
  font-size: 11px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.lead-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.lead-pagination-bottom {
  margin-top: 8px;
  margin-bottom: 0;
}

.lead-copy-hint {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 9px 11px;
  color: var(--text2);
  background: linear-gradient(135deg, rgba(79, 138, 255, .12), rgba(94, 234, 212, .06));
  border: 1px solid rgba(79, 138, 255, .28);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.35;
}

.lead-copy-hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: var(--accent);
  background: rgba(79, 138, 255, .14);
  border: 1px solid rgba(79, 138, 255, .26);
  border-radius: 7px;
}

.lead-copy-hint-icon i,
.lead-copy-hint-icon svg {
  width: 14px;
  height: 14px;
}

.lead-page-info {
  color: var(--text2);
  font-size: 12px;
}

.lead-page-info span,
.lead-page-number {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 700;
}

.lead-page-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.lead-page-controls label {
  color: var(--text3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.lead-page-controls .input-compact {
  width: 66px;
  min-width: 66px;
  min-height: 28px;
  padding: 4px 7px;
}

.lead-page-controls .select-compact {
  width: 78px;
  min-width: 78px;
  min-height: 28px;
  padding: 4px 24px 4px 8px;
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.table-hint {
  margin-top: 10px;
  color: var(--text3);
  font-size: 12px;
}

.shift-row-absent {
  background: rgba(255, 79, 106, .045);
}

.shift-row-editable {
  cursor: pointer;
}

.shift-row-editable:hover {
  background: rgba(79, 138, 255, .075);
}

.shift-critical-panel {
  margin-bottom: 14px;
  border-color: rgba(255, 79, 106, .34);
}

.shift-critical-list {
  display: grid;
  gap: 8px;
}

.shift-critical-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 79, 106, .07);
  border: 1px solid rgba(255, 79, 106, .26);
  border-radius: 8px;
}

.shift-critical-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.shift-critical-title,
.shift-critical-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.shift-status-critical {
  background: rgba(255, 79, 106, .045);
}

.lead-table-wrap {
  scrollbar-width: auto;
  scrollbar-color: rgba(79, 138, 255, .65) var(--surface2);
}

.lead-table-wrap::-webkit-scrollbar {
  width: 14px;
  height: 16px;
}

.lead-table-wrap::-webkit-scrollbar-track {
  background: var(--surface2);
  border-radius: 999px;
}

.lead-table-wrap::-webkit-scrollbar-thumb {
  min-width: 60px;
  background: linear-gradient(90deg, rgba(79, 138, 255, .55), rgba(94, 234, 212, .45));
  border: 3px solid var(--surface2);
  border-radius: 999px;
}

.lead-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 12px;
}

.lead-table {
  width: auto;
  table-layout: fixed;
}

.table th {
  padding: 10px 12px;
  color: var(--text3);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .8px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 10px 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.lead-table th {
  position: relative;
  overflow: visible;
}

.lead-table td {
  overflow: hidden;
  white-space: normal;
}

.lead-cell {
  max-height: 76px;
  overflow: hidden;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.lead-cell .tag,
.lead-cell .status {
  max-width: 100%;
  white-space: normal;
}

.lead-th-content {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 18px;
  padding-right: 8px;
}

.lead-col-resizer {
  position: absolute;
  top: -12px;
  right: -15px;
  bottom: -12px;
  width: 16px;
  cursor: col-resize;
}

.lead-col-resizer::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 7px;
  bottom: 9px;
  width: 3px;
  background: rgba(148, 163, 184, .22);
  border-radius: 999px;
}

.lead-col-resizer:hover::after {
  background: var(--accent);
}

.column-resizing {
  cursor: col-resize;
  user-select: none;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  cursor: pointer;
  transition: background .1s;
}

.table tbody tr:hover {
  background: var(--surface2);
}

.table tbody tr.live-highlight-row td,
.trade-console-table tbody tr.live-highlight-row td {
  background: rgba(34, 211, 160, .13);
  transition: background .18s ease;
}

.table tbody tr.live-highlight-row td:first-child,
.trade-console-table tbody tr.live-highlight-row td:first-child {
  box-shadow: inset 3px 0 0 rgba(0, 166, 118, .95);
  transition: background .18s ease, box-shadow .18s ease;
}

.table tbody tr.live-highlight-row:hover td,
.trade-console-table tbody tr.live-highlight-row:hover td {
  background: var(--surface2);
}

.table tbody tr.live-highlight-row:hover td:first-child,
.trade-console-table tbody tr.live-highlight-row:hover td:first-child {
  box-shadow: none;
}

.table tbody tr.notification-review-row td,
.trade-console-table tbody tr.notification-review-row td {
  background: rgba(148, 163, 184, .16);
  transition: background .18s ease;
}

.table tbody tr.notification-review-row td:first-child,
.trade-console-table tbody tr.notification-review-row td:first-child {
  box-shadow: inset 3px 0 0 rgba(100, 116, 139, .9);
  transition: background .18s ease, box-shadow .18s ease;
}

.table tbody tr.notification-review-row-red td,
.trade-console-table tbody tr.notification-review-row-red td {
  background: rgba(255, 77, 109, .12);
}

.table tbody tr.notification-review-row-red td:first-child,
.trade-console-table tbody tr.notification-review-row-red td:first-child {
  box-shadow: inset 3px 0 0 rgba(255, 77, 109, .96);
}

.table tbody tr.portal-requisites-missing-row td:first-child {
  box-shadow: inset 3px 0 0 rgba(255, 77, 109, .96);
}

.table tbody tr.notification-review-row:hover td,
.trade-console-table tbody tr.notification-review-row:hover td {
  background: var(--surface2);
}

.table tbody tr.notification-review-row:hover td:first-child,
.trade-console-table tbody tr.notification-review-row:hover td:first-child {
  box-shadow: none;
}

.notification-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.notification-search {
  flex: 1 1 260px;
}

.notification-table {
  min-width: 1080px;
}

.notification-row td {
  transition: background .18s ease;
}

.notification-row.is-unread td {
  background: rgba(79, 138, 255, .045);
}

.notification-row.notification-red.is-unread td {
  background: rgba(255, 79, 106, .06);
}

.notification-row.notification-yellow.is-unread td {
  background: rgba(245, 200, 66, .055);
}

.notification-row.notification-green.is-unread td {
  background: rgba(34, 211, 160, .045);
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.link-button {
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.copy-line,
.input-action {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.copy-line code {
  display: block;
  min-width: 0;
  max-width: 360px;
  overflow: hidden;
  color: var(--text2);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-line code.api-key-code {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: break-all;
  line-height: 1.35;
}

.input-action .input {
  min-width: 0;
}

.copy-btn {
  flex: 0 0 auto;
}

.copy-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 130px auto;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
}

.mono {
  font-family: var(--mono);
}

.muted {
  color: var(--text3);
}

.soft {
  color: var(--text2);
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.team-member-list {
  display: grid;
  gap: 7px;
  min-height: 64px;
  padding: 9px;
  background: rgba(17, 24, 39, .44);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.team-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(148, 163, 184, .13);
  border-radius: 7px;
}

.team-member-row strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.team-member-remove {
  flex: 0 0 auto;
}

.team-member-empty {
  display: grid;
  min-height: 44px;
  place-items: center;
  color: var(--text3);
  font-size: 12px;
}

.team-member-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 9px;
}

.team-member-warning {
  margin-top: 5px;
  color: var(--yellow);
  font-size: 10px;
}

.tag {
  display: inline-flex;
  padding: 2px 7px;
  border: 1px solid;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.tag-source {
  color: var(--accent);
  background: rgba(79, 138, 255, .07);
  border-color: rgba(79, 138, 255, .25);
}

.tag-company {
  color: #a78bfa;
  background: rgba(167, 139, 250, .07);
  border-color: rgba(167, 139, 250, .25);
}

.tag-brand,
.tag-portal {
  color: var(--orange);
  background: rgba(251, 146, 60, .07);
  border-color: rgba(251, 146, 60, .25);
}

.tag-portal-review {
  color: var(--yellow);
  background: rgba(245, 200, 66, .1);
  border-color: rgba(245, 200, 66, .34);
}

.tag-portal-empty {
  color: #93c5fd;
  background: rgba(79, 138, 255, .1);
  border-color: rgba(79, 138, 255, .32);
}

.portal-review-note {
  margin-top: 4px;
  color: var(--orange);
  font-size: 10px;
  font-weight: 800;
}

.tag-category {
  color: var(--yellow);
  background: rgba(245, 200, 66, .07);
  border-color: rgba(245, 200, 66, .3);
  font-weight: 700;
}

.tag-category-a {
  color: var(--red);
  background: rgba(255, 79, 106, .08);
  border-color: rgba(255, 79, 106, .3);
}

.tag-category-b {
  color: var(--yellow);
  background: rgba(245, 200, 66, .07);
  border-color: rgba(245, 200, 66, .3);
}

.tag-category-c {
  color: var(--green);
  background: rgba(34, 211, 160, .07);
  border-color: rgba(34, 211, 160, .3);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status::before {
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 999px;
  content: "";
}

.status-new,
.status-chatting,
.status-back {
  color: var(--accent);
  background: rgba(79, 138, 255, .07);
  border-color: rgba(79, 138, 255, .28);
}

.status-green {
  color: var(--green);
  background: rgba(34, 211, 160, .1);
  border-color: rgba(34, 211, 160, .34);
}

.status-greenstrong {
  color: #86efac;
  background: rgba(22, 163, 74, .18);
  border-color: rgba(134, 239, 172, .45);
}

.status-blue {
  color: var(--accent);
  background: rgba(79, 138, 255, .1);
  border-color: rgba(79, 138, 255, .34);
}

.status-lightblue {
  color: #7dd3fc;
  background: rgba(14, 165, 233, .1);
  border-color: rgba(125, 211, 252, .36);
}

.status-red {
  color: var(--red);
  background: rgba(255, 79, 106, .08);
  border-color: rgba(255, 79, 106, .34);
}

.status-darkred {
  color: #f87171;
  background: rgba(127, 29, 29, .34);
  border-color: rgba(248, 113, 113, .42);
}

.status-lightred {
  color: #fca5a5;
  background: rgba(239, 68, 68, .08);
  border-color: rgba(252, 165, 165, .34);
}

.status-yellow {
  color: var(--yellow);
  background: rgba(245, 200, 66, .09);
  border-color: rgba(245, 200, 66, .36);
}

.status-yellowdark {
  color: #f59e0b;
  background: rgba(120, 53, 15, .22);
  border-color: rgba(245, 158, 11, .38);
}

.status-grayblue {
  color: #93c5fd;
  background: rgba(71, 85, 105, .2);
  border-color: rgba(147, 197, 253, .32);
}

.status-whiteblue {
  color: #dbeafe;
  background: rgba(59, 130, 246, .11);
  border-color: rgba(219, 234, 254, .3);
}

.status-pink {
  color: #f9a8d4;
  background: rgba(219, 39, 119, .1);
  border-color: rgba(249, 168, 212, .36);
}

.status-off {
  color: var(--text3);
  background: rgba(100, 116, 139, .08);
  border-color: rgba(148, 163, 184, .24);
}

.status-preftd,
.status-referral {
  color: var(--purple);
  background: rgba(192, 132, 252, .08);
  border-color: rgba(192, 132, 252, .3);
}

.status-newduplicate,
.status-reassign,
.status-lowpotential {
  color: var(--yellow);
  background: rgba(245, 200, 66, .08);
  border-color: rgba(245, 200, 66, .3);
}

.status-callback,
.status-later,
.status-callbacklater,
.status-noans {
  color: var(--orange);
  background: rgba(251, 146, 60, .07);
  border-color: rgba(251, 146, 60, .3);
}

.status-neverans {
  color: var(--red);
  background: rgba(255, 79, 106, .07);
  border-color: rgba(255, 79, 106, .28);
}

.status-ftd,
.status-deposit,
.status-potential {
  color: var(--green);
  background: rgba(34, 211, 160, .1);
  border-color: rgba(34, 211, 160, .35);
}

.status-failed,
.status-hangup {
  color: var(--red);
  background: rgba(255, 79, 106, .07);
  border-color: rgba(255, 79, 106, .3);
}

.status-test {
  color: var(--red);
  background: rgba(255, 79, 106, .09);
  border-color: rgba(255, 79, 106, .36);
}

.status-muted {
  color: var(--text3);
  background: transparent;
  border-color: var(--border);
}

.status-warning {
  color: var(--orange);
  background: rgba(251, 146, 60, .07);
  border-color: rgba(251, 146, 60, .3);
}

.status-duplicate {
  color: var(--text3);
  background: rgba(148, 163, 184, .04);
  border-color: var(--border2);
}

.inline-status-select {
  width: 100%;
  min-width: 118px;
  max-width: 100%;
  padding: 5px 26px 5px 9px;
  border: 1px solid;
  border-radius: 8px;
  outline: 0;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2388a2ff' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.inline-status-select:focus {
  box-shadow: 0 0 0 2px rgba(79, 138, 255, .18);
}

.inline-draft-dirty {
  border-color: var(--yellow) !important;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, .20) !important;
}

.inline-draft-row {
  background: rgba(251, 191, 36, .07);
}

.inline-status-select:disabled {
  cursor: wait;
  opacity: .65;
}

.inline-status-select option {
  color: var(--text);
  background: var(--surface2);
}

.intake-status-select {
  min-width: 128px;
}

.lead-table-status-select {
  min-width: 128px;
}

.lead-table-status-select.is-dirty,
.intake-status-select.is-dirty {
  box-shadow: 0 0 0 2px rgba(79, 138, 255, .18);
  border-color: var(--accent);
}

.lead-status-cell {
  display: grid;
  gap: 4px;
  align-items: start;
}

.lead-status-warning {
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
}

.lead-deposit-amount {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 166px;
}

.lead-deposit-amount .status {
  grid-column: 1 / -1;
  justify-self: start;
}

.lead-deposit-amount.is-required .input {
  border-color: rgba(255, 79, 106, .58);
  box-shadow: 0 0 0 2px rgba(255, 79, 106, .12);
}

.follow-ok {
  color: var(--green);
  font-family: var(--mono);
  font-size: 11px;
}

.follow-soon {
  color: var(--yellow);
  font-family: var(--mono);
  font-size: 11px;
}

.follow-late {
  color: var(--red);
  font-family: var(--mono);
  font-size: 11px;
}

.empty-state {
  padding: 40px;
  color: var(--text3);
  text-align: center;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.add-lead-wide {
  grid-column: 1 / -1;
}

.add-lead-cabinet-switch {
  min-height: 38px;
}

.add-lead-cabinet-fields {
  margin-top: -2px;
  padding: 12px;
  background: rgba(79, 138, 255, .04);
  border: 1px solid rgba(79, 138, 255, .18);
  border-radius: 8px;
}

.agent-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 13px;
}

.agent-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.agent-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.agent-avatar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--text2);
  background: rgba(148, 163, 184, .10);
  border-radius: 8px;
}

.agent-card-sales .agent-avatar {
  color: var(--accent);
  background: rgba(79, 138, 255, .12);
}

.agent-card-retention .agent-avatar {
  color: var(--green);
  background: rgba(34, 211, 160, .12);
}

.agent-avatar svg {
  width: 17px;
  height: 17px;
}

.agent-name {
  font-size: 13px;
  font-weight: 800;
}

.agent-role {
  margin-top: 2px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.agent-card-sales .agent-role {
  color: var(--accent);
}

.agent-card-retention .agent-role {
  color: var(--green);
}

.agent-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.agent-card-metrics div {
  padding: 9px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.agent-card-metrics strong {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 21px;
  line-height: 1;
}

.agent-card-retention .agent-card-metrics strong {
  color: var(--green);
}

.agent-card-metrics span {
  display: block;
  margin-top: 4px;
  color: var(--text3);
  font-size: 10px;
  text-transform: uppercase;
}

.agent-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.assign-lead-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.assign-lead-summary div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.assign-lead-summary strong,
.assign-lead-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assign-lead-summary div > span {
  color: var(--text3);
  font-size: 11px;
}

.period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.period-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  isolation: isolate;
}

.period-current {
  min-width: 132px;
  padding: 8px 10px;
  color: var(--text2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.period-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1200;
  width: min(320px, 86vw);
  padding: 10px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.period-menu-item {
  display: flex;
  width: 100%;
  margin-bottom: 4px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.period-menu-item:hover,
.period-menu-item.active {
  color: #fff;
  background: rgba(79, 138, 255, .18);
  border-color: rgba(79, 138, 255, .42);
}

.period-custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.period-custom-grid .input {
  color: var(--text);
  background: #0e1118;
  border-color: var(--border2);
}

.period-custom-grid label {
  display: grid;
  gap: 5px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
}

.event-log-panel {
  display: grid;
  gap: 14px;
}

.event-log-tabs .btn {
  min-width: 138px;
}

.event-log-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.event-log-search {
  flex: 1 1 320px;
}

.event-log-toolbar .select {
  flex: 0 1 160px;
}

.error-log-toolbar .select {
  flex: 0 1 150px;
}

.error-log-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  background: rgba(2, 6, 23, .18);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.error-log-history-note {
  align-self: center;
  font-size: 11px;
  font-weight: 700;
}

.event-log-date {
  flex: 0 1 138px;
}

.event-log-stats {
  margin: 0;
}

.panel {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.panel-head-row,
.portal-site-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.settings-tabs {
  margin-bottom: 14px;
}

.settings-tab-button {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.settings-tab-badge {
  min-width: 16px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
}

.settings-panel {
  margin-bottom: 14px;
}

.crm-domain-warning {
  margin: 12px 0;
}

.crm-domain-modal-section {
  min-width: 0;
}

.settings-summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.portal-sites-panel {
  margin-bottom: 14px;
}

.portal-site-switcher {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 8px;
  color: var(--text2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.portal-site-switcher select {
  min-width: 170px;
  height: 26px;
  padding: 2px 26px 2px 8px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  font-size: 12px;
}

.portal-site-empty {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 10px;
  color: var(--text3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}

.trade-terminal-console {
  overflow: hidden;
  color: #151515;
  background: #d8d2b7;
  border: 1px solid #9d997f;
  border-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}

.trade-terminal-console .tag-portal,
.trade-terminal-console .tag-portal-review {
  color: #6f3b00;
  background: rgba(251, 146, 60, .18);
  border-color: rgba(111, 59, 0, .32);
}

.trade-terminal-console .tag-portal-review {
  color: #7a4d00;
  background: rgba(245, 200, 66, .26);
}

.trade-terminal-console .tag-portal-empty {
  color: #17406f;
  background: rgba(79, 138, 255, .2);
  border-color: rgba(23, 64, 111, .34);
}

.trade-terminal-console .portal-review-note {
  color: #8a4b12;
}

.ipo-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
}

.ipo-alert strong {
  font-size: 13px;
}

.ipo-alert-danger {
  color: #ffd7df;
  background: rgba(255, 79, 106, .15);
  border: 1px solid rgba(255, 79, 106, .42);
}

.ipo-alert-ok {
  color: #d8fff3;
  background: rgba(34, 211, 160, .12);
  border: 1px solid rgba(34, 211, 160, .34);
}

.ipo-tabs {
  margin-bottom: 14px;
  justify-content: flex-start;
  border: 0;
  background: transparent;
}

.ipo-logo {
  width: 22px;
  height: 22px;
  margin-right: 8px;
  object-fit: contain;
  vertical-align: middle;
  background: rgba(255, 255, 255, .85);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 4px;
}

.ipo-company {
  display: flex;
  align-items: center;
  min-width: 0;
}

.ipo-company strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ipo-manual-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 6px;
  color: #2451a6;
  background: rgba(49, 118, 255, .12);
  border: 1px solid rgba(49, 118, 255, .22);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.ipo-manual-keep-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ipo-manual-keep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ipo-manual-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
}

.ipo-logo-upload-field .muted {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.ipo-price-table {
  min-width: 1420px;
}

.ipo-price-table th,
.ipo-price-table td {
  vertical-align: middle;
}

.ipo-price-edit-cell,
.ipo-market-edit-cell {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 170px;
}

.ipo-price-edit-cell .input,
.ipo-market-edit-cell .input {
  min-height: 30px;
}

.ipo-url-cell {
  max-width: 280px;
}

.ipo-url-cell a {
  display: block;
  max-width: 280px;
  overflow-wrap: anywhere;
  color: var(--accent);
}

.ipo-terminal-table th,
.ipo-terminal-table td {
  white-space: nowrap;
}

.ipo-terminal-table td[data-trade-col="ipoAccount-name"] .trade-cell,
.ipo-terminal-table td[data-trade-col="ipoAccount-ipo"] .trade-cell,
.ipo-terminal-table td[data-trade-col="ipoPosition-asset"] .trade-cell {
  overflow-wrap: break-word;
  white-space: normal;
}

.ipo-account-list {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.ipo-account-list span {
  display: block;
  line-height: 1.25;
}

.ipo-account-list strong {
  display: block;
  font-size: 11px;
}

.ipo-account-list em {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.trade-console-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 5px 0;
  overflow-x: auto;
  background: #c9c2a4;
  border-bottom: 1px solid #9b957c;
}

.trade-console-tabs button {
  min-height: 24px;
  padding: 4px 10px;
  color: #202020;
  background: #ddd7bd;
  border: 1px solid #a8a188;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.trade-console-tabs button.active {
  background: #fffbe2;
  box-shadow: inset 0 2px 0 #d94a39;
}

.trade-console-tabs button span {
  margin-left: 5px;
  font-family: var(--mono);
  font-weight: 800;
}

.trade-filter-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  padding: 5px 7px;
  background: #eee9ca;
  border-bottom: 1px solid #aaa389;
}

.trade-filter-strip label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #252525;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.trade-filter-strip select,
.trade-keyword input {
  height: 22px;
  min-width: 92px;
  padding: 2px 6px;
  color: #111;
  background: #fffdf1;
  border: 1px solid #9f9b82;
  border-radius: 2px;
  font-size: 10px;
}

.trade-keyword {
  margin-left: auto;
}

.trade-keyword input {
  width: 220px;
}

.trade-terminal-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 5px 8px;
  color: #2b2b2b;
  background: #f6f1d3;
  border-bottom: 1px solid #b9b192;
  font-size: 10px;
}

.trade-terminal-summary strong {
  font-family: var(--mono);
}

.trade-market-pill {
  margin-left: auto;
}

.trade-market-pill-error {
  color: #b42318;
  font-weight: 800;
}

.trade-market-loading {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: #315f9f;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.trade-market-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid rgba(49, 95, 159, .2);
  border-top-color: #315f9f;
  border-radius: 50%;
  animation: refresh-spin .8s linear infinite;
}

.trade-market-loading-slot {
  display: block;
  min-height: 13px;
}

.trade-price-stack {
  position: relative;
  display: inline-block;
  min-width: 94px;
  padding-bottom: 14px;
  text-align: right;
  vertical-align: top;
}

.trade-price-main {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 94px;
}

.trade-price-stack > .trade-market-loading-slot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 86px;
}

.trade-price-stack .trade-market-loading {
  width: 86px;
}

.trade-console-frame {
  background: #cfc8aa;
}

.trade-table-caption {
  padding: 5px 7px;
  color: #151515;
  background: #d8d2b7;
  border-top: 1px solid #f2edcf;
  border-bottom: 1px solid #a7a086;
  font-size: 10px;
  font-weight: 800;
}

.trade-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #d8d2b7;
  border-top: 1px solid #9d997f;
}

.trade-detail-head .trade-table-caption {
  border: 0;
}

.trade-detail-meta {
  padding: 0 7px 5px;
  color: #55513f;
  font-size: 10px;
}

.trade-detail-head .btn {
  margin-right: 7px;
  color: #202020;
  background: #f7f1cf;
  border-color: #aaa389;
}

.trade-terminal-console .table-wrap {
  background: #fffde9;
  border: 0;
  border-radius: 0;
  scrollbar-color: #6d86c5 #d8d2b7;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: auto;
}

.trade-terminal-console .table-wrap::-webkit-scrollbar {
  width: 18px;
  height: 18px;
}

.trade-terminal-console .table-wrap::-webkit-scrollbar-track {
  background: #d8d2b7;
  border: 1px solid #aaa389;
}

.trade-terminal-console .table-wrap::-webkit-scrollbar-thumb {
  min-width: 80px;
  min-height: 80px;
  background: linear-gradient(135deg, #8aa4e8, #5f7fc5);
  border: 3px solid #d8d2b7;
  border-radius: 999px;
}

.trade-terminal-console .table-wrap::-webkit-scrollbar-thumb:hover {
  background: #4f8aff;
}

.trade-terminal-console .table-wrap::-webkit-scrollbar-corner {
  background: #d8d2b7;
}

.trade-client-wrap {
  max-height: none;
}

.trade-op-wrap {
  max-height: none;
}

.trade-pagination {
  margin: 0;
  padding: 7px;
  background: #d8d2b7;
  border-top: 1px solid #aaa389;
  border-bottom: 1px solid #aaa389;
}

.trade-pagination .lead-page-info,
.trade-pagination .lead-page-controls label,
.trade-pagination .lead-page-number {
  color: #252525;
}

.trade-pagination .input,
.trade-pagination .select {
  color: #111;
  background: #fffdf1;
  border-color: #9f9b82;
}

.trade-console-table {
  width: auto;
  min-width: 1760px;
  border-collapse: collapse;
  color: #151515;
  font-size: 10px;
  line-height: 1.22;
  table-layout: fixed;
}

.trade-op-table {
  min-width: 1520px;
}

.trade-console-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 4px 6px;
  color: #222;
  background: linear-gradient(#efefef, #d9d9d9);
  border-right: 1px solid #b8b8b8;
  border-bottom: 1px solid #9c9c9c;
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  overflow: visible;
}

.trade-console-table .sort-head,
.trade-console-table .sort-head.active {
  color: #1d1d1d;
}

.trade-console-table .sort-dir {
  color: #8d2f20;
  text-shadow: none;
}

.trade-console-table .sort-head:hover .sort-label,
.trade-console-table .sort-head:hover .sort-dir {
  color: #000;
}

.trade-console-table td {
  padding: 3px 6px;
  border-right: 1px solid #d0d0b6;
  border-bottom: 1px solid #d7d0a9;
  vertical-align: middle;
  overflow: hidden;
  white-space: nowrap;
}

.trade-th-content {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 18px;
  padding-right: 8px;
}

.trade-col-resizer {
  position: absolute;
  top: -7px;
  right: -12px;
  bottom: -7px;
  width: 14px;
  cursor: col-resize;
}

.trade-col-resizer::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 6px;
  bottom: 5px;
  width: 3px;
  background: rgba(80, 80, 80, .28);
  border-radius: 999px;
}

.trade-col-resizer:hover::after {
  background: #1b5ed8;
}

.trade-cell {
  overflow: hidden;
  line-height: 1.22;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
}

.trade-console-table td[data-trade-col="account-group"] .trade-cell,
.trade-console-table td[data-trade-col="account-name"] .trade-cell,
.trade-console-table td[data-trade-col="account-retention"] .trade-cell,
.trade-console-table td[data-trade-col="operation-symbol"] .trade-cell {
  overflow-wrap: break-word;
  white-space: normal;
}

.trade-cell .action-cell,
.trade-cell .terminal-actions {
  flex-wrap: nowrap;
  min-width: 0;
}

.trade-console-table tbody tr:nth-child(odd) {
  background: #fffef1;
}

.trade-console-table tbody tr:nth-child(even) {
  background: #fff9cf;
}

.trade-console-table tbody tr:hover {
  background: #f5e4a0;
}

.trade-online-table td {
  white-space: normal;
}

.trade-online-table .mono,
.trade-online-table .terminal-num,
.trade-online-table .trade-actions-col {
  white-space: nowrap;
}

.trade-online-identity {
  overflow-wrap: anywhere;
}

.trade-online-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  color: #176b36;
}

.trade-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #20b455;
  box-shadow: 0 0 0 3px rgba(32, 180, 85, .16);
}

.portal-user-name-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #176b36;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.portal-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #20b455;
  box-shadow: 0 0 0 3px rgba(32, 180, 85, .16);
}

.portal-online-badge.is-offline {
  color: var(--text2);
  font-weight: 700;
}

.portal-online-badge.is-offline .portal-online-dot {
  background: #a4afbd;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, .14);
}

.trade-selected-row {
  background: #f0cd6e !important;
}

.trade-op-table tbody tr {
  cursor: context-menu;
}

.terminal-sub {
  margin-top: 1px;
  overflow: hidden;
  color: #625e4d;
  font-size: 9px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-sub-inline {
  color: #625e4d;
  font-size: 9px;
  font-weight: 500;
}

.terminal-market-state {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin-top: 2px;
  padding: 2px 6px;
  border: 1px solid #8f876b;
  border-radius: 4px;
  color: #4e4939;
  background: #eee7c7;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .6px;
}

.trade-current-price .terminal-market-state {
  margin-left: 8px;
  margin-top: 0;
  vertical-align: middle;
}

.terminal-num {
  text-align: right;
}

.terminal-positive {
  color: #087b34;
  font-weight: 800;
}

.terminal-negative {
  color: #c42724;
  font-weight: 800;
}

.terminal-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.trade-row-action {
  width: 22px;
  height: 20px;
  color: #176d2d;
  background: #fff8ce;
  border-color: #aaa389;
  border-radius: 2px;
}

.trade-row-action:hover {
  color: #064d1c;
  background: #f0df96;
  border-color: #8f876d;
}

.trade-row-delete {
  color: #c42724;
}

@media (max-width: 900px) {
  .trade-keyword {
    width: 100%;
    margin-left: 0;
  }

  .trade-keyword input {
    width: 100%;
  }
}

.trade-context-menu {
  position: fixed;
  z-index: 90;
  min-width: 176px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .34);
}

.trade-context-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
}

.trade-context-menu button:hover {
  background: var(--surface2);
}

.trade-modal {
  width: min(980px, calc(100vw - 28px));
}

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

.trade-notional-field .input {
  color: var(--text3);
  font-weight: 800;
  background: rgba(79, 138, 255, .06);
}

.trade-current-price {
  margin: 12px 0;
  padding: 14px;
  color: var(--text);
  background: rgba(79, 138, 255, .06);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  font-size: 18px;
}

.trade-current-price-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.trade-current-price > .trade-market-loading-slot {
  height: 15px;
  margin-top: 4px;
}

.trade-current-price .trade-market-loading {
  justify-content: center;
}

.portal-site-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.portal-site-card {
  padding: 14px;
  background: linear-gradient(135deg, rgba(79, 138, 255, .06), rgba(255, 255, 255, .018));
  border: 1px solid rgba(103, 117, 180, .28);
  border-radius: 8px;
}

.portal-site-card.is-deactivated {
  background: linear-gradient(135deg, rgba(148, 163, 184, .07), rgba(255, 255, 255, .012));
  border-color: rgba(148, 163, 184, .24);
}

.platform-status-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  cursor: pointer;
  user-select: none;
}

.platform-status-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.platform-status-track {
  display: inline-flex;
  align-items: center;
  width: 50px;
  height: 28px;
  padding: 3px;
  background: rgba(148, 163, 184, .14);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .16);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.platform-status-thumb {
  display: block;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 5px 12px rgba(15, 23, 42, .24);
  transition: transform .18s ease;
}

.platform-status-switch input:checked + .platform-status-track {
  background: linear-gradient(135deg, rgba(34, 211, 160, .95), rgba(79, 138, 255, .95));
  border-color: rgba(34, 211, 160, .42);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 3px rgba(34, 211, 160, .09);
}

.platform-status-switch input:checked + .platform-status-track .platform-status-thumb {
  transform: translateX(22px);
}

.platform-status-switch input:focus-visible + .platform-status-track {
  outline: 2px solid rgba(79, 138, 255, .6);
  outline-offset: 2px;
}

.platform-status-switch input:disabled + .platform-status-track {
  opacity: .62;
}

.platform-status-text {
  min-width: 76px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}

.platform-status-switch.is-on .platform-status-text {
  color: var(--green);
}

.portal-site-create-switch {
  justify-content: flex-start;
  min-height: 38px;
}

.settings-toggle-switch {
  align-items: center;
  flex-wrap: wrap;
  padding: 2px 0;
}

.settings-toggle-switch .platform-status-text {
  min-width: 92px;
}

.settings-toggle-caption {
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.env-grid {
  margin-top: 10px;
}

.env-snippet {
  min-height: 170px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
}

.system-update-panel .metric-row strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
}

.telegram-backup-panel .metric-row strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
}

.telegram-backup-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.telegram-backup-summary-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.telegram-backup-summary-field span {
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.telegram-backup-summary-field strong {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}

.telegram-backup-password-summary {
  grid-column: span 2;
}

.telegram-secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.telegram-backup-edit-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.update-summary-row {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.server-health-panel {
  margin-bottom: 14px;
}

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

.monitoring-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.server-health-card {
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.server-health-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text2);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.server-health-card strong {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.monitoring-status-card strong {
  min-height: 22px;
}

.server-health-bar {
  height: 7px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--surface2);
  border-radius: 4px;
}

.server-health-bar span {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.server-health-detail-grid {
  margin-bottom: 14px;
}

.panel-title-small {
  margin-bottom: 8px;
  font-size: 12px;
}

.server-watch-list {
  display: grid;
  gap: 8px;
}

.server-watch-item {
  padding: 9px 10px;
  color: var(--text2);
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.server-health-checks {
  margin-top: 4px;
}

.update-repo-list {
  margin-top: 0;
}

.backup-tabs {
  margin: 0 0 14px;
}

.git-restore-panel .metric-row strong,
.git-restore-repo-card .metric-row strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
}

.git-restore-repo-card .table-wrap {
  max-height: 520px;
}

.git-restore-list {
  margin-top: 0;
}

.update-repo-card.is-disabled {
  opacity: .66;
}

.update-repo-card .portal-site-card-head > div:first-child {
  min-width: 0;
}

.update-repo-card .portal-site-card-head .mono {
  overflow-wrap: anywhere;
}

.update-repo-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.update-repo-grid {
  margin-bottom: 10px;
}

.update-command-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.update-command {
  margin-top: 8px;
  padding: 8px 10px;
  overflow: auto;
  background: rgba(2, 6, 23, .38);
  border: 1px solid var(--border);
  border-radius: 7px;
  white-space: nowrap;
}

.update-message {
  margin: 8px 0;
  overflow-wrap: anywhere;
}

.update-output {
  max-height: 320px;
  margin: 10px 0 0;
  padding: 12px;
  overflow: auto;
  color: var(--text);
  background: rgba(2, 6, 23, .52);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.update-result-item {
  padding: 12px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.update-result-item + .update-result-item {
  margin-top: 12px;
}

.update-rollback {
  margin-top: 12px;
  padding: 12px;
  background: rgba(34, 211, 160, .06);
  border: 1px solid rgba(34, 211, 160, .22);
  border-radius: 8px;
}

.update-rollback.is-failed {
  background: rgba(255, 79, 106, .06);
  border-color: rgba(255, 79, 106, .24);
}

.restore-warning {
  padding: 10px 12px;
  color: var(--red);
  background: rgba(255, 79, 106, .08);
  border: 1px solid rgba(255, 79, 106, .25);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.restore-keyword {
  color: var(--red);
  font-weight: 800;
}

.panel-title {
  margin-bottom: 12px;
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.stats-explorer-panel {
  margin-bottom: 14px;
}

.stats-explorer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.stats-period-caption {
  color: var(--text3);
  font-size: 12px;
  font-weight: 700;
}

.stats-explorer-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-segment {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stats-segment-button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--text2);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.stats-segment-button:last-child {
  border-right: 0;
}

.stats-segment-button:hover,
.stats-segment-button.active {
  color: var(--accent);
  background: var(--panel);
}

.stats-team-select {
  width: min(260px, 100%);
  min-height: 34px;
}

.stats-explorer-summary {
  margin-bottom: 14px;
}

.stats-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stats-rank-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stats-rank-card strong,
.stats-rank-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-rank-card span {
  color: var(--text3);
  font-size: 12px;
  font-weight: 700;
}

.stats-rank-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  color: var(--text2);
  background: var(--surface2);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.stats-rank-badge.gold {
  color: #8a5d00;
  background: rgba(245, 185, 45, .18);
}

.stats-rank-badge.silver {
  color: #56606c;
  background: rgba(148, 163, 184, .22);
}

.stats-rank-badge.bronze {
  color: #8b4a1f;
  background: rgba(190, 111, 45, .18);
}

.stats-comparison-table td:first-child {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .period-picker {
    width: 100%;
    justify-content: flex-end;
  }

  .period-current {
    min-width: 0;
    flex: 1 1 auto;
  }

  .period-custom-grid {
    grid-template-columns: 1fr;
  }

  .stats-explorer-head {
    display: grid;
  }

  .stats-explorer-controls {
    justify-content: flex-start;
  }

  .stats-segment {
    width: 100%;
  }

  .stats-segment-button {
    flex: 1 1 0;
  }

  .stats-podium {
    grid-template-columns: 1fr;
  }
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.metric-row:last-child {
  border-bottom: 0;
}

.link-row {
  width: 100%;
  color: inherit;
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.link-row:hover {
  color: var(--accent);
}

.progress-track {
  width: 80px;
  height: 5px;
  overflow: hidden;
  background: var(--surface2);
  border-radius: 4px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.mini-bar-cell {
  min-width: 150px;
}

.mini-bar {
  width: 140px;
  height: 6px;
  overflow: hidden;
  background: var(--surface2);
  border-radius: 4px;
}

.mini-bar span {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.admin-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 17px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(192, 132, 252, .08), rgba(79, 138, 255, .06));
  border: 1px solid rgba(192, 132, 252, .25);
  border-radius: 11px;
}

.admin-banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--purple);
  background: rgba(192, 132, 252, .1);
  border-radius: 8px;
}

.admin-banner strong {
  display: block;
  margin-bottom: 2px;
  color: var(--purple);
  font-size: 14px;
}

.admin-banner span {
  color: var(--text3);
  font-size: 12px;
}

.table-compact {
  min-width: 1120px;
}

.permissions-table {
  min-width: 1180px;
}

.permission-user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.permission-user-role-note {
  margin-top: 4px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.perm-pill {
  display: inline-flex;
  justify-content: center;
  min-width: 42px;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
}

.perm-pill.on {
  color: var(--green);
  background: rgba(34, 211, 160, .08);
  border-color: rgba(34, 211, 160, .35);
}

.perm-pill.off {
  color: var(--text3);
  background: transparent;
  border-color: var(--border);
}

.perm-pill.clickable {
  cursor: pointer;
}

.perm-pill.clickable:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.permission-final-lock-cell {
  min-width: 132px;
}

.permission-lock-hint {
  margin-top: 4px;
  font-size: 10px;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(4px);
}

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

.modal {
  width: min(960px, 100%);
  max-height: 94vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, .5);
  animation: modal-in .2s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.modal-lead {
  width: min(1320px, calc(100vw - 24px));
  max-height: 96vh;
}

.lead-card-modal {
  background:
    linear-gradient(180deg, rgba(79, 138, 255, .045), transparent 180px),
    var(--surface);
}

.lead-modal-head {
  padding: 17px 22px;
  border-bottom-color: rgba(79, 138, 255, .22);
}

.lead-modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}

.lead-modal-meta span {
  padding: 3px 7px;
  color: var(--text2);
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
}

.lead-modal-body {
  padding: 18px 22px 20px;
}

.modal-small {
  width: min(640px, 100%);
}

.portal-modal {
  width: min(1180px, 100%);
}

.portal-manager-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.portal-manager-metric {
  min-height: 68px;
  padding: 12px 13px;
  background: rgba(17, 24, 39, .64);
  border: 1px solid rgba(103, 117, 180, .24);
  border-radius: 8px;
}

.portal-manager-metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--text2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.portal-manager-metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 15px;
}

.portal-manager-metric-money strong {
  color: var(--green);
}

.portal-user-overview {
  margin-top: 14px;
}

.portal-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.portal-user-stats {
  margin: 14px 0 0;
}

.portal-review-row td {
  background: rgba(245, 200, 66, .035);
}

.portal-platform-review-panel {
  margin: 0 0 14px;
  border-color: rgba(245, 200, 66, .3);
  box-shadow: inset 3px 0 0 rgba(245, 200, 66, .7);
}

.portal-review-action-field {
  align-self: end;
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  padding: 20px 22px;
}

.modal-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.modal-foot-split {
  justify-content: space-between;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.close-btn {
  width: 30px;
  height: 30px;
  color: var(--text3);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
}

.close-btn:hover {
  color: var(--text);
}

.lead-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 16px;
}

.modal-lead .lead-info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.card-section {
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.requisites-warning {
  margin-bottom: 14px;
  padding: 10px 12px;
  color: var(--red);
  background: rgba(255, 79, 106, .08);
  border: 1px solid rgba(255, 79, 106, .32);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.portal-requisites-missing .requisites-section.is-missing {
  background: rgba(255, 79, 106, .045);
  border-color: rgba(255, 79, 106, .42);
}

.portal-requisites-missing .requisites-section.is-missing .panel-title {
  color: var(--red);
}

.portal-requisites-missing .requisites-section.is-missing .input {
  background: rgba(255, 79, 106, .035);
  border-color: rgba(255, 79, 106, .38);
}

.lead-card-section,
.lead-follow-section,
.lead-status-card {
  background: rgba(17, 24, 39, .78);
  border-color: rgba(103, 117, 180, .28);
  border-radius: 10px;
}

.lead-section-title {
  margin-bottom: 10px;
  color: var(--text2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.lead-follow-title span {
  margin-left: 8px;
  color: var(--red);
  font-size: 9px;
  letter-spacing: .5px;
}

.lead-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lead-history-title span:first-child {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}

.lead-duplicate-counter {
  padding: 4px 8px;
  color: var(--text3);
  background: rgba(148, 163, 184, .08);
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.modal-lead .field {
  margin-bottom: 9px;
}

.modal-lead .field:last-child {
  margin-bottom: 0;
}

.modal-lead .input,
.modal-lead .select,
.modal-lead .textarea {
  min-height: 35px;
  padding: 8px 10px;
  background-color: rgba(2, 6, 23, .34);
}

.modal-lead input[type="date"],
.modal-lead input[type="time"] {
  cursor: pointer;
  color-scheme: dark;
}

.modal-lead input[type="date"]::-webkit-calendar-picker-indicator,
.modal-lead input[type="time"]::-webkit-calendar-picker-indicator {
  width: 18px;
  height: 18px;
  cursor: pointer;
  filter: invert(1) brightness(1.25);
  opacity: .85;
}

.modal-lead input[type="date"]:hover::-webkit-calendar-picker-indicator,
.modal-lead input[type="time"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}

.modal-lead .input:disabled,
.modal-lead .select:disabled,
.modal-lead .textarea:disabled {
  color: var(--text2);
  background-color: rgba(2, 6, 23, .18);
  border-color: rgba(148, 163, 184, .12);
  opacity: 1;
}

.lead-follow-section {
  padding: 14px 15px;
  margin-bottom: 14px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.lead-follow-section.is-set {
  background: linear-gradient(135deg, rgba(16, 185, 129, .08), rgba(17, 24, 39, .78) 45%);
  border-color: rgba(16, 185, 129, .32);
}

.lead-follow-section.is-missing {
  background: linear-gradient(135deg, rgba(244, 63, 94, .09), rgba(17, 24, 39, .78) 46%);
  border-color: rgba(244, 63, 94, .72);
  box-shadow: 0 0 0 1px rgba(244, 63, 94, .22);
}

.lead-follow-section.follow-pulse {
  box-shadow: 0 0 0 3px rgba(244, 63, 94, .22), 0 0 22px rgba(244, 63, 94, .24);
}

.lead-follow-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(140px, 1fr) minmax(180px, 1.1fr) auto;
  gap: 10px;
  align-items: end;
}

.lead-follow-grid .btn {
  min-height: 35px;
  white-space: nowrap;
}

.lead-follow-current {
  min-height: 35px;
  display: flex;
  align-items: center;
  padding: 8px 11px;
  color: var(--text3);
  background: rgba(2, 6, 23, .24);
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 11px;
}

.lead-follow-section.is-set .lead-follow-current {
  color: var(--green);
  background: rgba(16, 185, 129, .10);
  border-color: rgba(16, 185, 129, .28);
  font-weight: 800;
}

.lead-follow-section.is-missing .lead-follow-current {
  color: var(--red);
  background: rgba(244, 63, 94, .08);
  border-color: rgba(244, 63, 94, .26);
}

.lead-follow-warning {
  min-height: 14px;
  margin-top: 8px;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
}

.follow-alerts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.follow-alert {
  padding: 6px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.follow-alert-blue {
  color: #bfdbfe;
  background: rgba(79, 138, 255, .12);
  border: 1px solid rgba(79, 138, 255, .3);
}

.follow-alert-yellow {
  color: #fde68a;
  background: rgba(245, 194, 87, .13);
  border: 1px solid rgba(245, 194, 87, .34);
}

.follow-alert-red {
  color: #fecdd3;
  background: rgba(244, 63, 94, .12);
  border: 1px solid rgba(244, 63, 94, .35);
}

.follow-section-title {
  margin: 20px 0 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.follow-section-overdue {
  color: var(--red);
}

.follow-section-soon {
  color: var(--yellow);
}

.follow-section-upcoming {
  color: var(--green);
}

.follow-table-wrap {
  margin-bottom: 18px;
}

.schedule-agent-cell {
  min-width: 170px;
}

.schedule-agent-select {
  min-width: 170px;
  max-width: 240px;
}

.schedule-agent-note {
  margin-top: 4px;
  font-size: 10px;
}

.lead-status-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.lead-status-card {
  padding: 14px 15px;
}

.lead-status-sales {
  border-color: rgba(79, 138, 255, .28);
  background: rgba(79, 138, 255, .055);
}

.lead-status-ret {
  border-color: rgba(34, 211, 160, .26);
  background: rgba(34, 211, 160, .05);
}

.lead-status-sales .lead-section-title {
  color: var(--accent);
}

.lead-status-ret .lead-section-title {
  color: var(--green);
}

.lead-modal-notes {
  margin-bottom: 14px;
}

.lead-notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.lead-notes-head .lead-section-title {
  margin-bottom: 0;
}

.lead-notes-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.lead-note-value {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  margin: 0;
}

.lead-note-value span {
  flex: 0 0 auto;
  color: var(--text2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.lead-note-value .input {
  width: 130px;
  min-height: 32px;
  padding: 6px 9px;
  background-color: rgba(2, 6, 23, .34);
  border-color: rgba(148, 163, 184, .22);
}

.lead-note-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: rgba(2, 6, 23, .28);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.lead-note-tab {
  min-height: 28px;
  padding: 4px 10px;
  color: var(--text2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
}

.lead-note-tab:hover {
  color: var(--text);
  border-color: rgba(148, 163, 184, .22);
}

.lead-note-tab.is-active {
  color: #fff;
  background: var(--accent);
  border-color: rgba(79, 138, 255, .8);
}

.lead-note-tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  min-height: 16px;
  margin-left: 4px;
  padding: 0 5px;
  color: inherit;
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
  font-size: 9px;
  line-height: 1;
}

.lead-modal-notes .note-list {
  max-height: 220px;
  margin-bottom: 9px;
}

.lead-note-panel[hidden],
.lead-note-add[hidden] {
  display: none;
}

.lead-note-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.lead-note-add .btn {
  flex: 0 0 auto;
}

.lead-note-add .input {
  min-height: 36px;
  background-color: rgba(2, 6, 23, .34);
  border-color: rgba(148, 163, 184, .22);
}

.lead-note-add .input:focus {
  border-color: rgba(79, 138, 255, .35);
}

.lead-history-section {
  margin-top: 0;
}

.nested-table {
  border-radius: 8px;
}

.nested-table .table {
  min-width: 760px;
}

.doc-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.doc-link:hover {
  text-decoration: underline;
}

.card-section.full {
  grid-column: 1 / -1;
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 190px;
  overflow: auto;
}

.note-item {
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.note-manual {
  background: rgba(34, 211, 160, .08);
  border-color: rgba(34, 211, 160, .28);
}

.note-system {
  background: rgba(79, 138, 255, .07);
  border-color: rgba(79, 138, 255, .24);
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--text3);
  font-size: 10px;
}

.note-meta span {
  padding: 1px 6px;
  color: var(--text);
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.json-pre {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  color: var(--text);
  background: rgba(2, 6, 23, .48);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: none;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
  font-size: 13px;
  font-weight: 700;
}

.toast.show {
  display: block;
}

.cell-tooltip {
  position: fixed;
  z-index: 80;
  display: none;
  max-width: min(520px, calc(100vw - 32px));
  max-height: 260px;
  padding: 10px 12px;
  overflow: auto;
  color: var(--text);
  background: #0f172a;
  border: 1px solid rgba(79, 138, 255, .38);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .48);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  white-space: pre-wrap;
}

.cell-tooltip.show {
  display: block;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}

@media (max-width: 980px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    display: flex;
    width: 100%;
    flex: 0 0 auto;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sb-section {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
  }

  .sb-label {
    display: none;
  }

  .nav-item {
    width: auto;
  }

  .filter-backdrop,
  .filter-drawer {
    top: 54px;
  }

  .stats-row,
  .grid-two,
  .trade-column-sections,
  .trade-terminal-grid,
  .lead-card-grid,
  .modal-lead .lead-info-grid,
  .lead-follow-grid,
  .lead-status-cols,
  .settings-summary-row {
    grid-template-columns: 1fr;
  }

  .trade-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-toolbar {
    flex-wrap: wrap;
  }

  .lead-toolbar .search-wrap {
    flex-basis: 100%;
  }

  .lead-toolbar-select {
    flex: 1 1 150px;
  }

  .update-command-row {
    align-items: stretch;
    flex-direction: column;
  }

}

@media (max-width: 680px) {
  .topbar {
    height: auto;
    min-height: 54px;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .top-left,
  .top-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .content {
    padding: 14px;
  }

  .page-head {
    flex-direction: column;
  }

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

  .filter-drawer {
    width: min(100vw, 360px);
  }

  .lead-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .lead-page-controls {
    justify-content: space-between;
  }

  .lead-note-add {
    align-items: stretch;
    flex-direction: column;
  }

  .lead-notes-head,
  .lead-notes-title-row,
  .lead-note-value {
    align-items: stretch;
    flex-direction: column;
  }

  .lead-note-value {
    width: 100%;
    min-width: 0;
  }

  .lead-note-value .input {
    width: 100%;
  }

  .trade-form-grid {
    grid-template-columns: 1fr;
  }

  .telegram-backup-password-summary {
    grid-column: span 1;
  }

  .telegram-secret-row {
    grid-template-columns: 1fr;
  }

  .team-member-add {
    grid-template-columns: 1fr;
  }

  .login-box {
    padding: 30px 24px;
  }
}
