:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --text: #1c2430;
  --muted: #637083;
  --line: #d9e0e7;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --shadow-soft: 0 12px 28px rgba(28, 36, 48, 0.06);
  --shadow-card: 0 16px 36px rgba(28, 36, 48, 0.07);
  --line-soft: #edf2f7;
}

#reportsYearView.reports-view {
  gap: 20px;
}

#reportsYearView .report-control-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-top: 3px solid #0f766e;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#reportsYearView .report-control-panel .panel-heading {
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #dfe8ef;
}

#reportsYearView .report-filter-row {
  align-items: end;
  gap: 12px;
  margin: 0;
}

#reportsYearView .report-filter-row .compact-field select {
  width: 158px;
}

.year-report-summary {
  display: grid;
  gap: 16px;
}

.year-report-summary .report-kpi-grid {
  margin-top: 0;
}

.year-report-table {
  min-width: 1320px;
}

.year-report-table thead tr:first-child th {
  text-align: center;
  border-bottom: 1px solid #dfe8ef;
}

.year-report-table th[rowspan] {
  vertical-align: middle;
  text-align: left;
}

.year-report-table tbody td:first-child {
  font-weight: 800;
  text-align: left;
}

.year-report-table .delta {
  white-space: nowrap;
}

.year-report-table thead tr:first-child th:nth-child(n + 3),
.year-report-table thead tr:nth-child(2) th:nth-child(3n + 4),
.year-report-table tbody td:nth-child(3n + 5),
.year-report-table tfoot td:nth-child(3n + 5) {
  border-left: 1px solid var(--line);
}

.year-report-table thead th:first-child,
.year-report-table tbody td:first-child,
.year-report-table tfoot td:first-child {
  border-right: 1px solid var(--line);
}

.year-report-table tfoot td {
  padding-top: 14px;
  padding-bottom: 14px;
  font-weight: 800;
  background: #f8fafc;
  border-top: 1px solid var(--line);
}

.year-report-table tfoot td:first-child {
  text-align: left;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.45 Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 380px);
  display: grid;
  gap: 22px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel h1,
.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px;
  background: #17202b;
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  max-width: 44px;
  display: block;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
}

.brand > div {
  min-width: 0;
}

.brand strong,
.brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand span {
  color: #aeb9c7;
  font-size: 13px;
}

.brand-version {
  display: inline-block;
  margin-left: 4px;
  color: #d8e0eb;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.nav-group {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-item,
.ghost-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #d9e4ee;
  background: transparent;
  text-align: left;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  white-space: nowrap;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active,
.nav-main.section-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  color: #9fb1c4;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon,
.nav-main.section-active .nav-icon {
  color: #ffffff;
}

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

.nav-caret {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.65;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.nav-group.is-open .nav-caret {
  transform: rotate(-135deg);
}

.nav-children {
  display: grid;
  gap: 4px;
  padding: 2px 0 2px 30px;
}

.nav-child {
  position: relative;
  min-height: 34px;
  padding: 0 12px 0 14px;
  color: #bdc9d7;
  font-size: 14px;
}

.nav-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  transform: translateY(-50%);
}

.nav-child:hover::before,
.nav-child.active::before {
  background: #ffffff;
}

.ghost-button {
  margin-top: auto;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  min-width: 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.page-title-with-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.page-title-help {
  margin-top: 2px;
}

.sync-controls {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

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

.filter-panel .filter-row {
  margin-bottom: 0;
}

.field,
.compact-field {
  display: grid;
  gap: 6px;
}

.filter-row .compact-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field span,
.compact-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-row .compact-field span {
  flex: 0 0 auto;
  color: var(--text);
}

.field input,
.field textarea,
.compact-field input,
.compact-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #ffffff;
}

.field textarea {
  min-height: 120px;
  padding: 10px 12px;
  resize: vertical;
}

.compact-field input,
.compact-field select {
  width: 148px;
}

.finance-filter-row .compact-field select {
  width: 180px;
}

.telegram-manual-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.telegram-manual-form .compact-field input,
.expense-form .compact-field input {
  width: 100%;
}

.expense-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.hint-line {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.upload-form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.file-field {
  min-width: min(100%, 360px);
}

.primary-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 700;
}

.secondary-button,
.ghost-light-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.secondary-button {
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  background: #e6f3f0;
}

.ghost-light-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

.table-action-button {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.table-action-group {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

.primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.status-line {
  min-height: 22px;
  margin-bottom: 14px;
  color: var(--muted);
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: grid;
  gap: 18px;
  min-width: 0;
}

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

.site-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

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

.metric-card {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
}

.metric-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
}

.metric-card span,
.sync-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.help-tip {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f8fafc;
  color: var(--muted);
  cursor: help;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.help-tip::before,
.help-tip::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  visibility: hidden;
  z-index: 20;
}

.help-tip::before {
  bottom: calc(100% + 3px);
  border: 6px solid transparent;
  border-top-color: #111827;
  content: "";
}

.help-tip::after {
  bottom: calc(100% + 14px);
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #111827;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  color: #ffffff;
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}

.help-tip:hover,
.help-tip:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.help-tip:hover::before,
.help-tip:hover::after,
.help-tip:focus-visible::before,
.help-tip:focus-visible::after,
.help-tip.is-open::before,
.help-tip.is-open::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  visibility: visible;
}

.help-tip--below::before {
  top: calc(100% + 3px);
  bottom: auto;
  border-top-color: transparent;
  border-bottom-color: #111827;
}

.help-tip--below::after {
  top: calc(100% + 14px);
  bottom: auto;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.panel-title-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel-heading .panel-title-with-help span {
  color: var(--text);
  font-size: inherit;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
}

.indexing-status-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: min(100%, 900px);
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.meta-badge__label {
  color: #64748b;
  font-weight: 750;
}

.meta-badge strong {
  color: #17202b;
  font: inherit;
}

.meta-badge--success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.meta-badge--success strong {
  color: #166534;
}

.meta-badge--muted {
  border-color: #e2e8f0;
  background: #f1f5f9;
}

.meta-badge--muted strong {
  color: #64748b;
}

.meta-badge--warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.meta-badge--warning strong {
  color: #9a3412;
}

.panel-meta {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.panel-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

#overviewView {
  gap: 20px;
}

.overview-filter-panel {
  padding: 16px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbfd 100%);
}

.overview-filter-panel .panel-heading {
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

.overview-filter-panel .panel-heading h2 {
  font-size: 16px;
}

.overview-filter-panel .filter-row {
  align-items: end;
  gap: 12px;
}

.overview-filter-panel .compact-field input {
  background: #fbfdff;
}

.overview-kpi-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
}

.overview-metric {
  --metric-accent: var(--accent);
  --metric-soft: #e7f4f2;
  position: relative;
  min-height: 122px;
  align-content: space-between;
  overflow: visible;
  border-top: 3px solid var(--metric-accent);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 14px 34px rgba(28, 36, 48, 0.07);
}

.overview-metric--leads {
  --metric-accent: #0f766e;
  --metric-soft: #e7f4f2;
}

.overview-metric--contracts {
  --metric-accent: #2563eb;
  --metric-soft: #eaf1ff;
}

.overview-metric--income {
  --metric-accent: #b42318;
  --metric-soft: #fff1ef;
}

.overview-metric--average {
  --metric-accent: #b7791f;
  --metric-soft: #fff7e8;
}

.overview-metric--conversion {
  --metric-accent: #4d7c0f;
  --metric-soft: #eef7e6;
}

.overview-metric .metric-title {
  width: 100%;
  justify-content: space-between;
  gap: 10px;
}

.overview-metric .metric-title span {
  color: #526174;
  line-height: 1.25;
}

.overview-metric .help-tip {
  background: var(--metric-soft);
  border-color: transparent;
  color: var(--metric-accent);
  z-index: 8;
}

.overview-metric strong {
  color: #0f172a;
  font-size: 30px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.overview-chart-panel {
  padding: 20px;
}

.overview-chart-panel .panel-heading {
  margin-bottom: 16px;
}

#overviewView .chart-toolbar {
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid #e7edf4;
  border-radius: 8px;
  background: #f8fafc;
}

#overviewView .chart-legend-button,
#overviewView .chart-legend-static,
#overviewView .chart-reset-button {
  border-color: #d8e1ea;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

#overviewView .chart-legend-button:hover,
#overviewView .chart-reset-button:hover {
  border-color: var(--accent);
}

#overviewView .chart-scroll {
  min-height: 300px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 6px 8px 8px;
}

