:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --ink: #20262d;
  --muted: #67717d;
  --line: #dfe5ea;
  --line-strong: #c7d0d8;
  --green: #1d7b63;
  --green-soft: #e7f3ef;
  --blue: #2f6bd3;
  --blue-soft: #e9f0ff;
  --red: #c84e3a;
  --red-soft: #fdecea;
  --amber: #9a6b17;
  --amber-soft: #fff2d8;
  --violet: #7454b8;
  --violet-soft: #f0ebff;
  --shadow: 0 12px 28px rgba(31, 41, 55, 0.08);
  --shadow-hover: 0 16px 34px rgba(31, 41, 55, 0.12);
  --motion-fast: 150ms ease;
  --motion-normal: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
}

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

.shell.is-sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 16px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.shell.is-sidebar-collapsed .sidebar {
  display: none;
}

.sidebar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: start;
}

.brand {
  display: grid;
  padding: 4px 4px 16px;
}

.sidebar-toggle,
.reveal-sidebar {
  width: 38px;
  height: 38px;
  padding: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-button {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    background var(--motion-fast),
    color var(--motion-fast),
    transform var(--motion-fast);
}

.nav-button:hover {
  background: var(--surface-2);
  transform: translateX(2px);
}

.nav-button.is-active {
  background: #ddebe7;
  color: #0e4f40;
  font-weight: 700;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast),
    color var(--motion-fast),
    transform var(--motion-fast);
}

.nav-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-button.is-active .nav-icon {
  border-color: #9ac9bc;
  background: #f8fffc;
  color: #0e4f40;
}

.nav-button:hover .nav-icon {
  transform: scale(1.04);
}

.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.sidebar-footer {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.source-line {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(220px, 640px) 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 249, 0.92);
  backdrop-filter: blur(12px);
}

.search {
  display: grid;
  grid-column: 1 / 3;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition:
    border-color var(--motion-fast),
    box-shadow var(--motion-fast),
    background var(--motion-fast);
}

.topbar .reveal-sidebar + .search {
  grid-column: 2 / 3;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-symbol {
  color: var(--muted);
  font-weight: 700;
}

.user-chip {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.content {
  min-width: 0;
  display: grid;
  gap: 22px;
  padding: 22px;
}

.content.is-view-entering > * {
  animation: view-enter var(--motion-normal) both;
}

.content.is-view-entering > *:nth-child(2) {
  animation-delay: 35ms;
}

.content.is-view-entering > *:nth-child(3) {
  animation-delay: 70ms;
}

.content.is-view-entering > *:nth-child(4) {
  animation-delay: 105ms;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.page-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.page-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.button,
.icon-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast),
    color var(--motion-fast),
    box-shadow var(--motion-fast),
    transform var(--motion-fast);
}

.button:hover,
.icon-button:hover {
  border-color: #aeb9c3;
  background: #f9fafb;
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.08);
  transform: translateY(-1px);
}

.button:active,
.icon-button:active {
  transform: translateY(0);
}

.button.primary {
  border-color: #176a55;
  background: var(--green);
  color: #fff;
}

.button.primary:hover {
  background: #176a55;
}

.button.danger {
  border-color: #d7a59d;
  color: var(--red);
}

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

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  text-align: left;
  font-weight: 800;
  transition:
    color var(--motion-fast),
    opacity var(--motion-fast),
    transform var(--motion-fast);
}

.link-button:hover {
  color: #174fa5;
  text-decoration: underline;
}

.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  color: currentColor;
}

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

.metric-card {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    border-color var(--motion-normal),
    box-shadow var(--motion-normal),
    transform var(--motion-normal),
    background var(--motion-normal);
}

.metric-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 10px;
  font-size: 27px;
  line-height: 1;
  font-weight: 850;
}

