:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e3e9f1;
  --line-strong: #d3dce8;
  --text: #182230;
  --muted: #657386;
  --subtle: #8b98a9;
  --navy: #14253d;
  --navy-2: #1c3351;
  --blue: #1769e0;
  --blue-dark: #0d55bd;
  --blue-soft: #eaf2ff;
  --teal: #0d9488;
  --teal-soft: #e7f7f5;
  --green: #16865a;
  --green-soft: #e8f7f0;
  --amber: #b76b00;
  --amber-soft: #fff5dc;
  --red: #c43a43;
  --red-soft: #fff0f1;
  --purple: #7057c8;
  --purple-soft: #f1edff;
  --shadow-sm: 0 1px 2px rgba(20, 37, 61, 0.05), 0 1px 6px rgba(20, 37, 61, 0.04);
  --shadow-md: 0 16px 42px rgba(20, 37, 61, 0.14);
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-width: 236px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

body {
  overflow: hidden;
}

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

button {
  color: inherit;
}

svg {
  display: block;
}

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

.sidebar {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 22px 15px 18px;
  background: var(--navy);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 0 7px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  margin-top: 2px;
  color: #aebfd4;
  font-size: 12px;
}

.nav-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  margin-top: 30px;
}

.nav-item {
  display: grid;
  grid-template-columns: 21px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #bbc9da;
  cursor: pointer;
  gap: 11px;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-item.active {
  background: #fff;
  color: var(--navy);
  font-weight: 650;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.nav-item:first-child svg {
  fill: currentColor;
  stroke: none;
}

.nav-count {
  min-width: 23px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.nav-item.active .nav-count {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.sidebar-note {
  display: grid;
  grid-template-columns: 10px 1fr;
  align-items: start;
  gap: 10px;
  padding: 13px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.save-dot {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: #4bd6a4;
  box-shadow: 0 0 0 3px rgba(75, 214, 164, 0.12);
}

.save-dot.saving {
  background: #f4bd55;
  box-shadow: 0 0 0 3px rgba(244, 189, 85, 0.12);
}

.save-label {
  color: #e9eff7;
  font-size: 12px;
  font-weight: 600;
}

.save-time {
  margin-top: 1px;
  color: #91a4bb;
  font-size: 11px;
}

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

.topbar {
  display: flex;
  min-height: 86px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.topbar-heading h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}

.button:active {
  transform: translateY(1px);
}

.button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.button-primary {
  background: var(--blue);
  color: #fff;
}

.button-primary:hover {
  background: var(--blue-dark);
}

.button-secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: #344359;
}

.button-secondary:hover {
  border-color: #bfcbd9;
  background: var(--surface-soft);
}

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

.button-ghost:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.button-danger {
  border-color: #f1c9cd;
  background: #fff;
  color: var(--red);
}

.button-small {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.view-container {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 24px 28px 38px;
}

.view-container.clients-view {
  overflow: auto;
  padding-bottom: 78px;
}

.view-inner {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
}

.loading-state,
.empty-state {
  display: flex;
  min-height: 320px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  gap: 13px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.period-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.period-caption {
  color: var(--muted);
  font-size: 12px;
}

.comparison-chip {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid #cfe0f8;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.segmented button {
  min-width: 74px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.segmented button.active {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 13px;
}

.kpi-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.kpi-card {
  min-width: 0;
  padding: 16px 17px;
}

.kpi-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 730;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.kpi-meta {
  display: flex;
  min-height: 20px;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  color: var(--subtle);
  font-size: 11px;
}

.kpi-value > .metric-change {
  font-size: inherit;
}

.metric-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
}

.metric-change.positive { color: var(--green); }
.metric-change.negative { color: var(--red); }
.metric-change.neutral { color: var(--muted); }

.quarter-overview {
  margin-top: 13px;
}

.quarter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 9px;
}

.quarter-card {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.quarter-card.current-year {
  border-color: #d5e4f8;
  background: #f7faff;
}

.quarter-card.latest {
  border-color: #8bb5ef;
  box-shadow: inset 0 0 0 1px rgba(23, 105, 224, 0.08);
}

.quarter-card-top {
  display: flex;
  min-height: 20px;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.quarter-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.quarter-amount {
  margin-top: 6px;
  font-size: 17px;
  font-weight: 730;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.quarter-comparison {
  display: flex;
  min-height: 18px;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
  color: var(--subtle);
  font-size: 10px;
}

.quarter-card.compact {
  padding: 10px 11px;
}

.quarter-card.compact .quarter-amount {
  font-size: 14px;
}

.drawer-quarter-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.9fr);
  gap: 13px;
  margin-top: 13px;
}

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

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  min-height: 57px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.panel-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.panel-body {
  padding: 16px 17px;
}

.panel-body.no-padding {
  padding: 0;
}

.sales-chart {
  width: 100%;
  min-height: 250px;
}

.sales-chart svg {
  width: 100%;
  height: 250px;
  overflow: visible;
}

.chart-grid-line {
  stroke: #e9eef5;
  stroke-width: 1;
}

.chart-axis-text {
  fill: #7f8b9b;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 10px;
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.chart-area {
  fill: url(#salesAreaGradient);
}

.chart-point {
  fill: #fff;
  stroke: var(--blue);
  stroke-width: 2.5;
}

.chart-point.selected {
  fill: var(--blue);
  stroke: #fff;
  stroke-width: 2;
  filter: drop-shadow(0 2px 4px rgba(23, 105, 224, 0.35));
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bar-item {
  display: grid;
  grid-template-columns: minmax(115px, 0.9fr) minmax(100px, 1.2fr) auto;
  align-items: center;
  gap: 12px;
}

.bar-label {
  overflow: hidden;
  color: #344359;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f6;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar-value {
  min-width: 70px;
  color: #344359;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.bar-delta {
  margin-top: 2px;
  font-size: 10px;
}

.attention-list {
  display: flex;
  flex-direction: column;
}

.attention-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 61px;
  padding: 10px 17px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

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

.attention-row:hover {
  background: var(--surface-soft);
}

.attention-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-reason {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-value {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

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

.search-field {
  position: relative;
  min-width: 245px;
  flex: 1 1 245px;
}

.search-field svg {
  position: absolute;
  top: 10px;
  left: 11px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--subtle);
  stroke-linecap: round;
  stroke-width: 1.8;
  pointer-events: none;
}

.field,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field,
.select {
  height: 38px;
  padding: 0 11px;
}

.search-field .field {
  padding-left: 36px;
}

.field:focus,
.select:focus,
.textarea:focus {
  border-color: #79aaf0;
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.1);
}

.select {
  min-width: 145px;
  cursor: pointer;
}

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

.field-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

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

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

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

.table-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.table-wrap.all-clients {
  height: calc(100vh - 235px);
  min-height: 520px;
  max-height: none;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-color: #a9b8ca #edf2f7;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.table-wrap.all-clients::-webkit-scrollbar {
  height: 0;
  width: 12px;
}

.table-wrap.all-clients::-webkit-scrollbar-track {
  background: #edf2f7;
}

.table-wrap.all-clients::-webkit-scrollbar-thumb {
  border: 3px solid #edf2f7;
  border-radius: 999px;
  background: #a9b8ca;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table th {
  position: sticky;
  z-index: 4;
  top: 0;
  height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-strong);
  background: #f7f9fc;
  color: #607086;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  min-height: 52px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: #344359;
  vertical-align: middle;
}

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

.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table tbody tr.clickable:hover td {
  background: #f8fbff;
}

.data-table .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.data-table .center {
  text-align: center;
}

.clients-table {
  min-width: 2820px;
}

.clients-horizontal-scrollbar {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: var(--sidebar-width);
  height: 27px;
  padding: 4px 28px 5px;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -5px 18px rgba(20, 37, 61, 0.12);
  scrollbar-color: #6f8fb6 #e8eef6;
  scrollbar-gutter: stable;
}

.clients-horizontal-scrollbar::-webkit-scrollbar {
  height: 17px;
}

.clients-horizontal-scrollbar::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #e8eef6;
}

.clients-horizontal-scrollbar::-webkit-scrollbar-thumb {
  border: 3px solid #e8eef6;
  border-radius: 999px;
  background: #6f8fb6;
}

.clients-horizontal-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #55779f;
}

.clients-horizontal-scrollbar-spacer {
  height: 1px;
  min-width: 100%;
}

.clients-table td {
  height: 49px;
  padding: 7px 10px;
}

.clients-table th:nth-child(1),
.clients-table td:nth-child(1) {
  left: 0;
  width: 54px;
  min-width: 54px;
}

.clients-table th:nth-child(2),
.clients-table td:nth-child(2) {
  left: 54px;
  width: 340px;
  min-width: 340px;
}

.clients-table th:nth-child(3),
.clients-table td:nth-child(3) {
  width: 160px;
  min-width: 160px;
}

.clients-table th:nth-child(1),
.clients-table th:nth-child(2) {
  z-index: 5;
}

.clients-table td:nth-child(1),
.clients-table td:nth-child(2) {
  position: sticky;
  z-index: 1;
  background: #fff;
}

.clients-table th:nth-child(2),
.clients-table td:nth-child(2) {
  box-shadow: 7px 0 9px -9px rgba(20, 37, 61, 0.55);
}

.clients-table tbody tr.clickable:hover td:nth-child(1),
.clients-table tbody tr.clickable:hover td:nth-child(2) {
  background: #f8fbff;
}

.clients-table .client-name,
.clients-table .client-subline,
.distributor-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clients-table .client-name {
  max-width: none;
  overflow: visible;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.distributor-name {
  max-width: 138px;
}

.table-editor-cell {
  min-width: 145px;
}

.tender-status-cell {
  min-width: 205px;
}

.tender-amount-cell {
  min-width: 190px;
}

.analysis-comment-cell {
  min-width: 390px;
  background: #fbfcfe;
  vertical-align: top;
}

.table-select,
.table-amount,
.table-analysis-text {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: #344359;
  outline: none;
  font-size: 11px;
}

.table-select {
  height: 32px;
  min-width: 132px;
  padding: 0 7px;
  cursor: pointer;
}

.table-amount {
  height: 32px;
  min-width: 160px;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.analysis-comment-editor {
  display: grid;
  gap: 3px;
}

.table-analysis-text {
  height: 52px;
  min-width: 360px;
  padding: 6px 8px;
  line-height: 1.25;
  resize: vertical;
}

.table-analysis-text.is-auto {
  background: #f7faff;
  color: #3f5878;
}

.analysis-comment-source {
  color: var(--subtle);
  font-size: 9px;
  font-weight: 600;
}

.clients-table tbody tr td.tender-status-cell.auction-status-won,
.auction-status-select.auction-status-won {
  border-color: #b8e2ce;
  background: #eaf8f1;
  color: #126b49;
}

.clients-table tbody tr td.tender-status-cell.auction-status-unknown,
.auction-status-select.auction-status-unknown {
  border-color: #ecd28f;
  background: #fff7dc;
  color: #80560b;
}

.clients-table tbody tr td.tender-status-cell.auction-status-planned,
.auction-status-select.auction-status-planned {
  border-color: #e8c96c;
  background: #fff4c7;
  color: #79520a;
}

.clients-table tbody tr td.tender-status-cell.auction-status-not-played,
.auction-status-select.auction-status-not-played {
  border-color: #efc0c5;
  background: #fff0f1;
  color: #a62f39;
}

.clients-table tbody tr td.tender-status-cell.auction-status-direct,
.auction-status-select.auction-status-direct {
  border-color: #d8cef7;
  background: #f3efff;
  color: #6248b0;
}

.clients-table tbody tr td.tender-status-cell.auction-status-neutral,
.auction-status-select.auction-status-neutral {
  border-color: #d7dee8;
  background: #f1f4f7;
  color: #596779;
}

.table-amount-stack {
  display: grid;
  gap: 4px;
}

.table-status-stack {
  display: grid;
  gap: 4px;
}

.tender-note-preview {
  display: -webkit-box;
  max-width: 200px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0.88;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.tender-note-input {
  min-height: 96px;
  font-size: 12px;
  line-height: 1.4;
}

.clients-table tbody tr td.tender-amount-cell.auction-amount-decline {
  background: #fff4e8;
}

.tender-amount-cell.auction-amount-decline .table-amount {
  border-color: #e6a15d;
  background: #fffaf4;
  color: #9a4d09;
  font-weight: 700;
}

.auction-amount-delta {
  color: #ad570b;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.table-select:focus,
.table-amount:focus,
.table-analysis-text:focus {
  border-color: #79aaf0;
  box-shadow: 0 0 0 2px rgba(23, 105, 224, 0.1);
}

.column-note {
  display: block;
  margin-top: 1px;
  color: var(--blue-dark);
  font-size: 9px;
  letter-spacing: 0;
  text-transform: none;
}

.clients-table .current-period-column {
  background: #f7faff;
}

.clients-table .comparison-column {
  border-left: 1px solid #d5e4f8;
  background: #f4f8fe;
}

.table-summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.client-name {
  max-width: 390px;
  color: var(--text);
  font-weight: 650;
}

.client-subline {
  margin-top: 3px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 400;
}

.status-badge,
.tag {
  display: inline-flex;
  max-width: 210px;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.status-badge.green,
.tag.green { background: var(--green-soft); color: var(--green); }
.status-badge.red,
.tag.red { background: var(--red-soft); color: var(--red); }
.status-badge.amber,
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.status-badge.blue,
.tag.blue { background: var(--blue-soft); color: var(--blue-dark); }
.status-badge.purple,
.tag.purple { background: var(--purple-soft); color: var(--purple); }
.status-badge.gray,
.tag.gray { background: #eef2f6; color: #637083; }

.attention-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ccd4df;
}

.attention-dot.active { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.attention-dot.warning { background: #e69a1d; box-shadow: 0 0 0 3px var(--amber-soft); }
.attention-dot.complete { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* Цветовая отметка клиента: авто — маленькая точка с мягким ореолом, ваша отметка — крупнее, с кольцом. */
.mark-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  vertical-align: middle;
}

.mark-dot.mark-red { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.mark-dot.mark-orange { background: #e69a1d; box-shadow: 0 0 0 3px var(--amber-soft); }
.mark-dot.mark-green { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.mark-dot.mark-gray { background: #9aa5b4; box-shadow: 0 0 0 3px #eef1f5; }
.mark-dot.mark-none { border: 2px solid #b9c4d2; background: #fff; }

.mark-dot.is-manual { width: 12px; height: 12px; }
.mark-dot.is-manual.mark-red { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--red); }
.mark-dot.is-manual.mark-orange { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #e69a1d; }
.mark-dot.is-manual.mark-green { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--green); }
.mark-dot.is-manual.mark-gray { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #9aa5b4; }

.mark-cell {
  padding-right: 4px !important;
  padding-left: 4px !important;
}

.mark-button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.mark-button:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.mark-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.mark-button.is-manual .mark-dot:not(.is-manual) { width: 12px; height: 12px; }
.mark-button.is-manual .mark-dot.mark-red { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--red); }
.mark-button.is-manual .mark-dot.mark-orange { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #e69a1d; }
.mark-button.is-manual .mark-dot.mark-green { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--green); }
.mark-button.is-manual .mark-dot.mark-gray { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #9aa5b4; }

.clients-table tbody tr.is-muted td {
  color: var(--subtle);
}

.clients-table tbody tr.is-muted .client-name {
  color: var(--muted);
  font-weight: 500;
}

.mark-menu {
  position: fixed;
  z-index: 70;
  width: 268px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.mark-menu[hidden] {
  display: none;
}

.mark-menu-title {
  overflow: hidden;
  padding: 7px 10px 6px;
  color: var(--subtle);
  font-size: 10.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mark-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.mark-menu-item:hover,
.mark-menu-item:focus-visible {
  background: #f1f5fb;
  outline: none;
}

.mark-menu-item.is-current {
  background: var(--blue-soft);
}

.mark-menu-item.is-current .mark-menu-label {
  font-weight: 700;
}

.mark-menu-item small {
  display: block;
  margin-top: 1px;
  color: var(--subtle);
  font-size: 10.5px;
}

.mark-menu-item .mark-dot {
  margin: 0 3px;
}

.mark-menu-divider {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}

.mark-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: -3px 0 11px;
}

.mark-chip {
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: #344359;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.mark-chip:hover {
  border-color: #b9c9de;
}

.mark-chip.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.mark-chip .mark-dot {
  margin: 0 1px;
}

.mark-chip-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.mark-chip.active .mark-chip-count {
  color: var(--blue-dark);
}

.mark-summary-hint {
  margin-left: 4px;
  color: var(--subtle);
  font-size: 11px;
}

.attention-name .mark-dot {
  margin-right: 9px;
}

.mark-control {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.mark-segment {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 11px;
}

.mark-option {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: #344359;
  cursor: pointer;
}

.mark-option:hover {
  border-color: #b9c9de;
}

.mark-option:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.mark-option.is-current {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.mark-option-label {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.mark-option-sub {
  color: var(--subtle);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.toolbar > .select {
  width: auto;
  flex: 0 1 auto;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.task-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.task-card.overdue {
  border-color: #f1c9cd;
  background: #fffafa;
}

.task-check {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--blue);
  cursor: pointer;
}

.task-title {
  font-size: 13px;
  font-weight: 650;
}

.task-card.completed .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.task-client-link {
  color: var(--blue-dark);
  cursor: pointer;
  font-weight: 600;
}

.task-date.overdue {
  color: var(--red);
  font-weight: 700;
}

.task-actions {
  display: flex;
  gap: 5px;
}

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

.opportunity-card {
  display: flex;
  min-width: 0;
  min-height: 260px;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.opportunity-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.opportunity-location {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.opportunity-metric {
  margin-top: 16px;
}

.opportunity-metric-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.opportunity-metric-value {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 700;
}

.opportunity-text {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 12px;
  color: #506077;
  font-size: 11px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.opportunity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-top: auto;
  padding-top: 14px;
}

.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(310px, 0.8fr);
  gap: 13px;
}

.drop-zone {
  display: flex;
  min-height: 210px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px;
  border: 1.5px dashed #b7c8dd;
  border-radius: 12px;
  background: #f8fbff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.drop-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  background: #fff;
  color: var(--blue);
  box-shadow: var(--shadow-sm);
}

.drop-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.drop-title {
  margin-top: 13px;
  font-size: 14px;
  font-weight: 700;
}

.drop-caption {
  max-width: 460px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.info-box {
  padding: 13px 14px;
  border: 1px solid #d8e5f5;
  border-radius: 10px;
  background: #f7fbff;
  color: #466079;
  font-size: 11px;
}

.info-box strong {
  color: #29445f;
}

.import-history {
  display: flex;
  flex-direction: column;
}

.import-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.import-entry:last-child {
  border-bottom: 0;
}

.import-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.drawer-overlay,
.modal-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
}

.drawer-overlay.open,
.modal-overlay.open {
  visibility: visible;
  pointer-events: auto;
}

.drawer-backdrop,
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 24, 40, 0.35);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.drawer-overlay.open .drawer-backdrop,
.modal-overlay.open .modal-backdrop {
  opacity: 1;
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(660px, calc(100vw - 42px));
  height: 100%;
  overflow: auto;
  background: #fff;
  box-shadow: var(--shadow-md);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.drawer-overlay.open .drawer {
  transform: translateX(0);
}

.drawer-header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 19px 21px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.drawer-title {
  margin: 0;
  font-size: 18px;
  font-weight: 730;
  letter-spacing: -0.02em;
}

.drawer-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.drawer-body {
  padding: 18px 21px 34px;
}

.drawer-section {
  margin-top: 21px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}

.drawer-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

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

.mini-kpi {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.mini-kpi-label {
  color: var(--muted);
  font-size: 10px;
}

.mini-kpi-value {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
}

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

.tender-control {
  margin-top: 11px;
  padding: 13px;
  border: 1px solid #cfe0f8;
  border-radius: 10px;
  background: #f7fbff;
}

.tender-control.auction-status-won {
  border-color: #b8e2ce;
  background: #f3fbf7;
}

.tender-control.auction-status-unknown {
  border-color: #ecd28f;
  background: #fffbec;
}

.tender-control.auction-status-planned {
  border-color: #e8c96c;
  background: #fff9df;
}

.tender-control.auction-status-not-played {
  border-color: #efc0c5;
  background: #fff7f8;
}

.tender-control.auction-status-direct {
  border-color: #d8cef7;
  background: #faf8ff;
}

.tender-control.auction-status-neutral {
  border-color: #d7dee8;
  background: #f8fafc;
}

.tender-control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auction-gap-warning {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #e6a15d;
  border-radius: 8px;
  background: #fff4e8;
  color: #9a4d09;
  font-size: 11px;
  font-weight: 700;
}

.analysis-drawer-card {
  margin-top: 11px;
  padding: 12px 13px;
  border: 1px solid #cfe0f8;
  border-radius: 10px;
  background: #f7faff;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px;
  border: 1px solid #efc2c6;
  border-radius: 10px;
  background: #fffafa;
}

.toggle {
  position: relative;
  width: 42px;
  height: 23px;
  flex: 0 0 auto;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd4df;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.toggle input:checked + .toggle-track {
  background: var(--red);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(19px);
}

.source-block {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.source-block + .source-block {
  margin-top: 9px;
}

.source-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.source-text {
  margin-top: 5px;
  color: #344359;
  font-size: 12px;
  white-space: pre-line;
}

.source-editor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.source-editor {
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.source-editor.manually-edited {
  border-color: #a9c8f2;
  background: #f8fbff;
}

.source-editor-header {
  display: flex;
  min-height: 21px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.source-editor-header .field-label {
  margin: 2px 0 7px;
}

.source-editor-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.manual-edit-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.field-label .manual-edit-badge {
  margin-left: 5px;
  vertical-align: middle;
}

.reset-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

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

.source-input.textarea {
  min-height: 72px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 13px;
}

.comment-item {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.comment-text {
  color: #344359;
  font-size: 12px;
  white-space: pre-wrap;
}

.comment-date {
  color: var(--subtle);
  font-size: 10px;
}

.comment-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.comment-actions {
  display: flex;
  gap: 9px;
}

.comment-actions button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.comment-actions button:hover {
  text-decoration: underline;
}

.comment-actions button.danger {
  color: var(--red);
}

.edit-comment-text {
  min-height: 180px;
}

.modal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100vh - 50px);
  overflow: auto;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translate(-50%, -47%) scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.modal-overlay.open .modal {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  padding: 19px 20px 15px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 730;
}

.modal-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px 18px;
}

.import-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 15px 0;
}

.preview-card {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.preview-label {
  color: var(--muted);
  font-size: 10px;
}

.preview-value {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 700;
}

.warning-box {
  padding: 11px 12px;
  border: 1px solid #f2d699;
  border-radius: 9px;
  background: var(--amber-soft);
  color: #765112;
  font-size: 11px;
}

.error-box {
  padding: 11px 12px;
  border: 1px solid #efc2c6;
  border-radius: 9px;
  background: var(--red-soft);
  color: #8f2731;
  font-size: 11px;
}

.toast-stack {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(380px, calc(100vw - 40px));
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease both;
}

.toast-mark {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
}

.toast.error .toast-mark { background: var(--red); }
.toast.warning .toast-mark { background: #e69a1d; }

.toast-title {
  font-size: 12px;
  font-weight: 700;
}

.toast-message {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-danger { color: var(--red); }
.text-success { color: var(--green); }
.strong { font-weight: 700; }
.hidden { display: none !important; }

@media (max-width: 1250px) {
  :root { --sidebar-width: 208px; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opportunity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 78px; }
  .brand { justify-content: center; padding: 0; }
  .brand > div:last-child,
  .nav-item span:not(.nav-count),
  .sidebar-note > div:last-child { display: none; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .nav-count { position: absolute; margin: -24px 0 0 28px; }
  .sidebar-note { grid-template-columns: 1fr; justify-items: center; }
  .dashboard-grid,
  .dashboard-grid.equal,
  .import-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app-shell { display: block; }
  .sidebar { position: sticky; top: 0; min-height: auto; padding: 8px 10px; flex-direction: row; align-items: center; }
  .brand { display: none; }
  .nav-list { margin: 0; flex-direction: row; justify-content: space-between; }
  .nav-item { width: 44px; min-height: 42px; }
  .sidebar-note { display: none; }
  .main-area { height: auto; min-height: calc(100vh - 58px); }
  .topbar { align-items: flex-start; padding: 15px 16px; flex-direction: column; }
  .topbar-actions { width: 100%; }
  .topbar-actions .button { flex: 1; }
  .view-container { overflow: visible; padding: 17px 14px 28px; }
  .view-container.clients-view { overflow: visible; padding-bottom: 78px; }
  .table-wrap.all-clients { height: calc(100vh - 180px); min-height: 420px; max-height: none; }
  .clients-horizontal-scrollbar { left: 0; padding-right: 14px; padding-left: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opportunity-grid { grid-template-columns: 1fr; }
  .form-grid,
  .form-grid.three,
  .mini-kpis,
  .import-preview,
  .drawer-quarter-grid { grid-template-columns: 1fr; }
  .period-toolbar,
  .table-summary { align-items: flex-start; flex-direction: column; }
  .drawer { width: 100vw; }
  .mark-segment { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mark-summary-hint { flex-basis: 100%; margin-left: 0; }
}