#overviewView .chart-grid-line {
  stroke: #eef3f8;
}

#overviewView .chart-axis-label,
#overviewView .chart-x-label {
  fill: #64748b;
}

#overviewView .chart-total-line {
  stroke: #0f172a;
}

#overviewView .advanced-chart-tooltip {
  border-color: #d8e1ea;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
}

.overview-bottom-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
}

.overview-rank-panel,
.overview-status-panel {
  padding: 20px;
}

#overviewView .rank-list,
#overviewView .status-list {
  gap: 0;
}

#overviewView .rank-item,
#overviewView .status-item {
  gap: 8px;
  padding: 11px 0;
}

#overviewView .rank-line strong {
  color: #111827;
}

#overviewView .rank-line span {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

#overviewView .progress {
  height: 7px;
  background: #edf2f7;
}

.overview-status-panel .status-item:nth-child(1) .progress span {
  background: #0f766e;
}

.overview-status-panel .status-item:nth-child(2) .progress span {
  background: #b42318;
}

.overview-status-panel .status-item:nth-child(3) .progress span {
  background: #2563eb;
}

.overview-status-panel .status-item:nth-child(4) .progress span {
  background: #b7791f;
}

.report-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
}

#reportsView.reports-view {
  gap: 20px;
}

#reportsView .report-control-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-top: 3px solid #0f766e;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#reportsView .report-control-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

#reportsView .report-control-panel .panel-heading h2 {
  font-size: 16px;
}

#reportsView .report-control-panel .panel-heading > span {
  max-width: min(100%, 760px);
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
  overflow-wrap: anywhere;
}

#reportsView .report-filter-row {
  align-items: end;
  gap: 12px;
  margin-bottom: 0;
}

#reportsView .report-filter-row .compact-field input {
  width: 158px;
  background: #fbfdff;
}

#reportsView .report-filter-row .primary-button,
#reportsView .report-filter-row .secondary-button {
  min-height: 40px;
}

.marketing-report {
  display: grid;
  gap: 22px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 30px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(28, 36, 48, 0.08);
}

.report-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  min-height: 0;
  padding-bottom: 20px;
  border-bottom: 2px solid #0f172a;
}

.report-logo {
  position: static;
  width: 188px;
  max-width: min(188px, 28vw);
  height: auto;
  display: block;
  object-fit: contain;
}

.report-cover h2 {
  margin: 0;
  max-width: 720px;
  color: #0f172a;
  font-size: 32px;
  font-weight: 850;
  line-height: 1.15;
}

.report-cover p:last-child {
  margin: 10px 0 0;
  max-width: 680px;
  color: #526174;
  font-weight: 700;
}

.report-cover p:empty {
  display: none;
}

.report-section {
  break-inside: avoid;
  display: grid;
  gap: 14px;
  padding-top: 2px;
}

.report-section h3,
.report-section h4 {
  margin: 0;
}

.report-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0f172a;
  font-size: 18px;
  font-weight: 850;
}

.report-section h3::before {
  width: 8px;
  height: 24px;
  border-radius: 999px;
  background: #0f766e;
  content: "";
}

.report-section h4 {
  font-size: 15px;
}

.report-kpi-grid,
.report-smm-grid {
  display: grid;
  gap: 12px;
}

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

.report-kpi-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-kpi-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-kpi-grid--single {
  grid-template-columns: minmax(260px, 360px);
}

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

.report-smm-grid > div {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.report-smm-grid .report-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.report-smm-grid .report-table td {
  min-width: 0;
  padding: 10px 8px;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
}

.report-smm-grid .report-table td:first-child {
  width: 22%;
  min-width: 0;
}

.report-smm-grid .report-table td:nth-child(2) {
  width: 36%;
}

.report-smm-grid .report-table td:nth-child(3) {
  width: 42%;
}

.report-smm-grid .delta {
  min-width: 0;
  display: inline;
}

.report-kpi {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 118px;
  align-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 3px solid #0f766e;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.report-kpi-grid .report-kpi:nth-child(2) {
  border-top-color: #2563eb;
}

.report-kpi-grid .report-kpi:nth-child(3) {
  border-top-color: #b7791f;
}

.report-kpi-grid .report-kpi:nth-child(4) {
  border-top-color: #7c3aed;
}

.report-kpi span {
  color: #526174;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.report-kpi strong {
  color: #0f172a;
  font-size: 31px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.report-kpi em {
  font-style: normal;
  font-weight: 800;
  line-height: 1.25;
}

.report-kpi strong,
.report-kpi em,
.report-table td:nth-child(n+2) {
  font-variant-numeric: tabular-nums;
}

.report-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #ffffff;
}

.report-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  background: #ffffff;
}

.report-table th,
.report-table td {
  min-width: 88px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}

.report-table th {
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

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

.report-table tbody tr:hover td {
  background: #fbfdff;
}

.report-table td:nth-child(n+2),
.report-table th:nth-child(n+2) {
  text-align: right;
  white-space: nowrap;
}

.report-table--compact td:first-child {
  min-width: 160px;
  font-weight: 800;
  text-align: left;
  white-space: normal;
}

.report-table--status td:nth-child(2),
.report-table--status th:nth-child(2) {
  text-align: left;
}

.report-table--compact td {
  padding: 8px 6px;
}

.delta {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 70px;
  font-weight: 800;
}

.delta--up {
  color: var(--accent);
}

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

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

.bar-chart {
  min-height: 260px;
  display: flex;
  align-items: end;
  gap: 6px;
  padding-top: 8px;
  overflow-x: auto;
}

.bar-chart.is-empty {
  align-items: stretch;
}

.bar-chart .empty-state {
  width: 100%;
}

.bar-day {
  width: 30px;
  min-width: 30px;
  display: grid;
  gap: 6px;
  align-items: end;
}

.bar-stack {
  height: 210px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  border-radius: 6px;
  overflow: hidden;
  background: #edf1f5;
}

.bar-segment {
  min-height: 2px;
}

.bar-label {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.advanced-chart {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding-top: 0;
  overflow: visible;
}

.chart-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-legend-static {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.chart-legend-line {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: #111827;
}

.chart-legend-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.chart-legend-button.is-disabled {
  color: var(--muted);
  opacity: 0.55;
}

.chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.chart-reset-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.chart-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.advanced-chart-svg {
  display: block;
  min-width: 100%;
}

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

.chart-axis-line {
  stroke: #cbd5e1;
  stroke-width: 1;
}

.chart-axis-label,
.chart-x-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.chart-day-hover {
  fill: transparent;
}

.chart-bar-segment {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.chart-bar-segment:hover,
.chart-total-point:hover {
  opacity: 0.8;
}

.chart-total-line {
  fill: none;
  stroke: #111827;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.chart-total-point {
  fill: #fff;
  stroke: #111827;
  stroke-width: 2;
  cursor: pointer;
}

.advanced-chart-tooltip {
  position: absolute;
  z-index: 6;
  width: 240px;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.25;
  pointer-events: none;
}

.advanced-chart-tooltip strong {
  font-size: 13px;
}

.advanced-chart-tooltip b {
  color: var(--accent);
}

.advanced-chart-tooltip span {
  color: var(--muted);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: 18px;
}

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

.rank-list,
.lead-list,
.status-list,
.review-list {
  display: grid;
  gap: 10px;
}

.rank-item,
.lead-item,
.status-item,
.review-item {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.rank-item:last-child,
.lead-item:last-child,
.status-item:last-child,
.review-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.rank-line,
.review-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #edf1f5;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.lead-item strong {
  font-size: 13px;
}

.lead-item span {
  color: var(--muted);
  font-size: 12px;
}

.review-item p {
  margin: 0;
  color: var(--text);
}

.review-item span {
  color: var(--muted);
  font-size: 12px;
}

.diagnostics-box {
  background: #0f172a;
  border-radius: 8px;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.5;
  margin: 12px 0 0;
  max-height: 260px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

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

.settings-sync-summary {
  margin-top: 14px;
}

.sync-summary div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.sync-summary strong {
  overflow-wrap: anywhere;
}

.warning-line,
.form-error {
  margin: 12px 0 0;
  color: var(--red);
}

.success-line {
  margin: 12px 0 0;
  color: var(--accent-dark);
}

.status-line:empty,
.success-line:empty,
.warning-line:empty,
.form-error:empty {
  display: none;
}

.ui-message--info,
.ui-message--success,
.ui-message--error,
.ui-message--loading {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ui-message--success {
  border-color: #b8ded8;
  background: #eef8f6;
  color: var(--accent-dark);
}

.ui-message--error {
  border-color: #f3bbb5;
  background: #fff3f1;
  color: var(--red);
}

.ui-message--loading {
  border-color: #cfe0f7;
  background: #f3f8ff;
  color: #1d4ed8;
}

.ui-message--loading::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: currentColor;
  content: "";
  animation: messagePulse 0.9s ease-in-out infinite;
}

@keyframes messagePulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.88);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.finance-control-panel {
  display: grid;
  gap: 14px;
}

#financeView {
  gap: 20px;
}

#financeView .finance-control-panel {
  padding: 16px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#financeView .finance-control-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

#financeView .finance-control-panel .panel-heading h2 {
  font-size: 16px;
}

#financeView .finance-filter-row {
  align-items: end;
  gap: 12px;
}

#financeView .finance-filter-row .compact-field {
  min-width: 0;
}

