:root {
  color-scheme: light;
  --bg: #ede4d7;
  --panel: #fffaf3;
  --line: #d9cec0;
  --text: #252722;
  --muted: #59665c;
  --accent: #f46c40;
  --accent-dark: #b85636;
  --warn: #9f6a43;
  --chrome: #202720;
  --chrome-dark: #151412;
  --chrome-soft: #323b35;
  --chrome-line: rgba(205, 194, 176, 0.22);
  --chrome-hot: #59665c;
  --brand-warm: #cdc2b0;
  --brand-paper: #e9e3dd;
  --brand-surface: #f4efe8;
  --brand-green-soft: rgba(89, 102, 92, 0.14);
  --brand-partial: #fff0cf;
}

/* Current income statistics and collapsible expense panels. */
.expense-categories-panel.is-collapsed > .expense-categories-body,
.work-types-panel.is-collapsed > .work-types-body {
  display: none !important;
}

.income-line-chart { margin-top: 12px; min-width: 0; }
.income-line-chart svg { display: block; width: 100%; height: 184px; overflow: visible; }
.income-stat-card .income-line-chart svg { height: 116px; }
.income-chart-axis { stroke: var(--line); stroke-width: 1; }
.income-chart-line { fill: none; stroke: var(--chrome-hot); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.income-chart-point { fill: #fff; stroke: var(--chrome-hot); stroke-width: 2; cursor: pointer; transition: r 120ms ease, fill 120ms ease; }
.income-chart-point:hover, .income-chart-point:focus, .income-chart-point.is-selected { fill: var(--chrome-hot); outline: none; }
.income-chart-point.is-peak { fill: #fff3dd; stroke-width: 3; }
.income-chart-point.is-peak:hover, .income-chart-point.is-peak.is-selected { fill: var(--chrome-hot); }
.income-line-chart--margin .income-chart-line, .income-line-chart--margin .income-chart-point { stroke: #4f8a5a; }
.income-line-chart--margin .income-chart-point:hover, .income-line-chart--margin .income-chart-point:focus, .income-line-chart--margin .income-chart-point.is-selected, .income-line-chart--margin .income-chart-point.is-peak:hover, .income-line-chart--margin .income-chart-point.is-peak.is-selected { fill: #4f8a5a; }
.income-chart-label { fill: var(--muted); font-size: 12px; }
.income-chart-peak-label { fill: var(--text); font-size: 12px; font-weight: 700; }
.income-chart-value-label { fill: var(--text); font-size: 11px; font-weight: 680; paint-order: stroke; stroke: #fffdf9; stroke-width: 4px; stroke-linejoin: round; }
.income-chart-selection { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 4px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fbf8f4; }
.income-chart-selection span { color: var(--muted); }
.income-chart-selection b { white-space: nowrap; }
.income-line-chart--empty { min-height: 108px; display: grid; place-items: center; color: var(--muted); border-bottom: 1px solid var(--line); }
.income-stats-dialog .work-table tr[data-income-chart-row] { cursor: pointer; }
.income-stats-dialog .work-table tr.is-selected td { background: #fff1e8; }
#formDialog.income-stats-dialog { width: min(1040px, calc(100vw - 48px)); max-height: min(780px, calc(100vh - 48px)); }
#formDialog.income-stats-dialog #formBody { padding: 18px 20px 20px; max-height: calc(100vh - 118px); }
.modal-form.income-stats-dialog { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.income-stats-overview { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(300px, auto) minmax(190px, 1fr); align-items: center; gap: 20px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 6px; background: #fffdf9; }
.income-stats-value span, .income-stats-chart-head span, .income-stats-peak span { display: block; color: var(--muted); font-size: 12px; }
.income-stats-value strong { display: block; margin-top: 2px; color: var(--text); font-size: 30px; line-height: 1; }
.income-stats-value b { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; font-weight: 400; }
.income-period-tabs { display: flex; gap: 0; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #f7f2eb; }
.income-period-tabs button { min-width: 78px; min-height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); padding: 0 12px; }
.income-period-tabs .active { background: var(--chrome-soft); color: #fff; }
.income-stats-controls { display: flex; align-items: end; gap: 8px; }
.income-stats-scope { display: grid; gap: 2px; color: var(--muted); font-size: 12px; }
.income-stats-scope select { min-width: 150px; min-height: 34px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--text); padding: 0 28px 0 9px; }
.income-stats-chart-panel { padding: 16px 20px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fffdf9; }
.income-stats-chart-head { display: flex; align-items: baseline; gap: 8px; }
.income-stats-chart-head b, .income-stats-peak b { display: block; margin-top: 2px; font-size: 16px; }
.income-stats-overview .income-stats-peak { text-align: right; }
.income-stats-peak small { display: block; color: var(--muted); font-size: 12px; }
.income-stats-chart-panel .income-line-chart { margin-top: 5px; }
.income-stats-chart-panel .income-line-chart svg { height: 340px; }
.income-stats-history { border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.income-stats-history summary { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 12px; cursor: pointer; color: var(--text); font-weight: 680; }
.income-stats-history summary small { min-width: 24px; border-radius: 9px; background: var(--brand-surface); color: var(--muted); padding: 2px 7px; text-align: center; }
.income-stats-history-table { max-height: 212px; overflow: auto; border-top: 1px solid var(--line); }
.income-stats-history .work-table th { position: sticky; top: 0; z-index: 1; }

@media (max-width: 680px) {
  #formDialog.income-stats-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  #formDialog.income-stats-dialog #formBody { padding: 12px; max-height: calc(100vh - 84px); }
  .income-stats-overview { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .income-stats-controls { align-items: stretch; flex-wrap: wrap; }
  .income-stats-scope { flex: 1 1 100%; }
  .income-stats-scope select { width: 100%; }
  .income-stats-overview .income-stats-peak { text-align: left; }
  .income-period-tabs { width: 100%; }
  .income-period-tabs button { flex: 1; min-width: 0; }
  .income-stats-value strong { font-size: 25px; }
  .income-stats-chart-panel { padding: 12px 10px 8px; }
  .income-stats-chart-panel .income-line-chart svg { height: 210px; }
  .income-chart-label { font-size: 10px; }
}

@font-face {
  font-family: "Akrobat";
  src: url("/assets/fonts/Akrobat-Regular.otf") format("opentype");
  font-weight: 400;
}

@font-face {
  font-family: "Akrobat";
  src: url("/assets/fonts/Akrobat-SemiBold.otf") format("opentype");
  font-weight: 680;
}

@font-face {
  font-family: "Akrobat";
  src: url("/assets/fonts/Akrobat-ExtraBold.otf") format("opentype");
  font-weight: 800;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg);
  color: var(--text);
  font: 16px/1.3 Akrobat, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  width: 100%;
}

body.booting .app-header,
body.booting .workspace {
  opacity: 0;
  pointer-events: none;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  gap: 22px;
  align-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 40%, rgba(89, 102, 92, 0.18), transparent 34%),
    linear-gradient(135deg, #202720, #151412);
  color: #fff;
}

body:not(.booting):not(.app-loading) .boot-screen {
  display: none;
}

body.app-loading:not(.booting) .boot-screen {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

body.app-loading:not(.booting) .boot-screen {
  align-content: center;
  gap: 8px;
  color: var(--chrome);
}

body.app-loading:not(.booting) .boot-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: none;
  padding: 0;
  text-align: left;
}

body.app-loading:not(.booting) .boot-logo {
  width: 34px;
  height: 46px;
  filter: invert(25%) sepia(12%) saturate(610%) hue-rotate(70deg) brightness(88%);
  animation-duration: 1.25s;
}

body.app-loading:not(.booting) .boot-card strong {
  font-size: 22px;
  color: var(--chrome);
}

body.app-loading:not(.booting) .boot-card span {
  display: none;
}

body.app-loading:not(.booting) .boot-progress {
  width: 180px;
  height: 3px;
  background: rgba(89, 102, 92, 0.18);
  box-shadow: 0 1px 5px rgba(21, 20, 18, 0.08);
}

body.auth-loading .login-surface {
  opacity: 0;
  pointer-events: none;
}

.boot-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 520px;
  text-align: center;
}

.boot-logo {
  width: 72px;
  height: 88px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  animation: boot-breathe 1.45s ease-in-out infinite;
}

.boot-card strong,
.boot-card span {
  display: block;
}

.boot-card strong {
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
}

.boot-card span {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 18px;
  line-height: 1.35;
}

.boot-progress {
  width: min(280px, 70vw);
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(233, 227, 221, 0.16);
}

.boot-progress span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: boot-progress 1.15s ease-in-out infinite;
}

@keyframes boot-breathe {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-9px);
  }
}

@keyframes boot-progress {
  0% {
    transform: translateX(-115%);
  }
  100% {
    transform: translateX(275%);
  }
}

button,
input,
select {
  font: inherit;
}

.app-header {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  overflow: hidden;
  background: var(--chrome);
  color: #fff;
  border-bottom: 1px solid #0f130f;
}

.login-mode .app-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.login-mode .brand-row {
  grid-template-columns: 1fr;
}

.login-mode .icon-strip,
.login-mode .top-status,
.login-mode .topbar,
.login-mode .pager {
  display: none;
}

.brand-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(142px, auto) minmax(0, 1fr) minmax(0, auto);
  align-items: stretch;
  gap: 8px;
  padding: 4px 10px;
  background: linear-gradient(180deg, #202720, var(--chrome-dark));
  min-width: 0;
  max-width: 100%;
}

.brand-row.has-home-week {
  grid-template-columns: minmax(142px, auto) max-content minmax(0, 1fr) minmax(0, auto);
}

.brand-row.has-home-week > .week-switcher {
  align-self: stretch;
  min-height: 42px;
  border-left: 1px solid var(--chrome-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
}

.brand:hover,
.brand:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.brand:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 2px;
}

.brand-logo {
  width: 28px;
  height: 38px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: none;
  line-height: 1;
}

.brand small {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.brand small,
.mini-stat span {
  color: #b8c2cc;
}

.top-status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: #cbd5de;
  font-size: 14px;
  min-width: 0;
  max-width: 420px;
  overflow: hidden;
}

.top-status span {
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-status b {
  flex: 1 1 auto;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(233, 227, 221, 0.12);
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-switch {
  min-width: 0;
}

.session-switch select {
  max-width: 230px;
  height: 30px;
  border: 1px solid rgba(233, 227, 221, 0.22);
  border-radius: 4px;
  background: rgba(233, 227, 221, 0.12);
  color: #fff;
  padding: 0 8px;
}

.session-switch option {
  color: #1f241f;
}

.audit-bar {
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: 46px;
  padding: 7px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #402d12;
  background: #f4d69a;
  border-bottom: 1px solid #d1aa5d;
  box-shadow: 0 3px 12px rgba(67, 44, 12, 0.14);
}

.audit-bar[hidden] {
  display: none;
}

.audit-bar strong {
  white-space: nowrap;
}

.audit-bar > span {
  flex: 1 1 auto;
}

.audit-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.audit-bar select {
  max-width: 290px;
  height: 32px;
  border: 1px solid #b88d3c;
  border-radius: 4px;
  background: #fffaf0;
  color: #2b251c;
  padding: 0 8px;
}

@media (max-width: 800px) {
  .audit-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
    padding: 8px 12px;
  }

  .audit-bar label {
    justify-content: space-between;
  }

  .audit-bar select {
    min-width: 0;
    flex: 1 1 auto;
  }
}

.icon-strip {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.icon-strip::-webkit-scrollbar {
  display: none;
}

.icon-strip button,
.week-arrow,
.week-setup,
.mark-button,
.mini-icon,
.pin-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid #303030;
  background: transparent;
  color: #aeb6bd;
  cursor: pointer;
  font-weight: 700;
  position: relative;
}

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

.icon-strip button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 20;
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  padding: 7px 9px;
  border-radius: 4px;
  background: #111;
  color: #fff;
  box-shadow: 0 8px 18px rgb(0 0 0 / 28%);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
}

.icon-strip button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  z-index: 21;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #111;
  opacity: 0;
  pointer-events: none;
}

.icon-strip button:hover::after,
.icon-strip button:hover::before,
.icon-strip button:focus-visible::after,
.icon-strip button:focus-visible::before {
  opacity: 1;
}

.icon-strip button:hover,
.icon-strip button.active,
.week-arrow:hover,
.week-setup:hover,
.mark-button:hover,
.mini-icon:hover,
.pin-button:hover {
  background: rgba(244, 108, 64, 0.22);
  color: #fff;
}

.finance-strip {
  display: flex;
  align-items: stretch;
  min-height: 34px;
  min-width: 0;
  max-width: 100vw;
  background: var(--chrome);
  border-top: 1px solid var(--chrome-line);
}

.week-switcher {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  min-width: 0;
  border-left: 1px solid var(--chrome-line);
  border-right: 1px solid var(--chrome-line);
}

.week-switcher .week-arrow {
  width: 36px;
  height: auto;
  min-height: 34px;
  border-left: 0;
  flex: 0 0 36px;
}

.week-switcher .week-label {
  min-width: 0;
  width: max-content;
  padding: 0 10px;
  border-right: 0;
  border-left: 0;
}

.week-switcher .week-arrow:last-child {
  border-left: 0;
}

.week-label {
  min-width: 165px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 12px 0 8px;
  border: 0;
  border-right: 1px solid var(--chrome-line);
  background: transparent;
  color: #d5dde4;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

.archive-table .sort,
.directive-column-sort,
.home-column-sort {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  width: 100%;
  color: inherit;
  font: inherit;
}

.archive-column-label,
.directive-column-label {
  display: block;
  width: 100%;
  text-align: left;
}

.column-sort-arrow {
  flex: 0 0 auto;
  min-width: 12px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  line-height: 1;
}

.archive-table .sort:not(.asc):not(.desc) .column-sort-arrow,
.directive-column-sort:not(.is-active) .column-sort-arrow,
.home-column-sort:not(.is-active) .column-sort-arrow {
  font-size: 14px;
}

.sort.asc .column-sort-arrow,
.sort.desc .column-sort-arrow,
.directive-column-sort.is-active .column-sort-arrow,
.home-column-sort.is-active .column-sort-arrow {
  color: #fff;
}

.directive-column-sort,
.home-column-sort {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.week-label:hover,
.week-label:focus-visible {
  background: rgba(244, 108, 64, 0.18);
  color: #fff;
  outline: none;
}

.module-label {
  display: none;
  align-items: center;
  min-width: 178px;
  flex: 0 0 auto;
  padding: 0 12px;
  border-left: 1px solid var(--chrome-line);
  border-right: 1px solid var(--chrome-line);
  background: #323b35;
  color: #f0f4f7;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tabs {
  flex: 1;
  display: flex;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  overflow-x: auto;
}

.tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #e6ebef;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}

.tabs button:hover,
.tabs button.active {
  background: #59665c;
  border-color: var(--chrome-line);
}

.tabs b {
  display: none;
}

.tabs span {
  white-space: nowrap;
}

.subnav {
  display: grid;
  grid-template-columns: auto auto auto minmax(20px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 12px;
  background: #f7f8f9;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.subnav button {
  min-height: 26px;
  border: 0;
  background: transparent;
  color: #394753;
  padding: 0 8px;
  cursor: pointer;
}

.subnav button:hover {
  color: var(--accent-dark);
}

.mini-stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  background: #eef2f4;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
}

.workspace {
  min-width: 0;
  width: 100%;
  max-width: 100vw;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  min-height: 0;
  height: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 33px;
  padding: 4px 10px;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.topbar > div {
  flex: 1;
  min-width: 0;
}

.topbar .topbar-toggle {
  flex: 0 0 auto;
}

.topbar.is-collapsed {
  min-height: 26px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.topbar.is-collapsed p {
  display: none;
}

.topbar.is-collapsed h1 {
  font-size: 13px;
}

.topbar h1,
.topbar p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.primary,
.pager button,
dialog button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #3a1408;
  font-weight: 700;
  min-height: 26px;
}

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

.actionbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 4px 8px;
  background: #efe6da;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.actionbar .mark-button,
.actionbar .mini-icon,
.actionbar .pin-button {
  width: 27px;
  height: 27px;
  border-left: 1px solid var(--line);
  color: #59665c;
}

.action-left,
.action-right,
.quick-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.action-left {
  flex: 1;
  overflow-x: auto;
}

.action-right {
  justify-content: end;
  min-width: 0;
  overflow-x: auto;
}

.archive-group-control {
  display: none;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.archive-group-control select {
  min-width: 155px;
  min-height: 27px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--text);
  padding: 0 26px 0 7px;
}

body[data-table="orders"] .archive-group-control,
body[data-table="bills"] .archive-group-control {
  display: flex;
}

body[data-table="orders"] [data-view-mode],
body[data-table="bills"] [data-view-mode],
body[data-table="orders"] #expandViewBtn,
body[data-table="bills"] #expandViewBtn,
body[data-table="orders"] .sort-control,
body[data-table="bills"] .sort-control,
body[data-table="orders"] #sortDirectionBtn,
body[data-table="bills"] #sortDirectionBtn,
body[data-table="orders"] #toolbarReset,
body[data-table="bills"] #toolbarReset,
body[data-table="orders"] #printBtn,
body[data-table="bills"] #printBtn,
body[data-table="orders"] #helpBtn,
body[data-table="bills"] #helpBtn,
body[data-table="orders"] #settingsBtn,
body[data-table="bills"] #settingsBtn {
  display: none;
}

.archive-group-row td {
  padding: 0 !important;
  background: #e8eee7 !important;
}

.archive-group-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 36px;
  border: 0;
  padding: 7px 10px;
  background: transparent;
  color: #324338;
  cursor: pointer;
  text-align: left;
}

.archive-group-toggle strong {
  min-width: 180px;
}

.archive-group-toggle b {
  margin-left: auto;
  white-space: nowrap;
}

.archive-group-toggle span:not(.archive-group-arrow) {
  color: #647168;
}

.archive-group-arrow {
  width: 14px;
}

.archive-group-row.is-collapsed td {
  background: #f0f3ef !important;
}

.soft-button,
.add-button,
.quick-filters button {
  min-height: 27px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--text);
  padding: 0 9px;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.add-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #3a1408;
  font-weight: 700;
}

.quick-filters {
  overflow-x: auto;
  padding-left: 2px;
}

.quick-filters button {
  border-color: transparent;
  background: transparent;
  color: #59665c;
}

.quick-filters button.active {
  background: rgba(244, 108, 64, 0.12);
  border-color: rgba(244, 108, 64, 0.34);
  color: var(--text);
}

.scope-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid var(--line);
}

.scope-switch button {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.inline-search {
  width: min(190px, 24vw);
  min-width: 120px;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 27px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: #59665c;
  white-space: nowrap;
}

.sort-control span {
  font-size: 11px;
}

.sort-control select {
  width: 150px;
  max-width: 18vw;
  min-width: 90px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.sort-direction {
  font-weight: 800;
}

.inline-search input {
  min-height: 27px;
  border-radius: 2px;
}

.view-button.active {
  background: rgba(89, 102, 92, 0.12);
}

body.filters-collapsed .filters {
  display: none !important;
}

body.workspace-expanded .app-header {
  display: none;
}

body.workspace-expanded {
  grid-template-rows: minmax(0, 1fr);
}

.mini-icon {
  color: #59665c;
  border-left: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.bottom-summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  grid-template-columns: none;
  position: sticky;
  bottom: 40px;
  z-index: 7;
  box-shadow: 0 -6px 14px rgba(50, 45, 35, 0.06);
}

.bottom-summary .metric {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  white-space: nowrap;
}

.bottom-summary .metric span,
.bottom-summary .metric b {
  display: inline;
  margin: 0;
}

.bottom-summary .metric span {
  font-size: 13px;
}

.bottom-summary .metric b {
  font-size: 14px;
}

.expense-category-search {
  width: min(250px, 26vw);
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.expense-category-search::placeholder {
  color: #788078;
  opacity: 1;
}

.inline-summary {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.metric {
  background: var(--panel);
  padding: 6px 10px;
}

.metric.is-empty {
  background: #f4efe8;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric b {
  display: block;
  margin-top: 1px;
  font-size: 14px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) 150px 170px 160px 150px minmax(150px, 1fr) 145px 145px 110px;
  gap: 7px;
  padding: 7px 8px;
  background: #f8f2eb;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
}

label {
  min-width: 0;
}

label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--text);
  padding: 0 9px;
}

.combo-wrap {
  display: block;
  position: relative;
  width: 100%;
}
.counterparty-create-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; }
.counterparty-create-field .combo-wrap { min-width: 0; }
.counterparty-create-button { min-height: 40px; white-space: nowrap; }
.counterparty-create-button.is-suggested { border-color: #c56f4f; background: #fff1e8; color: #93452f; }
.inline-form-note { padding: 10px 12px; border-radius: 7px; background: #edf3ef; color: #53665b; }

.combo-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 30;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 10px 24px rgb(0 0 0 / 18%);
}

.combo-list[hidden] {
  display: none;
}

.combo-list button {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-bottom: 1px solid #eadfd2;
  background: #fff;
  color: var(--text);
  padding: 6px 9px;
  text-align: left;
  cursor: pointer;
}

.combo-list button:hover,
.combo-list button.active {
  background: rgba(244, 108, 64, 0.12);
}

.combo-list small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.directive-fund-popup {
  position: fixed;
  z-index: 5000;
  max-height: min(260px, calc(100vh - 24px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 12px 28px rgb(0 0 0 / 20%);
}

.directive-fund-popup[hidden] {
  display: none;
}

.directive-fund-popup button {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid #eadfd2;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.directive-fund-popup button:hover,
.directive-fund-popup button:focus {
  background: rgba(244, 108, 64, 0.12);
  outline: none;
}

.directive-fund-popup-empty {
  padding: 9px 10px;
  color: var(--muted);
}

.check {
  display: flex;
  align-items: end;
  gap: 8px;
  padding-bottom: 7px;
}

.check input {
  width: 16px;
  min-height: 16px;
}

.check span {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.compact-check {
  align-self: center;
  justify-self: end;
  padding-bottom: 0;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.table-wrap.detail-view td {
  max-width: 420px;
  white-space: normal;
  line-height: 1.25;
}

table {
  width: 100%;
  min-width: 1320px;
  border-collapse: separate;
  border-spacing: 0;
}

body[data-table="bills"] table,
body[data-table="orders"] table {
  min-width: 1180px;
}

tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: #efe6da;
  border-top: 1px solid #d8c8b6;
  border-right: 1px solid #e6d7c7;
  font-weight: 700;
}

tfoot td.is-label {
  color: #4e564f;
  font-weight: 600;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #323b35;
  border-bottom: 1px solid #202720;
  border-right: 1px solid rgba(233, 227, 221, 0.18);
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
  color: #fff;
}

th.select-col,
td.select-col {
  width: 30px;
  max-width: 30px;
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}

th.select-col input,
td.select-col input {
  width: 14px;
  min-height: 14px;
}

th.actions-col,
td.actions-col {
  width: 156px;
  min-width: 156px;
  max-width: 156px;
  text-align: right;
  position: sticky;
  right: 0;
}

td.actions-col {
  background: inherit;
  padding: 3px 6px;
  white-space: nowrap;
}

td.actions-col button {
  width: 30px;
  height: 30px;
  margin-left: 3px;
  border: 1px solid #d8c9b8;
  border-radius: 7px;
  background: #fffaf3;
  color: #53635a;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 0 rgba(61, 51, 40, 0.06);
}

td.actions-col .action-btn {
  background: #fffaf3;
  border-color: #d8c9b8;
  color: #53635a;
}

td.actions-col .action-btn--approve {
  background: #f4fbf0;
  border-color: #b7d4aa;
  color: #4f8946;
}

td.actions-col .action-btn--money {
  background: #f4fbf0;
  border-color: #b7d4aa;
  color: #4f8946;
}

td.actions-col .action-btn--reject {
  background: #fff7f3;
  border-color: #edcfc5;
  color: #b85d3f;
}

td.actions-col .action-btn--cancel {
  background: #fff7f3;
  border-color: #edcfc5;
  color: #b85d3f;
}

td.actions-col .action-btn--delete {
  background: #fff7f3;
  border-color: #edcfc5;
  color: #b85d3f;
  font-size: 20px;
  font-weight: 400;
}

td.actions-col .action-btn--ghost {
  background: #fffaf3;
  border-color: #d8c9b8;
  color: #53635a;
}

td.actions-col .action-btn--select {
  background: #f4fbf0;
  border-color: #b7d4aa;
  color: #4f8946;
}

td.actions-col .action-btn.is-muted {
  filter: none;
  opacity: 1;
}

td.actions-col button:hover {
  border-color: #bda98f;
  background: #fff6e9;
}

td.actions-col .action-btn {
  cursor: pointer;
}

th button {
  width: 100%;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 0 8px;
  cursor: pointer;
}

th button.asc::after {
  content: none;
}

th button.desc::after {
  content: none;
}

td {
  max-width: 260px;
  padding: 5px 8px;
  border-bottom: 1px solid #eadfd2;
  border-right: 1px solid #f0e7dc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}

body[data-table="bills"] th,
body[data-table="bills"] td,
body[data-table="orders"] th,
body[data-table="orders"] td {
  padding-left: 6px;
  padding-right: 6px;
  font-size: 13px;
}

body[data-table="bills"] td,
body[data-table="orders"] td {
  max-width: 170px;
}

body[data-table="bills"] th.select-col,
body[data-table="bills"] td.select-col,
body[data-table="orders"] th.select-col,
body[data-table="orders"] td.select-col {
  width: 26px;
  max-width: 26px;
  padding-left: 4px;
  padding-right: 4px;
}

body[data-table="bills"] th.actions-col,
body[data-table="bills"] td.actions-col,
body[data-table="orders"] th.actions-col,
body[data-table="orders"] td.actions-col {
  width: 152px;
  min-width: 152px;
  max-width: 152px;
}

body[data-table="bills"] th:nth-child(2),
body[data-table="bills"] td:nth-child(2),
body[data-table="orders"] th:nth-child(2),
body[data-table="orders"] td:nth-child(2) {
  width: 58px;
  max-width: 58px;
}

body[data-table="bills"] th:nth-child(3),
body[data-table="bills"] td:nth-child(3) {
  width: 132px;
  max-width: 132px;
}

body[data-table="bills"] th:nth-child(4),
body[data-table="bills"] td:nth-child(4),
body[data-table="bills"] th:nth-child(5),
body[data-table="bills"] td:nth-child(5) {
  width: 88px;
  max-width: 88px;
}

body[data-table="bills"] th:nth-child(6),
body[data-table="bills"] td:nth-child(6) {
  width: 150px;
  max-width: 150px;
}

body[data-table="bills"] th:nth-child(7),
body[data-table="bills"] td:nth-child(7) {
  width: 92px;
  max-width: 92px;
}

body[data-table="bills"] th:nth-child(8),
body[data-table="bills"] td:nth-child(8) {
  width: 132px;
  max-width: 132px;
}

body[data-table="bills"] th:nth-child(9),
body[data-table="bills"] td:nth-child(9) {
  width: 94px;
  max-width: 94px;
}

body[data-table="bills"] th:nth-child(10),
body[data-table="bills"] td:nth-child(10) {
  width: 98px;
  max-width: 98px;
}

body[data-table="bills"] th:nth-child(11),
body[data-table="bills"] td:nth-child(11),
body[data-table="bills"] th:nth-child(12),
body[data-table="bills"] td:nth-child(12),
body[data-table="bills"] th:nth-child(13),
body[data-table="bills"] td:nth-child(13) {
  width: 88px;
  max-width: 88px;
}

body[data-table="bills"] th:nth-child(14),
body[data-table="bills"] td:nth-child(14) {
  width: 98px;
  max-width: 98px;
}

body[data-table="bills"] th:nth-child(15),
body[data-table="bills"] td:nth-child(15) {
  width: 136px;
  max-width: 136px;
}

body[data-table="bills"] th:nth-child(16),
body[data-table="bills"] td:nth-child(16) {
  width: 116px;
  max-width: 116px;
}

body[data-table="orders"] th:nth-child(3),
body[data-table="orders"] td:nth-child(3) {
  width: 124px;
  max-width: 124px;
}

body[data-table="orders"] th:nth-child(4),
body[data-table="orders"] td:nth-child(4) {
  width: 84px;
  max-width: 84px;
}

body[data-table="orders"] th:nth-child(5),
body[data-table="orders"] td:nth-child(5) {
  width: 168px;
  max-width: 168px;
}

body[data-table="orders"] th:nth-child(6),
body[data-table="orders"] td:nth-child(6) {
  width: 122px;
  max-width: 122px;
}

body[data-table="orders"] th:nth-child(7),
body[data-table="orders"] td:nth-child(7) {
  width: 126px;
  max-width: 126px;
}

body[data-table="orders"] th:nth-child(8),
body[data-table="orders"] td:nth-child(8) {
  width: 110px;
  max-width: 110px;
}

body[data-table="orders"] th:nth-child(9),
body[data-table="orders"] td:nth-child(9) {
  width: 92px;
  max-width: 92px;
}

body[data-table="orders"] th:nth-child(10),
body[data-table="orders"] td:nth-child(10) {
  width: 98px;
  max-width: 98px;
}

body[data-table="orders"] th:nth-child(11),
body[data-table="orders"] td:nth-child(11) {
  width: 92px;
  max-width: 92px;
}

body[data-table="orders"] th:nth-child(12),
body[data-table="orders"] td:nth-child(12),
body[data-table="orders"] th:nth-child(13),
body[data-table="orders"] td:nth-child(13),
body[data-table="orders"] th:nth-child(14),
body[data-table="orders"] td:nth-child(14) {
  width: 84px;
  max-width: 84px;
}

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

tbody tr {
  cursor: default;
}

tbody tr:nth-child(even) {
  background: #fbf7f0;
}

tbody tr:hover {
  background: rgba(244, 108, 64, 0.09);
}

.pager {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 10px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  z-index: 8;
  box-shadow: 0 -6px 14px rgba(50, 45, 35, 0.08);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

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

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.page-size-control select {
  width: 72px;
  min-height: 28px;
  padding: 2px 6px;
}

.pager button {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 13px;
}

#resultInfo {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

dialog {
  width: min(920px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

dialog::backdrop {
  background: rgba(32, 39, 32, 0.45);
  backdrop-filter: blur(2px);
}

.app-notice-dialog {
  width: min(430px, calc(100vw - 32px));
  height: fit-content;
  max-height: calc(100vh - 32px);
  border: 1px solid #d4c6b5;
  border-radius: 14px;
  background: #fffaf2;
  box-shadow: 0 24px 70px rgba(32, 39, 32, 0.28);
}

.app-notice-card {
  display: grid;
  justify-items: center;
  padding: 26px 24px 22px;
  text-align: center;
}

.app-notice-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background: #f9ded1;
  color: #b84927;
  font-size: 29px;
  font-weight: 700;
}

.app-notice-dialog.is-session-ended .app-notice-icon {
  background: #f3e5c5;
  color: #8a6420;
}

.request-error-dialog .request-error-icon {
  background: #f7dfd8;
  color: #a43f25;
}

.request-error-detail {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4ede4;
  color: #655d54 !important;
  font-size: 12px !important;
  overflow-wrap: anywhere;
}

.app-notice-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
}

.app-notice-card p {
  max-width: 340px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.app-notice-actions {
  display: flex;
  width: 100%;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.app-notice-actions button {
  min-height: 40px;
  padding: 0 18px;
  font-weight: 700;
}

.app-notice-actions .primary {
  color: #3a1408;
}

@media (max-width: 520px) {
  .app-notice-card {
    padding: 24px 18px 18px;
  }

  .app-notice-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .app-notice-actions button {
    width: 100%;
  }
}

pre {
  margin: 0;
  padding: 14px;
  height: calc(100% - 52px);
  overflow: auto;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#formDialog {
  width: min(1180px, calc(100vw - 32px));
  height: auto;
  max-height: min(860px, calc(100vh - 32px));
}

#formDialog.compact-dialog {
  width: min(760px, calc(100vw - 80px));
  max-height: min(620px, calc(100vh - 80px));
}

#formDialog.bulk-payment-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 32px));
}

#formDialog.bulk-payment-dialog header {
  min-height: 46px;
  padding: 0 14px;
}

#formDialog.bulk-payment-dialog #formBody {
  padding: 12px 14px 14px;
  max-height: calc(100vh - 96px);
}

#formDialog.bulk-payment-dialog .modal-form {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

#formDialog.bulk-payment-dialog .wide,
#formDialog.bulk-payment-dialog .modal-actions {
  grid-column: 1;
}

#formBody {
  padding: 14px;
  overflow: auto;
  max-height: calc(100vh - 96px);
}

#formDialog.compact-dialog #formBody {
  padding: 10px 12px 12px;
  max-height: calc(100vh - 128px);
}

#formDialog.compact-dialog header {
  min-height: 44px;
  padding: 0 12px;
}

#formDialog.compact-dialog #formTitle {
  font-size: 15px;
}

#formDialog.compact-dialog .modal-form {
  gap: 8px;
  font-size: 13px;
}

#formDialog.compact-dialog .income-rule-note {
  padding: 8px 10px;
  font-size: 12px;
}

#formDialog.compact-dialog .income-rule-stage summary {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

#formDialog.compact-dialog .work-table th,
#formDialog.compact-dialog .work-table td {
  padding: 6px 8px;
  font-size: 12px;
}

#formDialog.compact-dialog .work-table strong,
#formDialog.compact-dialog .work-table b {
  font-size: 12px;
}

