:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --text: #202a35;
  --muted: #5f6c7b;
  --border: rgba(17, 24, 39, 0.12);
  --popover-bg: rgba(255, 255, 255, 0.98);
  --popover-shadow: 0 14px 28px rgba(26, 36, 53, 0.14);
  --accent: #1f8d4d;
  --accent-rgb: 31, 141, 77;
  --danger: #c55862;
  --danger-rgb: 197, 88, 98;
  --warning: #c58a3f;
  --warning-rgb: 197, 138, 63;
  --success: #238a4a;
  --success-hover: #1d7440;
  --code: #2f4f94;
  --color-scheme: light;
  --sidebar-bg: rgba(255, 255, 255, 0.96);
  --customize-bar-bg: rgba(255, 255, 255, 0.96);
  --control-bg: rgba(16, 24, 40, 0.06);
  --control-bg-hover: rgba(16, 24, 40, 0.1);
  --sidebar-width: 360px;
  --sidebar-rail: 72px;
}

:root[data-theme='light'] {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --text: #202a35;
  --muted: #5f6c7b;
  --border: rgba(17, 24, 39, 0.12);
  --popover-bg: rgba(255, 255, 255, 0.98);
  --popover-shadow: 0 14px 28px rgba(26, 36, 53, 0.14);
  --accent: #1f8d4d;
  --accent-rgb: 31, 141, 77;
  --danger: #c55862;
  --danger-rgb: 197, 88, 98;
  --warning: #c58a3f;
  --warning-rgb: 197, 138, 63;
  --success: #238a4a;
  --success-hover: #1d7440;
  --code: #2f4f94;
  --color-scheme: light;
  --sidebar-bg: rgba(255, 255, 255, 0.96);
  --customize-bar-bg: rgba(255, 255, 255, 0.96);
  --control-bg: rgba(16, 24, 40, 0.06);
  --control-bg-hover: rgba(16, 24, 40, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  width: 0;
  height: 0;
}

* {
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

*::-webkit-scrollbar {
  background: transparent;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  color-scheme: var(--color-scheme);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(var(--accent-rgb), 0.22);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.link-danger {
  color: var(--danger);
  text-decoration: none;
}

.link-danger:hover {
  color: var(--accent);
  text-decoration: none;
}

code {
  color: var(--code);
}

.container {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
}

.shell .container {
  width: calc(100% - 12px);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  backdrop-filter: blur(8px);
  padding: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

.gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--control-bg);
  color: var(--text);
  white-space: nowrap;
}

.gear-btn:hover {
  background: var(--control-bg-hover);
}

.gear-btn__icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex: 0 0 auto;
}

.gear-btn__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

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

.gear-btn__label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
}

.gear-btn.is-active {
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.35);
  background: rgba(var(--danger-rgb), 0.1);
}

.gear-btn.is-active:hover {
  background: rgba(var(--danger-rgb), 0.14);
}

.gear-btn.is-active .gear-btn__icon,
.gear-btn.is-active .gear-btn__label {
  color: var(--danger);
}

body.menu-customize-mode .menu__item.is-active {
  background: transparent;
  border-color: transparent;
}

body.menu-customize-mode .menu__item.is-active[data-customizable='1'] {
  color: var(--danger);
  background: rgba(var(--danger-rgb), 0.12);
  border-color: rgba(var(--danger-rgb), 0.35);
}

body.menu-customize-mode .menu__item.is-active[data-customizable='1']:hover {
  background: rgba(var(--danger-rgb), 0.12);
  border-color: rgba(var(--danger-rgb), 0.35);
}

.sidebar__bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar__bottom .gear-btn {
  width: 100%;
}

.shell__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.customize-bar {
  position: fixed;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  background: var(--customize-bar-bg);
  backdrop-filter: blur(8px);
}


/* Desktop: collapsible sidebar (icon rail + expand on hover). */
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  body[data-auth='1'] .shell {
    grid-template-columns: var(--sidebar-rail) 1fr;
  }

  body[data-auth='1'] .sidebar {
    width: var(--sidebar-rail);
    transition: width 180ms ease, box-shadow 180ms ease;
    overflow: hidden;
    z-index: 60;
    will-change: width;
  }

  body[data-auth='1'] .sidebar:hover,
  body[data-auth='1'] .sidebar:focus-within {
    width: var(--sidebar-width);
    overflow: auto;
    box-shadow: 12px 0 30px rgba(0, 0, 0, 0.35);
  }

  body[data-auth='1'] .customize-bar {
    left: var(--sidebar-rail);
  }

  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .menu__label,
  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .menu__count,
  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .gear-btn__label,
  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .sidebar-action__label {
    display: none;
  }

  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .brand__text {
    visibility: hidden;
  }

  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .menu__item {
    justify-content: center;
    padding: 6px 6px;
  }

  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .menu__icon {
    margin-right: 0;
  }

  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .sidebar-action,
  body[data-auth='1'] .sidebar:not(:hover):not(:focus-within) .gear-btn {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
}


.customize-bar__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.customize-bar__label {
  margin-right: auto;
  color: var(--muted);
  font-size: 14px;
}

body.menu-customize-mode .shell__main > main.container {
  padding-bottom: 70px;
}

@media (max-width: 900px) {
  .customize-bar {
    left: 0;
  }
}

.shell__main > main.container {
  flex: 1;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0.2px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand__mono {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.12);
  border-radius: 12px;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.6px;
  color: var(--text);
  flex: 0 0 auto;
}

.brand__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.shell .page-head {
  margin-bottom: 8px;
}

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

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  flex-wrap: wrap;
}

.toolbar__group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.toolbar__group--right {
  justify-content: flex-end;
  margin-left: auto;
}

.toolbar__meta {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 6px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--muted);
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.field-inline > span {
  color: var(--muted);
  font-size: 14px;
}

.field-inline--search {
  flex: 1 1 260px;
}

.field-inline--search > input {
  width: 100%;
}

body[data-page='leads'] .toolbar {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

body[data-page='deals'] .toolbar {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

body[data-page='goods-services'] .toolbar {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

body[data-page='leads'] .toolbar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body[data-page='deals'] .toolbar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body[data-page='goods-services'] .toolbar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body[data-page='leads'] .toolbar input:focus-visible,
body[data-page='leads'] .toolbar select:focus-visible,
body[data-page='leads'] .toolbar button:focus-visible,
body[data-page='leads'] .toolbar a:focus-visible {
  outline-offset: -2px;
}

body[data-page='deals'] .toolbar input:focus-visible,
body[data-page='deals'] .toolbar select:focus-visible,
body[data-page='deals'] .toolbar button:focus-visible,
body[data-page='deals'] .toolbar a:focus-visible {
  outline-offset: -2px;
}

body[data-page='goods-services'] .toolbar input:focus-visible,
body[data-page='goods-services'] .toolbar select:focus-visible,
body[data-page='goods-services'] .toolbar button:focus-visible,
body[data-page='goods-services'] .toolbar a:focus-visible {
  outline-offset: -2px;
}

body[data-page='leads'] .toolbar__group {
  flex-wrap: nowrap;
  min-width: 0;
}

body[data-page='deals'] .toolbar__group {
  flex-wrap: nowrap;
  min-width: 0;
}

body[data-page='goods-services'] .toolbar__group {
  flex-wrap: nowrap;
  min-width: 0;
}

body[data-page='leads'] .toolbar__group--right {
  flex: 0 0 auto;
}

body[data-page='deals'] .toolbar__group--right {
  flex: 0 0 auto;
}

body[data-page='goods-services'] .toolbar__group--right {
  flex: 0 0 auto;
}

body[data-page='leads'] .field-inline--search {
  min-width: 240px;
}

body[data-page='deals'] .field-inline--search {
  min-width: 240px;
}

body[data-page='goods-services'] .field-inline--search {
  min-width: 240px;
}

body[data-page='leads'] .toolbar button,
body[data-page='leads'] .toolbar input,
body[data-page='leads'] .toolbar select {
  padding: 6px 8px;
  height: 36px;
  line-height: 1.3;
}

body[data-page='deals'] .toolbar button,
body[data-page='deals'] .toolbar input,
body[data-page='deals'] .toolbar select {
  padding: 6px 8px;
  height: 36px;
  line-height: 1.3;
}

body[data-page='goods-services'] .toolbar button,
body[data-page='goods-services'] .toolbar input,
body[data-page='goods-services'] .toolbar select {
  padding: 6px 8px;
  height: 36px;
  line-height: 1.3;
}

body[data-page='leads'] .toolbar select {
  padding-right: 30px;
}

body[data-page='deals'] .toolbar select {
  padding-right: 30px;
}

body[data-page='goods-services'] .toolbar select {
  padding-right: 30px;
}

body[data-page='leads'] #leads-pipeline {
  width: auto;
}

body[data-page='leads'] .toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body[data-page='leads'] #leads-refresh {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.75;
  font-size: 20px;
  line-height: 1;
}

body[data-page='deals'] #deals-refresh,
body[data-page='deals'] #deals-structure-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.75;
  font-size: 20px;
  line-height: 1;
}

body[data-page='goods-services'] #goods-services-refresh,
body[data-page='goods-services'] #goods-services-structure-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.75;
  font-size: 20px;
  line-height: 1;
}

body[data-page='deals'] #deals-structure-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

body[data-page='goods-services'] #goods-services-structure-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

body[data-page='leads'] #leads-refresh svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

body[data-page='leads'] #leads-refresh:hover {
  background: rgba(255, 255, 255, 0.04);
  opacity: 1;
}

body[data-page='deals'] #deals-refresh:hover,
body[data-page='deals'] #deals-structure-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  opacity: 1;
}