.metric-foot {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.metric-card.good {
  border-color: #bddfd5;
  background: linear-gradient(180deg, #ffffff 0%, #f2fbf8 100%);
}

.metric-card.warn {
  border-color: #f1d398;
  background: linear-gradient(180deg, #ffffff 0%, #fff8e7 100%);
}

.metric-card.bad {
  border-color: #efb9b0;
  background: linear-gradient(180deg, #ffffff 0%, #fff3f1 100%);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition:
    border-color var(--motion-normal),
    box-shadow var(--motion-normal);
}

.panel:hover {
  border-color: #d4dee5;
  box-shadow: var(--shadow-hover);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  font-weight: 800;
}

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

.panel-body {
  padding: 16px;
}

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

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

.select,
.input,
.textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  outline: 0;
  transition:
    border-color var(--motion-fast),
    box-shadow var(--motion-fast),
    background var(--motion-fast);
}

.select:focus,
.input:focus,
.textarea:focus,
.search:focus-within {
  border-color: #9ac9bc;
  box-shadow: 0 0 0 3px rgba(29, 123, 99, 0.12);
}

.select,
.input {
  padding: 8px 10px;
}

.input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
}

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

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

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

th,
td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  overflow-wrap: anywhere;
  transition:
    background-color var(--motion-fast),
    color var(--motion-fast),
    box-shadow var(--motion-fast);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  font-weight: 800;
  text-transform: uppercase;
}

tr:hover td {
  background: #f7fbf9;
}

tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 rgba(29, 123, 99, 0.35);
}

tr.is-selected td {
  background: #f0f7f4;
}

tr.clickable-row {
  cursor: pointer;
}

.content.is-view-entering tbody tr,
.content.is-view-entering .mobile-card,
.content.is-view-entering .calendar-order-card,
.content.is-view-entering .transaction-card {
  animation: row-enter 180ms ease both;
}

.content.is-view-entering tbody tr:nth-child(1),
.content.is-view-entering .mobile-card:nth-child(1),
.content.is-view-entering .calendar-order-card:nth-child(1),
.content.is-view-entering .transaction-card:nth-child(1) {
  animation-delay: 35ms;
}

.content.is-view-entering tbody tr:nth-child(2),
.content.is-view-entering .mobile-card:nth-child(2),
.content.is-view-entering .calendar-order-card:nth-child(2),
.content.is-view-entering .transaction-card:nth-child(2) {
  animation-delay: 50ms;
}

.content.is-view-entering tbody tr:nth-child(3),
.content.is-view-entering .mobile-card:nth-child(3),
.content.is-view-entering .calendar-order-card:nth-child(3),
.content.is-view-entering .transaction-card:nth-child(3) {
  animation-delay: 65ms;
}

.content.is-view-entering tbody tr:nth-child(4),
.content.is-view-entering .mobile-card:nth-child(4),
.content.is-view-entering .calendar-order-card:nth-child(4),
.content.is-view-entering .transaction-card:nth-child(4) {
  animation-delay: 80ms;
}

.content.is-view-entering tbody tr:nth-child(5),
.content.is-view-entering .mobile-card:nth-child(5),
.content.is-view-entering .calendar-order-card:nth-child(5),
.content.is-view-entering .transaction-card:nth-child(5) {
  animation-delay: 95ms;
}

.content.is-view-entering tbody tr:nth-child(n + 6),
.content.is-view-entering .mobile-card:nth-child(n + 6),
.content.is-view-entering .calendar-order-card:nth-child(n + 6),
.content.is-view-entering .transaction-card:nth-child(n + 6) {
  animation-delay: 110ms;
}

.client-click-cell {
  cursor: pointer;
}

.client-click-cell:hover {
  background: #eef6ff !important;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.client-cell {
  min-width: 0;
}

.nickname-cell {
  min-width: 0;
}

.task-cell {
  min-width: 0;
  max-width: 520px;
}

.line-clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.small {
  font-size: 12px;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background var(--motion-fast),
    color var(--motion-fast),
    transform var(--motion-fast);
}

.status-pill:hover,
.tag:hover {
  transform: translateY(-1px);
}

.status-new {
  color: #2559b8;
  background: var(--blue-soft);
}

.status-work {
  color: #12624f;
  background: var(--green-soft);
}

.status-ready {
  color: #76500e;
  background: var(--amber-soft);
}

.status-done {
  color: #59626c;
  background: #edf0f2;
}