#formDialog.compact-dialog .income-rule-edit-table input[type="number"] {
  width: 88px;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 12px;
}

#formDialog.compact-dialog .modal-actions {
  gap: 8px;
  padding-top: 2px;
}

#formDialog.compact-dialog .modal-actions button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

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

.modal-form label {
  position: relative;
  overflow: visible;
}

.modal-form .combo-list {
  z-index: 1000;
}

.modal-form .wide {
  grid-column: 1 / -1;
}

.income-breakdown {
  border: 1px solid var(--line, #d9cdbd);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.45);
}

.income-breakdown-head,
.income-breakdown-summary,
.income-breakdown-row {
  display: flex;
  align-items: end;
  gap: 10px;
}

.income-breakdown-head {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.income-breakdown-row {
  position: relative;
  margin-top: 8px;
}

.income-breakdown-row label:first-child { flex: 1 1 auto; }
.income-breakdown-row label:nth-child(2) { flex: 0 0 180px; }

.income-line-remove {
  flex: 0 0 38px;
  height: 38px;
  border: 1px solid #dbb7ab;
  border-radius: 8px;
  color: #a34835;
  background: #fff8f5;
}

.income-breakdown-summary {
  justify-content: flex-end;
  margin-top: 12px;
  color: var(--muted, #69756e);
}

.income-breakdown-summary span {
  padding: 7px 10px;
  border-radius: 8px;
  background: #f3eee6;
}

.income-breakdown-summary span.is-balanced {
  background: #dcefd8;
  color: #285b2d;
}

.bulk-action-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line, #d9cdbd);
  border-radius: 10px;
  background: #f8f4ed;
}

.bulk-action-summary small {
  max-height: 90px;
  overflow: auto;
  color: var(--muted, #69756e);
}

.bulk-warning {
  padding: 9px 10px;
  border-radius: 8px;
  color: #7a431b;
  background: #fae7c9;
}

.bulk-validation-list {
  display: grid;
  gap: 8px;
  max-height: min(46vh, 420px);
  overflow: auto;
}

.bulk-validation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 14px;
  padding: 10px 12px;
  border: 1px solid #e7c9c1;
  border-radius: 8px;
  background: #fff5f2;
}

.bulk-validation-item > div {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.bulk-validation-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-validation-item small {
  grid-column: 1 / -1;
  color: #8a3f32;
}

/* Universal statistics workspace */
.statistics-surface {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: #eee7dc;
}

body[data-module="stats"] .pager { display: none; }

.statistics-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 26px;
  border: 1px solid #d7ccbd;
  border-radius: 12px;
  background: linear-gradient(135deg, #fffdf9 0%, #f2ebe1 100%);
}

.statistics-hero .eyebrow {
  color: #b75f43;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.statistics-hero h2 {
  margin: 3px 0 4px;
  color: #26352e;
  font-size: 28px;
}

.statistics-hero p {
  margin: 0;
  max-width: 720px;
  color: #66726b;
}

.statistics-create { white-space: nowrap; }

.statistics-summary {
  display: grid;
  grid-template-columns: 130px 160px 150px minmax(220px, 1fr);
  border: 1px solid #d8cdbf;
  border-radius: 10px;
  overflow: hidden;
  background: #fffdf9;
}

.statistics-summary > div {
  display: grid;
  gap: 3px;
  padding: 13px 17px;
  border-right: 1px solid #e1d8cc;
}

.statistics-summary > div:last-child { border-right: 0; }
.statistics-summary span { color: #768078; font-size: 12px; }
.statistics-summary strong { color: #26352e; font-size: 20px; }
.statistics-summary .has-alert { background: #fff0e8; }
.statistics-summary .has-alert strong { color: #a84f38; }

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

.statistics-filters { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex: 1 1 520px; }
.statistics-filters input, .statistics-filters select { min-height: 38px; background-color: #fff; }
.statistics-filters input { min-width: 190px; flex: 1 1 230px; }
.statistics-filters select { min-width: 150px; }

.statistics-tabs {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #d4c8b8;
  border-radius: 9px;
  background: #f8f3ec;
}

.statistics-tabs button {
  min-height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #667169;
}

.statistics-tabs button.active {
  background: #56675d;
  color: #fff;
}

.statistics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.statistic-card {
  display: grid;
  gap: 12px;
  min-height: 315px;
  padding: 17px;
  border: 1px solid #d8cdbf;
  border-top: 4px solid #647d70;
  border-radius: 10px;
  background: #fffdf9;
  box-shadow: 0 3px 12px rgba(54, 47, 39, .06);
}

.statistic-card.is-pending { border-top-color: #c66d4f; background: #fffaf6; }
.statistic-card.is-behind { border-top-color: #b65e52; }
.statistic-card > header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.statistic-card h3 { margin: 3px 0 0; color: #26352e; font-size: 18px; line-height: 1.2; }
.statistic-type { color: #7a827d; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.statistic-state { padding: 4px 8px; border-radius: 12px; background: #e5eee8; color: #50685a; font-size: 11px; white-space: nowrap; }
.is-pending .statistic-state { background: #f7e0d2; color: #a04e37; }
.statistic-current { display: grid; gap: 2px; }
.statistic-current strong { color: #26352e; font-size: 27px; line-height: 1; }
.statistic-current small { color: #7b827d; }
.statistic-chart-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: inherit; cursor: pointer; }
.statistic-chart-open:hover { background: #f8f4ed; }
.statistic-chart-open:focus-visible { outline: 2px solid #c06c4e; outline-offset: 3px; }
.statistic-mini-chart { width: 100%; height: 88px; border-bottom: 1px solid #ece4da; }
.statistic-chart-label { fill: #35473e; stroke: #fffdf9; stroke-width: 3px; paint-order: stroke; font-size: 9px; font-weight: 700; pointer-events: none; }
.statistic-chart-empty { display: grid; place-items: center; height: 88px; border: 1px dashed #ded3c5; border-radius: 7px; color: #90968f; font-size: 12px; }
.statistic-meta { display: flex; justify-content: space-between; gap: 10px; color: #747d77; font-size: 12px; }
.statistic-meta b { color: #3c4a43; }
.statistic-meta .is-positive { color: #52705f; }
.statistic-meta .is-negative { color: #ad5549; }
.statistic-target { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 6px; background: #f1ece4; color: #657068; font-size: 12px; }
.statistic-target b { color: #36483e; }
.statistic-card footer { display: flex; gap: 8px; align-self: end; }
.statistic-card footer:empty { display: none; }
.statistic-multi-chart { display: grid; gap: 6px; }
.statistic-multi-chart .statistic-mini-chart { height: 64px; }
.statistic-multi-lines { display: grid; gap: 5px; align-content: center; }
.statistic-multi-lines span { display: flex; gap: 6px; align-items: center; color: #67726b; font-size: 12px; }
.statistic-multi-lines i { width: 9px; height: 9px; border-radius: 50%; background: #647d70; }
.statistics-empty { grid-column: 1 / -1; display: grid; place-items: center; gap: 7px; min-height: 230px; border: 1px dashed #cfc2b2; border-radius: 10px; background: #f8f3ec; color: #6d766f; text-align: center; }
.statistics-empty strong { color: #36483e; font-size: 18px; }

#formDialog.statistics-dialog { width: min(900px, calc(100vw - 32px)); }
.statistic-editor-section { padding: 13px; border: 1px solid #ddd2c4; border-radius: 8px; background: #faf6f0; }
.statistic-editor-section h3 { margin: 0 0 10px; font-size: 15px; color: #425248; }
.statistic-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.statistic-formula-row { display: grid; grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr); gap: 8px; }
.statistic-editor select[multiple] { min-height: 96px; padding: 6px; background-image: none; }
.statistic-user-picker { display: grid; gap: 7px; position: relative; }
.statistic-user-picker-label { color: #59665f; font-size: 12px; }
.statistic-user-selected { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.statistic-user-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px 6px 10px; border: 1px solid #cbd8cf; border-radius: 16px; background: #e8f0eb; color: #34483d; font-size: 12px; }
.statistic-user-chip button { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: #c8d7cd; color: #34483d; line-height: 16px; cursor: pointer; }
.statistic-user-search { position: relative; }
.statistic-user-search input { width: 100%; background: #fff; }
.statistic-user-results { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; max-height: 220px; overflow: auto; padding: 5px; border: 1px solid #cfc4b7; border-radius: 7px; background: #fff; box-shadow: 0 10px 26px rgba(39, 52, 45, .16); }
.statistic-user-results button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 5px; background: transparent; color: #33453b; text-align: left; cursor: pointer; }
.statistic-user-results button:hover { background: #edf2ee; }
.statistic-user-no-results { display: block; padding: 9px 10px; color: #8a918c; font-size: 12px; }
.statistics-access-pane { padding: 14px; }
.statistics-access-card { display: grid; gap: 8px; padding: 15px; border: 1px solid #d9cdbf; border-radius: 9px; background: #faf6f0; }
.statistics-access-card h3 { margin: 0; color: #31443a; }
.statistics-access-card > p { margin: 0 0 6px; color: #78817b; font-size: 12px; }
.statistics-scope-option, .statistics-manage-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid #ded5ca; border-radius: 7px; background: #fff; cursor: pointer; }
.statistics-scope-option:has(input:checked) { border-color: #8ba395; background: #edf4ef; }
.statistics-scope-option input, .statistics-manage-option input { margin-top: 3px; }
.statistics-scope-option span, .statistics-manage-option span { display: grid; gap: 2px; }
.statistics-scope-option b, .statistics-manage-option b { color: #34483d; }
.statistics-scope-option small, .statistics-manage-option small { color: #7b837e; }
.statistics-manage-option { margin-top: 12px; background: #fff7ef; }
.statistic-detail { display: grid; gap: 14px; }
.statistic-detail-switch { display: flex; gap: 5px; padding: 4px; border: 1px solid #d5cabc; border-radius: 9px; background: #f5efe7; }
.statistic-detail-switch button { flex: 1; min-height: 38px; border: 0; border-radius: 6px; background: transparent; color: #667169; }
.statistic-detail-switch button.active { background: #56675d; color: #fff; }
.statistic-detail-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.statistic-detail-summary { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 4px 14px; padding: 14px 16px; border-radius: 9px; background: #edf3ef; }
.statistic-detail-summary span { color: #647169; }
.statistic-detail-summary strong { color: #2f4438; font-size: 26px; }
.statistic-detail-summary small { grid-column: 1 / -1; color: #858c87; }
.statistic-detail-chart { display: grid; gap: 10px; overflow-x: auto; padding: 12px; border: 1px solid #e0d7cc; border-radius: 9px; background: #fff; }
.statistic-detail-chart .statistic-mini-chart.is-detailed { height: 220px; border-bottom: 0; }
.statistic-detail-chart .statistic-chart-label { font-size: 11px; }
.statistic-chart-axis { stroke: #9ba69f; stroke-width: 1; }
.statistic-chart-grid { stroke: #e6eae7; stroke-width: 1; stroke-dasharray: 4 5; }
.statistic-chart-axis-value, .statistic-chart-axis-period { fill: #6f7a73; font-size: 10px; }
.statistic-chart-axis-title { fill: #4f6057; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.statistic-detail-chart section h4 { margin: 0 0 4px; color: #47584e; }
.statistic-detail-table { max-height: 310px; overflow: auto; border: 1px solid #e0d7cc; border-radius: 8px; background: #fff; }
.statistic-detail-table > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid #eee7de; }
.statistic-detail-table > div:last-child { border-bottom: 0; }
.statistic-detail-table span { color: #707a73; }
.statistic-detail-table b { color: #34483d; }
.statistic-entry-period { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 7px; background: #f1ece4; color: #68736c; }
.statistic-entry-period strong { color: #34463c; }
.statistic-instruction { display: grid; gap: 4px; padding: 10px 12px; border-left: 3px solid #bc755b; background: #fff5ee; color: #665f59; }

@media (max-width: 720px) {
  .statistics-surface { padding: 10px; gap: 11px; }
  .statistics-hero { align-items: stretch; flex-direction: column; padding: 16px; }
  .statistics-hero h2 { font-size: 24px; }
  .statistics-summary { grid-template-columns: repeat(3, 1fr); }
  .statistics-summary > div { padding: 10px; }
  .statistics-summary > div:nth-child(3) { border-right: 0; }
  .statistics-summary > div:last-child { grid-column: 1 / -1; border-top: 1px solid #e1d8cc; }
  .statistics-grid { grid-template-columns: 1fr; }
  .statistics-filters { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .statistics-filters input { grid-column: 1 / -1; min-width: 0; }
  .statistics-filters select { min-width: 0; }
  .statistic-card { min-height: 0; }
  .statistic-editor-grid, .statistic-formula-row { grid-template-columns: 1fr; }
  .statistic-meta { flex-direction: column; }
  .statistic-detail-switch { display: grid; grid-template-columns: 1fr; }
  .statistic-detail-dates { grid-template-columns: 1fr; }
}

.bulk-actions-dialog > button {
  min-height: 42px;
}

.bulk-actions-dialog.is-compact {
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(460px, 82vw);
}

.bulk-actions-dialog.is-compact .bulk-action-summary {
  grid-column: 1 / -1;
}

@media (max-width: 680px) {
  .income-breakdown-row { align-items: stretch; flex-wrap: wrap; }
  .income-breakdown-row label:first-child { flex-basis: 100%; }
  .income-breakdown-row label:nth-child(2) { flex: 1 1 auto; }
}

.modal-field-note {
  grid-column: 1 / -1;
  color: #66756b;
  font-size: 12px;
  line-height: 1.35;
}

.fund-editor-tabs {
  display: flex;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3eee5;
}

.fund-editor-tabs button {
  flex: 1;
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.fund-editor-tabs button.is-active {
  background: var(--chrome-hot);
  color: #fff;
}

.fund-editor-tabs button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fund-editor-page {
  display: none;
}

.fund-editor-page.is-active {
  display: block;
}

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

.fund-rule-edit-table {
  margin-bottom: 8px;
}

.fund-rule-bulk-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(130px, auto) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f3ec;
}

.fund-rule-bulk-row label {
  margin: 0;
}

.fund-rule-bulk-row input[type="number"] {
  width: 100%;
}

.fund-rule-bulk-row .check {
  min-height: 36px;
  align-items: center;
}

.fund-rule-bulk-row button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(244, 108, 64, 0.45);
  border-radius: 6px;
  background: #fff;
  color: var(--chrome-hot);
  font-weight: 800;
}

.fund-rule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.fund-rule-actions button {
  min-height: 36px;
}

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

.settings-grid button {
  justify-content: center;
  min-height: 42px;
}

.week-picker-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(89, 102, 92, 0.18);
  border-radius: 6px;
  background: rgba(251, 247, 240, 0.82);
}

.week-picker-box label {
  margin: 0;
}

.week-picker-box button {
  min-width: 120px;
}

.employee-open {
  display: grid;
  gap: 3px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.employee-open:hover strong {
  color: var(--accent-dark);
}

.employee-editor {
  min-height: min(720px, calc(100vh - 150px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.editor-tabs {
  display: flex;
  justify-content: center;
  gap: 38px;
  border-bottom: 1px solid var(--line);
  margin: -14px -14px 18px;
  padding-top: 2px;
}

.editor-tabs button {
  min-width: 170px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-weight: 680;
}

.editor-tabs button.active {
  color: var(--muted);
  border-bottom-color: var(--chrome-hot);
}

.editor-pane {
  display: none;
  min-height: 0;
  overflow: auto;
}

.editor-pane.active {
  display: grid;
}

.editor-pane[data-editor-pane="general"] {
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px 14px;
  align-content: start;
}

.editor-pane[data-editor-pane="general"] label {
  display: contents;
}

.editor-pane[data-editor-pane="general"] label > span {
  align-self: center;
  justify-self: end;
  color: var(--text);
  font-size: 18px;
}

.editor-pane[data-editor-pane="general"] input,
.editor-pane[data-editor-pane="general"] select {
  min-height: 44px;
  border: 1px solid #d2d2d2;
  border-radius: 8px;
  background: #fff;
  padding: 0 14px;
  font-size: 18px;
}

.editor-pane[data-editor-pane="general"] .wide {
  display: contents;
}

.editor-pane[data-editor-pane="rights"] {
  display: none;
}

.editor-pane[data-editor-pane="rights"].active {
  display: block;
}

.permission-tree {
  padding: 4px 0 14px;
  font-size: 18px;
}

.permission-node {
  margin: 5px 0;
}

.permission-node summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  list-style: none;
  cursor: pointer;
}

.permission-node summary::-webkit-details-marker {
  display: none;
}

.permission-node[open] > summary .twisty {
  transform: rotate(90deg);
}

.permission-node .twisty {
  width: 18px;
  color: var(--text);
  transition: transform 0.15s ease;
}

.permission-node label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.permission-node input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--chrome-hot);
}

.employee-editor input[type="checkbox"],
.settings-table input[type="checkbox"] {
  accent-color: var(--chrome-hot);
}

.permission-children {
  margin-left: 28px;
}

.level-2 .permission-children,
.level-3 .permission-children {
  margin-left: 32px;
}

.editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px -14px -14px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.editor-footer button {
  min-width: 140px;
  min-height: 40px;
  font-size: 16px;
}

.login-surface {
  min-height: calc(100vh - 126px);
  display: grid;
  place-items: center;
  padding: 48px 16px;
  background:
    linear-gradient(135deg, rgba(29, 42, 32, 0.92), rgba(45, 63, 50, 0.84)),
    var(--bg);
}

.login-card {
  width: min(460px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid rgba(205, 194, 176, 0.72);
  border-radius: 8px;
  background: rgba(250, 247, 241, 0.98);
  box-shadow: 0 22px 54px rgb(0 0 0 / 26%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--brand);
}

.login-brand img {
  width: 42px;
  height: 58px;
  object-fit: contain;
  filter: invert(20%) sepia(14%) saturate(620%) hue-rotate(70deg) brightness(88%);
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 28px;
  line-height: 1;
}

.login-brand span {
  margin-top: 4px;
  font-size: 18px;
  color: var(--muted);
}

.login-card h2 {
  margin: 4px 0 0;
  font-size: 26px;
}

.login-lead {
  margin: -4px 0 4px;
  color: var(--muted);
  line-height: 1.42;
}

.login-card label {
  display: grid;
  gap: 6px;
}

.login-card input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 12px;
  background: #fff;
  font-size: 18px;
}

.login-card button.primary {
  min-height: 46px;
  margin-top: 2px;
}

.login-card p {
  font-size: 13px;
}

.login-note {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 980px) {
  .brand-row,
  .actionbar {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .finance-strip {
    overflow: hidden;
  }

  .module-label {
    display: none;
  }

  .week-label {
    min-width: auto;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

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

  .workspace {
    height: 100%;
    min-height: 0;
  }

  .action-left,
  .action-right {
    justify-content: start;
  }

  .inline-search {
    width: min(220px, 48vw);
  }
}

@media (max-width: 620px) {
  .brand-row.has-home-week {
    grid-template-columns: minmax(118px, 1fr) max-content;
  }

  .brand-row.has-home-week .icon-strip {
    grid-column: 1 / -1;
  }
}

.work-surface {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: #ede4d7;
  min-height: 100%;
  min-width: 0;
  width: 100%;
}

.work-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
  overflow: auto;
}

.module-surface {
  min-height: 100%;
}

.module-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.module-panel h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.module-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.home-filter-row {
  display: grid;
  grid-template-columns: 42px minmax(220px, 1.35fr) repeat(4, minmax(120px, 0.8fr)) auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.home-scope-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
}

.home-scope-row button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffaf2;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.home-scope-row button.is-active {
  border-color: rgba(244, 108, 64, 0.45);
  background: var(--accent);
  color: #fff;
}

.home-search-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: min(320px, 30vw);
  color: var(--muted);
}

.home-search-inline input {
  width: 100%;
  min-width: 170px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 0 9px;
}

.home-group-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.home-group-inline select {
  min-width: 160px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 0 28px 0 9px;
}

.home-group-row td {
  padding: 0;
  background: #e8eee7;
}

.home-group-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 36px;
  border: 0;
  padding: 7px 10px;
  background: transparent;
  color: #324338;
  cursor: pointer;
  text-align: left;
}

.home-group-toggle strong {
  min-width: 180px;
}

.home-group-toggle b {
  margin-left: auto;
  white-space: nowrap;
}

.home-group-toggle span:not(.home-group-arrow) {
  color: #647168;
}

.home-group-arrow {
  width: 14px;
  color: #4e6152;
}

.home-group-row.is-collapsed td {
  background: #f0f3ef;
}

.home-filter-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.home-filter-row input,
.home-filter-row select {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffaf2;
  color: var(--text);
  padding: 0 9px;
}

.home-filter-row button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.home-filter-panel {
  padding-top: 12px;
  padding-bottom: 12px;
}

.home-filter-row .home-filter-toggle {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 18px;
  color: var(--muted);
}

.home-filter-row .home-filter-toggle.is-active {
  color: var(--accent);
  border-color: rgba(244, 108, 64, 0.42);
  background: rgba(244, 108, 64, 0.08);
}

@media (max-width: 1100px) {
  .home-filter-row {
    grid-template-columns: 42px repeat(2, minmax(160px, 1fr));
  }
}

.home-table {
  table-layout: fixed;
  min-width: 0;
  width: 100%;
}

.home-col-select {
  width: 34px;
}

.home-col-id {
  width: 46px;
}

.home-col-status {
  width: 126px;
}

.home-col-title {
  width: 15%;
}

.home-col-description,
.home-col-expense,
.home-col-object,
.home-col-crew {
  width: 11%;
}

.home-col-money,
.home-col-approved {
  width: 90px;
}

.home-col-actions {
  width: 104px;
}

.home-table th,
.home-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-table th:first-child,
.home-table td:first-child {
  width: 34px;
  padding-left: 5px;
  padding-right: 5px;
  text-align: center;
}

.home-table .id-col,
.home-table th:nth-child(2),
.home-table td:nth-child(2) {
  width: 46px;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
}

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

.home-table th:last-child,
.home-table td:last-child {
  width: 104px;
  padding-left: 4px;
  padding-right: 4px;
}

.home-table tr.is-selected td {
  background: #fff1e8;
}

.home-section-toggle,
.home-section-summary {
  display: none;
}

.home-summary-dock {
  position: sticky;
  bottom: 0;
  z-index: 8;
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid #d5c5b2;
  border-radius: 7px;
  background: #d5c5b2;
  box-shadow: 0 -7px 18px rgba(50, 45, 35, 0.12);
}

.home-summary-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) repeat(4, minmax(105px, 0.8fr)) minmax(285px, 1.65fr);
  align-items: stretch;
  background: #fffaf2;
}

.home-summary-row > strong,
.home-summary-row > span {
  min-width: 0;
  padding: 7px 11px;
  border-right: 1px solid #e6d8c8;
}

.home-summary-row > strong {
  display: flex;
  align-items: center;
  color: #39463e;
  font-size: 13px;
}

.home-summary-row > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
}

.home-summary-row > span:last-child {
  border-right: 0;
}

.home-summary-row small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.home-summary-row b {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-summary-row .is-selected {
  background: #fff0e7;
}

.home-summary-row .is-empty {
  background: #f4efe8;
}

.home-summary-row > .home-summary-selection {
  display: grid;
  grid-template-columns: minmax(95px, 0.8fr) minmax(145px, 1.2fr);
  align-items: baseline;
  gap: 20px;
}

.home-summary-selection > span {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}

@media (max-width: 980px) {
  .home-summary-row {
    grid-template-columns: minmax(105px, 1.1fr) repeat(4, minmax(82px, 0.85fr)) minmax(255px, 1.6fr);
    min-width: 760px;
  }

  .home-summary-row > strong,
  .home-summary-row > span {
    padding-right: 6px;
    padding-left: 6px;
  }

  .home-summary-dock {
    overflow-x: auto;
  }
}

.home-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.home-row-actions .action-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #d8c9b8;
  border-radius: 7px;
  background: #fffaf3;
  color: #53635a;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(61, 51, 40, 0.06);
}

.home-row-actions .action-btn--delete {
  border-color: #edcfc5;
  background: #fff7f3;
  color: #b85d3f;
  font-size: 20px;
  font-weight: 400;
}

.company-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.company-action-row small {
  color: var(--muted);
}

.company-filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 0.7fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid rgba(89, 102, 92, 0.16);
  border-radius: 6px;
  background: rgba(251, 247, 240, 0.82);
}

.company-filter-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.company-filter-row input,
.company-filter-row select {
  min-height: 34px;
}

.directory-search-row {
  display: flex;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid rgba(89, 102, 92, 0.16);
  border-radius: 6px;
  background: rgba(251, 247, 240, 0.82);
}

.directory-search-row label {
  display: grid;
  flex: 1 1 460px;
  max-width: 720px;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.directory-search-row input {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(89, 102, 92, 0.28);
  background: #fff;
}

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

.settings-note {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(244, 108, 64, 0.28);
  border-radius: 6px;
  background: rgba(244, 108, 64, 0.08);
  color: var(--muted);
}

.settings-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.access-cell {
  min-width: 300px;
}

.access-cell label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 8px 6px 0;
  white-space: nowrap;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.fund-director-toggle {
  justify-content: flex-start;
  gap: 10px;
}

.fund-director-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.history-timeline {
  display: grid;
  gap: 12px;
}

.history-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
  align-items: start;
}

.history-dot {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 999px;
  background: #5d8b60;
  box-shadow: 0 0 0 3px rgba(93, 139, 96, 0.12);
}

.history-content {
  padding: 10px 12px;
  border: 1px solid #e6ded2;
  border-radius: 10px;
  background: #fffdf9;
}

.history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.history-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.history-meta {
  margin-top: 4px;
  color: #4f6351;
  font-size: 13px;
}

.history-note {
  margin-top: 6px;
  color: #3d463e;
  font-size: 13px;
  line-height: 1.45;
}

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

.report-split-grid h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  min-width: 0;
}

.module-grid button {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.module-grid button:hover {
  border-color: var(--accent);
  background: #f4fbf8;
}

.module-grid button:disabled,
.module-grid button.is-disabled {
  cursor: not-allowed;
  background: #f6f7f6;
  color: var(--muted);
}

.module-grid button:disabled:hover,
.module-grid button.is-disabled:hover {
  border-color: var(--line);
  background: #f6f7f6;
}

.module-grid b,
.module-grid span {
  display: block;
}

.module-grid span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.home-actions-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
}

.compact-table th,
.compact-table td {
  padding: 7px 10px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.archive-empty {
  padding: 34px 16px;
}

.archive-empty strong,
.archive-empty span {
  display: block;
  margin-bottom: 8px;
}

.empty-module p {
  margin: 0;
}

.work-panel h2 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: 0;
}

.directive-surface {
  gap: 12px;
}

.directive-toolbar {
  border-radius: 0;
}

.directive-flow {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.directive-stage {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.directive-lock-note {
  border: 1px solid rgba(191, 143, 0, 0.25);
  background: #fff7d6;
  color: #775d00;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.directive-lock-note.inline {
  margin-top: -2px;
}

.directive-flow-panel,
.directive-approvals-panel {
  display: grid;
  gap: 12px;
}

.directive-panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 0;
}

.directive-panel-heading h2 {
  margin: 0;
  font-size: 21px;
  color: var(--text);
}

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

.directive-section-title,
.directive-fund-title {
  min-height: 38px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  min-width: 0;
}

.directive-section-title {
  background: linear-gradient(180deg, #faf5ee, #f2eade);
}

.directive-fund-title {
  background: linear-gradient(180deg, rgba(89, 102, 92, 0.18), rgba(89, 102, 92, 0.1));
}

.directive-section-title b,
.directive-fund-title b {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  color: #39453b;
}

.directive-section-title strong,
.directive-fund-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.directive-toggle-arrow {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d8c9b8;
  border-radius: 7px;
  background: #fffaf3;
  color: #63705f;
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(61, 51, 40, 0.06);
}

.directive-toggle-arrow:hover {
  border-color: #bda98f;
  background: #fff6e9;
}

.directive-master-toggle {
  min-width: 42px;
  min-height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.directive-residual-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fffaf3;
}

.directive-residual-row strong {
  display: block;
  color: var(--text);
}

.directive-residual-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.directive-residual-row b {
  white-space: nowrap;
  font-size: 15px;
}

.directive-residual-row.is-zero {
  border-color: rgba(121, 188, 129, 0.45);
  background: #f2faef;
}

.directive-residual-row.is-diff {
  border-color: rgba(211, 91, 74, 0.42);
  background: #fff2ee;
}

.directive-residual-row button {
  min-height: 30px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  padding: 0 10px;
  font-weight: 800;
  cursor: pointer;
}

.directive-collapse-body.is-hidden {
  display: none;
}

.directive-block-title {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(89, 102, 92, 0.18), rgba(89, 102, 92, 0.1));
}

.directive-block-title strong {
  font-size: 18px;
  color: var(--text);
}

.directive-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
  background: var(--panel);
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.directive-table th {
  position: sticky;
  top: 0;
  background: #323b35;
  border-bottom: 1px solid #202720;
  color: #fff;
}

.directive-table td {
  max-width: 520px;
  background: #fffaf3;
}

.income-stage-table th:nth-child(2),
.income-stage-table td:nth-child(2) {
  width: 170px;
}

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

.fund-stage-table th:nth-child(1),
.fund-stage-table td:nth-child(1) {
  width: 34px;
}

.fund-stage-table th:nth-child(3),
.fund-stage-table td:nth-child(3),
.fund-stage-table th:nth-child(4),
.fund-stage-table td:nth-child(4),
.fund-stage-table th:nth-child(5),
.fund-stage-table td:nth-child(5),
.fund-stage-table th:nth-child(6),
.fund-stage-table td:nth-child(6) {
  width: 150px;
}

.fund-stage-table th:nth-child(7),
.fund-stage-table td:nth-child(7) {
  width: 78px;
}

.fund-stage-table td.directive-approval-demand.is-covered {
  background: #e5f5ed;
  color: #126044;
  font-weight: 800;
}

.fund-stage-table td.directive-approval-demand.is-short {
  background: #fde8e3;
  color: #9a3412;
  font-weight: 800;
}

.directive-fund-heading-short {
  display: none;
}

.directive-table small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.compact-directive-dialog {
  gap: 12px;
}

.directive-fund-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.directive-fund-meta > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fffaf3;
}

.directive-fund-meta span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.directive-fund-meta strong {
  font-size: 14px;
}

.directive-fund-edit-table input {
  width: 120px;
  min-height: 30px;
}

.doc-icon {
  display: inline-block;
  width: 24px;
  color: #66716a;
}

.directive-actions {
  width: 74px;
  min-width: 74px;
  text-align: right;
  white-space: nowrap;
}

.directive-actions button {
  width: 28px;
  height: 26px;
  margin-left: 3px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f4efe8;
  color: var(--text);
  font-weight: 800;
}

.directive-actions button:first-child {
  background: #5d8b60;
  border-color: #5d8b60;
  color: #fff;
}

.directive-total td {
  font-weight: 800;
  background: #efe6da;
}

.approve-calculated,
.reset-calculated {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
}

.directive-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text);
}

.directive-select-all input {
  margin: 0;
}

.approve-calculated {
  background: #5d8b60;
  border-color: #547f57;
  color: #fff;
}

.reset-calculated {
  margin-left: 5px;
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.approve-calculated[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.muted-num {
  color: #59665c;
}

.directive-bottom-grid {
  align-items: start;
}

.directive-approval-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.directive-approval-tabs button {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.directive-approval-tabs button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.directive-approval-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.directive-quick-filters {
  flex: 0 0 auto;
}

.directive-toolbar-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.directive-search {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.directive-search span {
  font-size: 11px;
  line-height: 1.1;
}

.directive-search input,
.directive-search select {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.directive-search select {
  width: 145px;
}

.directive-toolbar-search {
  width: 190px;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.directive-approval-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.directive-approval-content {
  overflow-x: hidden;
}

.directive-approval-group-row td {
  padding: 0;
  background: #e8eee7;
}

.directive-approval-group-toggle {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 8px 12px;
  background: transparent;
  color: #324338;
  cursor: pointer;
  text-align: left;
}

.directive-approval-group-toggle strong {
  min-width: 180px;
}

.directive-approval-group-toggle span:not(.directive-group-arrow) {
  color: #647168;
}

.directive-approval-tabs .directive-bulk-action {
  margin-left: auto;
  padding-inline: 12px;
  border: 1px solid #d76f45;
  border-radius: 4px;
  background: #f46c40;
  color: #30150b;
  font-weight: 700;
}

.directive-approval-group-toggle b {
  margin-left: auto;
  white-space: nowrap;
}

.directive-group-fund-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(108px, auto));
  gap: 6px;
  margin-left: auto;
  color: #324338;
}

.directive-approval-group-toggle .directive-group-fund-metrics > span {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 7px;
  border: 1px solid #ccd7cd;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.58);
  color: #324338;
}

.directive-approval-group-toggle .directive-group-fund-metrics > .directive-group-available.is-sufficient {
  border-color: #b8d8ac;
  background: #e2f2da;
}

.directive-approval-group-toggle .directive-group-fund-metrics > .directive-group-available.is-insufficient {
  border-color: #edc3b9;
  background: #fde8e3;
}

.directive-group-fund-metrics small {
  color: #647168;
  font-size: 10px;
  line-height: 1.05;
  white-space: nowrap;
}

.directive-approval-group-toggle .directive-group-fund-metrics b {
  margin-left: 0;
  color: #26372d;
  font-size: 12px;
  white-space: nowrap;
}

.directive-approval-group-toggle .directive-group-fund-metrics .directive-group-available.is-sufficient small,
.directive-approval-group-toggle .directive-group-fund-metrics .directive-group-available.is-sufficient b {
  color: #285d36;
}

.directive-approval-group-toggle .directive-group-fund-metrics .directive-group-available.is-insufficient small,
.directive-approval-group-toggle .directive-group-fund-metrics .directive-group-available.is-insufficient b {
  color: #8a3329;
}

.directive-group-arrow {
  width: 14px;
  color: #4e6152;
}

.directive-approval-group-row.is-collapsed td {
  background: #f0f3ef;
}

.directive-approval-table th,
.directive-approval-table td {
  padding: 6px 4px;
  font-size: 13px;
  line-height: 1.2;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.directive-approval-table th {
  overflow-wrap: anywhere;
  white-space: normal;
}

.directive-approval-table {
  width: 100%;
  table-layout: fixed;
}

.directive-approval-table th:nth-child(1),
.directive-approval-table td:nth-child(1) {
  width: 2%;
}

.directive-approval-table th:nth-child(2),
.directive-approval-table td:nth-child(2) {
  width: 4.5%;
}

.directive-requests-table th:nth-child(2), .directive-requests-table td:nth-child(2) { width: 3%; }
.directive-requests-table th:nth-child(3), .directive-requests-table td:nth-child(3) { width: 6.5%; }
.directive-requests-table th:nth-child(4), .directive-requests-table td:nth-child(4) { width: 4.5%; }
.directive-requests-table th:nth-child(5), .directive-requests-table td:nth-child(5) { width: 9%; }
.directive-requests-table th:nth-child(6), .directive-requests-table td:nth-child(6) { width: 9%; }
.directive-requests-table th:nth-child(7), .directive-requests-table td:nth-child(7) { width: 7%; }
.directive-requests-table th:nth-child(8), .directive-requests-table td:nth-child(8) { width: 9.6%; }
.directive-requests-table th:nth-child(9), .directive-requests-table td:nth-child(9) { width: 5.5%; }
.directive-requests-table th:nth-child(10), .directive-requests-table td:nth-child(10) { width: 6%; }
.directive-requests-table th:nth-child(11), .directive-requests-table td:nth-child(11) { width: 5.5%; }
.directive-requests-table th:nth-child(12), .directive-requests-table td:nth-child(12) { width: 8.1%; }
.directive-requests-table th:nth-child(13), .directive-requests-table td:nth-child(13),
.directive-requests-table th:nth-child(14), .directive-requests-table td:nth-child(14) { width: 8.2%; }

.directive-bills-table th:nth-child(2), .directive-bills-table td:nth-child(2) { width: 3%; }
.directive-bills-table th:nth-child(3), .directive-bills-table td:nth-child(3) { width: 4.5%; }
.directive-bills-table th:nth-child(4), .directive-bills-table td:nth-child(4) { width: 5.5%; }
.directive-bills-table th:nth-child(5), .directive-bills-table td:nth-child(5) { width: 7%; }
.directive-bills-table th:nth-child(6), .directive-bills-table td:nth-child(6) { width: 6.5%; }
.directive-bills-table th:nth-child(7), .directive-bills-table td:nth-child(7) { width: 5.5%; }
.directive-bills-table th:nth-child(8), .directive-bills-table td:nth-child(8) { width: 7.5%; }
.directive-bills-table th:nth-child(9), .directive-bills-table td:nth-child(9),
.directive-bills-table th:nth-child(10), .directive-bills-table td:nth-child(10) { width: 5%; }
.directive-bills-table th:nth-child(11), .directive-bills-table td:nth-child(11) { width: 4.5%; }
.directive-bills-table th:nth-child(n+12):nth-child(-n+17),
.directive-bills-table td:nth-child(n+12):nth-child(-n+17) { width: 6%; }

.directive-approval-table .directive-id-cell {
  white-space: nowrap;
}

.directive-approval-table td:not(.actions-col) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.directive-clamped-text,
.directive-clamped-link {
  display: -webkit-box;
  width: 100%;
  max-height: 2.4em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}

.directive-approval-table .directive-money-col {
  color: #27382e;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.directive-approval-table td.directive-money-col,
.directive-approval-table td.select-col,
.directive-approval-table td.actions-col {
  vertical-align: middle;
}

.directive-approval-table th.directive-money-col {
  color: #fff;
  white-space: normal;
}

.directive-approval-table th.actions-col,
.directive-approval-table td.actions-col {
  width: 156px;
  min-width: 156px;
  max-width: 156px;
  position: static;
}

.directive-approval-table th.actions-col {
  text-align: center;
}

.directive-approval-table td.actions-col {
  padding-left: 3px;
  padding-right: 3px;
  text-align: right;
}

.directive-approval-table td.actions-col button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 30px;
  margin-left: 2px;
  padding: 0;
  vertical-align: middle;
}

.directive-approval-table strong {
  font-size: 13px;
}

.directive-approval-table small {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.15;
}

.directive-approve-input {
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 3px 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-align: right;
  font-size: 13px;
}

.directive-inline-control {
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 3px 2px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: rgba(255, 250, 243, 0.72);
  color: var(--text);
  font: inherit;
}

.directive-inline-control:hover,
.directive-inline-control:focus {
  border-color: var(--line);
  background: #fff;
  outline: none;
}

.link-cell-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #286f8f;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.link-cell-button:hover {
  text-decoration: underline;
}

.directive-approval-table .row-actions-compact {
  white-space: nowrap;
}

.directive-approval-table .row-actions-compact button {
  min-width: 24px;
  min-height: 26px;
  border: 1px solid #d8c9b8;
  border-radius: 7px;
  background: #fffaf3;
  color: #53635a;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(61, 51, 40, 0.06);
}

.directive-approval-table .row-actions-compact .is-success,
.directive-approval-table .row-actions-compact .action-btn--approve,
.directive-approval-table .row-actions-compact .action-btn--select {
  border-color: #b7d4aa;
  background: #f4fbf0;
  color: #4f8946;
}

.directive-approval-table .row-actions-compact .is-danger,
.directive-approval-table .row-actions-compact .action-btn--cancel,
.directive-approval-table .row-actions-compact .action-btn--delete {
  border-color: #edcfc5;
  background: #fff7f3;
  color: #b85d3f;
}

.directive-approval-table .row-actions-compact .is-money,
.directive-approval-table .row-actions-compact .action-btn--money {
  border-color: #b7d4aa;
  background: #f4fbf0;
  color: #4f8946;
}

.directive-approval-table .row-actions-compact .action-btn--ghost {
  border-color: #d8c9b8;
  background: #fffaf3;
  color: #53635a;
}

.directive-approval-table .row-actions-compact .action-btn--delete {
  font-size: 20px;
  font-weight: 400;
}

tr.is-approved-row td {
  background: #e2f2da;
}

tr.is-rejected-row td {
  background: #fde8e3;
}

tr.is-paid-row td {
  background: #e8f0ff;
}

tr.is-partial-row td {
  background: #fff0cf;
}

.expense-categories-table select {
  min-height: 30px;
  font-size: 12px;
}

.expense-categories-table {
  table-layout: fixed;
  width: 100%;
}

.expense-operations-table {
  table-layout: fixed;
  width: 100%;
}

.expense-categories-panel.is-collapsed .expense-categories-body {
  display: none;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-collapse-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8f2eb;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.accent-btn {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.table-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

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

.expense-operation-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  align-items: end;
}

.expense-operation-filters label {
  min-width: 0;
}

.expense-operation-filters label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.expense-operation-filters input,
.expense-operation-filters select {
  min-height: 30px;
  font-size: 12px;
}

.expense-filter-actions {
  display: flex;
  align-items: end;
}

.expense-filter-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
}

.expense-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-top: 0;
  background: #f8f2eb;
  color: var(--muted);
  font-size: 12px;
}

.expense-load-more button {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.expense-categories-table td,
.expense-operations-table td {
  vertical-align: top;
}

.expense-categories-table th,
.expense-categories-table td,
.expense-operations-table th,
.expense-operations-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-category-groups {
  display: grid;
  gap: 10px;
}

.expense-category-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.expense-category-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  background: #efe6da;
  cursor: pointer;
}

.expense-category-group summary strong {
  font-size: 14px;
}

.expense-category-group summary span {
  color: var(--muted);
  font-size: 12px;
}

.expense-category-group table {
  border-top: 1px solid var(--line);
}

.expense-categories-table small,
.expense-operations-table small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.15;
}

.expense-categories-table th:nth-child(1),
.expense-categories-table td:nth-child(1) {
  width: 34px;
  white-space: nowrap;
}

.expense-categories-table th:nth-child(2),
.expense-categories-table td:nth-child(2) {
  width: 58px;
  white-space: nowrap;
}

.expense-categories-table th:nth-child(3),
.expense-categories-table td:nth-child(3) {
  width: 74px;
  white-space: nowrap;
}

.expense-categories-table th:nth-child(4),
.expense-categories-table td:nth-child(4) {
  width: 28%;
}

.expense-categories-table th:nth-child(5),
.expense-categories-table td:nth-child(5) {
  width: 13%;
}

.expense-categories-table th:nth-child(6),
.expense-categories-table td:nth-child(6) {
  width: 14%;
}

.expense-categories-table th:nth-child(7),
.expense-categories-table td:nth-child(7) {
  width: 20%;
}

.expense-categories-table th:nth-child(8),
.expense-categories-table td:nth-child(8) {
  width: 76px;
  white-space: nowrap;
}

.expense-categories-table th:nth-child(9),
.expense-categories-table td:nth-child(9) {
  width: 118px;
  min-width: 118px;
  max-width: 118px;
  white-space: nowrap;
  overflow: visible;
}

.expense-categories-table td.actions-col {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding-right: 8px;
}

.expense-categories-table td.actions-col .action-btn {
  flex: 0 0 30px;
  margin-left: 0;
}

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

.expense-editor-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}

.expense-editor-tabs button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #efe6da;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.expense-editor-tabs button.is-active {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.expense-editor-pane {
  display: none;
}

.expense-editor-pane.is-active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

.requirement-card {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf2;
  cursor: pointer;
}

.requirement-card--wide {
  grid-column: 1 / -1;
}

.requirement-card input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.requirement-card b {
  display: block;
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
}

.requirement-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: normal;
}

.requirement-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(244, 108, 64, 0.14);
  box-shadow: inset 0 0 0 1px rgba(244, 108, 64, 0.18);
}

.expense-access-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.expense-access-list label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.expense-access-list label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(244, 108, 64, 0.18);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(244, 108, 64, 0.18);
}

.expense-access-list input[type="checkbox"] {
  accent-color: var(--accent);
}

.expense-access-list small {
  color: var(--muted);
  white-space: nowrap;
}

.expense-operations-table th:nth-child(1),
.expense-operations-table td:nth-child(1) {
  width: 34px;
  white-space: nowrap;
}

.expense-operations-table th:nth-child(2),
.expense-operations-table td:nth-child(2) {
  width: 58px;
  white-space: nowrap;
}

.expense-operations-table th:nth-child(3),
.expense-operations-table td:nth-child(3) {
  width: 88px;
  white-space: nowrap;
}

.expense-operations-table th:nth-child(4),
.expense-operations-table td:nth-child(4) {
  width: 13%;
}

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

.expense-operations-table th:nth-child(6),
.expense-operations-table td:nth-child(6) {
  width: 12%;
}

.expense-operations-table th:nth-child(7),
.expense-operations-table td:nth-child(7) {
  width: 9%;
}

.expense-operations-table th:nth-child(8),
.expense-operations-table td:nth-child(8) {
  width: 10%;
}

.expense-operations-table th:nth-child(9),
.expense-operations-table td:nth-child(9) {
  width: 10%;
}

.expense-operations-table th:nth-child(10),
.expense-operations-table td:nth-child(10) {
  width: 9%;
}

.expense-operations-table th:nth-child(11),
.expense-operations-table td:nth-child(11) {
  width: 10%;
}

.expense-operations-table th:nth-child(12),
.expense-operations-table td:nth-child(12) {
  width: 82px;
  white-space: nowrap;
}

.expense-operations-table th:nth-child(13),
.expense-operations-table td:nth-child(13) {
  width: 92px;
  white-space: nowrap;
}

.week-control-grid {
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  align-items: stretch;
}

.close-panel header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.close-panel p {
  margin: -6px 0 0;
  color: var(--muted);
}

.close-state {
  border: 1px solid #d7a58f;
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff2eb;
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.close-state.ready {
  border-color: #79bc81;
  background: #eaf7ec;
  color: #235b31;
}

.week-checklist {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.week-checklist li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff;
}

.week-checklist li > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
}

.week-checklist .is-ok > span {
  background: #79bc81;
  color: #fff;
}

.week-checklist .is-wait > span {
  background: #f4d8c8;
  color: #8a3a18;
}

.week-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.week-actions button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
  cursor: pointer;
}

.week-action-state {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 6px;
  padding: 0 10px;
  font-weight: 800;
}

.week-action-state.is-open {
  background: #e8f6ea;
  color: #2f6d38;
}

.week-action-state.is-locked {
  background: #f9e1dc;
  color: #934133;
}

.week-actions .primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.week-actions .week-action-lock.is-open {
  border-color: #6fb267;
  background: #79bc81;
  color: #fff;
  font-weight: 800;
}

.week-actions .week-action-lock.is-locked {
  border-color: #b94c3f;
  background: #d35b4a;
  color: #fff;
  font-weight: 800;
}

.week-actions .week-action-supplier {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.week-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.control-summary {
  display: grid;
  gap: 7px;
}

.control-surface {
  display: grid;
  gap: 18px;
}

.control-register-panel,
.control-summary-panel,
.control-operations-panel {
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  border-color: rgba(89, 102, 92, 0.18);
  box-shadow: 0 10px 24px rgba(32, 39, 32, 0.06);
}

.manajet-strip {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(89, 102, 92, 0.98), rgba(72, 83, 74, 0.98));
  color: #fff;
  font-size: 16px;
  font-weight: 680;
  letter-spacing: 0.005em;
  line-height: 1;
}

.control-strip-add {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.control-strip-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.control-transfer-button {
  min-height: 25px;
  padding: 3px 9px;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 12px;
  line-height: 1.15;
}

.control-transfer-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.manajet-cash-table thead th,
.manajet-ops-table thead th {
  background: #465046;
  color: #f8f5ef;
  font-weight: 700;
  border-right: 1px solid rgba(233, 227, 221, 0.18);
}

.manajet-cash-table td strong,
.manajet-ops-table td strong {
  font-weight: 700;
}

.manajet-cash-table td small {
  display: block;
  margin-top: 4px;
  color: #6c7d8d;
}

.manajet-cash-input {
  min-width: 130px;
  min-height: 32px;
  border: 1px solid #d4c3b1;
  border-radius: 4px;
  padding: 0 8px;
  font: inherit;
}

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

.object-row-actions {
  min-width: 112px;
  width: 112px;
  max-width: 112px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.object-table {
  width: 100%;
  table-layout: fixed;
}

.object-table th:nth-child(1),
.object-table td:nth-child(1) {
  width: 72px;
  max-width: 72px;
}

.object-table th:nth-child(2),
.object-table td:nth-child(2) {
  width: 30%;
}

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

.object-table th:nth-child(4),
.object-table td:nth-child(4) {
  width: 126px;
  max-width: 126px;
}

.object-table th:nth-child(5),
.object-table td:nth-child(5) {
  width: 112px;
  max-width: 112px;
}

body:not(.workspace-expanded) .object-table th,
body:not(.workspace-expanded) .object-table td {
  padding-left: 6px;
  padding-right: 6px;
}

body:not(.workspace-expanded) .object-table td {
  font-size: 13px;
}

body:not(.workspace-expanded) .object-row-actions {
  gap: 4px;
}

.object-linker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.object-add-counterparty {
  min-width: 104px;
  min-height: 32px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.object-add-counterparty:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.control-icon-btn {
  min-width: 34px;
  min-height: 32px;
  border-radius: 7px;
  border: 1px solid #d8c9b8;
  background: #fffaf3;
  color: #59665c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 1px 0 rgba(61, 51, 40, 0.06);
}

.control-icon-btn:hover {
  border-color: #bda98f;
  background: #fff6e9;
}

.control-icon-btn.is-delete {
  border-color: #edcfc5;
  background: #fff7f3;
  color: #b85636;
}

.control-hidden-input {
  display: none;
}

.static-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.static-chip small {
  color: var(--muted);
  font-size: 11px;
}

.chip-remove-btn {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(184, 86, 54, 0.18);
  border-radius: 6px;
  background: #fff7f3;
  color: #b85636;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  flex: 0 0 auto;
}

.chip-remove-btn:hover {
  background: rgba(184, 86, 54, 0.12);
}

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

.object-counterparty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf3;
}

.object-counterparty-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.object-counterparty-text strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.object-counterparty-text small {
  color: var(--muted);
  font-size: 11px;
}

.manajet-control-summary {
  gap: 0;
}

.control-summary-caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: center;
  min-height: 36px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7f2eb, #f2ebe2);
  color: #6d736a;
  font-size: 13px;
}

.control-summary-caption span,
.control-summary-caption b {
  padding: 0 12px;
}

.control-summary-caption b {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: #59665c;
  color: #f8f5ef;
  font-size: 13px;
}

.control-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
}

.control-summary-row span,
.control-summary-row b {
  padding: 0 12px;
}

.control-summary-row b {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.control-summary-row.total {
  font-weight: 800;
  background: rgba(205, 194, 176, 0.14);
}

.control-summary-row.diff {
  background: rgba(244, 108, 64, 0.12);
}

.control-summary-row.is-balanced.diff {
  background: rgba(89, 102, 92, 0.14);
}

.control-confirm-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(251, 247, 240, 0.94);
  color: var(--muted);
}

.control-confirm-row .primary {
  min-height: 32px;
  border-radius: 4px;
  color: #fff;
  font-weight: 800;
}

.control-confirm-row .control-confirm-button.is-unbalanced {
  border-color: #c84d38;
  background: #c84d38;
}

.control-confirm-row .control-confirm-button.is-unbalanced:hover {
  border-color: #a83d2c;
  background: #a83d2c;
}

.control-confirm-row .control-confirm-button.is-ready,
.control-confirm-row .control-confirm-button.is-confirmed {
  border-color: #398447;
  background: #398447;
}

.control-confirm-row .control-confirm-button.is-ready:hover,
.control-confirm-row .control-confirm-button.is-confirmed:hover {
  border-color: #2e6d3a;
  background: #2e6d3a;
}

.control-confirm-row .primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.control-empty-note {
  margin: 0;
  padding: 18px 16px;
}

.control-summary div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 34px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.control-summary span {
  color: var(--muted);
}

.control-summary b {
  font-size: 16px;
}

.control-summary .is-balanced b {
  color: #235b31;
}

.control-summary .is-diff b {
  color: #a33b1a;
}

.funds-week-table tfoot td {
  border-top: 2px solid var(--line);
  background: #f8f2eb;
  font-weight: 800;
}

.income-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  overflow: visible;
  background: linear-gradient(180deg, #f7f2eb, #f2ebe2);
  border-color: rgba(89, 102, 92, 0.16);
}

.income-tabs button {
  min-height: 32px;
  border: 1px solid rgba(89, 102, 92, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0 12px;
  cursor: pointer;
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(89, 102, 92, 0.04);
}

.income-tabs button.active {
  border-color: rgba(89, 102, 92, 0.34);
  background: linear-gradient(180deg, rgba(89, 102, 92, 0.96), rgba(72, 83, 74, 0.96));
  color: #fffdf8;
  font-weight: 800;
}

.income-tabs .ghost {
  margin-left: auto;
  background: transparent;
  color: #59665c;
}

.income-advanced {
  display: grid;
  gap: 8px;
}

.income-advanced[hidden] {
  display: none;
}

.income-rules-table th:nth-child(4),
.income-rules-table td:nth-child(4),
.income-rules-table th:nth-child(5),
.income-rules-table td:nth-child(5) {
  width: 120px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: #f4fbf8;
}

.income-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.income-type-grid button {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.income-type-grid button:hover {
  border-color: var(--chrome-hot);
  background: #f4fbf8;
}

.income-type-grid strong,
.income-type-grid span {
  display: block;
}

.income-type-grid span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.income-overview-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.income-type-list th:nth-child(1),
.income-type-list td:nth-child(1) {
  width: 72px;
  white-space: nowrap;
}

.income-type-list th:nth-child(3),
.income-type-list td:nth-child(3) {
  width: 110px;
}

.income-type-list th:nth-child(4),
.income-type-list td:nth-child(4) {
  width: 180px;
}

.income-types-panel {
  max-height: 360px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title-row h2 {
  margin: 0;
}

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

.funds-surface {
  gap: 10px;
}

.funds-stage-panel > summary.panel-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
  cursor: default;
  list-style: none;
}

.funds-stage-panel > summary.panel-title-row::-webkit-details-marker {
  display: none;
}

.funds-stage-panel .panel-title-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.funds-full-table th:nth-child(1),
.funds-full-table td:nth-child(1) {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
}

.funds-full-table th:nth-child(2),
.funds-full-table td:nth-child(2) {
  width: 72px;
  white-space: nowrap;
}

.funds-full-table th:nth-child(3),
.funds-full-table td:nth-child(3) {
  width: 84px;
  white-space: nowrap;
}

.funds-full-table th.actions-col,
.funds-full-table td.actions-col {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
  overflow: visible;
}

.funds-full-table td:nth-child(3),
.funds-full-table td:nth-child(2) {
  white-space: nowrap;
  color: var(--muted);
  font-weight: 700;
}

.funds-full-table tr.is-archived-row {
  opacity: 0.68;
  background: rgba(90, 96, 88, 0.08);
}

.fund-group-row {
  background: rgba(91, 106, 91, 0.16);
  font-weight: 800;
}

.fund-group-toggle {
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-weight: 900;
}

.fund-group-title {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.fund-group-title small,
.funds-full-table .debt-cell small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.funds-full-table tr.is-group-child-row td:nth-child(4) {
  padding-left: 24px;
}

.income-week-table th:nth-child(1),
.income-week-table td:nth-child(1) {
  width: 72px;
  white-space: nowrap;
}

.funds-inline-metrics {
  margin-top: 8px;
  border-radius: 6px;
  overflow: hidden;
}

.debt-cell.is-negative {
  color: #c64545;
}

.debt-cell.is-positive {
  color: #2d8b57;
}

.fund-stage-toggle {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d8c9b8;
  border-radius: 7px;
  background: #fffaf3;
  color: #59665c;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(61, 51, 40, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  flex: 0 0 auto;
}

.fund-stage-chevron {
  display: inline-grid;
  place-items: center;
  width: 1em;
  height: 1em;
}

.funds-master-toggle {
  min-width: 42px;
  min-height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.panel-title-row:hover .fund-stage-toggle {
  border-color: #bda98f;
  background: #fff6e9;
}

.funds-total-panel {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 42px;
  padding: 6px 12px;
  border: 1px solid #cdbda9;
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.98);
  box-shadow: 0 -2px 10px rgba(61, 51, 40, 0.1);
  overflow-x: auto;
  white-space: nowrap;
}

.funds-total-panel strong {
  flex: 0 0 auto;
  min-width: 58px;
  color: #2c352f;
  font-size: 15px;
}

.funds-total-panel span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  flex: 0 0 auto;
  color: #59665c;
}

.funds-total-panel em {
  font-style: normal;
  font-size: 12px;
  color: #687469;
}

.funds-total-panel b {
  color: #20251f;
  font-size: 14px;
}

.income-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
}

.income-stat-card {
  min-height: 152px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.income-stat-card span,
.income-stat-card b {
  display: block;
}

.income-stat-card span {
  color: var(--muted);
}

.income-stat-card b {
  margin-top: 6px;
  font-size: 22px;
}

.mini-chart {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 68px;
  margin-top: 14px;
  border-bottom: 1px solid var(--line);
}

.mini-chart span {
  flex: 1;
  min-width: 5px;
  border-radius: 3px 3px 0 0;
  background: var(--chrome-hot);
}

.income-stat-card:nth-child(2) .mini-chart span {
  background: #79bc81;
}

.income-period-tabs {
  display: flex;
  gap: 8px;
}

.income-period-tabs button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

.income-period-tabs .active {
  border-color: var(--chrome-hot);
  background: var(--chrome-hot);
  color: #fff;
}

.income-period-filter,
.income-register-filters {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.income-period-filter label,
.income-register-filters label {
  display: grid;
  gap: 4px;
  min-width: 210px;
}

.income-period-filter label span,
.income-register-filters label span {
  color: var(--muted);
  font-size: 12px;
}

.income-period-filter input,
.income-register-filters input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

.income-register-filters label {
  flex: 1 1 280px;
}

.income-register-title {
  flex-wrap: wrap;
}

.income-register-title .income-period-tabs {
  margin-left: auto;
}

@media (max-width: 760px) {
  .income-period-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .income-period-filter label {
    min-width: 0;
  }

  .income-period-filter .primary {
    grid-column: 1 / -1;
  }

  .income-register-title .income-period-tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .income-register-title .income-period-tabs button {
    flex: 1;
  }
}

.income-rule-note {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid rgba(244, 108, 64, 0.25);
  border-radius: 6px;
  background: rgba(244, 108, 64, 0.08);
  color: var(--muted);
}

.income-rule-stage {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.income-rule-stage summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  align-items: center;
  padding: 0 12px;
  background: #c6dbce;
  cursor: pointer;
  font-weight: 800;
}

.income-rule-edit-table input[type="number"] {
  width: 110px;
}

body[data-table="incomes"] .action-right .inline-search,
body[data-table="incomes"] .sort-control,
body[data-table="incomes"] #sortDirectionBtn,
body[data-table="incomes"] #toolbarReset,
body[data-table="incomes"] [data-view-mode],
body[data-table="incomes"] #expandViewBtn {
  display: none;
}

body[data-table="orders"] #toggleFiltersBtn {
  display: none;
}

body[data-table="bills"] #toggleFiltersBtn {
  display: none;
}

.work-toolbar {
  display: grid;
  grid-template-columns: 280px minmax(220px, 1fr) 150px;
  gap: 14px;
  align-items: end;
  min-width: 0;
}

.work-toolbar b {
  display: block;
  min-height: 34px;
  padding: 8px 0;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  min-width: 0;
}

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

.request-form h2,
.request-form .wide {
  grid-column: 1 / -1;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  color: inherit;
  font: inherit;
  resize: vertical;
}

.work-table,
.cash-table {
  min-width: 0;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.work-table th,
.cash-table th {
  position: static;
}

.work-table td,
.cash-table td {
  max-width: 360px;
}

.work-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #e8eef3;
  color: #35424e;
  font-size: 12px;
  white-space: nowrap;
}

.status-draft,
.status-new,
.status-not_approved {
  background: #f5e8d8;
  color: #292724;
}

.status-approved {
  background: #e5f5ed;
  color: #126044;
}

.status-partially_approved {
  background: #fff6db;
  color: #8a5b00;
}

.status-paid {
  background: #d5e4ff;
  color: #244b90;
}

.status-closed {
  background: #e8f0ff;
  color: #244b90;
}

.status-rejected {
  background: #fde8e3;
  color: #9a3412;
}

.row-actions {
  min-width: 190px;
  white-space: nowrap;
}

.fund-link-button {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.fund-link-button strong {
  color: var(--accent-deep, #3f5b40);
  text-decoration: underline;
  text-decoration-color: rgba(63, 91, 64, 0.35);
  text-underline-offset: 2px;
}

.fund-editor-note {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(63, 91, 64, 0.08);
  color: #435445;
  font-size: 13px;
  line-height: 1.45;
}

.row-actions button,
.save-cash,
.work-toolbar button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 8px;
  margin-right: 5px;
  cursor: pointer;
}

.empty {
  padding: 18px;
  color: var(--muted);
  background: #f8fafb;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #202720;
  color: #fff;
  box-shadow: 0 12px 28px rgb(0 0 0 / 24%);
  font-size: 13px;
}

@media print {
  .app-header,
  .topbar,
  .actionbar,
  .filters,
  .pager,
  .actions-col,
  .select-col {
    display: none !important;
  }

  html,
  body {
    height: auto;
    overflow: visible;
  }

  .workspace,
  .table-wrap {
    display: block;
    height: auto;
    overflow: visible;
    max-width: none;
  }

  table {
    min-width: 0;
    font-size: 10px;
  }
}

@media (max-width: 1180px) {
  .work-grid,
  .work-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .directive-section-title,
  .directive-fund-title {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 8px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .directive-section-title strong,
  .directive-fund-title strong {
    grid-column: 2;
    grid-row: 1;
    padding-left: 2px;
  }

  .directive-section-title b,
  .directive-fund-title b {
    grid-column: 3;
    grid-row: 1;
    margin: 0;
    font-size: 12px;
    text-align: right;
  }

  .directive-section-title .directive-toggle-arrow,
  .directive-fund-title .directive-toggle-arrow {
    width: 28px;
    height: 28px;
  }

  .brand-row {
    grid-template-columns: minmax(118px, auto) minmax(0, 1fr);
    min-height: 46px;
    padding: 3px 6px;
  }

  .brand {
    gap: 7px;
  }

  .brand-logo {
    width: 23px;
    height: 32px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand small,
  .top-status {
    display: none;
  }

  .icon-strip button,
  .week-arrow,
  .week-setup {
    width: 36px;
    height: 36px;
  }

  .icon-strip button svg {
    width: 22px;
    height: 22px;
  }

  .week-label {
    max-width: 116px;
    padding-right: 8px;
  }

  .tabs button {
    min-height: 32px;
    padding: 0 10px;
  }

  .topbar {
    gap: 10px;
    min-height: 38px;
  }

  .actionbar {
    gap: 6px;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 114px;
    overflow: auto;
  }

  .pager {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 8px;
  }

  .pager-actions {
    gap: 6px;
  }

  .work-surface {
    padding: 8px;
    gap: 8px;
  }

  .work-panel {
    padding: 10px;
    border-radius: 6px;
  }

  .module-grid,
  .request-form,
  .modal-form {
    grid-template-columns: 1fr;
  }

  .directive-section-title,
  .directive-fund-title {
    grid-template-columns: 18px minmax(0, 1fr);
    padding: 0 9px;
  }

  .directive-section-title b,
  .directive-fund-title b {
    grid-column: 2;
    font-size: 13px;
  }

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

.work-table,
.cash-table {
  min-width: 720px;
}
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(118, 151, 95, 0.14);
  color: #45583b;
  font-size: 12px;
  margin: 0 6px 6px 0;
}

.muted {
  color: #7e7b73;
  font-size: 12px;
}

.checkbox-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(70, 92, 55, 0.18);
  border-radius: 10px;
  background: #fff;
}

.object-pick-block {
  display: grid;
  gap: 10px;
}

.object-pick-block.is-disabled {
  opacity: 0.6;
}

.object-pick-title {
  font-weight: 700;
  color: #2f352d;
}

.toggle-line.compact {
  font-size: 12px;
}

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

  .icon-strip {
    grid-row: 2;
  }

  .finance-strip {
    min-height: 32px;
  }

  .week-label {
    display: none;
  }

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

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

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

  .pager-actions {
    justify-content: space-between;
    width: 100%;
  }
}

/* Personal cabinet: phone layout uses readable cards instead of a wide table. */
@media (max-width: 760px) {
  @supports (height: 100dvh) {
    body[data-module="home"] {
      height: 100dvh;
      min-height: 100dvh;
    }
  }

  body[data-module="home"] .pager,
  body[data-module="home"] #metrics {
    display: none;
  }

  .module-surface {
    overflow-x: hidden;
  }

  .module-surface > .module-panel,
  .home-filter-panel {
    min-width: 0;
    padding: 9px;
  }

  .home-actions-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .home-actions-grid button {
    min-height: 58px;
    padding: 9px 11px;
    text-align: left;
  }

  .home-actions-grid button b {
    font-size: 15px;
  }

  .home-actions-grid button span {
    margin-top: 2px;
    font-size: 11px;
  }

  .home-scope-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .home-scope-row button {
    min-width: 0;
    min-height: 36px;
    padding: 0 7px;
    font-size: 12px;
  }

  .home-scope-row #homeCustomPeriod,
  .home-scope-row .home-search-inline {
    grid-column: auto;
  }

  .home-scope-row .home-group-inline {
    grid-column: 1 / -1;
  }

  .home-scope-row .home-search-inline {
    min-width: 0;
    gap: 0;
  }

  .home-scope-row .home-search-inline > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .home-scope-row .home-group-inline > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .home-scope-row .home-group-inline select {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    font-size: 12px;
  }

  .home-scope-row .home-search-inline input {
    min-width: 0;
    min-height: 36px;
    font-size: 12px;
  }

  .home-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 9px;
  }

  .home-filter-row .home-filter-toggle {
    display: none;
  }

  .home-filter-row .home-search-field,
  .home-filter-row #homeFilterReset {
    grid-column: 1 / -1;
  }

  .home-filter-row label {
    min-width: 0;
    font-size: 11px;
  }

  .home-filter-row input,
  .home-filter-row select,
  .home-filter-row button {
    min-width: 0;
    min-height: 36px;
    font-size: 13px;
  }

  .home-filter-row #homeFilterReset {
    width: 100%;
  }

  .home-section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: center;
    gap: 7px;
  }

  .home-document-section .home-section-header h2 {
    min-width: 0;
    margin: 0;
    font-size: 18px;
    line-height: 1.1;
  }

  .home-section-toggle {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fffaf2;
    color: #45534a;
    padding: 0;
    font: inherit;
    font-size: 23px;
    line-height: 1;
  }

  .home-section-body {
    margin-top: 8px;
  }

  .home-document-section.is-collapsed .home-section-body {
    display: none;
  }

  .home-section-summary {
    display: block;
    margin-top: 8px;
  }

  .home-table.work-table {
    display: block;
    min-width: 0;
    width: 100%;
    border: 0;
    background: transparent;
  }

  .home-table colgroup,
  .home-table thead {
    display: none;
  }

  .home-table tbody {
    display: grid;
    gap: 9px;
    width: 100%;
  }

  .home-table tbody .home-group-row {
    display: block;
    width: 100%;
  }

  .home-table tbody .home-group-row > td {
    display: block;
    width: 100%;
  }

  .home-group-toggle {
    flex-wrap: wrap;
    gap: 4px 8px;
    min-height: 42px;
    padding: 7px 9px;
  }

  .home-group-toggle strong {
    min-width: 0;
    flex: 1 1 150px;
  }

  .home-group-toggle b {
    margin-left: 22px;
  }

  .home-table tbody tr[data-id] {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto auto;
    grid-template-areas:
      "select status amount amount"
      "title title title title"
      "description description description description"
      "expense expense expense actions"
      "object object approved actions"
      "crew crew approved actions";
    gap: 4px 8px;
    min-width: 0;
    padding: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 2px 7px rgba(54, 46, 37, 0.06);
  }

  .home-table tbody tr[data-id].is-approved-row {
    background: #e2f2da;
  }

  .home-table tbody tr[data-id].is-rejected-row {
    background: #fde8e3;
  }

  .home-table tbody tr[data-id].is-paid-row {
    background: #e8f0ff;
  }

  .home-table tbody tr[data-id].is-partial-row {
    background: #fff0cf;
  }

  .home-table tbody tr[data-id].is-selected {
    box-shadow: inset 0 0 0 2px rgba(244, 108, 64, 0.48);
  }

  .home-table tbody tr[data-id] > td {
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    text-align: left;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .home-table td[data-home-field="select"] {
    grid-area: select;
    align-self: center;
  }

  .home-table td[data-home-field="select"] input {
    width: 24px;
    height: 24px;
    margin: 0;
  }

  .home-table td[data-home-field="status"] {
    grid-area: status;
    align-self: center;
  }

  .home-table td[data-home-field="status"] .badge {
    min-height: 25px;
    max-width: 100%;
    padding: 0 8px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
  }

  .home-table tbody tr[data-id] > td[data-home-field="amount"] {
    grid-area: amount;
    align-self: center;
    padding-right: 4px;
    color: var(--text);
    font-size: 17px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
  }

  .home-table td[data-home-field="approved"] {
    grid-area: approved;
    align-self: center;
    color: #126044;
    font-size: 13px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
  }

  .home-table td[data-home-field="approved"]::before {
    content: "Одобрено: ";
    color: var(--muted);
    font-weight: 400;
  }

  .home-table td[data-home-field="title"] {
    grid-area: title;
    display: -webkit-box;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.18;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .home-table td[data-home-field="description"] {
    grid-area: description;
    display: -webkit-box;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .home-table td[data-home-field="expense"] {
    grid-area: expense;
    color: #39463e;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .home-table td[data-home-field="expense"]::before {
    content: "Статья: ";
    color: var(--muted);
  }

  .home-table td[data-home-field="object"] {
    grid-area: object;
    color: #39463e;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .home-table td[data-home-field="object"]::before {
    content: "Объект: ";
    color: var(--muted);
  }

  .home-table td[data-home-field="object"]:empty {
    display: none;
  }

  .home-table td[data-home-field="crew"] {
    grid-area: crew;
    color: #39463e;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .home-table td[data-home-field="crew"]::before {
    content: "Бригада: ";
    color: var(--muted);
  }

  .home-table td[data-home-field="crew"]:empty {
    display: none;
  }

  .home-table tbody tr[data-id] > td[data-home-field="id"] {
    display: none;
  }

  .home-table td[data-home-field="actions"] {
    grid-area: actions;
    align-self: center;
    overflow: visible;
  }

  .home-table .home-row-actions {
    justify-content: flex-end;
  }

  .home-table .home-row-actions .action-btn {
    width: 30px;
    height: 30px;
  }

  .home-table .home-search-empty,
  .home-table tbody > tr:not([data-id]) {
    display: block;
    padding: 14px 8px;
    border: 1px dashed var(--line);
    border-radius: 7px;
  }

  .home-table tbody > tr[hidden] {
    display: none !important;
  }

  .home-table tbody > tr:not([data-id]) td {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
  }

  .home-summary-dock {
    display: none;
  }

  .home-summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
  }

  .home-summary-row > strong {
    grid-column: 1 / -1;
    padding: 8px 10px 5px;
    border: 0;
    font-size: 14px;
  }

  .home-summary-row > span {
    min-width: 0;
    padding: 6px 10px;
    border: 0;
    border-top: 1px solid #eadfd2;
  }

  .home-summary-row > span:nth-of-type(odd) {
    border-right: 1px solid #eadfd2;
  }

  .home-summary-row small {
    font-size: 10px;
  }

  .home-summary-row b {
    font-size: 12px;
  }

  .home-summary-row > .home-summary-selection {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .home-summary-row > .home-summary-selection.is-empty {
    display: none;
  }
}

/* Directive approvals: phone layout uses approval cards instead of compressed columns. */
@media (max-width: 760px) {
  .directive-approvals-panel {
    display: flex;
    flex-direction: column;
  }

  .directive-approvals-panel > .directive-block-title {
    order: 1;
  }

  .directive-approvals-panel > .directive-approval-toolbar {
    order: 2;
  }

  .directive-approvals-panel > .directive-approval-tabs {
    order: 3;
  }

  .directive-approvals-panel > .directive-approval-content {
    order: 4;
  }

  .directive-approval-toolbar {
    display: grid;
    gap: 5px;
    overflow: visible;
  }

  .directive-quick-filters {
    display: flex;
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .directive-quick-filters [data-work-status="paid"] {
    display: none;
  }

  .directive-quick-filters [data-work-status] {
    min-height: 28px;
    padding-right: 5px;
    padding-left: 5px;
    font-size: 11px;
  }

  .directive-toolbar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    width: 100%;
  }

  .directive-toolbar-controls .directive-search {
    display: none;
  }

  .directive-toolbar-controls #workApprovalSortDirection {
    display: none;
  }

  .directive-toolbar-search {
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }

  .directive-toolbar-controls #workApprovalReset {
    grid-column: 2;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .directive-approval-content {
    overflow: visible;
  }

  .directive-approval-table.work-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
    border: 0;
    background: transparent;
  }

  .directive-approval-table thead {
    display: none;
  }

  .directive-approval-table tbody {
    display: grid;
    gap: 8px;
    width: 100%;
  }

  .directive-approval-table tbody > tr[data-history-id] {
    display: grid;
    grid-template-columns: 28px repeat(4, minmax(0, 1fr)) auto;
    gap: 5px 6px;
    width: 100%;
    padding: 8px;
    border: 1px solid #d9ccbc;
    border-radius: 9px;
    background: #fffaf3;
    box-shadow: 0 1px 2px rgba(50, 45, 35, 0.06);
  }

  .directive-requests-table tbody > tr[data-history-id] {
    grid-template-areas:
      "select title title title amount amount"
      "expense expense expense fund fund fund"
      "object object worktype worktype crew crew"
      "approve approve approve actions actions actions";
  }

  .directive-bills-table tbody > tr[data-history-id] {
    grid-template-areas:
      "select title title title amount amount"
      "company company company company company company"
      "expense expense expense fund fund fund"
      "object object worktype worktype crew crew"
      "approve approve approve actions actions actions";
  }

  .directive-approval-table tbody > tr[data-history-id] > td {
    display: none;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0;
    border: 0;
    background: transparent !important;
    overflow: visible;
  }

  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="select"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="title"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="company"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="expense"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="fund"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="object"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="worktype"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="crew"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="amount"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="approve"],
  .directive-approval-table tbody > tr[data-history-id] > td[data-directive-field="actions"] {
    display: block;
  }

  .directive-approval-table td[data-directive-field="select"] {
    grid-area: select;
    align-self: start;
    padding-top: 13px !important;
  }

  .directive-approval-table td[data-directive-field="title"] {
    grid-area: title;
  }

  .directive-approval-table td[data-directive-field="company"] {
    grid-area: company;
  }

  .directive-approval-table td[data-directive-field="expense"] {
    grid-area: expense;
  }

  .directive-approval-table td[data-directive-field="fund"] {
    grid-area: fund;
  }

  .directive-approval-table td[data-directive-field="object"] {
    grid-area: object;
  }

  .directive-approval-table td[data-directive-field="worktype"] {
    grid-area: worktype;
  }

  .directive-approval-table td[data-directive-field="crew"] {
    grid-area: crew;
  }

  .directive-approval-table td[data-directive-field="amount"] {
    grid-area: amount;
    min-width: 88px !important;
    color: #27382e;
    text-align: right;
  }

  .directive-approval-table td[data-directive-field="approve"] {
    grid-area: approve;
    display: grid !important;
    grid-template-columns: auto minmax(78px, 110px);
    align-items: center;
    justify-content: end;
    gap: 5px;
    padding-top: 5px !important;
    border-top: 1px solid rgba(120, 105, 85, 0.18) !important;
  }

  .directive-approval-table td[data-directive-field="actions"] {
    grid-area: actions;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-top: 5px !important;
    border-top: 1px solid rgba(120, 105, 85, 0.18) !important;
    text-align: right;
  }

  .directive-approval-table td[data-directive-label]::before {
    content: attr(data-directive-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.05;
    text-align: left;
  }

  .directive-bills-table td[data-directive-field="object"]:has(.directive-clamped-text:empty),
  .directive-bills-table td[data-directive-field="worktype"]:has(.directive-clamped-text:empty),
  .directive-bills-table td[data-directive-field="crew"]:has(.directive-clamped-text:empty) {
    display: none !important;
  }

  .directive-bills-table td[data-directive-field="company"] .directive-clamped-text {
    display: block;
    max-height: 1.2em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .directive-approval-table td[data-directive-field="title"] .link-cell-button {
    display: block;
    max-height: 1.2em;
    overflow: hidden;
    color: #245f7a;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .directive-approval-table td[data-directive-field="amount"]::before {
    text-align: right;
  }

  .directive-approval-table .directive-inline-control,
  .directive-approval-table .directive-approve-input,
  .directive-approval-table .directive-fund-select {
    min-height: 30px;
    padding: 4px 6px;
    border-color: #d8c9b8;
    background: rgba(255, 255, 255, 0.76);
    font-size: 12px;
  }

  .directive-approval-table .row-actions-compact {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
  }

  .directive-approval-table td.actions-col button {
    width: 29px;
    height: 32px;
    margin: 0;
  }

  .directive-approval-table tbody > tr[data-history-id].is-approved-row {
    background: #e2f2da;
  }

  .directive-approval-table tbody > tr[data-history-id].is-rejected-row {
    background: #fde8e3;
  }

  .directive-approval-table tbody > tr[data-history-id].is-paid-row {
    background: #e8f0ff;
  }

  .directive-approval-table tbody > tr[data-history-id].is-partial-row {
    background: #fff0cf;
  }

  .directive-approval-table .directive-approval-group-row {
    display: block;
    width: 100%;
  }

  .directive-approval-table .directive-approval-group-row > td {
    display: block;
    width: 100%;
  }

  .directive-approval-group-toggle {
    flex-wrap: wrap;
    gap: 4px 8px;
    min-height: 42px;
    padding: 7px 9px;
  }

  .directive-approval-group-toggle strong {
    min-width: 0;
    flex: 1 1 150px;
  }

  .directive-approval-group-toggle b {
    margin-left: 22px;
  }

  .directive-group-fund-metrics {
    flex: 1 1 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-left: 22px;
  }

  .directive-approval-group-toggle .directive-group-fund-metrics b {
    margin-left: 0;
  }

  .income-stage-table.directive-table {
    min-width: 420px;
  }

  .directive-stage,
  .directive-collapse-body {
    min-width: 0;
    width: 100%;
  }

  .directive-collapse-body {
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .income-stage-table th,
  .income-stage-table td,
  .fund-stage-table th,
  .fund-stage-table td {
    padding: 5px 4px;
    font-size: 12px;
  }

  .income-stage-table th:nth-child(2),
  .income-stage-table td:nth-child(2) {
    width: 110px;
  }

  .income-stage-table th:nth-child(3),
  .income-stage-table td:nth-child(3) {
    width: 64px;
  }

  .fund-stage-table.directive-table {
    width: calc(100% - 2px);
    min-width: 350px;
  }

  .fund-stage-table th:nth-child(1),
  .fund-stage-table td:nth-child(1) {
    width: 24px;
  }

  .fund-stage-table th:nth-child(2),
  .fund-stage-table td:nth-child(2) {
    width: 103px;
  }

  .fund-stage-table th:nth-child(3),
  .fund-stage-table td:nth-child(3) {
    width: 66px;
  }

  .fund-stage-table th:nth-child(4),
  .fund-stage-table td:nth-child(4),
  .fund-stage-table th:nth-child(5),
  .fund-stage-table td:nth-child(5),
  .fund-stage-table th:nth-child(6),
  .fund-stage-table td:nth-child(6) {
    width: 54px;
  }

  .fund-stage-table th:nth-child(7),
  .fund-stage-table td:nth-child(7) {
    width: 49px;
  }

  .income-stage-table .directive-actions,
  .fund-stage-table .directive-actions {
    width: 49px;
    min-width: 49px;
  }

  .fund-stage-table td.directive-actions {
    padding-right: 1px;
    padding-left: 1px;
  }

  .income-stage-table .directive-actions button,
  .fund-stage-table .directive-actions button {
    width: 22px;
    height: 25px;
    margin-left: 1px;
  }

  .income-stage-table .doc-icon,
  .fund-stage-table .doc-icon {
    width: 18px;
  }

  .fund-stage-table small {
    font-size: 10px;
  }

  .fund-stage-table th,
  .fund-stage-table td.num {
    font-size: 10px;
  }

  .fund-stage-table td:nth-child(2) {
    font-size: 11px;
  }

  .directive-fund-heading-long {
    display: none;
  }

  .directive-fund-heading-short {
    display: inline;
  }

  .fund-stage-table .directive-select-all span {
    display: none;
  }

  .fund-stage-table .approve-calculated,
  .fund-stage-table .reset-calculated {
    max-width: 100%;
    min-height: 25px;
    padding-right: 3px;
    padding-left: 3px;
    font-size: 9px;
    line-height: 1.05;
    white-space: normal;
  }

  .directive-section-title,
  .directive-fund-title {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 8px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .directive-section-title strong,
  .directive-fund-title strong {
    grid-column: 2;
    grid-row: 1;
    padding-left: 2px;
  }

  .directive-section-title b,
  .directive-fund-title b {
    grid-column: 3;
    grid-row: 1;
    margin: 0;
    font-size: 12px;
    text-align: right;
  }

  .directive-section-title .directive-toggle-arrow,
  .directive-fund-title .directive-toggle-arrow {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 980px) {
  .brand-row.has-home-week {
    grid-template-columns: minmax(118px, auto) max-content minmax(0, 1fr);
  }

  .brand-row.has-home-week .top-status {
    display: none;
  }
}

@media (max-width: 620px) {
  .brand-row.has-home-week {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 2px;
    min-height: 42px;
    padding: 2px 4px;
  }

  .brand-row.has-home-week .brand {
    flex: 0 0 auto;
    gap: 4px;
    padding: 0 2px;
  }

  .brand-row.has-home-week .brand > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
  }

  .brand-row.has-home-week .brand-logo {
    width: 20px;
    height: 30px;
  }

  .brand-row.has-home-week .brand strong {
    font-size: 11px;
    line-height: 1;
  }

  .brand-row.has-home-week .brand small {
    display: block;
    margin-top: 2px;
    font-size: 9px;
    line-height: 1;
  }

  .brand-row.has-home-week > .week-switcher {
    flex: 0 0 auto;
    min-height: 36px;
  }

  .brand-row.has-home-week .week-arrow {
    width: 24px;
    min-height: 36px;
    flex-basis: 24px;
  }

  .brand-row.has-home-week .week-label {
    display: flex;
    width: auto;
    max-width: 76px;
    min-height: 36px;
    padding: 0 5px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
  }

  .brand-row.has-home-week .icon-strip {
    flex: 1 1 auto;
    gap: 0;
    min-width: 0;
    overflow: hidden;
  }

  .brand-row.has-home-week .icon-strip button {
    flex: 1 1 30px;
    width: auto;
    min-width: 28px;
    max-width: 36px;
    height: 36px;
  }

  .brand-row.has-home-week .icon-strip button svg {
    width: 20px;
    height: 20px;
  }
}