body[data-page='goods-services'] #goods-services-refresh:hover,
body[data-page='goods-services'] #goods-services-structure-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  opacity: 1;
}

body[data-page='goods-services'] #goods-services-structure-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(76vh, 820px);
}

body[data-page='goods-services'] #goods-services-structure-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
  padding-bottom: 4px;
}

.segmented {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  padding: 0;
  position: relative;
}

body[data-page='leads'] .segmented {
  height: 36px;
  min-width: 220px;
}

.segmented::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 50%;
  border-radius: 9px 0 0 9px;
  background: rgba(var(--accent-rgb), 0.12);
  transition: none;
  pointer-events: none;
  will-change: transform;
}

.segmented[data-value='list']::before {
  border-radius: 0 9px 9px 0;
  transform: translate3d(100%, 0, 0);
}

.segmented__btn {
  border: 0;
  border-radius: 0;
  padding: 0 6px;
  background: transparent;
  color: var(--muted);
  font-size: inherit;
  position: relative;
  z-index: 1;
  height: 100%;
  flex: 1 1 0;
  white-space: nowrap;
  text-align: center;
  transition: color 140ms ease;
}

body[data-page='leads'] .segmented__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.segmented__btn:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.03);
}

.segmented__btn.is-active {
  color: var(--text);
}

.segmented.is-ready::before {
  transition:
    transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1),
    border-radius 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.panel {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.shell .panel {
  margin-top: 6px;
  padding: 6px;
  border-radius: 10px;
}

.kanban {
  display: grid;
  grid-template-rows: 1fr;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  min-width: 0;
}

.shell .kanban {
  gap: 6px;
  padding-bottom: 2px;
}

body[data-page='leads'] .kanban {
  transform: rotateX(180deg);
  scrollbar-gutter: stable;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
  scrollbar-width: thin;
}

body[data-page='leads'] .kanban > * {
  transform: rotateX(180deg);
}

body[data-page='leads'] .kanban::-webkit-scrollbar {
  height: 10px;
}

body[data-page='leads'] .kanban::-webkit-scrollbar-track {
  background: transparent;
}

body[data-page='leads'] .kanban::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

body[data-page='leads'] .kanban::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

body[data-page='leads'] .leads-board {
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

body[data-page='leads'] .leads-board__meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

body[data-page='deals'] .deals-board {
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

body[data-page='goods-services'] .goods-services-board {
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

body[data-page='deals'] .deals-board > #deals-table {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-page='goods-services'] .goods-services-board > #goods-services-table {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-page='leads'] .leads-board > #leads-kanban,
body[data-page='leads'] .leads-board > #leads-table {
  flex: 1 1 auto;
  min-height: 0;
}

.kanban__col {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.shell .kanban__col {
  border-radius: 10px;
  padding: 6px;
  gap: 6px;
}

.kanban__col::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--stage-color, rgba(255, 255, 255, 0.08));
  border-radius: inherit;
  opacity: 0.9;
  pointer-events: none;
}

.kanban__col-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  padding-top: 4px;
}

.shell .kanban__col-head {
  padding-top: 6px;
}

.kanban__col-title {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.2;
}

.kanban__col-title > span {
  display: block;
  width: 100%;
  min-width: 0;
}

.kanban__col-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.kanban__col-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  opacity: 0.9;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  min-width: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
}

.badge--warn {
  border-color: rgba(var(--warning-rgb), 0.35);
  background: rgba(var(--warning-rgb), 0.08);
  color: var(--warning);
  font-weight: 700;
}

.badge--danger {
  border-color: rgba(var(--danger-rgb), 0.35);
  background: rgba(var(--danger-rgb), 0.08);
  color: var(--danger);
  font-weight: 700;
}

.badge--success {
  border-color: rgba(var(--success-rgb), 0.35);
  background: rgba(var(--success-rgb), 0.1);
  color: var(--success);
  font-weight: 700;
}

.badge--soft {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.kanban__col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  padding: 0;
  overscroll-behavior: contain;
}

.shell .kanban__col-body {
  gap: 6px;
}

body[data-page='leads'] .kanban__col-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

body[data-page='leads'] .kanban__col-body::-webkit-scrollbar {
  width: 10px;
}

body[data-page='leads'] .kanban__col-body::-webkit-scrollbar-track {
  background: transparent;
}

body[data-page='leads'] .kanban__col-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

body[data-page='leads'] .kanban__col-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lead-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 8px 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
  line-height: 1.35;
  isolation: isolate;
}

.kanban__col-body > .lead-card {
  flex: 0 0 auto;
}

.shell .lead-card {
  border-radius: 10px;
  padding: 6px 6px 6px 10px;
}

.lead-card::before {
  content: '';
  position: absolute;
  inset: 0;
  /* Don't tint the whole card by stage color: keep only the stripe (::after). */
  background: transparent;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.lead-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--stage-color, rgba(255, 255, 255, 0.1));
  opacity: 0.9;
  pointer-events: none;
  z-index: 0;
}

.lead-card > * {
  position: relative;
  z-index: 1;
}

.lead-card__title {
  display: grid;
  gap: 6px;
  font-weight: 600;
  line-height: 1.2;
}

.lead-card__fields {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  row-gap: 0;
  font-weight: 400;
  min-width: 0;
}

.lead-card__fields .lead-card__name {
  font-weight: 600;
  line-height: 1.2;
}

.lead-card__fields .lead-card__time {
  margin-top: 0;
}

.lead-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lead-card__top-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.lead-card__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  min-height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
  color: var(--stage-color, var(--muted));
  font-size: 14px;
  line-height: 1.1;
  flex: 0 0 auto;
}

.lead-card__tasks {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  min-height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--success);
  font-size: 13px;
  line-height: 1.1;
  flex: 0 0 auto;
  opacity: 0.9;
}

.lead-card__tasks--overdue {
  border-color: rgba(var(--danger-rgb), 0.42);
  background: rgba(var(--danger-rgb), 0.12);
  color: var(--danger);
  box-shadow: 0 0 0 1px rgba(var(--danger-rgb), 0.14) inset;
}

.lead-card__comments {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  min-height: 24px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--control-bg);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.1;
  flex: 0 0 auto;
  opacity: 0.92;
}

.lead-card__issue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
  flex: 0 0 auto;
}

.lead-card__issue--warn {
  border-color: rgba(var(--warning-rgb), 0.35);
  background: rgba(var(--warning-rgb), 0.08);
  color: var(--warning);
}

.lead-card__issue--danger {
  border-color: rgba(var(--danger-rgb), 0.35);
  background: rgba(var(--danger-rgb), 0.08);
  color: var(--danger);
}

.lead-card__name {
  min-width: 0;
}

.lead-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.lead-card__title .lead-card__tags {
  margin-top: 0;
}

.lead-card__timer {
  margin-top: 0;
  font-size: 13px;
  line-height: 1.2;
  color: var(--muted);
}

.lead-card__timer.is-overdue {
  color: var(--danger);
}

.lead-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
}

.lead-tag:hover {
  background: rgba(0, 0, 0, 0.26);
}

.lead-tag--colored {
  border-color: rgba(var(--tag-rgb), 0.32);
  background: rgba(var(--tag-rgb), 0.12);
  color: rgba(var(--tag-rgb), 0.92);
}

.lead-tag--colored:hover {
  background: rgba(var(--tag-rgb), 0.18);
}

.lead-tag--outline {
  border-color: rgba(var(--tag-rgb), 0.32);
  background: transparent;
  color: rgba(var(--tag-rgb), 0.92);
}

.lead-tag--outline:hover {
  background: rgba(var(--tag-rgb), 0.08);
}

.lead-tag-menu,
.lead-card-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: min(260px, calc(100% - 16px));
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--popover-bg);
  box-shadow: var(--popover-shadow);
  z-index: 90;
  display: grid;
  gap: 6px;
}

.dt-menu {
  width: min(320px, calc(100% - 16px));
}

.dt-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dt-menu__month {
  flex: 1 1 auto;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.dt-menu__dow {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 0;
  user-select: none;
}

.dt-menu__day {
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  display: inline-grid;
  place-items: center;
  line-height: 1;
  font-size: 13px;
}

.dt-menu__day:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.dt-menu__day.is-selected {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.65);
}

.dt-menu__day.is-today:not(.is-selected) {
  border-color: rgba(var(--accent-rgb), 0.35);
}

.dt-menu__day.is-out {
  opacity: 0.45;
}

.dt-menu__time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dt-menu__time input {
  width: 64px;
  text-align: center;
  box-shadow: none;
  background-color: rgba(0, 0, 0, 0.18);
}

.dt-menu__time-sep {
  color: var(--muted);
  font-weight: 600;
  user-select: none;
}

.dt-menu__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.confirm-menu__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px;
  gap: 6px;
  align-items: center;
}

.confirm-menu__text {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.lead-tag-menu__item,
.lead-card-menu__item {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: 10px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

.lead-tag-menu__item:hover,
.lead-card-menu__item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.lead-tag-menu__item.is-disabled,
.lead-card-menu__item.is-disabled {
  opacity: 0.45;
}

.lead-task-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 56px;
}

.lead-task-notify {
  display: grid;
  gap: 6px;
}

.lead-task-notify__options {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lead-task-notify__option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.stage-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin-right: 8px;
  vertical-align: middle;
}

.pipeline-menu__edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.pipeline-menu__edit input {
  box-shadow: none;
}

.pipeline-menu__item {
  line-height: 1.35;
  padding: 8px 10px;
}

.pipeline-menu__item.is-active {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.35);
}

.lead-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  padding: 12px;
  display: flex;
}

body[data-page='leads'] .leads-board .lead-modal {
  position: absolute;
  border-radius: inherit;
}

body[data-page='deals'] .deals-board .deal-modal {
  position: absolute;
  border-radius: inherit;
  padding: 0;
}