#financeView .finance-filter-row .compact-field select,
#financeView .finance-filter-row .compact-field input {
  background: #fbfdff;
}

#financeView .finance-filter-row .compact-field select {
  width: 176px;
}

#financeView .finance-filter-row .compact-field input {
  width: 148px;
}

#financeView .panel-meta span,
#financeView .panel-heading > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
}

.finance-kpi-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.finance-metric {
  --metric-accent: var(--accent);
  --metric-soft: #e7f4f2;
  position: relative;
  min-height: 128px;
  align-content: space-between;
  overflow: visible;
  border-top: 3px solid var(--metric-accent);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 14px 34px rgba(28, 36, 48, 0.07);
}

.finance-metric--deals {
  --metric-accent: #2563eb;
  --metric-soft: #eaf1ff;
}

.finance-metric--income {
  --metric-accent: #0f766e;
  --metric-soft: #e7f4f2;
}

.finance-metric--average {
  --metric-accent: #b7791f;
  --metric-soft: #fff7e8;
}

.finance-metric span {
  color: #526174;
  line-height: 1.25;
}

.finance-metric strong {
  color: #0f172a;
  font-size: 31px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.finance-split-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.84fr);
}

.finance-table-panel {
  padding: 20px;
}

.finance-table-panel .panel-heading {
  align-items: center;
  margin-bottom: 16px;
}

#financeView .table-wrap {
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #ffffff;
}

#financeView table {
  min-width: 620px;
}

#financeView th {
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  font-weight: 850;
}

#financeView td,
#financeView th {
  padding: 12px 14px;
}

#financeView tbody tr:hover {
  background: #fbfdff;
}

#financeView td:nth-child(n+2),
#financeView th:nth-child(n+2) {
  text-align: right;
}

#financeView .finance-client-panel table {
  min-width: 980px;
}

#financeView .finance-client-panel td:nth-child(3),
#financeView .finance-client-panel th:nth-child(3),
#financeView .finance-client-panel td:nth-child(4),
#financeView .finance-client-panel th:nth-child(4),
#financeView .finance-client-panel td:nth-child(5),
#financeView .finance-client-panel th:nth-child(5),
#financeView .finance-client-panel td:nth-child(6),
#financeView .finance-client-panel th:nth-child(6),
#financeView .finance-client-panel td:nth-child(7),
#financeView .finance-client-panel th:nth-child(7) {
  text-align: left;
}

#cohortRomiView.cohort-romi-view {
  gap: 20px;
}

#cohortRomiView .cohort-control-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-top: 3px solid #7c3aed;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#cohortRomiView .cohort-control-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

#cohortRomiView .cohort-control-panel .panel-heading h2 {
  font-size: 16px;
}

#cohortRomiView .panel-heading > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
}

#cohortRomiView .cohort-filter-row {
  align-items: end;
  gap: 12px;
}

#cohortRomiView .cohort-filter-row .compact-field {
  min-width: 0;
}

#cohortRomiView .cohort-filter-row .compact-field input,
#cohortRomiView .cohort-filter-row .compact-field select {
  background: #fbfdff;
}

#cohortRomiView .cohort-filter-row .compact-field input {
  width: 148px;
}

#cohortRomiView .cohort-filter-row .compact-field select {
  width: 190px;
}

#cohortRomiView .cohort-filter-row .secondary-button,
#cohortRomiView .cohort-filter-row .ghost-light-button {
  min-height: 40px;
}

#cohortRomiView .cohort-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e8ddff;
  border-radius: 8px;
  background: #fbf8ff;
  color: #5b4b77;
  font-weight: 700;
}

.cohort-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.cohort-metric {
  --metric-accent: var(--accent);
  position: relative;
  min-height: 128px;
  align-content: space-between;
  overflow: visible;
  border-top: 3px solid var(--metric-accent);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 14px 34px rgba(28, 36, 48, 0.07);
}

.cohort-metric--leads {
  --metric-accent: #0f766e;
}

.cohort-metric--contracts {
  --metric-accent: #2563eb;
}

.cohort-metric--issued {
  --metric-accent: #0e7490;
}

.cohort-metric--revenue {
  --metric-accent: #4d7c0f;
}

.cohort-metric--average-check {
  --metric-accent: #0f766e;
}

.cohort-metric--expenses {
  --metric-accent: #b42318;
}

.cohort-metric--romi {
  --metric-accent: #7c3aed;
}

.cohort-metric--refused {
  --metric-accent: #be123c;
}

.cohort-metric--in-transit {
  --metric-accent: #0284c7;
}

.cohort-metric--search {
  --metric-accent: #475569;
}

.cohort-metric--close {
  --metric-accent: #b7791f;
}

.cohort-metric span {
  color: #526174;
  line-height: 1.25;
}

#cohortRomiView .cohort-metric .metric-title {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  align-items: flex-start;
}

#cohortRomiView .cohort-metric .metric-title > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

#cohortRomiView .cohort-metric .help-tip {
  flex: 0 0 18px;
}

.cohort-metric strong {
  max-width: 100%;
  color: #0f172a;
  font-size: 30px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cohort-table-panel {
  padding: 20px;
}

.cohort-table-panel .panel-heading {
  align-items: center;
  margin-bottom: 16px;
}

#cohortRomiView .cohort-table-panel .table-wrap {
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #ffffff;
}

#cohortRomiView .cohort-table-panel table {
  min-width: 1180px;
}

#cohortRomiView .cohort-month-panel table {
  min-width: 1060px;
}

#cohortRomiView .cohort-client-panel table {
  min-width: 1280px;
}

#cohortRomiView .cohort-table-panel th {
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  font-weight: 850;
}

#cohortRomiView .cohort-table-panel td,
#cohortRomiView .cohort-table-panel th {
  padding: 12px 14px;
}

#cohortRomiView .cohort-table-panel tbody tr:hover {
  background: #fbfdff;
}

#cohortRomiView .cohort-table-panel td:nth-child(n+2),
#cohortRomiView .cohort-table-panel th:nth-child(n+2) {
  text-align: right;
}

#cohortRomiView .cohort-table-panel td:first-child,
#cohortRomiView .cohort-table-panel th:first-child {
  text-align: left;
}

#cohortRomiView .cohort-client-panel td:nth-child(-n+8),
#cohortRomiView .cohort-client-panel th:nth-child(-n+8) {
  text-align: left;
}

#expensesView.ledger-view {
  gap: 20px;
}

#expensesView .ledger-control-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#expensesView .ledger-form-panel {
  border-top: 3px solid #0f766e;
}

