.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar-scrim { display: none; }

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 13px 14px;
  overflow-y: auto;
  background:
    radial-gradient(700px 300px at -30% -10%, rgba(63, 110, 220, .18), transparent 65%),
    linear-gradient(180deg, var(--sidebar), #141d30);
  color: var(--sidebar-text);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; color: #fff; }
.brand-mark {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #4b8bff, #245fd1);
  box-shadow: 0 6px 18px rgba(35, 92, 210, .38);
  color: #fff; font-size: 20px; font-weight: 800; letter-spacing: -.04em;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15.5px; font-weight: 800; letter-spacing: .01em; }
.brand-text small { margin-top: 1px; color: var(--sidebar-muted); font-size: 10.5px; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item .icon { width: 18px; height: 18px; color: var(--sidebar-muted); transition: color .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item:hover .icon { color: #dbe6ff; }
.nav-item.active { background: rgba(85, 135, 245, .16); color: #fff; font-weight: 600; }
.nav-item.active .icon { color: #8db4ff; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #5b91ff;
}
.nav-badge {
  display: none;
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .1);
  color: #dbe6ff;
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
}
.nav-badge:not(:empty) { display: inline-block; }
.nav-badge-alert:not(:empty) { background: rgba(229, 72, 77, .2); color: #ffb4b6; }
.nav-sep { height: 1px; margin: 9px 9px; background: rgba(255, 255, 255, .07); }
.sidebar-bottom { margin-top: auto; padding-top: 16px; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 10px; }
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { overflow: hidden; color: #eef3ff; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { margin-top: 1px; color: var(--sidebar-muted); font-size: 10.5px; }
.sidebar-logout {
  display: flex; align-items: center; gap: 9px; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--sidebar-muted); font-size: 12px; text-align: left;
}
.sidebar-logout .icon { width: 16px; height: 16px; }
.sidebar-logout:hover { background: rgba(255, 255, 255, .06); color: #fff; }

/* Main / topbar */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 70px;
  padding: 10px 28px;
  border-bottom: 1px solid rgba(221, 227, 239, .85);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
}
.page-heading { min-width: 0; flex: 0 1 auto; }
.page-heading h1 { font-size: 19px; font-weight: 750; letter-spacing: -.025em; line-height: 1.15; }
.page-heading p { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.mobile-menu { display: none; }
.global-search { position: relative; width: 256px; }
.global-search .search-icon { position: absolute; top: 50%; left: 11px; width: 17px; height: 17px; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.global-search input {
  width: 100%; height: 36px; padding: 0 36px 0 35px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
  color: var(--text); font-size: 12.5px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.global-search input::placeholder { color: var(--muted-2); }
.global-search input:focus { border-color: #b8ccf9; background: #fff; box-shadow: 0 0 0 3px rgba(47, 111, 237, .1); }
.search-kbd {
  position: absolute; top: 50%; right: 9px; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  border: 1px solid var(--border); border-radius: 5px; background: #fff; color: var(--muted-2); font-size: 10px; font-family: var(--font);
}
.global-search input:focus + .search-kbd { display: none; }
.top-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: #fff; font-size: 11px; font-weight: 700;
}
.top-avatar .avatar { width: 34px; height: 34px; }
.create-wrap { position: relative; }
.create-wrap .chevron { width: 14px; height: 14px; margin-left: -2px; opacity: .8; }
.view { width: 100%; max-width: 1680px; margin: 0 auto; padding: 22px 28px 50px; }

/* Dropdowns */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 198px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: dropdownIn .13s ease-out;
}
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 12.5px; text-align: left;
}
.dropdown-menu button:hover { background: var(--surface-3); color: var(--text); }
.dropdown-menu .icon { width: 16px; height: 16px; color: var(--muted); }
.dropdown-sep { height: 1px; margin: 4px 6px; background: var(--border); }

/* Search results */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  width: min(460px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.search-section { padding: 5px 0 2px; }
.search-section-title { padding: 7px 9px 5px; color: var(--muted-2); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 8px; cursor: pointer; }
.search-item:hover, .search-item.active { background: var(--surface-2); }
.search-item-icon { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--muted); }
.search-item-icon .icon { width: 16px; height: 16px; }
.search-item-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.search-item-title { overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.search-item-sub { overflow: hidden; margin-top: 1px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.search-item-aside { flex: 0 0 auto; margin-left: 4px; max-width: 42%; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.search-empty { padding: 18px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* Dashboard */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { position: relative; padding: 16px 17px; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -20px; bottom: -36px; width: 100px; height: 100px; border-radius: 50%; background: var(--kpi-soft, var(--accent-soft)); opacity: .55; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.kpi-icon { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--kpi-soft, var(--accent-soft)); color: var(--kpi-color, var(--accent)); }
.kpi-icon .icon { width: 17px; height: 17px; }
.kpi-value { position: relative; z-index: 1; margin-top: 13px; font-size: 24px; font-weight: 750; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.kpi-sub { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 11.5px; }
.kpi-sub .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--kpi-color, var(--accent)); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.dash-stack { display: flex; flex-direction: column; gap: 16px; }
.funnel-list { display: flex; flex-direction: column; gap: 13px; }
.funnel-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 92px; align-items: center; gap: 11px; cursor: pointer; }
.funnel-row:hover .funnel-name { color: var(--accent); }
.funnel-name { overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.funnel-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf1f7; }
.funnel-fill { height: 100%; min-width: 3px; border-radius: inherit; background: var(--bar-color, var(--accent)); transition: width .4s ease; }
.funnel-meta { text-align: right; font-variant-numeric: tabular-nums; }
.funnel-meta strong { display: block; font-size: 11.5px; }
.funnel-meta span { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; }
.months { display: flex; align-items: flex-end; gap: 12px; height: 168px; padding: 10px 3px 0; }
.month { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; height: 100%; min-width: 0; }
.month-bar-wrap { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; }
.month-bar { position: relative; width: min(44px, 72%); min-height: 3px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #7ba7ff, #2f6fed); transition: height .4s ease; }
.month-bar:hover { filter: brightness(1.06); }
.month-value { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 9.5px; font-weight: 600; white-space: nowrap; }
.month-label { color: var(--muted); font-size: 10.5px; text-transform: capitalize; }
.task-mini-list { display: flex; flex-direction: column; }
.task-mini { display: flex; align-items: flex-start; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task-mini:first-child { padding-top: 0; }
.task-mini:last-child { padding-bottom: 0; border-bottom: 0; }
.task-mini .task-check { margin-top: 1px; }
.task-mini-main { min-width: 0; flex: 1; }
.task-mini-title { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.task-mini-title.done { color: var(--muted-2); text-decoration: line-through; }
.task-mini-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.recent-list { display: flex; flex-direction: column; }
.recent-deal { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.recent-deal:first-child { padding-top: 0; }
.recent-deal:last-child { padding-bottom: 0; border-bottom: 0; }
.recent-deal:hover .recent-deal-title { color: var(--accent); }
.recent-deal-main { min-width: 0; flex: 1; }
.recent-deal-title { overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.recent-deal-sub { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.recent-deal-amount { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 11px; padding: 0 0 17px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-rail { display: flex; flex-direction: column; align-items: center; }
.timeline-dot { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.timeline-dot .icon { width: 13px; height: 13px; }
.timeline-line { flex: 1; width: 1px; margin-top: 5px; background: var(--border); }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-main { padding-top: 3px; min-width: 0; }
.timeline-text { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.timeline-text strong { color: var(--text); font-weight: 600; }
.timeline-meta { margin-top: 3px; color: var(--muted-2); font-size: 10.5px; }

/* Deals / kanban */
.page-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.page-toolbar .grow { flex: 1; }
.filter-select { min-height: 36px; max-width: 190px; font-size: 12.5px; }
.kanban { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; padding: 2px 2px 18px; margin: 0 -2px; }
.kanban-col {
  display: flex; flex-direction: column; flex: 0 0 292px; max-height: calc(100vh - 220px); min-height: 120px;
  padding: 8px; border: 1px solid #e1e7f1; border-radius: 13px; background: #eaeff7;
  transition: background .15s, border-color .15s;
}
.kanban-col.drag-over { border-color: #9dbcfb; background: #e2ebff; }
.kanban-col-head { padding: 4px 6px 9px; }
.kanban-col-title-row { display: flex; align-items: center; gap: 7px; }
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stage-color, var(--muted)); }
.kanban-col-name { font-size: 12px; font-weight: 700; }
.kanban-col-count { margin-left: auto; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.kanban-col-sum { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.kanban-col-add { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: rgba(255,255,255,.55); color: var(--muted); }
.kanban-col-add:hover { background: #fff; color: var(--accent); }
.kanban-col-add .icon { width: 14px; height: 14px; }
.kanban-list { display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 24px; padding: 1px; }
.kanban-empty { padding: 12px 8px 14px; color: var(--muted-2); font-size: 11px; text-align: center; }
.deal-card {
  padding: 10px 11px; border: 1px solid #e1e7f1; border-radius: 10px; background: #fff; box-shadow: var(--shadow-xs); cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.deal-card:hover { border-color: #c4d1e7; box-shadow: 0 4px 14px rgba(20, 31, 51, .08); }
.deal-card.dragging { opacity: .4; }
.deal-card-top { display: flex; align-items: flex-start; gap: 7px; }
.deal-card-title { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 650; line-height: 1.35; }
.deal-card-amount { color: var(--text); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deal-card-company { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.deal-card-footer { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.deal-card-footer .avatar { width: 21px; height: 21px; font-size: 8px; }
.deal-card-date { margin-left: auto; color: var(--muted-2); font-size: 9.5px; }
.deal-task-chip { display: inline-flex; align-items: center; gap: 3px; color: var(--amber); font-size: 9.5px; font-weight: 600; }
.deal-task-chip .icon { width: 11px; height: 11px; }
.deal-task-chip.overdue { color: var(--red); }
.priority-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.priority-high { background: var(--red); }
.priority-medium { background: var(--amber); }
.priority-low { background: var(--muted-2); }
.list-card { overflow: hidden; }
.list-card .table { min-width: 980px; }
.deal-title-cell { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.deal-title-link { font-weight: 600; }
.deal-title-link:hover { color: var(--accent); }
.deal-number { color: var(--muted-2); font-size: 10px; font-variant-numeric: tabular-nums; }
.cell-person { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.cell-person .avatar { width: 24px; height: 24px; font-size: 8.5px; }
.stage-pill { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 10.5px; font-weight: 600; }
.stage-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--stage-color); }
.stage-pill.won { color: var(--green); }
.stage-pill.lost { color: var(--red); }
.task-date { font-size: 11px; white-space: nowrap; }
.task-date.overdue { color: var(--red); font-weight: 600; }
.task-date.today { color: var(--amber); font-weight: 600; }

/* Entity pages */
.entity-head { display: flex; align-items: center; gap: 10px; }
.entity-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.entity-name strong { font-size: 12.5px; font-weight: 600; }
.entity-name span { overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.entity-logo { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 700; }
.entity-logo .icon { width: 16px; height: 16px; }
.entity-contact { display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; }
.entity-contact span { color: var(--muted); font-size: 10.5px; }
.table .muted-cell { color: var(--muted); font-size: 11.5px; }

/* Drawer content */
.deal-form { display: flex; flex-direction: column; gap: 22px; }
.form-section { display: flex; flex-direction: column; gap: 12px; }
.form-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.form-section-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .055em; }
.deal-title-field .input { height: 44px; font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.deal-main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.deal-main-grid .span-2 { grid-column: 1 / -1; }
.amount-wrap { position: relative; }
.amount-wrap .input { padding-right: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-wrap .currency { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--muted); font-size: 12px; }
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { padding: 6px 5px; color: var(--muted-2); font-size: 9.5px; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
.items-table td { padding: 3px 4px; }
.items-table .input { min-height: 31px; padding: 4px 7px; font-size: 12px; border-radius: 6px; }
.items-table .qty { width: 58px; text-align: center; }
.items-table .price, .items-table .sum { width: 96px; text-align: right; }
.items-table .sum { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.items-table .item-del { width: 28px; }
.items-total { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 9px; border-top: 1px solid var(--border); font-size: 12px; }
.items-total strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.add-item { align-self: flex-start; }
.quick-task { display: flex; align-items: center; gap: 7px; }
.quick-task .input { flex: 1; }
.quick-task .input[type="date"] { flex: 0 0 135px; }
.task-list { display: flex; flex-direction: column; }
.task-item { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: 0; }
.task-item .task-check { margin-top: 1px; }
.task-item-main { flex: 1; min-width: 0; }
.task-item-title { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.task-item-title.done { color: var(--muted-2); text-decoration: line-through; }
.task-item-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.task-item-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .12s; }
.task-item:hover .task-item-actions { opacity: 1; }
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item { display: flex; gap: 9px; padding: 0 0 15px; }
.activity-item:last-child { padding-bottom: 0; }
.activity-rail { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; }
.activity-dot { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.activity-dot .icon { width: 12px; height: 12px; }
.activity-line { flex: 1; width: 1px; margin-top: 4px; background: var(--border); }
.activity-item:last-child .activity-line { display: none; }
.activity-main { flex: 1; padding-top: 2px; min-width: 0; }
.activity-text { color: var(--text-2); font-size: 12px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.activity-text strong { color: var(--text); }
.activity-meta { margin-top: 2px; color: var(--muted-2); font-size: 10px; }
.note-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; }
.note-form .textarea { min-height: 40px; height: 40px; resize: none; }
.note-form .btn { flex: 0 0 auto; }
.related-list { display: flex; flex-direction: column; }
.related-item { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.related-item:last-child { border-bottom: 0; }
.related-item:hover .related-title { color: var(--accent); }
.related-main { flex: 1; min-width: 0; }
.related-title { overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.related-sub { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.related-amount { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contact-chip { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); font-size: 12px; }
.contact-chip .icon { width: 14px; height: 14px; color: var(--muted); }
.company-link { color: var(--accent); cursor: pointer; }
.company-link:hover { text-decoration: underline; }

/* Tasks page */
.task-groups { display: flex; flex-direction: column; gap: 16px; }
.task-group { overflow: hidden; }
.task-group-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.task-group-title { font-size: 12px; font-weight: 700; }
.task-group-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 10px; font-weight: 700; }
.task-group.overdue .task-group-head { background: #fff8f8; }
.task-group.overdue .task-group-title { color: #bd2b30; }
.task-group.today .task-group-head { background: #fffbf2; }
.task-group.today .task-group-title { color: #a86500; }
.task-row { display: flex; align-items: flex-start; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: #fafbff; }
.task-row .task-check { margin-top: 2px; }
.task-row-main { flex: 1; min-width: 0; }
.task-row-title { font-size: 13px; font-weight: 600; line-height: 1.35; cursor: pointer; }
.task-row-title:hover { color: var(--accent); }
.task-row-title.done { color: var(--muted-2); text-decoration: line-through; }
.task-row-desc { margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.task-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 5px; color: var(--muted); font-size: 10.5px; }
.task-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.task-meta-item .icon { width: 12px; height: 12px; }
.task-meta-item.link { color: var(--accent); cursor: pointer; }
.task-row-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; padding-top: 1px; }
.task-row-actions { display: flex; opacity: 0; transition: opacity .12s; }
.task-row:hover .task-row-actions { opacity: 1; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 3px; }
.settings-nav button { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; text-align: left; }
.settings-nav button .icon { width: 16px; height: 16px; }
.settings-nav button:hover { background: var(--surface-3); color: var(--text); }
.settings-nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.settings-content { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings-card { overflow: hidden; }
.settings-card .card-header { padding: 15px 18px; }
.settings-form { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 3px; }
.user-list, .stage-list { display: flex; flex-direction: column; }
.user-row, .stage-row { display: flex; align-items: center; gap: 11px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.user-row:last-child, .stage-row:last-child { border-bottom: 0; }
.user-row-main { min-width: 0; flex: 1; }
.user-row-name { font-size: 12.5px; font-weight: 600; }
.user-row-email { margin-top: 1px; color: var(--muted); font-size: 10.5px; }
.user-row-actions { display: flex; align-items: center; gap: 6px; }
.stage-row { gap: 10px; }
.stage-row-fields { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.stage-row .input { max-width: 220px; }
.stage-row .kind-select { max-width: 130px; }
.stage-row .prob-input { width: 72px; }
.stage-row .move-buttons { display: flex; flex-direction: column; gap: 2px; }
.stage-move { width: 24px; height: 19px; padding: 0; border: 0; border-radius: 5px; background: var(--surface-3); color: var(--muted); }
.stage-move:hover { color: var(--accent); background: var(--accent-soft); }
.stage-move .icon { width: 12px; height: 12px; margin: auto; }
.add-stage-form { display: flex; align-items: flex-end; gap: 8px; padding: 15px 18px; background: var(--surface-2); flex-wrap: wrap; }
.add-stage-form .field { min-width: 130px; }
.add-stage-form .field.grow { flex: 1; }
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 18px; }
.export-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.export-card .icon { width: 20px; height: 20px; color: var(--accent); }
.export-title { font-size: 12.5px; font-weight: 700; }
.export-text { color: var(--muted); font-size: 11px; line-height: 1.4; }
.export-card .btn { margin-top: auto; align-self: flex-start; }
.info-list { display: flex; flex-direction: column; padding: 4px 18px 16px; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }

/* Misc */
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-tab { padding: 6px 11px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.pill-tab.active { border-color: #c6d8ff; background: var(--accent-soft); color: var(--accent); }
.inline-error { color: var(--red); font-size: 11.5px; }
.section-label { margin: 0 0 8px; color: var(--muted-2); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* Responsive */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .global-search { width: 210px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    width: 258px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 12px 0 40px rgba(15, 24, 40, .2);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 199; display: none; background: rgba(17, 26, 45, .45); }
  .sidebar-scrim.show { display: block; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 9px 16px; gap: 10px; min-height: 64px; }
  .page-heading h1 { font-size: 17px; }
  .page-heading p { display: none; }
  .view { padding: 16px 16px 40px; }
  .global-search { width: 190px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; padding-bottom: 2px; }
  .settings-nav button { white-space: nowrap; }
}
@media (max-width: 720px) {
  .topbar-actions { gap: 6px; }
  .global-search { width: 42px; transition: width .2s ease; }
  .global-search input { padding-right: 11px; cursor: pointer; }
  .global-search input::placeholder { color: transparent; }
  .global-search .search-kbd { display: none; }
  .global-search.expanded { position: absolute; left: 12px; right: 12px; top: 8px; z-index: 80; width: auto; }
  .global-search.expanded input { padding-right: 35px; cursor: text; background: #fff; }
  .global-search.expanded input::placeholder { color: var(--muted-2); }
  .search-results { position: fixed; top: 58px; left: 12px; right: 12px; width: auto; }
  .create-label { display: none; }
  .create-wrap .btn { width: 38px; padding: 0; }
  .create-wrap .chevron { display: none; }
  .page-heading { flex: 1; }
  .page-heading h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 20px; }
  .funnel-row { grid-template-columns: 100px minmax(0, 1fr) 74px; gap: 8px; }
  .kanban-col { flex-basis: 266px; }
  .export-grid { grid-template-columns: 1fr; }
  .deal-main-grid { grid-template-columns: 1fr; }
  .deal-main-grid .span-2 { grid-column: auto; }
  .contact-grid { grid-template-columns: 1fr; }
  .toolbar-search { max-width: none; width: 100%; flex: 1 0 100%; min-width: 0; }
  .page-toolbar .filter-select { flex: 1 1 calc(50% - 5px); max-width: none; min-width: 0; }
  .page-toolbar > .grow { display: none; }
  .page-toolbar .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .page-toolbar .segmented::-webkit-scrollbar { display: none; }
  .page-toolbar .segmented button { flex: 0 0 auto; padding: 0 8px; font-size: 11.5px; }
  .task-row { padding: 11px 12px; }
  .task-row-actions { opacity: 1; }
  .hide-mobile { display: none !important; }

  /* Компактные карточки вместо широких таблиц на телефоне */
  .mobile-cards { display: block; }
  .list-card .mobile-cards { min-width: 0; }
  .mobile-cards thead { display: none; }
  .mobile-cards tbody { display: block; }
  .mobile-cards tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .mobile-cards tbody tr:last-child { border-bottom: 0; }
  .mobile-cards td { display: block; min-width: 0; padding: 0; border: 0; }
  .mobile-cards td:nth-child(1), .mobile-cards td:nth-child(2) { grid-column: 1 / -1; }
  .mobile-cards td:nth-child(2) { margin-top: 2px; color: var(--muted); font-size: 11.5px; }
  .contacts-table td:nth-child(3),
  .contacts-table td:nth-child(5),
  .contacts-table td:nth-child(6),
  .contacts-table td:nth-child(8) { display: none; }
  .contacts-table td:nth-child(4) { grid-column: 1; grid-row: 3; margin-top: 4px; }
  .contacts-table td:nth-child(7) { grid-column: 2; grid-row: 3; margin-top: 4px; text-align: right; }
  .companies-table td:nth-child(2),
  .companies-table td:nth-child(4),
  .companies-table td:nth-child(5),
  .companies-table td:nth-child(6),
  .companies-table td:nth-child(8) { display: none; }
  .companies-table td:nth-child(9) { display: none; }
  .companies-table td:nth-child(3) { grid-column: 1; grid-row: 2; margin-top: 4px; }
  .companies-table td:nth-child(7) { grid-column: 2; grid-row: 2; margin-top: 4px; text-align: right; }
  .mobile-cards .entity-head { align-items: center; }
  .mobile-cards .entity-name strong { font-size: 13.5px; }
  .mobile-cards .cell-person { font-size: 11.5px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 22px; }
  .view { padding-left: 12px; padding-right: 12px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .funnel-row { grid-template-columns: 90px minmax(0, 1fr); }
  .funnel-meta { display: none; }
  .segmented button span { display: none; }
  .page-toolbar .segmented button { padding: 0 6px; font-size: 10.5px; }
}