body[data-page='deals'] .deals-board .deal-modal__panel {
  border-radius: inherit;
}

.shell .lead-modal {
  padding: 6px;
}

.lead-modal__panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--popover-shadow);
  overflow: hidden;
}

.shell .lead-modal__panel {
  border-radius: 10px;
}

.lead-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.shell .lead-modal__header {
  padding: 6px;
}

.lead-modal__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.lead-modal__name {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-modal__stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.select-like.lead-modal__stage-btn {
  width: auto;
  min-width: 0;
  max-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 10px;
  padding-right: 30px;
}

.lead-modal__stage-btn-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
}

.lead-modal__stage-btn.has-color {
  border-color: rgba(var(--stage-rgb), 0.55);
  background-color: rgba(var(--stage-rgb), 0.1);
}

.lead-modal__stage-btn.has-color:hover {
  border-color: rgba(var(--stage-rgb), 0.75);
  background-color: rgba(var(--stage-rgb), 0.16);
}

.lead-modal__stage-btn.has-color .lead-modal__stage-btn-dot {
  background: rgb(var(--stage-rgb));
}

.lead-modal__stage-switch {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.lead-modal__stage-switch .icon-btn__glyph {
  transform: translateY(-2px);
}

.lead-modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.lead-modal__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow: auto;
}

.lead-modal__body--split {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
}

.lead-modal__side {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lead-modal__contact {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.lead-modal__tab-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lead-modal__tab-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.lead-modal__tab-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.lead-modal__tab-action {
  flex: 1 1 220px;
}

.lead-modal__tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.shell .lead-modal__tabs {
  border-radius: 10px;
}

.lead-modal__tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 10px;
}

.lead-modal__tab:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.lead-modal__tab.is-active {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--text);
}

.lead-tasks-tab {
  display: grid;
  gap: 8px;
}

.shell .lead-tasks-tab {
  gap: 6px;
}

.lead-tasks-tab__toolbar {
  justify-content: flex-end;
}

.lead-task-list {
  display: grid;
  gap: 6px;
}

.shell .lead-task-list {
  gap: 5px;
}

.lead-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.shell .lead-task-item {
  padding: 7px 8px;
  border-radius: 10px;
}

.lead-task-item__meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.lead-task-item__title {
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-task-item__desc {
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lead-task-item__actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.lead-tab-placeholder {
  padding: 8px 2px;
}

.shell .lead-modal__body {
  padding: 6px;
  gap: 6px;
}

.lead-modal__stages {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  min-width: 0;
}

.lead-modal__metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}

.shell .lead-modal__metrics {
  border-radius: 10px;
}

.lead-metric {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 8px;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: default;
}

.lead-metric__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--muted);
  opacity: 0.9;
  flex: 0 0 auto;
}

.lead-metric__icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.lead-metric__value {
  font-weight: 700;
}

.lead-metric--warn {
  border-color: rgba(var(--warning-rgb), 0.35);
  background: rgba(var(--warning-rgb), 0.06);
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  gap: 0;
}

.lead-metric--warn .lead-metric__icon {
  color: var(--warning);
  font-weight: 900;
  font-size: 22px;
  width: 36px;
  height: 36px;
  opacity: 0.95;
}

.lead-metric--warn .lead-metric__value {
  color: var(--warning);
}

.lead-metric--danger {
  border-color: rgba(var(--danger-rgb), 0.35);
  background: rgba(var(--danger-rgb), 0.06);
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  gap: 0;
}

.lead-metric--danger .lead-metric__icon {
  color: var(--danger);
  font-weight: 900;
  font-size: 22px;
  width: 36px;
  height: 36px;
  opacity: 0.95;
}

.lead-metric--danger .lead-metric__value {
  color: var(--danger);
}

.lead-modal__stage {
  flex: 0 0 auto;
  position: relative;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font: inherit;
  text-align: left;
  min-width: 140px;
}

.lead-modal__stage::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--stage-color, rgba(255, 255, 255, 0.08));
  border-radius: inherit;
  opacity: 0.9;
  pointer-events: none;
}

.lead-modal__stage:hover {
  background: rgba(255, 255, 255, 0.04);
}

.lead-modal__stage.is-active {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.35);
}

.lead-modal__details {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}

.shell .lead-modal__details {
  border-radius: 10px;
  padding: 6px;
}

.lead-modal__meta {
  display: grid;
  gap: 8px;
}

.lead-modal__meta-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.lead-modal__meta-val {
  overflow-wrap: anywhere;
}

.lead-meta-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.lead-meta-actions__grow {
  margin-right: auto;
}

.lead-warning {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--warning);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-warning__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(var(--warning-rgb), 0.35);
  background: rgba(var(--warning-rgb), 0.12);
  color: var(--warning);
  font-weight: 900;
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
  transform: translateY(-1px);
}

.lead-warning__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-modal__tags {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.shell .lead-modal__tags {
  margin-top: 8px;
}

.lead-block {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.lead-modal__details .lead-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.shell .lead-block {
  margin-top: 8px;
  padding-top: 8px;
  gap: 6px;
}

.lead-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lead-block__actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lead-block__title {
  font-weight: 600;
  line-height: 1.2;
}

.lead-object-create__btn {
  width: 100%;
  justify-content: center;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1;
  flex: 0 0 auto;
}

.avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.avatar--md {
  width: 52px;
  height: 52px;
  font-size: 16px;
  border-radius: 999px;
}

.avatar-img {
  display: block;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  flex: 0 0 auto;
}

.avatar-img--sm {
  width: 28px;
  height: 28px;
  border-radius: 10px;
}

.avatar-img--md {
  width: 52px;
  height: 52px;
  border-radius: 999px;
}

.assignee-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  height: 60px;
  min-height: 60px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  max-width: 100%;
}

.assignee-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.assignee-btn.is-empty {
  color: var(--muted);
}

.assignee-btn__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

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

.comment {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.comment__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.comment__author {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment__time {
  flex: 0 0 auto;
  white-space: nowrap;
}

.comment__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-form {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.shell .comment {
  padding: 7px 8px;
  border-radius: 10px;
}

.shell .comment-form {
  padding: 7px 8px;
  border-radius: 10px;
}

.comment-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 56px;
}

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

.chat {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.shell .chat {
  padding: 7px 8px;
  border-radius: 10px;
  gap: 6px;
}

.chat__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  overflow: auto;
  max-height: 340px;
  padding-right: 4px;
}

.shell .chat__list {
  gap: 6px;
  max-height: 320px;
}

.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 100%;
}

.chat-msg.is-me {
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-msg__avatar {
  flex: 0 0 auto;
}

.chat-msg__content {
  min-width: 0;
  max-width: min(560px, 100%);
  display: grid;
  gap: 4px;
}

.chat-msg.is-me .chat-msg__content {
  align-items: end;
}

.chat-msg__meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
}

.chat-msg.is-me .chat-msg__meta {
  justify-content: flex-end;
}

.chat-msg__author {
  font-weight: 600;
  color: var(--text);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-msg__time {
  flex: 0 0 auto;
  white-space: nowrap;
}

.chat-msg__bubble {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.14);
  padding: 8px 10px;
}

.chat-msg.has-delete .chat-msg__bubble {
  padding-right: 38px;
}

.chat-msg.is-me .chat-msg__bubble {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.12);
}

.chat-msg__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.chat-msg__delete.icon-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  font-size: 16px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
}

.chat-msg.has-delete:hover .chat-msg__delete.icon-btn {
  opacity: 1;
  pointer-events: auto;
}

.chat-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-composer__input {
  flex: 1;
  min-width: 0;
  width: 100%;
  resize: vertical;
  min-height: 44px;
  max-height: 160px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.14);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
}

.chat-composer__input:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.attachments {
  display: grid;
  gap: 6px;
}

.lead-attachment-editor {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
}

.lead-avatar-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lead-avatar-head__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.icon-btn.lead-avatar-btn {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  padding: 0;
  overflow: hidden;
  flex: 0 0 auto;
}

.lead-avatar-btn__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lead-avatar-btn__glyph {
  font-size: 30px;
  transform: translateY(-1px);
}

.lead-avatar-block__img {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

.attachment {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment:hover {
  background: rgba(0, 0, 0, 0.22);
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 640px) {
  .lead-modal {
    padding: 8px;
  }

  .lead-modal__body--split {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .lead-modal__contact {
    overflow: visible;
  }

  .lead-modal__tab-content {
    overflow: visible;
    display: block;
  }

  .lead-modal__tab-scroll {
    overflow: visible;
  }

  .lead-modal__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .lead-modal__actions {
    width: 100%;
  }

  .lead-modal__meta-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.lead-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  row-gap: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.15;
  margin-top: 3px;
}

.lead-card__time {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.3;
  margin-top: 3px;
}

.lead-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  min-height: 30px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-decoration: none;
  max-width: 100%;
  min-width: 0;
}

.lead-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.lead-link--static {
  cursor: default;
}

.lead-link--static:hover {
  color: var(--muted);
}

.lead-link__icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  flex: 0 0 auto;
}

.lead-link--assignee .lead-link__icon {
  width: 34px;
  height: 34px;
}

.lead-link--assignee .avatar--sm,
.lead-link--assignee .avatar-img--sm {
  width: 34px;
  height: 34px;
  border-radius: 999px;
}

.lead-link--assignee .avatar--sm {
  font-size: 13px;
}

.lead-link__icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.lead-link__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu {
  display: grid;
  gap: 4px;
  padding: 2px 0;
}

.menu__item {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
}
.menu__icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  color: var(--muted);
  flex: 0 0 auto;
}

.menu__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.menu__item:hover .menu__icon,
.menu__item.is-active .menu__icon {
  color: var(--text);
}