#expensesView.payments-view .ledger-form-panel {
  border-top-color: #2563eb;
}

#expensesView .ledger-control-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

#expensesView .ledger-control-panel .panel-heading h2 {
  font-size: 16px;
}

#expensesView .panel-heading > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
}

#expensesView .ledger-entry-form,
#expensesView .ledger-filter-row {
  align-items: end;
  gap: 12px;
}

#expensesView .ledger-entry-form .compact-field,
#expensesView .ledger-filter-row .compact-field {
  min-width: 0;
}

#expensesView .ledger-entry-form .compact-field input,
#expensesView .ledger-entry-form .compact-field select,
#expensesView .ledger-filter-row .compact-field input,
#expensesView .ledger-filter-row .compact-field select {
  background: #fbfdff;
}

#expensesView .ledger-entry-form .compact-field select,
#expensesView .ledger-filter-row .compact-field select {
  width: 176px;
}

#expensesView .ledger-entry-form .compact-field input {
  width: 100%;
}

#expensesView .ledger-filter-row .compact-field input {
  width: 148px;
}

#expensesView .ledger-entry-form .primary-button,
#expensesView .ledger-entry-form .ghost-light-button,
#expensesView .ledger-filter-row .secondary-button,
#expensesView .ledger-filter-row .ghost-light-button {
  min-height: 40px;
}

#expensesView .hint-line {
  min-height: 18px;
  margin: 0;
}

.ledger-kpi-grid {
  gap: 14px;
}

.payments-kpi-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.expenses-kpi-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.ledger-metric {
  --metric-accent: var(--accent);
  min-height: 126px;
  align-content: space-between;
  overflow: visible;
  border-top: 3px solid var(--metric-accent);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 14px 34px rgba(28, 36, 48, 0.07);
}

.ledger-metric--attraction,
.ledger-metric--total {
  --metric-accent: #0f766e;
}

.ledger-metric--content,
.ledger-metric--count {
  --metric-accent: #2563eb;
}

.ledger-metric--admin {
  --metric-accent: #b7791f;
}

.ledger-metric--service {
  --metric-accent: #b42318;
}

.ledger-metric--average {
  --metric-accent: #7c3aed;
}

.ledger-metric span {
  color: #526174;
  line-height: 1.25;
}

.ledger-metric strong {
  color: #0f172a;
  font-size: 30px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.ledger-split-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.84fr);
}

.ledger-table-panel {
  padding: 20px;
}

.ledger-table-panel .panel-heading {
  align-items: center;
  margin-bottom: 16px;
}

#expensesView .table-wrap {
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #ffffff;
}

#expensesView table {
  min-width: 720px;
}

#expensesView th {
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  font-weight: 850;
}

#expensesView td,
#expensesView th {
  padding: 12px 14px;
}

#expensesView tbody tr:hover {
  background: #fbfdff;
}

#expensesView .payments-category-panel td:nth-child(n+2),
#expensesView .payments-category-panel th:nth-child(n+2),
#expensesView .ledger-month-panel td:nth-child(n+2),
#expensesView .ledger-month-panel th:nth-child(n+2),
#expensesView .ledger-company-panel td:nth-child(n+2),
#expensesView .ledger-company-panel th:nth-child(n+2),
#expensesView .ledger-source-panel td:nth-child(n+2),
#expensesView .ledger-source-panel th:nth-child(n+2) {
  text-align: right;
}

#expensesView .ledger-rows-panel table {
  min-width: 980px;
}

#expensesView .ledger-rows-panel td:nth-last-child(2),
#expensesView .ledger-rows-panel th:nth-last-child(2),
#expensesView .ledger-rows-panel td:last-child,
#expensesView .ledger-rows-panel th:last-child {
  text-align: right;
}

#expensesView .panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
}

#expensesView .table-action-button {
  min-height: 32px;
  padding: 0 10px;
}

#siteLinksView.site-links-view {
  gap: 20px;
}

#siteLinksView .site-links-form-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-top: 3px solid #0f766e;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#siteLinksView .site-links-form-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

#siteLinksView .site-links-form-panel .panel-heading h2 {
  font-size: 16px;
}

#siteLinksView .site-links-form-panel .panel-heading > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
}

#siteLinksView .site-links-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
}

#siteLinksView .site-links-form .compact-field,
#siteLinksView .site-links-form .compact-field input {
  min-width: 0;
  width: 100%;
}

#siteLinksView .site-links-form .compact-field input {
  background: #fbfdff;
}

#siteLinksView .site-links-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

#siteLinksView .site-links-form-actions .primary-button,
#siteLinksView .site-links-form-actions .ghost-light-button {
  min-width: 112px;
}

#siteLinksView .hint-line {
  min-height: 18px;
  margin: 0;
}

#siteLinksView .site-links-table-panel {
  padding: 20px;
}

#siteLinksView .site-links-table-panel .table-wrap {
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #ffffff;
}

#siteLinksView .site-links-table-panel table {
  min-width: 1320px;
}

#siteLinksView .site-links-table-panel th {
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  font-weight: 850;
}

#siteLinksView .site-links-table-panel td,
#siteLinksView .site-links-table-panel th {
  padding: 12px 14px;
  vertical-align: top;
}

#siteLinksView .site-links-table-panel td:nth-child(2),
#siteLinksView .site-links-table-panel td:nth-child(3),
#siteLinksView .site-links-table-panel td:nth-child(4) {
  min-width: 210px;
  max-width: 340px;
  white-space: normal;
  overflow-wrap: anywhere;
}

#siteLinksView .site-links-table-panel td:nth-child(5),
#siteLinksView .site-links-table-panel th:nth-child(5) {
  text-align: right;
  white-space: nowrap;
}

#siteLinksView .site-links-table-panel tbody tr:hover {
  background: #fbfdff;
}

#siteLinksView .table-action-group {
  flex-wrap: nowrap;
}

#siteLinksView .table-action-button {
  min-height: 32px;
  padding: 0 10px;
}

#sourcesView.source-view,
#sourceDailyView.source-daily-view {
  gap: 20px;
}

#sourcesView .source-control-panel,
#sourceDailyView .source-daily-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#sourcesView .source-control-panel {
  border-top: 3px solid #0f766e;
}

#sourceDailyView .source-daily-panel {
  border-top: 3px solid #2563eb;
}

#sourcesView .source-control-panel .panel-heading,
#sourceDailyView .source-daily-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

#sourcesView .source-control-panel .panel-heading h2,
#sourceDailyView .source-daily-panel .panel-heading h2 {
  font-size: 16px;
}

#sourcesView .panel-heading > span,
#sourceDailyView .panel-heading > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
}

#sourcesView .source-filter-row,
#sourceDailyView .source-filter-row {
  align-items: end;
  gap: 12px;
  margin-bottom: 0;
}

#sourcesView .source-filter-row .compact-field input,
#sourceDailyView .source-filter-row .compact-field input {
  width: 148px;
  background: #fbfdff;
}

#sourcesView .source-filter-row .secondary-button,
#sourcesView .source-filter-row .ghost-light-button,
#sourceDailyView .source-filter-row .secondary-button,
#sourceDailyView .source-filter-row .ghost-light-button {
  min-height: 40px;
}

.source-table-panel {
  padding: 20px;
}

.source-table-panel .panel-heading {
  align-items: center;
  margin-bottom: 16px;
}

#sourcesView .table-wrap {
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #ffffff;
}

#sourcesView table {
  min-width: 820px;
}

#sourcesView th {
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  font-weight: 850;
}

#sourcesView td,
#sourcesView th {
  padding: 12px 14px;
}

#sourcesView tbody tr:hover {
  background: #fbfdff;
}

#sourcesView td:nth-child(n+2),
#sourcesView th:nth-child(n+2) {
  text-align: right;
}

#sourcesView td:first-child,
#sourcesView th:first-child {
  text-align: left;
}

#siteView.site-analytics-view,
#siteSectionView.site-analytics-view,
#indexingView.site-analytics-view {
  gap: 20px;
}

#siteView .site-control-panel,
#siteSectionView .site-control-panel,
#indexingView .site-control-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-top: 3px solid #0f766e;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#siteSectionView .site-control-panel {
  border-top-color: #2563eb;
}