.status-cancel {
  color: #a23c2c;
  background: var(--red-soft);
}

.tag {
  color: #3f4b57;
  background: var(--surface-2);
}

.tag.green {
  color: #0f5949;
  background: var(--green-soft);
}

.tag.red {
  color: #a23c2c;
  background: var(--red-soft);
}

.tag.amber {
  color: #76500e;
  background: var(--amber-soft);
}

.stack {
  display: grid;
  gap: 12px;
}

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

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

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

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

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

.mini-name {
  min-width: 0;
  font-weight: 700;
}

.transaction-list {
  display: grid;
  gap: 10px;
}

.transaction-card {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast),
    box-shadow var(--motion-fast),
    filter var(--motion-fast),
    transform var(--motion-fast);
}

.transaction-card:hover {
  filter: brightness(0.985);
  box-shadow: 0 10px 22px rgba(31, 41, 55, 0.1);
  transform: translateY(-1px);
}

.transaction-card.income {
  border-color: #bddfd5;
  background: #f5fbf8;
}

.transaction-card.expense {
  border-color: #efb9b0;
  background: #fff3f1;
}

.transaction-card-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.transaction-card-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.transaction-type {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.transaction-type.income {
  color: #0f5949;
  background: #dcefe9;
}

.transaction-type.expense {
  color: #a23c2c;
  background: #f9dcd7;
}

.transaction-card-description {
  min-width: 0;
  color: #2862c4;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: normal;
}

.transaction-card-meta {
  color: var(--muted);
  font-size: 12px;
}

.transaction-card-amount {
  align-self: start;
  white-space: nowrap;
}

.progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transform-origin: left center;
  transition: width 220ms ease, transform 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.category-row {
  margin-inline: -6px;
  padding-inline: 6px;
  border-radius: 8px;
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.category-row:hover {
  background: #f5fbf8;
  box-shadow: inset 3px 0 0 var(--green);
  transform: translateX(3px);
}

.category-row:hover .mini-name {
  color: #0f5949;
}

.category-row:hover .category-progress > span {
  transform: scaleX(1.025);
  box-shadow: 0 0 0 3px rgba(61, 128, 101, 0.12);
}

.bar-chart {
  min-height: 210px;
  display: grid;
  grid-template-columns: repeat(var(--bars, 6), minmax(42px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 18px 8px 6px;
}

.bar-group {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 8px;
  align-items: end;
  padding: 8px 7px 6px;
  border-radius: 8px;
  cursor: default;
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.bar-group:hover {
  z-index: 2;
  background: #f5fbf8;
  box-shadow: 0 14px 30px rgba(35, 49, 64, 0.12);
  transform: translateY(-4px);
}

.bar-stack {
  height: 164px;
  display: grid;
  grid-template-rows: 1fr;
  align-items: end;
  gap: 3px;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 180ms ease;
}

.bar-group:hover .bar-stack {
  border-color: #a8cfc3;
}

.bar {
  min-height: 4px;
  border-radius: 5px 5px 0 0;
  transform-origin: bottom center;
  animation: bar-pop 520ms cubic-bezier(0.2, 0.85, 0.25, 1) backwards;
  animation-delay: calc(var(--bar-index, 0) * 70ms);
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.bar-group:hover .bar {
  filter: saturate(1.12);
  transform: scaleY(1.08);
}

.bar.income {
  background: linear-gradient(180deg, #4c9a7f 0%, var(--green) 100%);
}

.bar.expense {
  background: linear-gradient(180deg, #de7665 0%, var(--red) 100%);
}

.bar.profit {
  background: linear-gradient(180deg, #668bdd 0%, var(--blue) 100%);
}

.bar-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  transition: color 180ms ease, font-weight 180ms ease;
}

.bar-group:hover .bar-label {
  color: var(--ink);
  font-weight: 850;
}

.bar-tooltip {
  position: absolute;
  left: 50%;
  top: 12px;
  min-width: 190px;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 18px 36px rgba(35, 49, 64, 0.18);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px) scale(0.96);
  transform-origin: top center;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.bar-group:hover .bar-tooltip {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.bar-group:first-child .bar-tooltip {
  left: 0;
  transform: translate(0, 8px) scale(0.96);
  transform-origin: top left;
}

.bar-group:first-child:hover .bar-tooltip {
  transform: translate(0, 0) scale(1);
}

.bar-group:last-child .bar-tooltip {
  right: 0;
  left: auto;
  transform: translate(0, 8px) scale(0.96);
  transform-origin: top right;
}

.bar-group:last-child:hover .bar-tooltip {
  transform: translate(0, 0) scale(1);
}

@keyframes bar-pop {
  from {
    transform: scaleY(0.12);
    opacity: 0.4;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes row-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

.pipeline {
  display: grid;
  gap: 12px;
}

.pipeline-row {
  display: grid;
  grid-template-columns: 150px 1fr 46px;
  gap: 10px;
  align-items: center;
}

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

.attention-item {
  min-height: 84px;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast),
    box-shadow var(--motion-fast),
    transform var(--motion-fast);
}

.attention-item:hover {
  border-color: #bddfd5;
  background: #f7fffc;
  box-shadow: 0 10px 22px rgba(31, 41, 55, 0.08);
  transform: translateY(-2px);
}

.attention-check {
  width: 100%;
  justify-content: center;
  border: 0;
  cursor: pointer;
}

.attention-check:hover {
  filter: brightness(0.98);
}

.attention-number {
  font-size: 22px;
  font-weight: 850;
}

.analytics-toolbar {
  align-items: end;
}

.analytics-toolbar .field {
  flex: 1 1 156px;
  min-width: 150px !important;
}

.analytics-toolbar .button {
  align-self: end;
}

.filter-panel .panel-body {
  padding: 14px 16px;
}

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

.filter-grid .field {
  min-width: 0 !important;
}

.filter-grid .button {
  width: 100%;
}

.active-filter-line {
  margin-top: 10px;
}

.order-table th,
.order-table td,
.client-table th,
.client-table td,
.payment-table th,
.payment-table td,
.expense-table th,
.expense-table td,
.cashflow-table th,
.cashflow-table td {
  padding: 10px 9px;
  font-size: 13px;
}

.client-table th {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.order-table th:nth-child(1),
.order-table td:nth-child(1) {
  width: 64px;
}

.client-table th:nth-child(3),
.client-table td:nth-child(3) {
  width: 78px;
}

.order-table th:nth-child(2),
.order-table td:nth-child(2),
.client-table th:nth-child(1),
.client-table td:nth-child(1) {
  width: 20%;
}

.order-table th:nth-child(3),
.order-table td:nth-child(3) {
  width: 13%;
}

.order-table th:nth-child(4),
.order-table td:nth-child(4) {
  width: 34%;
}

.order-table th:nth-child(5),
.order-table td:nth-child(5) {
  width: 16%;
}

.order-table th:nth-child(6),
.order-table td:nth-child(6) {
  width: 17%;
}

.orders-grid:not(.is-detail-closed) .order-table th:nth-child(n + 5),
.orders-grid:not(.is-detail-closed) .order-table td:nth-child(n + 5),
.client-table th:nth-child(2),
.client-table td:nth-child(2),
.client-table th:nth-child(10),
.client-table td:nth-child(10),
.client-table th:nth-child(11),
.client-table td:nth-child(11),
.client-table th:nth-child(12),
.client-table td:nth-child(12) {
  display: none;
}

.client-table th:nth-child(4),
.client-table td:nth-child(4),
.client-table th:nth-child(5),
.client-table td:nth-child(5),
.client-table th:nth-child(6),
.client-table td:nth-child(6),
.client-table th:nth-child(7),
.client-table td:nth-child(7),
.client-table th:nth-child(8),
.client-table td:nth-child(8),
.client-table th:nth-child(9),
.client-table td:nth-child(9) {
  width: 11%;
}

.avito-form .field-grid {
  gap: 8px;
}

.avito-form .input {
  padding-inline: 8px;
}

.avito-workspace {
  align-items: start;
}

.avito-manual-grid,
.avito-input-grid,
.avito-summary-list {
  display: grid;
  gap: 12px;
}

.avito-manual-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

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

.avito-form-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.avito-form-summary span {
  padding: 6px 8px;
  border-radius: 999px;
  background: #eef4f2;
}

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

.avito-summary-row {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.avito-summary-row.is-selected {
  border-color: #9ac9bc;
  background: #f3fbf8;
}

.avito-summary-head {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
}

.avito-summary-head strong,
.avito-summary-head span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.avito-summary-head span {
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

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

.avito-summary-stats span {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f4f7f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.order-state-stack,
.order-money-stack {
  display: grid;
  gap: 6px;
}

.order-state-stack {
  justify-items: start;
}

.money-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}

.money-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.analytics-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.analytics-card-grid,
.analytics-row-grid,
.pnl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.analytics-mini-grid,
.partner-grid,
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.analytics-card,
.analytics-row-card,
.partner-card,
.pnl-card,
.scenario-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.analytics-subpanel,
.calculator-box {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.analytics-card.good {
  border-color: #bddfd5;
  background: #f5fbf8;
}

.analytics-card.warn {
  border-color: #f1d398;
  background: #fff9ea;
}

.analytics-card.bad {
  border-color: #efb9b0;
  background: #fff3f1;
}

.analytics-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analytics-value,
.partner-balance,
.forecast-value,
.calculator-price {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.05;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.forecast-value,
.calculator-price {
  font-size: 30px;
}

.analytics-foot {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.analytics-lines {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

.analytics-line,
.analytics-list-row,
.analytics-row-head,
.partner-head,
.pnl-head {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.analytics-line {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.analytics-line:last-child {
  border-bottom: 0;
}

.analytics-line span,
.analytics-list-row > div,
.analytics-row-head strong,
.partner-head > div,
.pnl-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.analytics-line span {
  color: var(--muted);
  font-size: 13px;
}

.analytics-line strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.analytics-list-row {
  width: 100%;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}

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

.analytics-list-row.as-button {
  cursor: pointer;
}

.analytics-list-row.as-button:hover {
  color: var(--blue);
}

.forecast-box,
.calculator-main {
  padding: 14px;
  border: 1px solid #bddfd5;
  border-radius: var(--radius);
  background: #f5fbf8;
}

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

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

.client-order-grid,
.avito-month-grid,
.avito-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.client-order-card,
.avito-form,
.avito-total-box {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: inherit;
  text-align: left;
}

.client-order-card {
  cursor: pointer;
}

.client-order-card:hover {
  border-color: #9ac9bc;
  background: #f7fffc;
}

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

.avito-month-card .panel-body {
  display: grid;
  gap: 12px;
}

.empty {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.7fr);
  gap: 16px;
}

.orders-grid.is-detail-closed {
  grid-template-columns: minmax(0, 1fr);
}

.order-detail-panel .panel-head .toolbar {
  flex-wrap: nowrap;
}

.detail-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.quick-status-box {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.quick-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-status-chip {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast),
    color var(--motion-fast),
    transform var(--motion-fast),
    box-shadow var(--motion-fast);
}

.quick-status-chip:hover {
  border-color: #9ac9bc;
  color: #0e4f40;
  box-shadow: 0 6px 14px rgba(31, 41, 55, 0.08);
  transform: translateY(-1px);
}

.quick-status-chip.is-active {
  border-color: #9ac9bc;
  background: var(--green-soft);
  color: #0e4f40;
  cursor: default;
}

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

.calendar-group.red {
  border-color: #efb9b0;
}

.calendar-group.amber {
  border-color: #f1d398;
}

.calendar-group.green {
  border-color: #bddfd5;
}

.calendar-list,
.mobile-card-list {
  display: grid;
  gap: 10px;
}

.calendar-order-card,
.mobile-card {
  min-width: 0;
  display: grid;
  gap: 9px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast),
    box-shadow var(--motion-fast),
    transform var(--motion-fast);
}

.calendar-order-card {
  cursor: pointer;
  font: inherit;
}

.calendar-order-card:hover,
.mobile-card:hover {
  border-color: #9ac9bc;
  background: #f7fffc;
  box-shadow: 0 10px 22px rgba(31, 41, 55, 0.08);
  transform: translateY(-2px);
}

.calendar-order-head,
.mobile-card-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.calendar-order-task {
  color: var(--ink);
}

.calendar-order-meta,
.mobile-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.calendar-order-money,
.mobile-money-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.calendar-order-money span,
.mobile-money-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mobile-money-grid > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.mobile-card-list {
  display: none;
  padding: 12px;
}

.mobile-card.is-selected {
  border-color: #9ac9bc;
  background: #f0f7f4;
}

.client-strip {
  margin: -6px;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background var(--motion-fast),
    transform var(--motion-fast);
}

.client-strip:hover {
  background: #eef6ff;
  transform: translateX(2px);
}

.strong-link {
  color: var(--ink);
}

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

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

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

.dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.2);
}

.dialog::backdrop {
  background: rgba(24, 34, 44, 0.42);
}

.dialog-head,
.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog-title {
  margin: 0;
  font-size: 18px;
}

.dialog-body {
  padding: 18px;
  max-height: calc(100vh - 178px);
  overflow: auto;
}

.client-dialog {
  width: min(1080px, calc(100vw - 28px));
}

.login-panel .button {
  width: 100%;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid #efb9b0;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: #a23c2c;
  font-size: 13px;
  font-weight: 700;
}

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

.sheet-tab {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.sheet-tab.is-active {
  border-color: #9ac9bc;
  background: var(--green-soft);
  color: #0e4f40;
  font-weight: 800;
}

.raw-table td,
.raw-table th {
  min-width: 120px;
  max-width: 360px;
}

.raw-table .row-index {
  min-width: 54px;
  color: var(--muted);
  background: #f8fafb;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid #9ac9bc;
  border-radius: var(--radius);
  background: #f7fffc;
  color: #0e4f40;
  box-shadow: var(--shadow);
  font-weight: 700;
}

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

.boot-panel {
  width: min(520px, 100%);
}

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

  .sidebar {
    position: relative;
    height: auto;
    display: grid;
    gap: 12px;
  }

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

  .sidebar-footer {
    position: static;
  }

  .work-grid,
  .detail-grid,
  .analytics-two,
  .calendar-board {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .analytics-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .split,
  .three,
  .field-grid,
  .attention-grid,
  .analytics-mini-grid,
  .partner-grid,
  .scenario-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .search,
  .topbar .reveal-sidebar + .search {
    grid-column: auto;
  }

  .user-chip {
    justify-self: stretch;
    justify-content: space-between;
  }

  .sidebar {
    padding: 12px;
    gap: 10px;
  }

  .sidebar-head {
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .brand {
    padding-bottom: 6px;
  }

  .brand-title {
    font-size: 17px;
  }

  .nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .nav-button {
    width: max-content;
    min-width: 136px;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    padding: 9px;
  }

  .nav-button > span:nth-child(2) {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  .page-head {
    display: grid;
    gap: 6px;
  }

  .page-title {
    font-size: 24px;
    overflow-wrap: anywhere;
  }

  .page-note {
    font-size: 13px;
  }

  .toolbar {
    justify-content: stretch;
  }

  .button,
  .select,
  .input {
    width: 100%;
  }

  .content {
    padding: 16px;
    gap: 16px;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .desktop-table {
    display: none;
  }

  .mobile-card-list {
    display: grid;
  }

  .calendar-order-head,
  .mobile-card-head {
    display: grid;
    gap: 6px;
  }

  .calendar-order-money,
  .mobile-money-grid {
    grid-template-columns: 1fr;
  }

  .dialog {
    width: min(920px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
  }

  .dialog-head,
  .dialog-foot {
    flex-wrap: wrap;
    padding: 14px;
  }

  .dialog-body {
    padding: 14px;
    max-height: calc(100vh - 164px);
  }

  .dialog-foot .button {
    flex: 1 1 160px;
  }

  .metric-grid,
  .analytics-card-grid,
  .analytics-row-grid,
  .pnl-grid {
    grid-template-columns: 1fr;
  }
}