body.menu-customize-mode .menu__item.is-active[data-customizable='1'] .menu__icon {
  color: var(--danger);
}


.menu__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu__count {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  flex: 0 0 auto;
}

.menu__item.is-active .menu__count {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.1);
}

body.menu-customize-mode .menu__item.is-active[data-customizable='1'] .menu__count {
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.35);
  background: rgba(var(--danger-rgb), 0.1);
}

.menu__item:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.menu__item.is-active {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.35);
}


.sidebar-action {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.sidebar-action__icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex: 0 0 auto;
}

.sidebar-action__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-action:hover .sidebar-action__icon {
  color: var(--text);
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar .auth-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.sidebar .auth-actions form,
.sidebar .auth-actions button,
.sidebar .pill {
  width: 100%;
}

.sidebar .pill {
  text-align: left;
}

.pill {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 14px;
  color: var(--muted);
}

.ghost {
  background: transparent;
  border-color: var(--border);
}

main.container {
  padding: 12px 0;
  display: grid;
  gap: 10px;
  align-content: start;
}

.shell main.container {
  padding: 6px 0;
  gap: 6px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    overflow: visible;
  }

  .sidebar__bottom {
    margin-top: 0;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .sidebar__bottom .gear-btn {
    width: auto;
  }

  .menu {
    display: flex;
    gap: 6px;
    overflow: auto;
    padding: 0;
    flex: 1;
  }

  .menu__item {
    white-space: nowrap;
  }

  .sidebar .auth-actions {
    flex-direction: row;
    align-items: center;
  }


  .sidebar .auth-actions form,
  .sidebar .auth-actions button,
  .sidebar .pill {
    width: auto;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  min-width: 0;
}

.shell .card {
  border-radius: 8px;
  padding: 6px;
}

.shell .card > p {
  margin: 0 0 8px 0;
}

.shell .card > p:last-child {
  margin-bottom: 0;
}

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

.footer {
  padding: 16px 0 24px;
  color: var(--muted);
}

.footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.footer-link {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

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

.user-links {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.user-link {
  display: block;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.shell .user-link {
  padding: 6px;
  border-radius: 10px;
}

.user-link:hover {
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}

.user-link:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 2px;
}

.notice {
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.08);
  color: #ffd3d3;
  padding: 8px 9px;
  border-radius: 10px;
}

.banner {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.banner--danger {
  border-color: rgba(var(--danger-rgb), 0.35);
  background: rgba(var(--danger-rgb), 0.14);
  color: #ffd3d3;
}

.shell .notice {
  padding: 8px 9px;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.form-row {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.form-row--pipelines {
  grid-template-columns: minmax(0, 1fr) auto;
}

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

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

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

.form-row--auth-code {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.form-row--auth-code > button {
  height: 36px;
  white-space: nowrap;
}

.auth-code-timer {
  height: 36px;
  min-width: 76px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--control-bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.auth-code-timer.is-active {
  color: var(--text);
  border-color: rgba(var(--danger-rgb), 0.42);
}

.auth-code-timer.is-expired {
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.6);
}

.auth-code-timer.is-idle {
  opacity: 0.88;
}

.auth-code-status {
  min-height: 18px;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  opacity: 0;
  transition: opacity 160ms ease;
}

.auth-code-status.is-visible {
  opacity: 1;
}

.auth-code-status.is-success {
  color: var(--accent);
}

.auth-code-status.is-error {
  color: var(--danger);
}

.form-row--user-profile {
  grid-template-columns: minmax(0, 1fr) auto;
}

.form-row--user-password {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.form-row--user-owner-extra {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.form-row--finance {
  grid-template-columns: minmax(0, 160px) minmax(0, 180px) minmax(0, 220px) minmax(0, 1fr) auto;
}

.form-row--goods-services {
  grid-template-columns: minmax(0, 1fr) minmax(0, 160px) minmax(0, 260px) minmax(0, 180px) auto auto;
}

.parsing-layout {
  display: grid;
  gap: 16px;
}

.parsing-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
  gap: 16px;
}

.parsing-choice {
  display: inline-flex;
  flex-wrap: wrap;
  height: auto;
  min-height: 36px;
}

.parsing-choice--wide {
  display: flex;
  width: 100%;
}

.parsing-hints {
  margin-top: 6px;
}

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

.user-profile {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.lead-form {
  display: grid;
  gap: 8px;
}

.leads-create-form {
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.lead-create-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 8px 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  gap: 8px;
}

.shell .lead-create-card {
  border-radius: 10px;
  padding: 6px 6px 6px 10px;
}

.lead-create-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(var(--accent-rgb), 0.08);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.lead-create-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: rgba(var(--accent-rgb), 0.55);
  opacity: 0.95;
  pointer-events: none;
  z-index: 0;
}

.lead-create-card > * {
  position: relative;
  z-index: 1;
}

.lead-create-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lead-create-card__title {
  font-weight: 600;
  line-height: 1.2;
}

.lead-create-card__num {
  flex: 0 0 auto;
}

.leads-create-top__row {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.lead-extras {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.shell .lead-extras {
  padding: 6px;
  border-radius: 8px;
}

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

.lead-extras__actions > button {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-extras__body {
  display: grid;
  gap: 8px;
}

.lead-extras__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lead-extras__title {
  font-weight: 600;
  line-height: 1.2;
}

.lead-extras__editor {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.lead-extras__editor textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
}

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

.lead-extras__summary {
  display: grid;
  gap: 6px;
}

.lead-extras__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
}

.lead-extras__item-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.lead-extras__item-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lead-avatar-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lead-avatar-preview__img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

.lead-avatar-preview--sm .lead-avatar-preview__img {
  width: 28px;
  height: 28px;
}

.lead-form .actions {
  flex-wrap: nowrap;
}

.lead-form .actions > button[type='submit'] {
  flex: 1 1 auto;
  min-width: 0;
}

.lead-form .actions > #leads-create-cancel {
  flex: 0 0 auto;
  padding-left: 10px;
  padding-right: 10px;
  white-space: nowrap;
}

.lead-objects {
  display: grid;
  gap: 8px;
}

.lead-object {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  display: grid;
  gap: 8px;
}

.lead-object__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  padding-right: 46px;
}

.lead-object__title {
  font-weight: 600;
}

.lead-object__head > button[data-lead-object-remove] {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

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

.lead-object__head-actions {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  height: 36px;
  padding: 0;
  gap: 0;
}

.lead-object__head-actions > .field__action {
  border: 0;
  border-radius: 0;
  height: 100%;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  opacity: 1;
}

.lead-object__head-actions > .field__action + .field__action {
  border-left: 1px solid var(--border);
}

.lead-object__head-actions > .field__action:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.lead-object__head-actions > .field__action:disabled {
  opacity: 0.45;
}

.form-row--lead-object {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-row--lead-meta {
  grid-template-columns: auto;
  justify-content: end;
}

.form-row--lead-source {
  grid-template-columns: minmax(0, 1fr);
}

.addresses {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}

.addresses__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.addresses__list {
  display: grid;
  gap: 6px;
}

.lead-object__extras {
  grid-column: 1 / -1;
}

.lead-object__comment {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 36px;
  gap: 6px;
  align-items: end;
}

.pipeline-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: end;
  justify-self: end;
}

@media (max-width: 900px) {
  .form-row {
    grid-template-columns: 1fr;
  }

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

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

  .parsing-meta {
    grid-template-columns: 1fr;
  }

  .parsing-settings-grid {
    grid-template-columns: 1fr;
  }

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

  .leads-create-top__row {
    grid-template-columns: 1fr;
  }

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

.customize-editor {
  display: grid;
  gap: 10px;
}

.customize-block {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.shell .customize-block {
  border-radius: 8px;
  padding: 8px;
  gap: 6px;
}

.customize-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.customize-block__title {
  font-weight: 600;
}

.hint {
  position: relative;
  flex: 0 0 auto;
}

.hint__popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(360px, 86vw);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--popover-bg);
  box-shadow: var(--popover-shadow);
  z-index: 60;
}

.hint__list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.customize-list {
  display: grid;
  gap: 6px;
}

.customize-row {
  display: grid;
  grid-template-columns: 1fr 36px 36px;
  gap: 6px;
  align-items: center;
}

.customize-row--stage {
  grid-template-columns: minmax(0, 1fr) 36px 200px 36px;
}

.customize-row--deal-status {
  grid-template-columns: 36px minmax(0, 1fr) 36px 240px 36px;
}

.stage-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stage-timer__value {
  width: 80px;
  flex: 0 0 auto;
}

.stage-timer__unit {
  min-width: 0;
  flex: 1 1 auto;
}

.stage-config {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--stage-color, var(--border));
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  position: relative;
}

.stage-config.is-dragging {
  opacity: 0.75;
}

.stage-config.is-drop-before::before,
.stage-config.is-drop-after::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(var(--accent-rgb), 0.75);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
  border-radius: 3px;
}

.stage-config.is-drop-before::before {
  top: -2px;
}

.stage-config.is-drop-after::after {
  bottom: -2px;
}

.stage-drag-handle {
  cursor: grab;
  user-select: none;
}

.stage-config.is-dragging .stage-drag-handle {
  cursor: grabbing;
}

.shell .stage-config {
  border-radius: 8px;
}

.stage-config__fields {
  display: flex;
  align-items: center;
}

.stage-card-fields {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.card-field-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.card-field-item.is-dragging {
  opacity: 0.6;
}

.card-field-item__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.14);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
}

.card-field-item.is-delete-hover .card-field-item__label {
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.6);
  background: rgba(var(--danger-rgb), 0.08);
}

.customize-row .btn {
  height: 36px;
}

.customize-row--source {
  grid-template-columns: 1fr 36px;
}

.columns-editor {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.columns-editor__head,
.columns-editor__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 64px;
  gap: 10px;
  align-items: center;
}

.columns-editor__head {
  padding: 0 10px;
  font-size: 14px;
}

.columns-editor__head-cell {
  text-align: center;
}

.columns-editor__row {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
}

.shell .columns-editor__row {
  border-radius: 8px;
}

.columns-editor__cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.columns-editor__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customize-stage-tags {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.shell .customize-stage-tags {
  border-radius: 8px;
  padding: 8px;
  gap: 6px;
}

.customize-stage-tags__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customize-stage-tags__list {
  display: grid;
  gap: 6px;
}

.customize-tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customize-tag-row > span {
  min-width: 0;
  font-size: 14px;
}

@media (max-width: 900px) {
  .customize-row {
    grid-template-columns: 1fr;
  }

  .customize-row--source {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  gap: 3px;
}

.field--full {
  grid-column: 1 / -1;
}

.field > span {
  color: var(--muted);
  font-size: 14px;
}

.field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.field__head > span {
  color: var(--muted);
  font-size: 14px;
  min-width: 0;
}

.field__action {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  opacity: 0.88;
}

.field__action:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.field__with-icon {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: center;
}

.field__with-icon > input {
  width: 100%;
}

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

.password-field > input {
  width: 100%;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.52);
  opacity: 0.56;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle svg {
  width: 17px;
  height: 17px;
  display: block;
  pointer-events: none;
}

.password-toggle:hover {
  color: rgba(255, 255, 255, 0.66);
  background: rgba(255, 255, 255, 0.02);
  opacity: 0.74;
}

.password-toggle.is-visible {
  color: rgba(var(--danger-rgb), 0.86);
  opacity: 0.9;
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.22);
  outline-offset: 1px;
}
.choice {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  height: 36px;
  padding: 0;
  gap: 0;
}

.choice--compact {
  height: 36px;
  border-radius: 10px;
}

.choice__item {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  font-size: inherit;
  color: var(--text);
  cursor: pointer;
}

.choice__item + .choice__item {
  border-left: 1px solid var(--border);
}

.choice__item > input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.choice__item > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.choice--compact .choice__item > span {
  padding: 0 8px;
}

.choice__item:hover > span {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.choice__item > input:checked + span {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--text);
}

.choice__item > input:focus-visible + span {
  outline: 2px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: -2px;
}

body[data-page='cabinet'] .toolbar__group--stretch {
  flex: 1 1 0;
  width: 100%;
}

body[data-page='cabinet'] #cabinet-metrics-tabs {
  display: flex;
  width: 100%;
}

input,
select,
textarea,
button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
}

input,
select {
  height: 36px;
  line-height: 1.3;
}

input:not([type='checkbox']):not([type='radio']):not([type='color']):not([type='file']),
select,
textarea {
  background-color: var(--popover-bg);
  box-shadow: var(--popover-shadow);
}

input:not([type='checkbox']):not([type='radio']):not([type='color']):not([type='file']):hover,
select:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

input[type='checkbox'] {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  cursor: pointer;
}

input[type='checkbox']:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

input[type='checkbox']:checked {
  background-color: rgba(var(--accent-rgb), 0.22);
  border-color: rgba(var(--accent-rgb), 0.65);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 6L9 17l-5-5' fill='none' stroke='rgba(255,255,255,0.92)' stroke-width='3.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}

input[type='checkbox']:checked:hover {
  border-color: rgba(var(--accent-rgb), 0.85);
}

input[type='checkbox']:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input[type='radio'] {
  width: 16px;
  height: 16px;
  padding: 0;
  background: transparent;
  border-radius: 999px;
  margin: 0;
  accent-color: var(--accent);
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.select-like {
  width: 100%;
  height: 36px;
  line-height: 1.3;
  text-align: left;
  background-color: var(--popover-bg);
  box-shadow: var(--popover-shadow);
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.select-like:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

input[type='color'] {
  padding: 0;
  width: 36px;
  height: 36px;
}

input.color-swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: grab;
}

input.color-swatch:active {
  cursor: grabbing;
}

input.color-swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

input.color-swatch::-webkit-color-swatch {
  border: 0;
  border-radius: 8px;
}

input.color-swatch::-moz-color-swatch {
  border: 0;
  border-radius: 8px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.35);
}

button:hover {
  background: rgba(var(--accent-rgb), 0.18);
}

button:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

h1,
h2 {
  margin: 0 0 10px 0;
  font-size: 18px;
  line-height: 1.2;
}

.card__section-title {
  margin-top: 12px;
}

.shell .card__section-title {
  margin-top: 10px;
}

.customize-title {
  color: var(--danger);
}

.list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

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

.shell .table-wrap {
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.shell th,
.shell td {
  padding: 5px 6px;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}

.deals-hint {
  margin: 8px 0 10px;
}

.deals-table {
  table-layout: fixed;
  min-width: 100%;
  font-size: 14px;
  line-height: 1.25;
}

/* Deals table: compact density */
.deals-table th,
.deals-table td {
  padding: 5px 6px;
}

.deals-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--popover-bg);
  vertical-align: middle;
}

.deals-table thead th.deals-th {
  padding-right: 0;
}

.deals-table th + th,
.deals-table td + td {
  border-left: 1px solid var(--border);
}

.deals-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deals-table tbody td {
  vertical-align: middle;
}

.deals-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.deals-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Deals table: selection */
.deals-table tbody tr.is-selected {
  background: rgba(var(--accent-rgb), 0.06);
}

.deals-table tbody tr.is-selected:hover {
  background: rgba(var(--accent-rgb), 0.09);
}

.deals-col-select,
.deals-col-open,
.deals-col-expand {
  text-align: center;
  vertical-align: middle;
  padding: 0;
}

.deals-col-select {
  line-height: 0;
}

.deals-col-open {
  line-height: 0;
  font-size: 0;
}

.deals-col-select input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.deals-col-select input:hover {
  border-color: rgba(var(--accent-rgb), 0.7);
}

.deals-col-select input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.deals-col-select input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.22);
}

.deals-col-select input:disabled {
  opacity: 0.45;
  cursor: default;
}

.deals-row-expand {
  margin: 0 auto;
}

.deals-row-open {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.deals-row-open.icon-btn--info,
.deals-row-open.icon-btn--info:hover,
.deals-row-open.icon-btn--info:focus,
.deals-row-open.icon-btn--info:focus-visible {
  border: 0;
  background: transparent;
}

.deals-col-open .deals-row-open {
  margin-left: auto;
  margin-right: auto;
}

.deals-row-open__icon {
  width: 18px;
  height: 18px;
  display: block;
  margin: 0 auto;
}

.deals-row-expand__glyph {
  display: block;
  line-height: 1;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform 140ms ease;
}

.deals-row-expand.is-open .deals-row-expand__glyph {
  transform: rotate(90deg);
}

.deals-expand-row td {
  padding: 10px;
  background: rgba(0, 0, 0, 0.06);
}

.deals-expand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

@media (max-width: 720px) {
  .deals-expand {
    grid-template-columns: 1fr;
  }
}

.deals-expand__box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.shell .deals-expand__box {
  border-radius: 10px;
}

.deals-expand__title {
  font-weight: 700;
  margin-bottom: 8px;
}

.deals-expand__meta {
  display: grid;
  gap: 6px;
}

.deals-expand__meta-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

@media (max-width: 720px) {
  .deals-expand__meta-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.deals-expand__meta-key {
  color: var(--muted);
  font-size: 12px;
}

.deals-expand__meta-val {
  min-width: 0;
  overflow-wrap: anywhere;
}

.deals-expand__comments {
  display: grid;
  gap: 8px;
}

.deals-expand__comment {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
}

.deals-expand__comment-meta {
  font-size: 12px;
  margin-bottom: 4px;
}

.deals-expand__comment-text {
  white-space: pre-wrap;
}

.deals-table th[data-col-key='amount'],
.deals-table th[data-col-key='profit'],
.deals-table th[data-col-key='costs'],
.deals-table th[data-col-key='seq'],
.deals-table th[data-col-key='products'],
.deals-table th[data-col-key='communications'],
.deals-table th[data-col-key='documents'],
.deals-table th[data-col-key='events'],
.deals-table th[data-col-key='comments'],
.deals-table th[data-col-key='customFields'] {
  text-align: right;
}

.deals-table td[data-col-key='amount'],
.deals-table td[data-col-key='profit'],
.deals-table td[data-col-key='costs'],
.deals-table td[data-col-key='seq'],
.deals-table td[data-col-key='products'],
.deals-table td[data-col-key='communications'],
.deals-table td[data-col-key='documents'],
.deals-table td[data-col-key='events'],
.deals-table td[data-col-key='comments'],
.deals-table td[data-col-key='customFields'] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.deals-table th[data-col-key='products'],
.deals-table td[data-col-key='products'] {
  text-align: left;
}

.deals-table td[data-col-key='products'] {
  font-variant-numeric: normal;
}

.deals-table td[data-col-key='products'] .deals-products {
  display: flex;
  justify-content: flex-start;
}

.deals-th {
  position: relative;
  user-select: none;
}

.deals-th__inner {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.deals-th__label {
  flex: 1 1 auto;
  min-width: 0;
  cursor: grab;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deals-th.is-dragging .deals-th__label {
  cursor: grabbing;
  opacity: 0.75;
}

.deals-th__resize {
  flex: 0 0 12px;
  width: 12px;
  margin-right: -6px;
  cursor: col-resize;
  align-self: stretch;
  position: relative;
}

.deals-th__resize::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 6px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background 120ms ease;
}

.deals-th:hover .deals-th__resize::before {
  background: rgba(255, 255, 255, 0.12);
}

.deals-th .deals-th__resize:hover::before {
  background: rgba(255, 255, 255, 0.2);
}

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

.deals-th.is-drop-before::before,
.deals-th.is-drop-after::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(var(--accent-rgb), 0.75);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
}

.deals-th.is-drop-before::before {
  left: 0;
}

.deals-th.is-drop-after::after {
  right: 0;
}

.deals-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Deals tags: smaller chips */
.deals-tags .chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.1;
}

.deals-tags .chip::before {
  inset: -1px;
  border-radius: 8px;
}

.deals-products {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-start;
}

.deals-products .chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.1;
}

.deals-products .chip::before {
  inset: -1px;
  border-radius: 8px;
}

.deals-products__more {
  font-weight: 600;
}

.deals-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.deals-pager__info {
  min-width: 124px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.deals-stage-filters {
  --deals-stage-filter-width: clamp(96px, 13vw, 140px);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.deals-stage-filters > button {
  flex: 0 0 auto;
  width: auto;
}

.deals-structure-toggle {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}

.deals-structure-toggle .deal-stage-chip__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 18px;
  line-height: 1;
}

.deals-client-picker {
  position: relative;
}

.deals-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.deals-create-form__col {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.deals-create-form__col--client {
  padding-right: 12px;
}

.shell .deals-create-form__col--client {
  padding-right: 10px;
}

.deals-create-form__col--order {
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.shell .deals-create-form__col--order {
  padding-left: 10px;
}

.deals-create-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.shell .deals-create-form__row {
  gap: 6px;
}

.deals-create-form__block--items {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
}

.shell .deals-create-form__block--items {
  border-radius: 8px;
}

.deals-create-form__block--items > button {
  width: 100%;
  justify-content: center;
}

.deals-create-form__actions {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .deals-create-form {
    grid-template-columns: 1fr;
  }

  .deals-create-form__col--client {
    padding-right: 0;
  }

  .deals-create-form__col--order {
    padding-left: 0;
    border-left: 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
}

.deals-create-form textarea {
  width: 100%;
  resize: vertical;
}

.deals-client-picker__control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deals-client-picker__control > input {
  flex: 1 1 0;
  min-width: 0;
}

.deals-client-picker__clear {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.75;
  font-size: 20px;
  line-height: 1;
}

.deals-client-picker__clear:hover {
  background: rgba(255, 255, 255, 0.04);
  opacity: 1;
}

.deals-client-picker__list {
  flex: 0 0 auto;
}

.deals-client-picker__list svg {
  width: 20px;
  height: 20px;
  display: block;
}

.deals-client-picker__manual {
  flex: 0 0 auto;
  white-space: nowrap;
}

.deals-client-picker__manual.is-active {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: rgba(var(--accent-rgb), 0.12);
}

.deals-client-manual {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.deals-client-picker__results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.deals-client-picker__results-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-like.deals-stage-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  padding-right: 30px;
  min-width: 0;
}

.deals-stage-btn__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
}

.deals-stage-btn__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deals-stage-btn.has-color {
  border-color: rgba(var(--stage-rgb), 0.55);
  background-color: rgba(var(--stage-rgb), 0.1);
}

.deals-stage-btn.has-color:hover {
  border-color: rgba(var(--stage-rgb), 0.75);
  background-color: rgba(var(--stage-rgb), 0.16);
}

.deals-stage-btn.has-color .deals-stage-btn__dot {
  background: rgb(var(--stage-rgb));
}

.deals-stage-menu {
  width: min(320px, calc(100% - 16px));
}

.deals-stage-menu > .muted {
  font-size: 12px;
  padding: 0 6px;
}

.deals-stage-menu .lead-card-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deals-stage-menu .stage-dot {
  margin-right: 0;
}

.deals-stage-menu .lead-card-menu__item.has-color {
  border-left: 3px solid rgba(var(--stage-rgb), 0.65);
  padding-left: 6px;
}

.deals-stage-menu .lead-card-menu__item.has-color:hover {
  border-color: rgba(var(--stage-rgb), 0.35);
  background: rgba(var(--stage-rgb), 0.12);
}

.deals-responsible-display {
  width: 100%;
}

.deals-responsible-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.deals-responsible-cell__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deals-client-picker__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--popover-bg);
  box-shadow: var(--popover-shadow);
  z-index: 60;
  display: grid;
  gap: 4px;
  max-height: 280px;
  overflow: auto;
}

.shell .deals-client-picker__results {
  padding: 5px;
  border-radius: 10px;
  max-height: 240px;
}

.deals-client-picker__result {
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  display: grid;
  gap: 2px;
}

.shell .deals-client-picker__result {
  padding: 6px 8px;
  border-radius: 8px;
}

.deals-client-picker__result:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.deals-client-picker__result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.deals-client-picker__result-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deals-client-picker__badge {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.deals-client-picker__result-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.deals-client-picker__empty {
  padding: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
}

.shell .deals-client-picker__empty {
  border-radius: 8px;
}

.deals-structure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
  gap: 8px;
  margin-top: 0;
  margin-bottom: 8px;
}

.shell .deals-structure-grid {
  gap: 6px;
  margin-top: 0;
  margin-bottom: 6px;
}

.deals-structure-stage__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.deals-structure-stage {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.deals-structure-stage__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deals-structure-stage__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell .deals-structure-stage__toggle {
  padding: 6px 10px;
}

.deals-structure-stage__toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.deals-structure-stage__toggle.is-active {
  background: rgba(var(--stage-rgb, var(--accent-rgb)), 0.12);
}

.deals-structure-stage__toggle.is-partial {
  background: rgba(var(--stage-rgb, var(--accent-rgb)), 0.06);
}

.deals-structure-stage__toggle:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 2px;
}

.deals-structure-stage__choices {
  width: 100%;
  display: flex;
  flex-direction: column;
  height: auto;
  border: 0;
  padding: 6px;
  gap: 4px;
  border-radius: 0;
  background: transparent;
}

.deals-structure-stage__choices .choice__item {
  flex: 0 0 auto;
}

.deals-structure-stage__choices .choice__item + .choice__item {
  border: 0;
}

.deals-structure-stage__choices .choice__item > span {
  justify-content: flex-start;
  height: auto;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.deals-structure-stage__choices .choice__item:hover > span {
  background: rgba(var(--stage-rgb, var(--accent-rgb)), 0.12);
  border-color: rgba(var(--stage-rgb, var(--accent-rgb)), 0.35);
  color: var(--text);
}

.deals-structure-stage__choices .choice__item > input:checked + span {
  background: rgba(var(--stage-rgb, var(--accent-rgb)), 0.12);
  border-color: rgba(var(--stage-rgb, var(--accent-rgb)), 0.55);
  color: var(--text);
}

.shell .deals-structure-stage__choices {
  padding: 5px;
  gap: 3px;
}

.shell .deals-structure-stage__choices .choice__item > span {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
}

.deals-stage-filters::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.deal-stage-chip.deal-stage-chip--filter {
  white-space: nowrap;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 4px 2px;
  color: var(--muted);
  font-weight: 600;
}

.deal-stage-chip.deal-stage-chip--filter:hover {
  color: var(--text);
}

.deal-stage-chip.deal-stage-chip--filter:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 2px;
  border-radius: 8px;
}

.deal-stage-chip.deal-stage-chip--filter.has-color {
  border-color: transparent;
  background-color: transparent;
}

.deal-stage-chip.deal-stage-chip--filter.is-active {
  color: var(--text);
  box-shadow: none;
}

.deal-stage-chip.deal-stage-chip--filter.is-active.has-color {
  border-color: transparent;
  background-color: transparent;
}

.taxonomy-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  margin-bottom: 8px;
}

.shell .taxonomy-tree {
  gap: 6px;
  margin-bottom: 6px;
}

.taxonomy-stage__head {
  justify-content: flex-start;
}

.taxonomy-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.taxonomy-row .taxonomy-toggle {
  flex: 1 1 auto;
  width: auto;
}

.taxonomy-disclosure {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.shell .taxonomy-disclosure {
  width: 26px;
  height: 26px;
}

.taxonomy-disclosure:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  opacity: 1;
}

.taxonomy-disclosure:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 2px;
}