#siteView .site-control-panel .panel-heading,
#siteSectionView .site-control-panel .panel-heading,
#indexingView .site-control-panel .panel-heading,
#siteView .site-chart-panel .panel-heading,
#siteView .site-table-panel .panel-heading,
#siteSectionView .site-table-panel .panel-heading,
#indexingView .site-table-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
}

#siteView .site-control-panel .panel-heading,
#siteSectionView .site-control-panel .panel-heading,
#indexingView .site-control-panel .panel-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

#siteView .site-control-panel .panel-heading h2,
#siteSectionView .site-control-panel .panel-heading h2,
#indexingView .site-control-panel .panel-heading h2 {
  font-size: 16px;
}

#siteView .panel-heading > span,
#siteSectionView .panel-heading > span,
#indexingView .panel-heading > span {
  max-width: min(100%, 720px);
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
  overflow-wrap: anywhere;
}

#siteView .site-filter-row,
#siteSectionView .site-filter-row,
#indexingView .site-filter-row {
  align-items: end;
  gap: 12px;
  margin-bottom: 0;
}

#siteView .site-filter-row .compact-field input,
#siteSectionView .site-filter-row .compact-field input,
#indexingView .site-filter-row .compact-field input,
#indexingView .site-filter-row .compact-field select {
  width: 148px;
  background: #fbfdff;
}

#siteView .site-filter-row .secondary-button,
#siteView .site-filter-row .ghost-light-button,
#siteSectionView .site-filter-row .secondary-button,
#siteSectionView .site-filter-row .ghost-light-button,
#indexingView .site-filter-row .secondary-button,
#indexingView .site-filter-row .ghost-light-button {
  min-height: 40px;
}

.site-analytics-kpi-grid {
  gap: 14px;
}

.site-metric {
  --metric-accent: var(--accent);
  min-height: 126px;
  align-content: space-between;
  overflow: visible;
  border-top: 3px solid var(--metric-accent);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 14px 34px rgba(28, 36, 48, 0.07);
}

#indexingView .indexing-kpi-delta {
  justify-content: flex-start;
  min-width: 0;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.2;
}

#indexingView .indexing-kpi-delta[hidden] {
  display: none;
}

.site-metric--pages,
.site-metric--visits {
  --metric-accent: #0f766e;
}

.site-metric--users {
  --metric-accent: #2563eb;
}

.site-metric--pageviews {
  --metric-accent: #7c3aed;
}

.site-metric--bounce {
  --metric-accent: #b42318;
}

.site-metric--depth {
  --metric-accent: #b7791f;
}

.site-metric--duration {
  --metric-accent: #0e7490;
}

.site-metric span {
  color: #526174;
  line-height: 1.25;
}

.site-metric strong {
  color: #0f172a;
  font-size: 30px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.site-chart-panel,
.site-table-panel {
  padding: 20px;
}

.site-chart-panel {
  overflow: visible;
}

.site-chart-panel .panel-heading,
.site-table-panel .panel-heading {
  margin-bottom: 16px;
}

#siteView .site-chart-panel .advanced-chart {
  min-height: 330px;
}

#siteView .site-chart-panel .chart-toolbar {
  padding: 10px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fbfdff;
}

#siteView .site-chart-panel .chart-scroll {
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #ffffff;
}

#siteView .site-chart-panel .advanced-chart-svg {
  min-height: 330px;
}

#siteView .site-table-panel .table-wrap,
#siteSectionView .site-table-panel .table-wrap,
#indexingView .site-table-panel .table-wrap {
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #ffffff;
}

#siteView .site-table-panel table,
#siteSectionView .site-table-panel table {
  min-width: 820px;
}

#indexingView .site-table-panel table {
  min-width: 1120px;
}

#siteView .site-table-panel th,
#siteSectionView .site-table-panel th,
#indexingView .site-table-panel th {
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  font-weight: 850;
}

#siteView .site-table-panel td,
#siteView .site-table-panel th,
#siteSectionView .site-table-panel td,
#siteSectionView .site-table-panel th,
#indexingView .site-table-panel td,
#indexingView .site-table-panel th {
  padding: 12px 14px;
}

#siteView .site-table-panel tbody tr:hover,
#siteSectionView .site-table-panel tbody tr:hover,
#indexingView .site-table-panel tbody tr:hover {
  background: #fbfdff;
}

#siteView .site-table-panel td:nth-child(n+2),
#siteView .site-table-panel th:nth-child(n+2),
#siteSectionView .site-table-panel td:nth-child(n+2),
#siteSectionView .site-table-panel th:nth-child(n+2),
#indexingView .site-table-panel td:nth-child(n+2),
#indexingView .site-table-panel th:nth-child(n+2) {
  text-align: right;
}

#siteView .site-table-panel td:first-child,
#siteView .site-table-panel th:first-child,
#siteSectionView .site-table-panel td:first-child,
#siteSectionView .site-table-panel th:first-child,
#indexingView .site-table-panel td:first-child,
#indexingView .site-table-panel th:first-child {
  text-align: left;
}

#siteSectionView .site-table-panel td:first-child a,
#indexingView .site-table-panel td:first-child a {
  color: #0f766e;
  font-weight: 750;
}

#siteSectionView .site-table-panel td:first-child a:hover,
#indexingView .site-table-panel td:first-child a:hover {
  color: #0b5f59;
}

#indexingView .site-table-panel td:first-child {
  max-width: 460px;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.status-pill--indexed {
  background: #dcfce7;
  color: #166534;
}

.status-pill--not_indexed {
  background: #fee2e2;
  color: #991b1b;
}

.status-pill--error {
  background: #fef3c7;
  color: #92400e;
}

.status-pill--not_checked,
.status-pill--not_connected {
  background: #eef2f7;
  color: #475569;
}

#siteView .site-daily-panel .panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
}

#socialsView.socials-view {
  gap: 20px;
}

#socialsView .socials-control-panel,
#socialsView .socials-edit-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

#socialsView .socials-control-panel {
  border-top: 3px solid #0f766e;
}

#socialsView .socials-edit-panel {
  border-top: 3px solid #2563eb;
}

#socialsView .socials-control-panel .panel-heading,
#socialsView .socials-edit-panel .panel-heading,
#socialsView .socials-table-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
}

#socialsView .socials-control-panel .panel-heading,
#socialsView .socials-edit-panel .panel-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

#socialsView .socials-control-panel .panel-heading h2,
#socialsView .socials-edit-panel .panel-heading h2 {
  font-size: 16px;
}

#socialsView .panel-heading > span {
  max-width: min(100%, 760px);
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
  overflow-wrap: anywhere;
}

#socialsView .socials-sync-row,
#socialsView .socials-manual-form {
  align-items: end;
  gap: 12px 14px;
  margin-bottom: 0;
}

#socialsView .socials-sync-row .compact-field input,
#socialsView .socials-manual-form .compact-field input,
#socialsView .socials-manual-form .compact-field select {
  background: #fbfdff;
}

#socialsView .socials-sync-row .compact-field input,
#socialsView .socials-manual-form .compact-field input,
#socialsView .socials-manual-form .compact-field select {
  width: 100%;
}

#socialsView .socials-sync-row .compact-field {
  width: auto;
  flex: 0 0 auto;
}

#socialsView .socials-sync-row .compact-field input {
  width: 148px;
  padding-right: 34px;
}

#socialsView .socials-sync-row .primary-button,
#socialsView .socials-sync-row .secondary-button,
#socialsView .socials-manual-form .secondary-button {
  min-height: 40px;
}

#socialsView .socials-sync-row .primary-button {
  min-width: 164px;
}

#socialsView .socials-sync-row .secondary-button {
  min-width: 114px;
}

#socialsView .socials-sync-row .hint-line {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  max-width: 520px;
  padding: 0 12px;
  border: 1px solid #e7edf4;
  border-radius: 8px;
  background: #fbfdff;
  color: #526174;
}

#socialsView .success-line {
  margin: 0;
}

#socialsView .socials-manual-form {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