.taxonomy-disclosure svg {
  width: 16px;
  height: 16px;
  display: block;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: transform 140ms ease;
}

.taxonomy-disclosure.is-collapsed svg {
  transform: rotate(-90deg);
}

.taxonomy-disclosure--spacer {
  opacity: 0;
  pointer-events: none;
}

.taxonomy-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.shell .taxonomy-toggle {
  padding: 6px 10px;
  border-radius: 8px;
}

.taxonomy-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.taxonomy-toggle.is-active {
  background: rgba(var(--stage-rgb, var(--accent-rgb)), 0.12);
  border-color: rgba(var(--stage-rgb, var(--accent-rgb)), 0.35);
}

.taxonomy-toggle.is-partial {
  background: rgba(var(--stage-rgb, var(--accent-rgb)), 0.06);
  border-color: rgba(var(--stage-rgb, var(--accent-rgb)), 0.25);
}

.taxonomy-toggle.is-inherited {
  background: rgba(var(--stage-rgb, var(--accent-rgb)), 0.08);
  border-color: rgba(var(--stage-rgb, var(--accent-rgb)), 0.2);
}

.taxonomy-toggle:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 2px;
}

.taxonomy-subtree {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  margin-left: 18px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.shell .taxonomy-subtree {
  gap: 4px;
  padding-top: 4px;
  margin-left: 16px;
  padding-left: 10px;
}

.taxonomy-node {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.taxonomy-subtree--groups {
  margin-left: 22px;
  padding-left: 12px;
  border-left: 1px dashed rgba(255, 255, 255, 0.08);
}

.shell .taxonomy-subtree--groups {
  margin-left: 20px;
  padding-left: 10px;
}

.taxonomy-leaves {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 18px;
  padding-left: 12px;
  border-left: 1px dotted rgba(255, 255, 255, 0.06);
}

.shell .taxonomy-leaves {
  margin-left: 16px;
  padding-left: 10px;
}

.taxonomy-toggle--leaf {
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
}

.shell .taxonomy-toggle--leaf {
  padding: 5px 10px;
  border-radius: 8px;
}

.taxonomy-toggle--leaf::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
}

.taxonomy-toggle--category::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgb(var(--stage-rgb, var(--accent-rgb)));
  box-shadow: 0 0 0 2px rgba(var(--stage-rgb, var(--accent-rgb)), 0.18);
  flex: 0 0 auto;
}

.taxonomy-toggle--sub::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 2px solid rgba(var(--stage-rgb, var(--accent-rgb)), 0.65);
  background: rgba(var(--stage-rgb, var(--accent-rgb)), 0.12);
  flex: 0 0 auto;
}

.taxonomy-toggle--group::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 3px;
  border: 2px solid rgba(var(--stage-rgb, var(--accent-rgb)), 0.55);
  background: transparent;
  flex: 0 0 auto;
}

.taxonomy-choices {
  margin-left: 10px;
}

.taxonomy-choices--leaf {
  margin-left: 0;
}

.taxonomy-editor__row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 2px;
  border-radius: 10px;
}

.shell .taxonomy-editor__row {
  padding: 1px;
  border-radius: 8px;
}

.taxonomy-editor__row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.taxonomy-editor__name {
  flex: 1 1 0;
  min-width: 0;
}

.taxonomy-editor__toggle.is-empty {
  visibility: hidden;
}

.taxonomy-editor__children {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 14px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.shell .taxonomy-editor__children {
  margin-left: 12px;
  padding-left: 8px;
}

.module-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.module-card__info {
  min-width: 0;
}

.module-card__title {
  font-weight: 700;
}

.module-card__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.module-card__col {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.06);
}

.module-card__col-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.module-card__list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.module-card__hint {
  margin-top: 10px;
}