#socialsView .socials-manual-form .secondary-button {
  width: 100%;
}

.socials-table-panel {
  padding: 20px;
}

.socials-table-panel .panel-heading {
  margin-bottom: 16px;
}

#socialsView .tabs-row {
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #f8fafc;
}

#socialsView .tab-button {
  min-height: 34px;
  border-color: #d8e1ea;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

#socialsView .tab-button.active,
#socialsView .tab-button:hover {
  border-color: #0f766e;
  background: #e7f4f2;
  color: #0f766e;
}

#socialsView .telegram-table-wrap {
  max-height: 680px;
  border-color: #edf2f7;
  background: #ffffff;
}

#socialsView .telegram-table th,
#socialsView .telegram-table td {
  padding: 9px 10px;
}

#socialsView .telegram-table th:first-child,
#socialsView .telegram-table td:first-child {
  min-width: 190px;
  color: #334155;
}

#socialsView .telegram-table thead th {
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  font-weight: 850;
}

#socialsView .telegram-table tbody tr:hover td {
  box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.16);
}

#socialsView .telegram-heat-cell {
  font-weight: 750;
}

#telegramPostsView.telegram-posts-view {
  gap: 20px;
}

.telegram-bot-panel,
#telegramPostsView .telegram-filter-panel,
#telegramPostsView .telegram-posts-table-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 100%);
}

.telegram-bot-panel {
  border-top: 3px solid #0f766e;
}

#telegramPostsView .telegram-filter-panel {
  border-top: 3px solid #2563eb;
}

.telegram-bot-form,
#telegramPostsView .telegram-posts-filter-row {
  align-items: end;
  gap: 12px 14px;
  margin-bottom: 0;
}

.telegram-bot-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 0.8fr) minmax(220px, 1.2fr) minmax(170px, 0.8fr) minmax(130px, auto) minmax(170px, auto);
}

.telegram-bot-form .compact-field input,
#telegramPostsView .telegram-posts-filter-row .compact-field input,
#telegramPostsView .telegram-posts-filter-row .compact-field select {
  width: 100%;
  background: #fbfdff;
}

.telegram-token-clear {
  min-height: 40px;
  align-items: center;
}

.telegram-webhook-url {
  margin-top: 12px;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.panel-subsection {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel-subsection h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.telegram-import-form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.telegram-import-form .compact-field {
  min-width: min(100%, 360px);
}

.telegram-import-form .compact-field input {
  width: 100%;
  padding: 8px 12px;
}

#telegramPostsView .telegram-country-share-panel {
  border-top: 3px solid var(--accent);
}

#telegramPostsView .telegram-country-share-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

#telegramPostsView .telegram-country-share-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

#telegramPostsView .telegram-country-share-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

#telegramPostsView .telegram-country-share-title strong {
  color: #334155;
  font-size: 13px;
}

#telegramPostsView .telegram-country-share-title span {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

#telegramPostsView .telegram-country-share-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

#telegramPostsView .telegram-country-share-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

#telegramPostsView .telegram-country-share-item:nth-child(2) .telegram-country-share-track span {
  background: #2563eb;
}

#telegramPostsView .telegram-country-share-item:nth-child(3) .telegram-country-share-track span {
  background: #b7791f;
}

#telegramPostsView .telegram-country-share-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

#telegramPostsView .telegram-posts-table-panel .table-wrap {
  max-height: 620px;
}

#telegramPostsView .telegram-posts-list-panel table {
  min-width: 1520px;
}

#telegramPostsView .telegram-post-date-link {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  color: var(--accent);
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

#telegramPostsView .telegram-post-date-link:hover {
  text-decoration: underline;
}

#telegramPostsView .telegram-post-date-id {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

#telegramPostsView .telegram-post-specs {
  min-width: 250px;
  max-width: 320px;
  white-space: normal;
}

#telegramPostsView .telegram-spec-list {
  display: grid;
  gap: 4px;
  margin: 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.35;
}

#telegramPostsView .telegram-spec-list div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
}

#telegramPostsView .telegram-spec-list dt {
  color: #64748b;
  font-weight: 800;
}

#telegramPostsView .telegram-spec-list dd {
  margin: 0;
}

#telegramPostsView .telegram-post-text {
  max-width: 360px;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

#telegramPostsView .panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
}

.finance-upload-row {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.finance-upload-row .upload-form {
  flex: 1 1 520px;
}

.finance-upload-messages {
  flex: 1 1 260px;
}

.finance-upload-messages .success-line,
.finance-upload-messages .warning-line {
  margin: 0;
}

.table-wrap,
.report-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
}

.telegram-table-wrap {
  max-height: 620px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.heatmap-wrap {
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 250px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap::-webkit-scrollbar,
.telegram-table-wrap::-webkit-scrollbar,
.heatmap-wrap::-webkit-scrollbar,
.report-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track,
.telegram-table-wrap::-webkit-scrollbar-track,
.heatmap-wrap::-webkit-scrollbar-track,
.report-table-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #edf2f7;
}

.table-wrap::-webkit-scrollbar-thumb,
.telegram-table-wrap::-webkit-scrollbar-thumb,
.heatmap-wrap::-webkit-scrollbar-thumb,
.report-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid #edf2f7;
  border-radius: 999px;
  background: #97a6b7;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.telegram-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.manager-sources-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.manager-sources-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.manager-sources-table th,
.manager-sources-table td {
  min-width: 90px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.manager-sources-table th:first-child,
.manager-sources-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 200px;
  text-align: left;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.manager-sources-table thead th,
.manager-sources-table tfoot td {
  background: #f8fafc;
}

.manager-sources-table tfoot td {
  font-weight: 800;
  border-top: 2px solid var(--line);
}

.telegram-table th,
.telegram-table td {
  min-width: 68px;
  padding: 7px 9px;
  border-right: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
}

.telegram-table th:first-child,
.telegram-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 170px;
  max-width: 220px;
  text-align: left;
  background: #ffffff;
  box-shadow: 1px 0 0 var(--line);
  font-weight: 800;
}

.telegram-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: var(--text);
}

.telegram-table thead th:first-child {
  z-index: 3;
}

.telegram-heat-cell {
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
}

th.sortable {
  position: relative;
  cursor: pointer;
  user-select: none;
}

th.sortable::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 7px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  opacity: 0.35;
  vertical-align: middle;
}

th.sort-asc::after {
  border-top: 0;
  border-bottom: 5px solid var(--accent);
  opacity: 1;
}

th.sort-desc::after {
  border-top-color: var(--accent);
  opacity: 1;
}

.heatmap-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.heatmap-table th,
.heatmap-table td {
  min-width: 58px;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}

.heatmap-table th:first-child,
.heatmap-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 180px;
  max-width: 260px;
  text-align: left;
  white-space: normal;
  background: #ffffff;
  box-shadow: 1px 0 0 var(--line);
}

.heatmap-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--text);
  background: #f8fafc;
}

.heatmap-table thead th:first-child {
  z-index: 3;
}

.heatmap-table .total-cell,
.heatmap-table .total-head {
  font-weight: 800;
  background: #f8fafc;
}

.heatmap-table .heatmap-total-row td {
  font-weight: 800;
  background: #f8fafc;
}

.heatmap-cell {
  font-variant-numeric: tabular-nums;
}

.day-source-panel .empty-state {
  min-height: 140px;
}

.day-source-panel {
  min-width: 0;
}

#sourceDailyView .heatmap-wrap {
  max-height: calc(100vh - 285px);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

#sourceDailyView .heatmap-table th,
#sourceDailyView .heatmap-table td {
  height: 38px;
}

#sourceDailyView .heatmap-table th:first-child,
#sourceDailyView .heatmap-table td:first-child {
  font-weight: 800;
}

#sourceDailyView .heatmap-table tbody tr:hover td:first-child {
  background: #fbfdff;
}

#sourceDailyView .heatmap-table tbody tr:not(.heatmap-total-row):hover td {
  box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.18);
}

#sourceDailyView .heatmap-table .total-head,
#sourceDailyView .heatmap-table .total-cell {
  color: #0f172a;
}

#sourceDailyView .heatmap-table .heatmap-total-row td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  border-top: 1px solid #cfd8e3;
}