@media (max-width: 720px) {
  .module-card__grid {
    grid-template-columns: 1fr;
  }
}

.deal-stage-chip.deal-stage-chip--filter.has-color .deal-stage-chip__dot {
  background: rgba(255, 255, 255, 0.22);
}

.deal-stage-chip.deal-stage-chip--filter.is-active.has-color .deal-stage-chip__dot {
  background: rgb(var(--stage-rgb));
}

.deal-stage-chip.deal-stage-chip--filter.is-active {
  box-shadow: none;
}

.deal-stage-chip.deal-stage-chip--filter.is-active.has-color {
  box-shadow: none;
}

.deal-stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  max-width: 100%;
}

.deals-table td[data-col-key='stage'] {
  padding: 5px 6px;
}

.deals-table td[data-col-key='stage'] .deal-stage-chip {
  display: flex;
  width: 100%;
  justify-content: center;
  padding: 3px 6px;
  box-sizing: border-box;
  border-radius: 12px;
}

.deal-stage-chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
}

.deal-stage-chip__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-stage-chip.has-color {
  border-color: rgba(var(--stage-rgb), 0.55);
  background-color: rgba(var(--stage-rgb), 0.1);
}

.deal-stage-chip.has-color .deal-stage-chip__dot {
  background: rgb(var(--stage-rgb));
}

.deal-link {
  color: var(--accent);
  text-decoration: none;
}

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

tr.is-highlighted {
  background: rgba(var(--accent-rgb), 0.08);
}

.deal-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  padding: 12px;
  display: flex;
}

.shell .deal-modal {
  padding: 8px;
}

.deal-modal__panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--popover-shadow);
  overflow: hidden;
}

.shell .deal-modal__panel {
  border-radius: 10px;
}

.deal-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.deal-modal__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.deal-modal__stage,
.deal-modal__stage-status {
  width: clamp(140px, 28vw, 240px);
  height: 36px;
}

#deals-create-stage.has-color,
.deal-modal__stage.has-color {
  border-color: rgba(var(--stage-rgb), 0.55);
  background-color: rgba(var(--stage-rgb), 0.1);
}

#deals-create-stage.has-color:hover,
.deal-modal__stage.has-color:hover {
  border-color: rgba(var(--stage-rgb), 0.75);
  background-color: rgba(var(--stage-rgb), 0.16);
}

.shell .deal-modal__header {
  padding: 6px;
}

.deal-modal__title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.deal-modal__name {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-modal__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.deal-modal__body {
  padding: 10px;
  overflow: auto;
}

.shell .deal-modal__body {
  padding: 8px;
}

.deal-modal__meta {
  display: grid;
  gap: 8px;
}

.deal-modal__products-wrap,
.deal-modal__comments {
  margin-top: 8px;
}

.deal-modal__products {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  gap: 10px;
}

.deal-modal__products-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.deal-modal__products-title {
  font-weight: 600;
  line-height: 1.2;
}

.deal-modal__products-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: auto;
}

.deal-modal__products-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.deal-modal__products-table th,
.deal-modal__products-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.deal-modal__products-table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
}

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

.deal-modal__products-name {
  min-width: 220px;
}

.deal-modal__products-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.deal-modal__products-totals {
  display: grid;
  gap: 6px;
  justify-content: end;
}

.deal-modal__products-total-line {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .deal-modal__products-table {
    min-width: 460px;
  }

  .deal-modal__products-table th,
  .deal-modal__products-table td {
    padding: 7px 8px;
  }
}

.deal-modal__meta-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.deal-modal__meta-val {
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .deal-modal__meta-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

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

.shell .grid {
  gap: 6px;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.kpi--action {
  text-align: left;
  width: 100%;
}

.kpi--action:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.kpi--action:active {
  background: rgba(255, 255, 255, 0.04);
}

.shell .kpi {
  border-radius: 10px;
  padding: 8px;
}

.kpi__label {
  color: var(--muted);
  font-size: 14px;
}

.kpi__value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 5px;
}

.chart-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.shell .chart-panel {
  margin-top: 10px;
  border-radius: 10px;
  padding: 8px;
}

.chart-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.chart-panel__title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.chart-panel__meta {
  font-weight: 700;
  color: var(--text);
  opacity: 0.92;
  white-space: nowrap;
}

.chart-panel__body {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.chart-panel__body--split {
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  align-items: center;
}

@media (max-width: 720px) {
  .chart-panel__body--split {
    grid-template-columns: 1fr;
  }
}

.chart {
  width: 100%;
  min-height: 200px;
}

.chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.chart-legend--inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.chart-legend__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.chart-legend--inline .chart-legend__item {
  justify-content: flex-start;
  gap: 8px;
}

.chart-legend__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

.chart-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--swatch, rgba(255, 255, 255, 0.22));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  flex: 0 0 auto;
}

.chart-legend__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-legend__value {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.gauge {
  display: grid;
  gap: 6px;
}

.gauge__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.gauge__title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.gauge__value {
  font-weight: 700;
  white-space: nowrap;
}

.gauge__bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  overflow: hidden;
}

.gauge__fill {
  height: 100%;
  width: var(--pct, 0%);
  background: var(--fill, rgba(var(--accent-rgb), 0.85));
  border-radius: 999px;
}

.gauge__hint {
  color: var(--muted);
  font-size: 14px;
}

.funnel-section {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.shell .funnel-section {
  margin-top: 10px;
  gap: 6px;
}

.funnel-section__title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.funnel-items {
  display: grid;
  gap: 10px;
}

.funnel-items--cols {
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  align-items: start;
}

.shell .funnel-items--cols {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.shell .funnel-items {
  gap: 8px;
}

.funnel-item,
.funnel-summary {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
}

.shell .funnel-item,
.shell .funnel-summary {
  border-radius: 10px;
  padding: 8px;
}

.funnel-item::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--stage-color, rgba(255, 255, 255, 0.08));
  opacity: 0.9;
  pointer-events: none;
}

.funnel-item__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.funnel-item__label {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.3px;
  color: var(--text);
  text-transform: uppercase;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel-item__meta {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.funnel-item__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.shell .funnel-item__stats {
  margin-top: 6px;
  gap: 6px;
}

@media (max-width: 560px) {
  .funnel-item__stats {
    grid-template-columns: 1fr;
  }
}

.funnel-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.funnel-stat__label {
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

.funnel-stat__value {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.funnel-stat__pct {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.funnel-item__bar {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.shell .funnel-item__bar {
  margin-top: 6px;
}

.funnel-item__bar > span {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  background: var(--stage-color, rgba(var(--accent-rgb), 0.9));
  border-radius: inherit;
}

.funnel-item__bar.is-danger > span {
  background: rgba(var(--danger-rgb), 0.85);
}

.funnel-reasons {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.shell .funnel-reasons {
  margin-top: 6px;
  padding-top: 6px;
  gap: 5px;
}

.funnel-reason {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
  padding-left: 12px;
  position: relative;
}

.funnel-reason::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 3px;
  transform: translateY(-50%);
  background: var(--stage-color, rgba(255, 255, 255, 0.18));
}

.funnel-reason__name {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel-reason__meta {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}


.funnels-list {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.shell .funnels-list {
  margin-top: 10px;
  gap: 10px;
}

.funnels-pipeline {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.shell .funnels-pipeline {
  border-radius: 10px;
  padding: 8px;
}

.funnels-pipeline__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.funnels-pipeline__name {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnels-pipeline__meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.funnels-pipeline__kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 8px;
  margin-top: 8px;
}

.shell .funnels-pipeline__kpis {
  gap: 6px;
  margin-top: 6px;
}

.funnels-kpi {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.12);
}

:root[data-theme='light'] .funnels-kpi {
  background: rgba(16, 24, 40, 0.04);
}

.funnels-kpi.is-warn {
  border-color: rgba(var(--warning-rgb), 0.45);
}

.funnels-kpi.is-danger {
  border-color: rgba(var(--danger-rgb), 0.45);
}

.funnels-kpi__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.funnels-kpi__value {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.funnels-pipeline__tables {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.shell .funnels-pipeline__tables {
  margin-top: 8px;
  gap: 8px;
}

@media (max-width: 900px) {
  .funnels-pipeline__tables {
    grid-template-columns: 1fr;
  }
}

.funnels-table-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.shell .funnels-table-title {
  margin-bottom: 5px;
}

.funnels-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.funnels-stage__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  flex: 0 0 auto;
}

:root[data-theme='light'] .funnels-stage__dot {
  background: rgba(17, 24, 39, 0.12);
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.14) inset;
}

.funnels-stage__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnels-matrix th,
.funnels-matrix td {
  white-space: nowrap;
}

.funnels-matrix__th-stage {
  min-width: 140px;
}

.funnels-pipeline td.is-danger {
  color: var(--danger);
  font-weight: 800;
}

.funnels-pipeline td.is-warn {
  color: var(--warning);
  font-weight: 800;
}

.funnels-note {
  margin-top: 8px;
}

.auth-card {
  width: min(520px, 100%);
  margin: 0 auto;
}

.entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.entry-brand {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0.2px;
  color: var(--text);
  text-decoration: none;
}

.entry-brand:hover {
  text-decoration: none;
}

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

.entry-actions .btn {
  font-weight: 700;
}

.entry-actions .btn.btn-outline-danger {
  border-width: 2px;
  padding: 6px 8px;
}

@media (max-width: 560px) {
  .entry-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .entry-actions .btn {
    width: 100%;
    padding: 7px 8px;
  }

  .auth-form .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-form .actions__right {
    margin-left: 0;
  }

  .auth-form .actions > button,
  .auth-form .actions > a {
    width: 100%;
  }

  .auth-form .action-link {
    justify-content: center;
  }

  .form-row--auth-2 {
    grid-template-columns: 1fr;
  }

  .form-row--auth-code {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .form-row--auth-code > button {
    width: 100%;
  }

  .auth-code-timer {
    width: 100%;
    justify-content: flex-start;
  }
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 10px;
  align-items: start;
}

.auth-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 10px;
  align-items: start;
  margin-top: 0;
  margin-bottom: 6px;
}

@media (min-width: 1024px) {
  .auth-info {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  }
}

.entry-block {
  display: grid;
  gap: 6px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.entry-block > p {
  margin: 0;
}

.entry-block .list {
  margin: 0;
  padding-left: 16px;
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 5px;
  margin-top: 6px;
}

.chip {
  display: block;
  padding: 3px 8px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: inherit;
  line-height: 1.15;
  text-decoration: none;
  position: relative;
  z-index: 0;
}

.chip::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  background: transparent;
  transition: background 120ms ease;
  z-index: -1;
  pointer-events: none;
}

.chip__icon {
  opacity: 0.9;
}

.chip:hover {
  text-decoration: none;
}

.chip:hover::before {
  background: rgba(var(--accent-rgb), 0.12);
}

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

.chip--muted:hover::before {
  background: rgba(255, 255, 255, 0.06);
}

.chip:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.35);
  outline-offset: 2px;
}

.task-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.task-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.task-refs .chip {
  display: inline-block;
  max-width: 100%;
}

.task-refs-builder {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.shell .task-refs-builder {
  border-radius: 10px;
}

.task-refs-builder__row {
  display: grid;
  grid-template-columns: minmax(0, 160px) minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: end;
}

.task-refs-builder__pick {
  min-width: 0;
}

.task-refs-builder__pick > select,
.task-refs-builder__pick > input {
  width: 100%;
}

.task-refs-builder__row > button {
  height: 36px;
  width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 560px) {
  .task-refs-builder__row {
    grid-template-columns: 1fr;
  }

  .task-refs-builder__row > button {
    width: 100%;
  }
}

.text-small {
  font-size: inherit;
}

.auth-form {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.password-group {
  display: grid;
  gap: 8px;
  margin-block: 12px;
  padding: 10px 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  box-shadow: none;
}

.password-group__fields {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.password-group__fields input[name='password'],
.password-group__fields input[name='passwordConfirm'],
.password-group__fields .password-field > input {
  background: transparent;
  background-color: transparent;
  box-shadow: none;
}

.password-group .password-strength {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.password-group .password-strength.is-mismatch {
  background: transparent;
  border: 0;
}

.password-strength {
  --password-strength-percent: 0%;
  --password-strength-color: rgba(var(--danger-rgb), 0.9);
  --password-strength-track: rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.08)),
    rgba(0, 0, 0, 0.18);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 10px 18px rgba(0, 0, 0, 0.16);
}

.password-strength__meter {
  position: relative;
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--password-strength-track);
  overflow: hidden;
}

.password-strength__meter::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 72%);
  pointer-events: none;
}

.password-strength__meter > span {
  display: block;
  height: 100%;
  width: var(--password-strength-percent);
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.22),
    var(--password-strength-color) 34%,
    var(--password-strength-color)
  );
  box-shadow: 0 0 12px color-mix(in srgb, var(--password-strength-color) 42%, transparent);
  transition: width 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.password-strength__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.password-strength__status {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.password-strength__hint {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.54);
}

.password-strength.is-empty {
  --password-strength-color: rgba(255, 255, 255, 0.32);
  --password-strength-track: rgba(255, 255, 255, 0.1);
}

.password-strength.is-weak {
  --password-strength-color: rgba(var(--danger-rgb), 0.9);
  --password-strength-track: rgba(var(--danger-rgb), 0.16);
}

.password-strength.is-medium {
  --password-strength-color: #d6a44a;
  --password-strength-track: rgba(214, 164, 74, 0.2);
}

.password-strength.is-strong {
  --password-strength-color: #42b369;
  --password-strength-track: rgba(66, 179, 105, 0.2);
}

.password-strength.is-weak .password-strength__status {
  color: rgba(var(--danger-rgb), 0.92);
}

.password-strength.is-medium .password-strength__status {
  color: #d6a44a;
}

.password-strength.is-strong .password-strength__status {
  color: #42b369;
}

.password-strength.is-mismatch {
  border-color: rgba(var(--danger-rgb), 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(var(--danger-rgb), 0.06)),
    rgba(0, 0, 0, 0.2);
}

.password-strength.is-mismatch .password-strength__status {
  color: rgba(var(--danger-rgb), 0.95);
}

:root[data-theme='light'] .password-group__fields {
  border-top-color: rgba(17, 24, 39, 0.12);
}

:root[data-theme='light'] .password-strength {
  --password-strength-track: rgba(17, 24, 39, 0.12);
}

:root[data-theme='light'] .password-strength__status {
  color: rgba(17, 24, 39, 0.82);
}

:root[data-theme='light'] .password-strength__hint {
  color: rgba(17, 24, 39, 0.62);
}

:root[data-theme='light'] .password-strength.is-empty {
  --password-strength-color: rgba(17, 24, 39, 0.3);
  --password-strength-track: rgba(17, 24, 39, 0.1);
}

:root[data-theme='light'] .password-toggle {
  color: rgba(17, 24, 39, 0.66);
  opacity: 0.88;
}

:root[data-theme='light'] .password-toggle:hover {
  color: rgba(17, 24, 39, 0.88);
  background: rgba(17, 24, 39, 0.07);
  opacity: 1;
}

:root[data-theme='light'] .password-toggle.is-visible {
  color: rgba(var(--danger-rgb), 0.9);
  opacity: 0.96;
}

:root[data-theme='light'] .password-toggle:focus-visible {
  outline: 2px solid rgba(var(--danger-rgb), 0.38);
}

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

.actions__right {
  margin-left: auto;
}

.action-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 0;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--text);
  font: inherit;
  text-decoration: none;
}

.btn:hover {
  background: rgba(var(--accent-rgb), 0.18);
  text-decoration: none;
}

.btn-primary {
  background: var(--success);
  border-color: var(--success);
}

.btn-primary:hover {
  background: var(--success-hover);
  border-color: var(--success-hover);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: rgba(255, 255, 255, 0.92);
}

.btn-danger:hover {
  background: rgba(var(--danger-rgb), 0.92);
  border-color: rgba(var(--danger-rgb), 0.92);
  color: rgba(255, 255, 255, 0.92);
}

.btn-outline-danger {
  background: rgba(var(--danger-rgb), 0.06);
  border-color: rgba(var(--danger-rgb), 0.85);
  color: var(--danger);
}

.btn-outline-danger:hover {
  background: rgba(var(--danger-rgb), 0.14);
  border-color: var(--danger);
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  font-size: 20px;
  font-weight: 600;
}

.icon-btn--sm {
  width: 28px;
  height: 28px;
  font-size: 18px;
  border-radius: 8px;
}

.icon-btn__glyph {
  display: block;
  line-height: 1;
  transform: translateY(-1px);
}

.icon-btn--danger {
  background: transparent;
  border-color: rgba(var(--danger-rgb), 0.55);
  color: var(--danger);
}

.icon-btn--danger:hover {
  background: rgba(var(--danger-rgb), 0.14);
  border-color: rgba(var(--danger-rgb), 0.85);
}

.icon-btn--ok {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.55);
  color: var(--accent);
}

.icon-btn--ok:hover {
  background: rgba(var(--accent-rgb), 0.18);
  border-color: rgba(var(--accent-rgb), 0.85);
}

.icon-btn--info {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.icon-btn--info:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