#sourceDailyView .heatmap-table .heatmap-total-row td:first-child {
  z-index: 2;
}

td:last-child,
th:last-child {
  text-align: right;
}

.telegram-table td:last-child,
.telegram-table th:last-child {
  text-align: center;
}

.telegram-table td:first-child,
.telegram-table th:first-child {
  text-align: left;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.short-field {
  max-width: 260px;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tabs-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.tab-button.active,
.tab-button:hover {
  border-color: var(--accent);
  background: #e7f6f4;
  color: var(--accent);
}

.ghost-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  text-decoration: none;
  background: #ffffff;
}

.secondary-button.disabled,
.ghost-link.disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: default;
}

.empty-state {
  min-height: 100px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media screen {
  body {
    background:
      radial-gradient(circle at top right, rgba(15, 118, 110, 0.055), transparent 34%),
      linear-gradient(180deg, #f6f8fb 0%, #eef2f6 100%);
  }

  .workspace {
    padding: 28px 30px 34px;
  }

  .topbar {
    align-items: flex-start;
    margin-bottom: 22px;
  }

  .topbar h1 {
    color: #0f172a;
    font-size: 30px;
    font-weight: 850;
    letter-spacing: 0;
  }

  .view.active {
    gap: 20px;
  }

  .panel,
  .metric-card {
    border-color: #d8e1ea;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    box-shadow: var(--shadow-soft);
  }

  .panel {
    padding: 20px;
  }

  .panel-heading {
    align-items: center;
  }

  .panel-heading h2 {
    color: #0f172a;
    font-weight: 850;
  }

  .panel-heading > span,
  .panel-meta span {
    font-weight: 800;
  }

  .panel-heading > span {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    max-width: min(100%, 720px);
    padding: 4px 8px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: #f8fafc;
    color: #526174;
    overflow-wrap: anywhere;
  }

  .metric-card {
    position: relative;
    min-height: 124px;
    align-content: space-between;
    overflow: visible;
    border-top: 3px solid var(--metric-accent, var(--accent));
    box-shadow: var(--shadow-card);
  }

  .metric-card span {
    color: #526174;
    line-height: 1.25;
  }

  .metric-card strong {
    color: #0f172a;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
  }

  .filter-row {
    gap: 12px;
  }

  .filter-row .compact-field {
    gap: 7px;
  }

  .filter-row .compact-field span {
    font-size: 12px;
  }

  .filter-row .compact-field input,
  .filter-row .compact-field select {
    min-height: 38px;
  }

  .filter-row .primary-button,
  .filter-row .secondary-button,
  .filter-row .ghost-light-button {
    min-height: 38px;
  }

  .field input,
  .field textarea,
  .compact-field input,
  .compact-field select {
    border-color: #d7e0ea;
    background: #fbfdff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  }

  .field input:focus,
  .field textarea:focus,
  .compact-field input:focus,
  .compact-field select:focus {
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
    outline: none;
  }

  .primary-button,
  .secondary-button,
  .ghost-light-button,
  .tab-button,
  .ghost-link,
  .table-action-button {
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  }

  .primary-button {
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
  }

  .primary-button:hover {
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.22);
    transform: translateY(-1px);
  }

  .secondary-button:hover,
  .ghost-light-button:hover,
  .tab-button:hover,
  .ghost-link:hover,
  .table-action-button:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
  }

  .table-wrap,
  .telegram-table-wrap,
  .heatmap-wrap,
  .report-table-wrap {
    border-color: var(--line-soft);
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  }

  th {
    background: #f8fafc;
    color: #526174;
    font-weight: 850;
  }

  td {
    color: #0f172a;
  }

  tbody tr {
    transition: background 0.12s ease;
  }

  tbody tr:hover {
    background: #fbfdff;
  }

  .empty-state {
    min-height: 112px;
    background: #fbfdff;
    color: #64748b;
    font-weight: 700;
  }

  .tabs-row {
    padding: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #f8fafc;
  }

  .tab-button {
    background: #ffffff;
  }

  .success-line,
  .warning-line,
  .form-error,
  .hint-line {
    font-weight: 700;
  }
}

@media screen and (min-width: 1320px) {
  #cohortRomiView .cohort-kpi-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media screen and (min-width: 1320px) and (max-width: 1759px) {
  #cohortRomiView .cohort-metric:nth-child(6n + 1) .help-tip::after {
    left: 0;
    right: auto;
    transform: translateX(0) translateY(4px);
  }

  #cohortRomiView .cohort-metric:nth-child(6n) .help-tip::after {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(4px);
  }

  #cohortRomiView .cohort-metric:nth-child(6n + 1) .help-tip:hover::after,
  #cohortRomiView .cohort-metric:nth-child(6n + 1) .help-tip:focus-visible::after,
  #cohortRomiView .cohort-metric:nth-child(6n + 1) .help-tip.is-open::after,
  #cohortRomiView .cohort-metric:nth-child(6n) .help-tip:hover::after,
  #cohortRomiView .cohort-metric:nth-child(6n) .help-tip:focus-visible::after,
  #cohortRomiView .cohort-metric:nth-child(6n) .help-tip.is-open::after {
    transform: translateX(0) translateY(0);
  }
}

@media screen and (min-width: 1760px) {
  #cohortRomiView .cohort-kpi-grid {
    grid-template-columns: repeat(11, minmax(0, 1fr));
    gap: 10px;
  }

  #cohortRomiView .cohort-metric {
    padding: 16px 10px;
  }

  #cohortRomiView .cohort-metric strong {
    font-size: 22px;
    letter-spacing: -0.02em;
  }

  #cohortRomiView .cohort-metric:first-child .help-tip::after {
    left: 0;
    right: auto;
    transform: translateX(0) translateY(4px);
  }

  #cohortRomiView .cohort-metric:last-child .help-tip::after {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(4px);
  }

  #cohortRomiView .cohort-metric:first-child .help-tip:hover::after,
  #cohortRomiView .cohort-metric:first-child .help-tip:focus-visible::after,
  #cohortRomiView .cohort-metric:first-child .help-tip.is-open::after,
  #cohortRomiView .cohort-metric:last-child .help-tip:hover::after,
  #cohortRomiView .cohort-metric:last-child .help-tip:focus-visible::after,
  #cohortRomiView .cohort-metric:last-child .help-tip.is-open::after {
    transform: translateX(0) translateY(0);
  }
}

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

  .workspace {
    padding: 22px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    max-width: 100%;
    overflow-x: auto;
  }

  .topbar,
  .split-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    align-items: start;
  }

  .kpi-grid,
  .finance-kpi-grid,
  .cohort-kpi-grid,
  .ledger-kpi-grid,
  .sync-summary,
  .report-kpi-grid,
  .report-smm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-split-grid,
  .ledger-split-grid,
  .site-split-grid {
    grid-template-columns: 1fr;
  }

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

  .panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .panel-heading > span {
    max-width: 100%;
  }

  .indexing-status-badges {
    justify-content: flex-start;
    max-width: 100%;
  }

  .table-wrap,
  .report-table-wrap {
    scrollbar-gutter: stable;
  }

  .chart-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-reset-button {
    align-self: flex-start;
  }

  .table-wrap table {
    min-width: 720px;
  }

  .finance-client-panel table,
  #contractsTable,
  #cohortRomiView .cohort-table-panel table,
  #expensesView .ledger-rows-panel table {
    min-width: 900px;
  }

  .marketing-report {
    max-width: none;
    padding: 20px;
  }

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

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .workspace {
    padding: 18px 14px 24px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 16px;
  }

  .topbar h1 {
    font-size: 26px;
    line-height: 1.12;
  }

  .panel {
    padding: 16px;
  }

  .panel-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .panel-heading > span {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    border-radius: 8px;
  }

  .metric-card {
    min-height: 98px;
    padding: 16px;
  }

  .metric-card strong {
    font-size: 26px;
  }

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

  .telegram-bot-form .primary-button,
  .telegram-bot-form .secondary-button {
    width: 100%;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }

  .nav-item {
    white-space: normal;
  }

  .chart-toolbar {
    gap: 10px;
  }

  .chart-legend {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .chart-legend-static,
  .chart-legend-button {
    flex: 0 0 auto;
  }

  .chart-reset-button {
    width: 100%;
  }

  .chart-scroll {
    margin-inline: -4px;
    padding-inline: 4px;
  }

  .advanced-chart-tooltip {
    max-width: calc(100vw - 48px);
  }

  .kpi-grid,
  .finance-kpi-grid,
  .cohort-kpi-grid,
  .ledger-kpi-grid,
  .sync-summary,
  .report-kpi-grid,
  .report-smm-grid {
    grid-template-columns: 1fr;
  }

  .sync-controls,
  .expense-form,
  .filter-row,
  .compact-field,
  .compact-field input,
  .compact-field select,
  .primary-button,
  .secondary-button,
  .ghost-light-button {
    width: 100%;
  }

  .filter-row {
    align-items: stretch;
    gap: 10px;
  }

  .filter-row .compact-field {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    width: 100%;
  }

  .filter-row .compact-field span {
    align-self: center;
    max-width: 96px;
    white-space: normal;
  }

  .filter-row .compact-field input,
  .filter-row .compact-field select,
  .compact-field input,
  .compact-field select {
    min-width: 0;
  }

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

  #siteLinksView .site-links-form {
    grid-template-columns: 1fr;
  }

  #siteLinksView .site-links-form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .upload-form,
  .finance-upload-row {
    align-items: stretch;
  }

  .table-wrap,
  .telegram-table-wrap,
  .heatmap-wrap,
  .report-table-wrap {
    margin-inline: -2px;
    box-shadow: inset -18px 0 22px -24px rgba(15, 23, 42, 0.45);
  }

  .table-wrap table:not(.telegram-table):not(.heatmap-table) {
    width: max-content;
    min-width: 680px;
    table-layout: auto;
  }

  .table-wrap table:not(.telegram-table):not(.heatmap-table) th,
  .table-wrap table:not(.telegram-table):not(.heatmap-table) td {
    padding: 10px 12px;
    white-space: nowrap;
    overflow-wrap: normal;
  }

  .table-wrap table:not(.telegram-table):not(.heatmap-table) th:first-child,
  .table-wrap table:not(.telegram-table):not(.heatmap-table) td:first-child {
    min-width: 132px;
    max-width: 220px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #managersView .table-wrap table,
  #contractsView .table-wrap table,
  #sourcesView .table-wrap table,
  #reviewsView > .panel:last-child .table-wrap table {
    min-width: 840px;
  }

  .finance-client-panel table,
  #contractsTable,
  #cohortRomiView .cohort-table-panel table,
  #expensesView .ledger-rows-panel table {
    min-width: 840px;
  }

  #sourceDailyView .heatmap-table th:first-child,
  #sourceDailyView .heatmap-table td:first-child,
  #socialsView .telegram-table th:first-child,
  #socialsView .telegram-table td:first-child {
    min-width: 132px;
    max-width: 160px;
  }

  #reviewsView > .panel:last-child td:nth-child(5),
  #reviewsView > .panel:last-child td:nth-child(6) {
    min-width: 240px;
    max-width: 340px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table-action-group {
    justify-content: flex-start;
  }

  .report-cover h2 {
    font-size: 24px;
  }

  .marketing-report {
    gap: 18px;
    padding: 18px 14px;
  }

  .report-section {
    gap: 12px;
  }

  .report-kpi {
    min-height: 104px;
    padding: 14px;
  }

  .report-kpi strong {
    font-size: 28px;
  }

  .report-cover {
    display: grid;
    gap: 10px;
    padding-right: 0;
  }

  #financeView .finance-filter-row .compact-field select,
  #financeView .finance-filter-row .compact-field input,
  #cohortRomiView .cohort-filter-row .compact-field select,
  #cohortRomiView .cohort-filter-row .compact-field input,
  #expensesView .ledger-entry-form .compact-field select,
  #expensesView .ledger-entry-form .compact-field input,
  #expensesView .ledger-filter-row .compact-field select,
  #expensesView .ledger-filter-row .compact-field input,
  #sourcesView .source-filter-row .compact-field input,
  #sourceDailyView .source-filter-row .compact-field input,
  #siteView .site-filter-row .compact-field input,
  #siteSectionView .site-filter-row .compact-field input {
    width: 100%;
  }

  #reportsView .report-filter-row .compact-field input {
    width: 100%;
  }

  #socialsView .socials-sync-row .compact-field,
  #socialsView .socials-sync-row .hint-line {
    width: 100%;
    max-width: none;
  }

  #reportsView .report-control-panel .panel-heading > span,
  #siteView .panel-heading > span,
  #siteSectionView .panel-heading > span,
  #socialsView .panel-heading > span {
    width: 100%;
  }

  .report-logo {
    position: static;
    width: min(150px, 52vw);
    justify-self: end;
  }

  .report-cover {
    grid-template-columns: 1fr;
  }

  .report-smm-grid .report-table td {
    padding: 9px 5px;
    font-size: clamp(11px, 3.25vw, 13px);
  }

  .report-smm-grid .report-table td:first-child {
    width: 20%;
  }

  .report-smm-grid .report-table td:nth-child(2) {
    width: 36%;
  }

  .report-smm-grid .report-table td:nth-child(3) {
    width: 44%;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  *,
  *::before,
  *::after {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    background: #ffffff;
    color: #0f172a;
    font-size: 10px;
    line-height: 1.35;
  }

  .no-print,
  .sidebar,
  .topbar,
  #statusLine {
    display: none !important;
  }

  .app-shell {
    display: block;
    min-height: auto;
  }

  .workspace {
    width: 100%;
    padding: 0 !important;
    overflow: visible !important;
  }

  .view.active {
    display: block !important;
    width: 100%;
  }

  #reportsView {
    gap: 0 !important;
  }

  .marketing-report {
    display: block;
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  .report-cover {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38mm;
    column-gap: 10mm;
    row-gap: 2mm;
    align-items: start;
    align-content: start;
    margin: 0 0 7mm;
    padding: 0 0 5mm;
    border-bottom: 1.5pt solid #0f172a;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-logo {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 38mm !important;
    max-width: 38mm !important;
    justify-self: end;
  }

  .report-cover h2 {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    max-width: none;
    font-size: 24px;
    line-height: 1.15;
  }

  .report-cover p:last-child {
    grid-column: 1;
    grid-row: 2;
    margin: 2mm 0 0;
    max-width: none;
    font-size: 10px;
  }

  .report-cover p:empty {
    display: none;
  }

  .report-section {
    display: block;
    margin: 0 0 7mm;
    padding: 0;
    break-inside: auto;
    page-break-inside: auto;
  }

  .report-section h3 {
    margin: 0 0 3mm;
    font-size: 15px;
    break-after: avoid;
    page-break-after: avoid;
  }

  .report-section h3::before {
    width: 5px;
    height: 17px;
  }

  .report-section h4 {
    margin: 0 0 2mm;
    font-size: 11px;
    break-after: avoid;
    page-break-after: avoid;
  }

  .report-kpi-grid,
  .report-smm-grid {
    gap: 4mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

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

  .report-kpi-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .report-kpi {
    min-height: 25mm;
    padding: 4mm;
    border-radius: 4px;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-kpi span {
    font-size: 9px;
  }

  .report-kpi strong {
    font-size: 22px;
  }

  .report-kpi em {
    font-size: 9px;
  }

  .report-table-wrap {
    overflow: visible !important;
    border-radius: 4px;
  }

  .report-table {
    width: 100%;
    min-width: 0;
    font-size: 9px;
    table-layout: auto;
  }

  .report-table thead {
    display: table-header-group;
  }

  .report-table tfoot {
    display: table-footer-group;
  }

  .report-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-table th,
  .report-table td {
    min-width: 0;
    padding: 5px 6px;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .report-table td:nth-child(n+2),
  .report-table th:nth-child(n+2) {
    white-space: normal;
  }

  .report-table th {
    font-size: 8.5px;
  }

  .report-table tbody tr:hover td {
    background: transparent;
  }

  .delta {
    min-width: 0;
  }
}
