:root {
  --bg: #f2f6fc;
  --surface: #ffffff;
  --surface-soft: #f6f8fd;
  --surface-blue: #e7edff;
  --line: #dce3ef;
  --line-strong: #c2cddd;
  --text: #050505;
  --muted: #677087;
  --accent: #334cdb;
  --accent-strong: #182da8;
  --danger: #c93838;
  --warning: #a96b00;
  --income: #087a56;
  --expense: #c93838;
  --shadow: 0 18px 48px rgba(24, 45, 168, 0.14);
}

/* Import review: warnings must explain why a row needs attention before it reaches the journal. */
.modal-card.bank-import-card { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; width: min(780px, 100vw); height: 100vh; box-sizing: border-box; overflow: hidden; }
.bank-import-card #bankImportRows { display: grid; gap: 8px; min-height: 0; overflow: auto; padding: 2px; }
.bank-import-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 220px; gap: 7px 12px; align-items: center; padding: 12px; border: 1px solid #dbe3ef; border-left: 4px solid #198754; border-radius: 8px; color: #24324a; background: #fff; }
.bank-import-row.is-warning { border-left-color: #e6a700; background: #fffaf0; }
.bank-import-row.is-excluded { grid-template-columns: 1fr; margin: 7px 0; border-left-color: #94a3b8; color: #64748b; background: #f8fafc; }
.bank-import-row.is-excluded small { grid-column: 1 / -1; }
.bank-import-row small { grid-column: 2 / -1; color: #64748b; line-height: 1.35; }
.bank-import-row .bank-import-reason { color: #9a6700; font-weight: 700; }
.bank-import-row .bank-import-transfer { color: #2563eb; font-weight: 700; }
.bank-import-select { display: grid; place-items: center; width: 30px; height: 30px; cursor: pointer; }
.bank-import-select input { width: 19px; height: 19px; margin: 0; accent-color: #3156dc; cursor: pointer; }
.bank-import-identity { display: grid; min-width: 0; gap: 3px; }
.bank-import-amount { font-size: 17px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.bank-import-amount.is-expense { color: #be4242; }
.bank-import-amount.is-income { color: #087a56; }
.bank-import-identity span { overflow: hidden; color: #64748b; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.bank-import-category { display: grid; gap: 3px; min-width: 0; color: #64748b; font-size: 12px; font-weight: 700; }
.bank-import-category .category-picker > input { min-height: 36px; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; color: #24324a; font-size: 13px; font-weight: 600; }
.bank-import-category .category-picker-menu { width: min(430px, calc(100vw - 28px)); }
.bank-import-card details { margin-top: 12px; color: #64748b; }
.bank-import-card details summary { cursor: pointer; font-weight: 700; }
.bank-import-card .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 14px -24px -24px; padding: 14px 24px; border-top: 1px solid #dbe3ef; background: #fff; box-shadow: 0 -8px 18px rgba(30, 41, 59, .06); }
@media (max-width: 700px) { .bank-import-row { grid-template-columns: 32px minmax(0, 1fr); } .bank-import-category { grid-column: 2; } .bank-import-row small { grid-column: 2; } }

/* Beta feedback center */

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nav-notification-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #e24b55;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.nav-item.active .nav-notification-badge {
  background: rgba(255, 255, 255, 0.92);
  color: #d33e49;
}

.feedback-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.feedback-summary-item {
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid rgba(137, 156, 190, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(38, 60, 112, 0.05);
  text-align: left;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.feedback-summary-item:hover,
.feedback-summary-item.active {
  border-color: rgba(49, 86, 220, 0.4);
  background: rgba(241, 245, 255, 0.94);
  transform: translateY(-1px);
}

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

.feedback-summary-item strong {
  display: block;
  margin-top: 7px;
  color: #1e293b;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.feedback-workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.72fr) minmax(520px, 1.28fr);
  min-height: 620px;
  padding: 0;
  overflow: hidden;
}

.feedback-list-pane {
  min-width: 0;
  border-right: 1px solid rgba(137, 156, 190, 0.24);
  background: rgba(248, 250, 255, 0.58);
}

.feedback-list-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, auto);
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid rgba(137, 156, 190, 0.22);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(12px);
}

.feedback-list-toolbar #feedbackTypeFilter,
.feedback-list-toolbar #newFeedbackTaskButton {
  grid-column: span 1;
}

.feedback-list-toolbar #newFeedbackTaskButton {
  white-space: nowrap;
}

.feedback-task-list {
  max-height: 660px;
  overflow-y: auto;
}

.feedback-task-row {
  display: grid;
  width: 100%;
  gap: 7px;
  padding: 14px 15px;
  border: 0;
  border-bottom: 1px solid rgba(137, 156, 190, 0.18);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.feedback-task-row:hover {
  background: rgba(235, 241, 255, 0.66);
}

.feedback-task-row.active {
  background: rgba(229, 237, 255, 0.94);
  box-shadow: inset 3px 0 0 #3156dc;
}

.feedback-task-row.unread > strong {
  color: #163bb5;
}

.feedback-task-row-top,
.feedback-task-row-tags,
.feedback-task-row-meta,
.feedback-detail-tags,
.feedback-message-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.feedback-task-row-top time {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.feedback-task-number {
  color: #52627d;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.feedback-unread-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #3156dc;
  box-shadow: 0 0 0 3px rgba(49, 86, 220, 0.12);
}

.feedback-task-row > strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.feedback-task-row-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-status,
.feedback-type,
.feedback-blocking-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.feedback-status {
  background: #eef2ff;
  color: #3153c7;
}

.feedback-status[data-feedback-status="new"] {
  background: #e8efff;
  color: #274fc5;
}

.feedback-status[data-feedback-status="needs_info"] {
  background: #fff1d7;
  color: #8a5a06;
}

.feedback-status[data-feedback-status="ready"] {
  background: #e4f6ed;
  color: #147653;
}

.feedback-status[data-feedback-status="verified"] {
  background: #edf0f5;
  color: #596579;
}

.feedback-type {
  background: #f0f3f8;
  color: #596579;
}

.feedback-blocking-label {
  background: #fde9eb;
  color: #b63642;
}

.feedback-detail-pane {
  min-width: 0;
  max-height: 720px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.7);
}

.feedback-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 20px 22px 17px;
  border-bottom: 1px solid rgba(137, 156, 190, 0.2);
}

.feedback-detail-header h2 {
  margin: 5px 0 9px;
  font-size: 22px;
  line-height: 1.28;
}

.feedback-detail-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 8px;
  min-width: 330px;
}

.feedback-detail-controls label {
  color: var(--muted);
  font-size: 11px;
}

.feedback-detail-controls select {
  width: 100%;
  margin-top: 5px;
}

.feedback-description {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(137, 156, 190, 0.18);
}

.feedback-description p {
  margin: 0 0 12px;
  color: #273247;
  font-size: 14px;
  line-height: 1.6;
}

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

.feedback-context {
  margin: 0 22px;
  border-bottom: 1px solid rgba(137, 156, 190, 0.18);
}

.feedback-context summary {
  padding: 13px 0;
  color: #42516a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.feedback-context dl {
  display: grid;
  gap: 7px;
  margin: 0 0 15px;
}

.feedback-context dl > div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
}

.feedback-context dt {
  color: var(--muted);
  font-size: 11px;
}

.feedback-context dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #37445b;
  font-size: 11px;
}

.feedback-chat {
  padding: 18px 22px 22px;
}

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

.feedback-chat-heading h3 {
  margin: 0;
  font-size: 16px;
}

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

.feedback-messages {
  display: grid;
  gap: 10px;
  max-height: 320px;
  padding: 2px 2px 10px;
  overflow-y: auto;
}

.feedback-message {
  width: min(78%, 620px);
  padding: 11px 13px;
  border: 1px solid rgba(137, 156, 190, 0.22);
  border-radius: 8px;
  background: rgba(247, 249, 253, 0.92);
}

.feedback-message.mine {
  justify-self: end;
  border-color: rgba(91, 121, 220, 0.24);
  background: rgba(234, 240, 255, 0.92);
}

.feedback-message-meta {
  justify-content: space-between;
  margin-bottom: 6px;
}

.feedback-message-meta strong {
  font-size: 12px;
}

.feedback-message-meta time {
  color: var(--muted);
  font-size: 10px;
}

.feedback-message p {
  margin: 0;
  color: #2f3b50;
  font-size: 13px;
  line-height: 1.5;
}

.feedback-system-message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #6b7485;
  font-size: 11px;
  text-align: center;
}

.feedback-system-message time {
  color: #9aa3b2;
}

.feedback-empty-chat {
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.feedback-message-form {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding-top: 13px;
  border-top: 1px solid rgba(137, 156, 190, 0.2);
}

.feedback-message-form textarea {
  width: 100%;
  resize: vertical;
}

.feedback-message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.feedback-attach-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #3b475c;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.feedback-attach-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.feedback-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.feedback-attachment {
  display: grid;
  width: 132px;
  overflow: hidden;
  border: 1px solid rgba(137, 156, 190, 0.24);
  border-radius: 8px;
  background: #fff;
  color: #46536a;
  text-decoration: none;
}

.feedback-attachment img {
  width: 100%;
  height: 82px;
  object-fit: cover;
  background: #f1f4f9;
}

.feedback-attachment span {
  overflow: hidden;
  padding: 6px 8px;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-empty-state {
  display: grid;
  place-content: center;
  min-height: 280px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.feedback-empty-state strong {
  color: #354158;
  font-size: 16px;
}

.feedback-empty-state span {
  margin-top: 6px;
  font-size: 12px;
}

.feedback-list-empty {
  min-height: 220px;
}

.feedback-launch-button {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 16px 0 11px;
  border: 1px solid rgba(49, 86, 220, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  color: #294bc3;
  box-shadow: 0 12px 30px rgba(35, 55, 107, 0.14);
  font-weight: 650;
}

.feedback-launch-button:hover {
  border-color: rgba(49, 86, 220, 0.42);
  background: #fff;
  transform: translateY(-1px);
}

.feedback-launch-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3156dc;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.feedback-toast {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 30;
  display: grid;
  gap: 3px;
  min-width: 270px;
  padding: 13px 15px;
  border: 1px solid rgba(49, 86, 220, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  color: #273247;
  box-shadow: 0 16px 36px rgba(31, 48, 92, 0.18);
  text-align: left;
}

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

.feedback-task-modal .modal-card {
  width: min(620px, 100%);
}

.feedback-task-modal .modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.feedback-file-field > span {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1100px) {
  .feedback-workspace {
    grid-template-columns: minmax(290px, 0.8fr) minmax(460px, 1.2fr);
  }

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

  .feedback-detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .feedback-detail-controls {
    min-width: 0;
  }
}

@media (max-width: 820px) {
  .feedback-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feedback-workspace {
    grid-template-columns: 1fr;
  }

  .feedback-list-pane {
    border-right: 0;
    border-bottom: 1px solid rgba(137, 156, 190, 0.24);
  }

  .feedback-task-list {
    max-height: 340px;
  }

  .feedback-detail-pane {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .feedback-list-toolbar,
  .feedback-detail-controls {
    grid-template-columns: 1fr;
  }

  .feedback-list-toolbar #feedbackTypeFilter,
  .feedback-list-toolbar #newFeedbackTaskButton {
    grid-column: 1;
  }

  .feedback-detail-header,
  .feedback-description,
  .feedback-chat {
    padding-right: 14px;
    padding-left: 14px;
  }

  .feedback-context {
    margin-right: 14px;
    margin-left: 14px;
  }

  .feedback-message {
    width: 92%;
  }

  .feedback-launch-button {
    right: 14px;
    bottom: 14px;
  }
}

/* Cash control overview */
.cash-control-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cash-control-toolbar-copy p {
  margin: 6px 0 0;
  color: var(--muted);
}

.cash-control-filters {
  display: flex;
  align-items: end;
  gap: 10px;
}

.cash-control-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.cash-control-filters input {
  min-width: 168px;
}

.cash-control-notice {
  margin: 0 0 14px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
}

.cash-control-notice.is-success {
  border-color: rgba(58, 151, 111, 0.3);
  background: rgba(232, 248, 240, 0.82);
  color: #17664c;
}

.cash-control-notice.is-error {
  border-color: rgba(190, 78, 78, 0.3);
  background: rgba(255, 239, 240, 0.84);
  color: #9b4141;
}

.cash-control-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.cash-control-summary-item {
  min-height: 72px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 6px 18px rgba(39, 67, 118, 0.045);
}

.cash-control-summary-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.cash-control-summary-item strong {
  font-size: 24px;
  line-height: 1;
}

.cash-control-summary-item.is-ready strong { color: #3156dc; }
.cash-control-summary-item.is-attention strong { color: #a2670a; }
.cash-control-summary-item.is-closed strong { color: #147657; }
.cash-control-summary-item.is-open strong { color: #6f798c; }
.cash-control-summary-item.is-waiting strong { color: #6f798c; }

.cash-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 14px;
}

.cash-control-card {
  --cash-status: #788398;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 4px solid var(--cash-status);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), var(--shadow-card);
}

.cash-control-card.status-ready { --cash-status: #3156dc; }
.cash-control-card.status-attention { --cash-status: #d0942e; }
.cash-control-card.status-danger { --cash-status: #c45151; }
.cash-control-card.status-closed { --cash-status: #2a9570; }
.cash-control-card.status-open { --cash-status: #788398; }

.cash-control-card-header {
  min-height: 104px;
  padding: 17px 18px 15px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.cash-control-card-header > div {
  min-width: 0;
}

.cash-control-card-header > div > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.cash-control-card-header h2 {
  overflow-wrap: anywhere;
}

.cash-control-status {
  max-width: 170px;
  padding: 5px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--cash-status) 12%, white);
  color: color-mix(in srgb, var(--cash-status) 82%, #152036);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
}

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

.cash-control-metric {
  min-width: 0;
  min-height: 72px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.cash-control-metric:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.cash-control-metric:last-child {
  grid-column: 1 / -1;
  border-right: 0;
}

.cash-control-metric span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.cash-control-metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.2;
}

.cash-control-metric.is-negative strong {
  color: var(--danger);
}

.cash-control-card-footer {
  min-height: 76px;
  padding: 13px 16px 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cash-control-card-footer > span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.cash-control-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

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

.cash-control-shortage-action {
  white-space: nowrap;
}

.cash-control-empty {
  grid-column: 1 / -1;
  padding: 28px;
}

@media (max-width: 1000px) {
  .cash-control-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
}

@media (max-width: 800px) {
  .cash-control-toolbar,
  .cash-control-filters,
  .cash-control-card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .cash-control-filters input,
  .cash-control-filters button,
  .cash-control-action {
    width: 100%;
  }

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

  .cash-control-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .cash-control-metrics {
    grid-template-columns: 1fr;
  }

  .cash-control-metric,
  .cash-control-metric:nth-child(odd),
  .cash-control-metric:last-child {
    grid-column: auto;
    border-right: 0;
  }

  .cash-control-card-header {
    flex-direction: column;
  }

  .cash-control-status {
    max-width: none;
    text-align: left;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body:not(.is-authenticated) > :not(.login-screen):not(script) {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Favorit Pro", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(72, 104, 234, 0.18), transparent 34%),
    radial-gradient(circle at 85% 80%, rgba(49, 86, 220, 0.12), transparent 32%),
    #eef3fb;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid rgba(114, 137, 179, 0.24);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 70px rgba(39, 59, 112, 0.16);
}

.login-brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(180deg, #4969ea 0%, #2f4fd7 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(49, 86, 220, 0.24);
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card h1 {
  font-size: 28px;
  line-height: 1.15;
}

.login-eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-copy,
.login-help {
  color: var(--muted);
  line-height: 1.5;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: #303b50;
  font-weight: 650;
}

.login-card input {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
}

.login-card input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(51, 76, 219, 0.14);
}

.login-submit {
  min-height: 46px;
  justify-content: center;
}

.login-secondary {
  min-height: 42px;
  justify-content: center;
}

.login-error {
  padding: 10px 12px;
  border: 1px solid rgba(201, 56, 56, 0.24);
  border-radius: 8px;
  background: rgba(201, 56, 56, 0.08);
  color: var(--danger);
}

.login-help {
  font-size: 12px;
  text-align: center;
}

.role-box-label,
.current-user-role {
  color: var(--muted);
  font-size: 12px;
}

.role-box #currentUserName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  justify-content: center;
}

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

@media (max-width: 520px) {
  .login-screen {
    align-items: start;
    padding: 16px;
  }

  .login-card {
    margin-top: 7vh;
    padding: 26px 22px;
  }
}

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

button {
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(94, 116, 246, 0.28);
  outline-offset: 1px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #fff;
  color: var(--text);
  border-right: 1px solid var(--line);
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 8px 22px rgba(51, 76, 219, 0.24);
}

.brand-title {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.15;
}

.brand-subtitle,
.hint,
.report-controls p,
.drawer-header p {
  color: var(--muted);
  margin: 4px 0 0;
}

.sidebar .brand-subtitle {
  color: var(--muted);
}

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

@keyframes navWiggle {
  0%, 100% {
    transform: rotate(-0.45deg) translateY(0);
  }

  50% {
    transform: rotate(0.45deg) translateY(-1px);
  }
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: #34394a;
  text-align: left;
  min-height: 42px;
  padding: 0 13px;
  border-radius: 8px;
  font-weight: 500;
  user-select: none;
  touch-action: manipulation;
}

.nav-item:hover {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

.nav-item.active,
.nav-item.active:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 22px rgba(51, 76, 219, 0.18);
}

.nav.is-editing .nav-item {
  cursor: grab;
  animation: navWiggle 170ms ease-in-out infinite;
}

.nav.is-editing .nav-item:nth-child(2n) {
  animation-delay: 80ms;
}

.nav.is-editing .nav-item.is-dragging {
  cursor: grabbing;
  opacity: 0.74;
  animation: none;
  transform: scale(0.98);
}

.role-box {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.role-box label {
  color: var(--muted);
  font-size: 12px;
}

.storage-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #e3a129;
}

.storage-status.online .status-dot {
  background: #0d9b6b;
}

.storage-status.offline .status-dot {
  background: #d79b24;
}

.main {
  min-width: 0;
  padding: 28px 30px 38px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.05;
  font-weight: 700;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

#viewSubtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-heading {
  min-width: 0;
}

.topbar-title-row,
.journal-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.journal-title-actions[hidden] {
  display: none;
}

.journal-title-actions .primary-button {
  min-height: 40px;
}

.top-actions,
.action-strip,
.panel-header,
.report-controls,
.filters,
.panel-actions,
.drawer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions,
.panel-header,
.report-controls {
  justify-content: space-between;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.balance-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.balance-overview .metric {
  min-height: 132px;
}

.calendar-liability small {
  display: block;
  margin-top: 12px;
  color: inherit;
  font-size: 12px;
  line-height: 1.4;
}

.calendar-liability.coverage-good {
  border-color: #a8d8c3;
  background: #edf8f3;
  color: #17694f;
}

.calendar-liability.coverage-warning {
  border-color: #e8d39b;
  background: #fff8e8;
  color: #8a620d;
}

.calendar-liability.coverage-bad {
  border-color: #e3aaa8;
  background: #fff0f0;
  color: #9d3f3f;
}

.calendar-liability.coverage-good span,
.calendar-liability.coverage-warning span,
.calendar-liability.coverage-bad span {
  color: inherit;
  opacity: 0.78;
}

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

.metric {
  min-height: 112px;
  padding: 18px 20px;
}

.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

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

.metric:first-child {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 14px 30px rgba(51, 76, 219, 0.2);
}

.metric:first-child span {
  color: rgba(255, 255, 255, 0.72);
}

.metric.warning strong {
  color: var(--warning);
}

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

.wallet-section {
  margin-bottom: 18px;
}

.wallet-section h2 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.wallet-card {
  position: relative;
  min-height: 122px;
  padding: 18px 20px;
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.wallet-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.wallet-card:hover {
  border-color: #bac7f6;
  box-shadow: 0 12px 28px rgba(24, 45, 168, 0.1);
  transform: translateY(-1px);
}

.wallet-card .balance {
  display: block;
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  margin: 14px 0 8px;
}

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

.action-strip {
  margin: 16px 0 22px;
  flex-wrap: wrap;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.panel.feedback-workspace {
  padding: 0;
}

.table-wrap {
  overflow: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(24, 45, 168, 0.04);
}

.table-wrap.tall {
  max-height: calc(100vh - 280px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #edf2ff;
  font-size: 12px;
  color: #47506a;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  transition: background-color 120ms ease;
}

tbody tr:hover td {
  background: #f7f9ff;
}

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

td.amount,
th.amount {
  text-align: right;
  white-space: nowrap;
}

.income {
  color: var(--income);
  font-weight: 700;
}

.expense {
  color: var(--expense);
  font-weight: 700;
}

.transfer-amount {
  color: var(--accent-strong);
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-blue);
  color: var(--accent-strong);
  padding: 3px 8px;
  font-size: 12px;
}

.tag.warning {
  background: #fff1d6;
  color: var(--warning);
}

.tag.success {
  background: #e7f7f0;
  color: var(--income);
}

.primary-button,
.ghost-button,
.danger-ghost-button,
.link-button,
.icon-button {
  border-radius: 8px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  font-weight: 500;
}

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

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 8px 20px rgba(51, 76, 219, 0.18);
}

.button-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.button-icon {
  position: relative;
  display: inline-block;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.download-icon::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 7px;
  height: 7px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg);
}

.download-icon::after {
  content: "";
  position: absolute;
  inset: auto 1px 1px;
  height: 5px;
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 0 0 4px 4px;
  opacity: 0.9;
}

.download-icon {
  background: linear-gradient(currentColor, currentColor) center 0 / 1.8px 10px no-repeat;
}

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

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

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

.danger-ghost-button:hover {
  background: #fff5f5;
  border-color: #e8a3a3;
}

.link-button {
  background: transparent;
  color: var(--accent);
  padding: 0;
}

.link-button:hover {
  color: var(--accent-strong);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 176px;
}

.row-actions .ghost-button,
.row-actions .danger-ghost-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.icon-button {
  width: 36px;
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.icon-button:hover {
  background: var(--surface-blue);
  border-color: #bac7f6;
  color: var(--accent-strong);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 116, 246, 0.16);
}

textarea {
  resize: vertical;
}

.quick-entry-options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#journalView .table-wrap.tall {
  max-height: calc(100vh - 240px);
}

.quick-entry-form {
  gap: 12px;
}

.quick-entry-options {
  justify-content: space-between;
  min-width: 0;
}

.quick-entry-status {
  min-height: 18px;
  color: var(--income);
  font-size: 12px;
  text-align: left;
}

.quick-keep-control {
  min-height: 36px;
}

.filters {
  display: grid;
  grid-template-columns:
    minmax(200px, 1fr) 140px 160px minmax(180px, 210px)
    minmax(180px, 210px) 145px 120px;
}

.journal-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 32px;
  padding: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.journal-summary span:first-child {
  margin-right: auto;
  color: var(--text);
}

.journal-summary strong {
  font-weight: 700;
}

.journal-summary small {
  color: var(--muted);
  font-size: inherit;
}

.journal-load-more {
  display: flex;
  justify-content: center;
  padding-top: 10px;
}

.journal-load-more[hidden] {
  display: none;
}

.journal-load-more .ghost-button {
  min-width: 280px;
}

.counterparty-directory-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.counterparty-directory-toolbar .checkbox-control {
  min-height: 40px;
  white-space: nowrap;
}

.counterparty-directory-list {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 3px;
}

select:disabled {
  color: #35435e;
  background: #eef2f8;
  cursor: not-allowed;
  opacity: 1;
}

.journal-category-filter {
  position: relative;
  min-width: 0;
}

.journal-category-filter > input {
  padding-right: 38px;
}

.journal-category-filter.has-selection > input {
  padding-right: 68px;
}

.journal-category-count {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 39px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  transform: translateY(-50%);
  border-radius: 10px;
  background: #e6edff;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  line-height: 21px;
  text-align: center;
  pointer-events: none;
}

.journal-category-count[hidden] {
  display: none;
}

.journal-category-toggle {
  position: absolute;
  z-index: 2;
  top: 1px;
  right: 1px;
  width: 36px;
  height: 40px;
  border: 0;
  border-left: 1px solid transparent;
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.journal-category-toggle:hover,
.journal-category-toggle:focus-visible {
  border-left-color: var(--line);
  background: #f4f7ff;
  color: var(--accent-strong);
}

.journal-category-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: min(420px, 55vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(24, 39, 75, 0.16);
}

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

.journal-category-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.journal-category-check {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid #c8d2e6;
  border-radius: 5px;
  background: #fff;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.journal-category-option:hover,
.journal-category-option:focus-visible {
  background: #eef3ff;
  color: var(--accent-strong);
}

.journal-category-option.is-all {
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  font-weight: 600;
}

.journal-category-option.is-all .journal-category-check {
  color: var(--accent-strong);
}

.journal-category-option.is-selected {
  background: #e6edff;
  color: var(--accent-strong);
  font-weight: 600;
}

.journal-category-option.is-selected .journal-category-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.journal-category-group + .journal-category-group {
  margin-top: 4px;
}

.journal-category-group-title {
  position: sticky;
  top: -6px;
  z-index: 1;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 7px 9px 5px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.journal-category-group-title .color-swatch {
  width: 8px;
  height: 8px;
}

.journal-category-group-title small {
  font-size: 10px;
  font-weight: 600;
}

.journal-category-empty {
  padding: 12px 9px;
  color: var(--muted);
  font-size: 13px;
}

.category-picker {
  position: relative;
  min-width: 0;
}

.category-picker > input {
  width: 100%;
  padding-right: 38px;
}

.category-picker.is-open > input {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(51, 76, 219, 0.12);
}

.category-picker-source {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.category-picker-toggle {
  position: absolute;
  z-index: 2;
  top: 1px;
  right: 1px;
  width: 36px;
  height: 38px;
  padding: 0;
  border: 0;
  border-left: 1px solid transparent;
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.category-picker-toggle:hover,
.category-picker-toggle:focus-visible,
.category-picker.is-open .category-picker-toggle {
  border-left-color: var(--line);
  background: #f4f7ff;
  color: var(--accent-strong);
}

.category-picker-menu {
  position: absolute;
  z-index: 90;
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, calc(100vw - 32px));
  min-width: 100%;
  max-width: calc(100vw - 32px);
  max-height: min(360px, 50vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(24, 39, 75, 0.16);
}

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

.category-picker-option-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.category-picker-option-copy strong,
.category-picker-option-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-picker-option-copy strong {
  font-size: 13px;
}

.category-picker-option-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.category-picker-option.is-empty {
  border-bottom: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
}

.report-controls {
  min-height: 64px;
  align-items: flex-start;
  gap: 28px;
  padding: 14px 2px 16px;
  border-bottom: 1px solid rgba(112, 135, 174, 0.2);
}

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

.report-tabs {
  width: fit-content;
  margin: 0;
}

.report-density-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.report-density-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.report-density-control .report-density-switch {
  grid-template-columns: repeat(2, minmax(94px, 1fr));
}

.report-density-control .report-density-switch button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.report-heading {
  min-width: 0;
}

.report-heading h2 {
  font-size: 20px;
  line-height: 1.25;
}

.report-heading p {
  max-width: 520px;
  font-size: 13px;
  line-height: 1.45;
}

.report-filter-controls {
  display: grid;
  grid-template-columns: 112px 190px 180px 150px;
  gap: 10px;
  flex: 0 0 auto;
}

.report-filter-controls label,
.report-summary-months-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.report-filter-controls select {
  width: 100%;
  min-height: 40px;
  font-size: 13px;
}

.report-month-picker {
  position: relative;
}

.report-month-picker summary {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.report-month-picker summary::-webkit-details-marker {
  display: none;
}

.report-month-picker-chevron {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-right: 1.5px solid #64748b;
  border-bottom: 1.5px solid #64748b;
  transform: rotate(45deg) translateY(-2px);
}

.report-month-picker[open] .report-month-picker-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.report-month-picker-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  width: 330px;
  padding: 12px;
  border: 1px solid #cbd6e5;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(34, 48, 75, 0.18);
}

.report-month-picker-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.report-month-picker-actions button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #ced8e7;
  border-radius: 6px;
  background: #f5f7fb;
  color: #44516a;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.report-month-picker-actions button:hover {
  border-color: #9eb0ca;
  background: #edf2f8;
}

.report-month-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 8px;
}

.report-filter-controls .report-month-options label,
.report-filter-controls .report-percent-toggle {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: #344057;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.report-month-options input,
.report-percent-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #3555d7;
}

.report-percent-toggle {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e1e7f0;
}

#reportSummaryComparisonHint {
  margin: 5px 0 0 21px;
  color: #718096;
  font-size: 11px;
  font-weight: 500;
}

.report-checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.report-checkbox-control input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.report-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
  color: #4d5569;
  font-size: 12.5px;
  font-weight: 500;
}

.report-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.report-legend-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.report-legend-swatch.revenue {
  background: #e6f6ec;
  border-color: #92d1aa;
}

.report-legend-swatch.supplier {
  background: #e8f0ff;
  border-color: #9ab8ef;
}

.report-legend-swatch.tax {
  background: #fff0d3;
  border-color: #e5bd6f;
}

.report-legend-swatch.payroll {
  background: #f2e9ff;
  border-color: #c6a7e8;
}

.report-legend-divider {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
}

.report-location-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.report-location-dot.bk,
.report-location-badge.bk {
  background: #b4236c;
}

.report-location-dot.vg,
.report-location-badge.vg {
  background: #087a72;
}

.report-location-dot.chtz,
.report-location-badge.chtz {
  background: #c45d16;
}

.report-wrap {
  max-height: calc(100vh - 270px);
  margin-top: 16px;
}

.report-table {
  min-width: 0;
  table-layout: fixed;
  color: #1d2739;
  font-size: 11px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.report-table.single-month {
  min-width: 660px;
  table-layout: auto;
  font-size: 13px;
}

.report-table.density-comfortable:not(.single-month) {
  font-size: 11.5px;
}

.report-table.density-compact:not(.single-month) {
  font-size: 10px;
}

.report-table:not(.single-month) th,
.report-table:not(.single-month) td {
  padding: 10px 3px;
  border-right: 1px solid rgba(112, 135, 174, 0.22);
}

.report-table.density-compact:not(.single-month) th,
.report-table.density-compact:not(.single-month) td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.report-table th:first-child,
.report-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fbfcff;
  width: 210px;
  min-width: 210px;
  box-shadow: 1px 0 0 rgba(100, 123, 162, 0.2);
}

.report-table th:first-child {
  background: #eaf0fb;
  z-index: 6;
}

.report-table.density-compact th:first-child,
.report-table.density-compact td:first-child {
  width: 198px;
  min-width: 198px;
}

.report-table.single-month th:first-child,
.report-table.single-month td:first-child {
  width: 320px;
  min-width: 320px;
}

.report-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 43px;
  background: #eaf0fb;
  color: #44516a;
  font-size: 11.5px;
  font-weight: 750;
  line-height: 1.2;
  box-shadow: inset 0 -1px 0 rgba(97, 120, 160, 0.26);
}

.report-table.single-month thead th {
  font-size: 12.5px;
}

.report-table th:last-child,
.report-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  border-left: 2px solid rgba(81, 96, 128, 0.22);
  background: #f8faff;
  box-shadow: -1px 0 0 rgba(100, 123, 162, 0.2);
}

.report-table:not(.single-month) th:last-child,
.report-table:not(.single-month) td:last-child {
  width: 80px;
}

.report-table.density-compact:not(.single-month) th:last-child,
.report-table.density-compact:not(.single-month) td:last-child {
  width: 78px;
}

.report-table th:last-child {
  z-index: 5;
  background: #e4ebf8;
}

.report-table .report-change-column {
  width: 62px;
  min-width: 62px;
  background: #f3f6fb;
  color: #68758a;
  font-weight: 700;
  text-align: right;
}

.report-table .report-change-column.positive {
  color: #315d9d;
}

.report-table .report-change-column.negative {
  color: #9a5a43;
}

.report-table .section-row .report-change-column {
  color: #fff;
}

.report-table .section-row td,
.report-table .section-row th {
  background: #26375f;
  color: #fff;
  font-weight: 700;
  border-right-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.report-table tbody .section-row:not(:first-child) td {
  border-top: 7px solid #edf2f8;
}

.report-table .section-row .report-row-label {
  min-height: 30px;
  font-size: 14px;
  font-weight: 750;
}

.report-table .section-row.report-kind-default td {
  background: #5c4829;
}

.report-table .section-row.report-kind-default:hover td {
  background: #4e3d23;
}

.report-table .section-row:hover td {
  background: #203052;
}

.report-table .report-kind-revenue:not(.section-row) td {
  background: #e6f6ec;
}

.report-table .report-kind-revenue:not(.section-row):hover td {
  background: #d6efdf;
}

.report-table .report-kind-supplier:not(.section-row) td {
  background: #e8f0ff;
}

.report-table .report-kind-supplier:not(.section-row):hover td {
  background: #dbe7fb;
}

.report-table .report-kind-tax:not(.section-row) td {
  background: #fff0d3;
}

.report-table .report-kind-tax:not(.section-row):hover td {
  background: #f8e4bc;
}

.report-table .report-kind-payroll:not(.section-row) td {
  background: #f2e9ff;
}

.report-table .report-kind-payroll:not(.section-row):hover td {
  background: #e8dcf8;
}

.report-row-label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 26px;
  padding-left: calc(var(--report-level, 0) * 16px);
  font-size: 13px;
  line-height: 1.3;
}

.report-row-label > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-expand-button,
.report-expand-spacer {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}

.density-compact .report-expand-button,
.density-compact .report-expand-spacer {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
}

.report-expand-button {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.report-expand-button:hover {
  border-color: rgba(49, 86, 220, 0.18);
  background: rgba(49, 86, 220, 0.1);
}

.section-row .report-expand-button:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
}

.report-expand-button:focus-visible {
  outline: 2px solid rgba(49, 86, 220, 0.42);
  outline-offset: 1px;
}

.report-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: translateX(-1px) rotate(-45deg);
  transition: transform var(--transition-fast);
}

.report-expand-button[aria-expanded="true"] .report-chevron {
  transform: translateY(-1px) rotate(45deg);
}

.report-direction-swatch {
  width: 4px;
  height: 20px;
  flex: 0 0 4px;
  border-radius: 3px;
  background: var(--report-swatch, #64748b);
}

.report-node-group td {
  font-weight: 700;
  border-top: 2px solid rgba(81, 96, 128, 0.22);
  background: #f3f6fb;
}

.report-node-group .report-row-label {
  font-size: 13.5px;
}

.report-node-project td {
  font-weight: 650;
  background: #f8faff;
  border-top: 2px solid rgba(91, 111, 148, 0.24);
}

.report-node-project .report-row-label {
  font-size: 13.5px;
}

.report-node-project.report-location-bk td {
  border-top-color: rgba(180, 35, 108, 0.3);
}

.report-node-project.report-location-bk td:first-child {
  background: #fceef5;
}

.report-node-project.report-location-vg td {
  border-top-color: rgba(8, 122, 114, 0.3);
}

.report-node-project.report-location-vg td:first-child {
  background: #eaf8f6;
}

.report-node-project.report-location-chtz td {
  border-top-color: rgba(196, 93, 22, 0.3);
}

.report-node-project.report-location-chtz td:first-child {
  background: #fff2e8;
}

.report-node-category td:first-child,
.report-node-balance td:first-child {
  font-weight: 600;
}

.report-node-counterparty td {
  color: #5b6478;
  font-size: 11.5px;
}

.density-compact .report-row-label {
  min-height: 22px;
  gap: 7px;
  padding-left: calc(var(--report-level, 0) * 14px);
  font-size: 11px;
}

.density-compact .report-node-counterparty td {
  font-size: 10px;
}

.density-compact .section-row .report-row-label,
.density-compact .report-node-group .report-row-label,
.density-compact .report-node-project .report-row-label {
  font-size: 12px;
}

.report-node-balance td {
  background: #f7f9fd;
}

.report-table .report-annual-total {
  font-size: 12.5px;
  font-weight: 750;
}

.report-table.density-compact .report-annual-total {
  font-size: 10.5px;
}

.report-location-badge {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 24px;
  padding: 0 8px;
  flex: 0 0 auto;
  border-radius: 5px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}

.report-location-bk td:first-child {
  border-left: 3px solid #b4236c;
}

.report-location-vg td:first-child {
  border-left: 3px solid #087a72;
}

.report-location-chtz td:first-child {
  border-left: 3px solid #c45d16;
}

.report-cell {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.report-cell button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  width: 100%;
  text-align: right;
  min-height: 28px;
  border-radius: 6px;
  font: inherit;
  font-weight: 520;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.report-cell > span {
  display: block;
  min-height: 28px;
  line-height: 28px;
}

.report-cell button:hover {
  background: rgba(49, 86, 220, 0.1);
  color: var(--accent-strong);
}

.density-compact .report-cell button,
.density-compact .report-cell > span {
  min-height: 24px;
  line-height: 24px;
}

.report-table td.report-column-hover:not(:first-child),
.report-table th.report-column-hover:not(:first-child) {
  box-shadow: inset 0 0 0 9999px rgba(49, 86, 220, 0.035);
}

.report-table th.report-column-hover:not(:first-child) {
  color: #2747b4;
  box-shadow:
    inset 0 0 0 9999px rgba(49, 86, 220, 0.065),
    inset 0 -2px 0 rgba(49, 86, 220, 0.36);
}

.report-table tbody tr:not(.section-row):hover td {
  box-shadow: inset 0 0 0 9999px rgba(49, 86, 220, 0.04);
}

.report-table tbody tr:not(.section-row):hover td.report-column-hover {
  box-shadow: inset 0 0 0 9999px rgba(49, 86, 220, 0.075);
}

@media (max-width: 900px) {
  .report-table:not(.single-month) {
    min-width: 1220px;
    table-layout: auto;
    font-size: 11.5px;
  }

  .report-table:not(.single-month) th,
  .report-table:not(.single-month) td {
    padding: 10px 7px;
  }

  .report-table:not(.single-month) th:first-child,
  .report-table:not(.single-month) td:first-child {
    width: 270px;
    min-width: 270px;
  }

  .report-table.density-compact:not(.single-month) {
    min-width: 1140px;
    font-size: 10.5px;
  }

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

  .report-density-control {
    justify-content: space-between;
  }
}

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

.operations-report-panel {
  display: grid;
  gap: 14px;
}

.control-report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.control-report-summary > div {
  min-height: 82px;
  padding: 14px 16px;
  border-left: 1px solid var(--line);
  display: grid;
  align-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.9);
}

.control-report-summary > div:first-child {
  border-left: 0;
}

.control-report-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.control-report-summary strong {
  font-size: 21px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.report-subtoolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.segmented-control.control-report-tabs {
  width: min(100%, 760px);
  grid-template-columns: repeat(5, minmax(100px, 1fr));
}

.report-subtoolbar .hint {
  max-width: 620px;
  margin: 0;
  text-align: right;
}

.control-report-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.control-report-table th,
.control-report-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
}

.control-report-table .amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.control-report-table tbody tr:hover td {
  background: rgba(240, 245, 255, 0.78);
}

.control-report-table td.income {
  color: #117a58;
}

.control-report-table td.expense {
  color: #b34747;
}

.control-report-table .control-group-row th {
  padding: 9px 12px;
  background: #edf2f8;
  color: #2c3a55;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
}

.operations-report-row-button {
  width: 100%;
  padding: 0;
  border: 0;
  display: grid;
  gap: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.operations-report-row-button strong {
  color: var(--text);
}

.operations-report-row-button span {
  color: var(--muted);
  font-size: 11px;
}

.operations-report-row-button:hover strong,
.operations-report-row-button:focus-visible strong {
  color: var(--accent-strong);
}

.operations-report-row-button:focus-visible {
  outline: 2px solid rgba(49, 86, 220, 0.32);
  outline-offset: 4px;
  border-radius: 4px;
}

.report-empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 18px;
}

.planning-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(105px, 1fr));
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented-control button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.segmented-control button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 3px 12px rgba(24, 45, 168, 0.1);
}

.planning-filters {
  display: grid;
  grid-template-columns: 160px minmax(180px, 240px) minmax(170px, 220px) auto auto;
  align-items: center;
  gap: 8px;
}

.payment-matrix-panel {
  padding: 0;
  overflow: hidden;
}

.payment-matrix-header {
  min-height: 70px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.payment-matrix-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.calendar-inline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calendar-inline-actions[hidden] {
  display: none;
}

.payment-matrix-wrap {
  position: relative;
  max-height: calc(100vh - 240px);
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 50px;
  isolation: isolate;
}

.payment-matrix-table {
  width: max-content;
  min-width: 100%;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 11px;
}

.payment-matrix-table th,
.payment-matrix-table td {
  width: 86px;
  min-width: 86px;
  height: 38px;
  padding: 3px 5px;
  border-right: 1.5px solid #cdd4df;
  border-bottom: 1.5px solid #cdd4df;
  background: #fff;
  text-align: right;
  vertical-align: middle;
}

.payment-matrix-table thead {
  position: sticky;
  top: 0;
  z-index: 6;
}

.payment-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 48px;
  border-bottom: 2px solid rgba(157, 168, 184, 0.78);
  background: rgba(241, 244, 248, 0.84);
  box-shadow: 0 8px 20px rgba(43, 51, 65, 0.08);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  color: var(--muted);
  text-align: center;
}

.payment-matrix-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 238px;
  min-width: 238px;
  max-width: 238px;
  background: #fff;
  text-align: left;
}

.payment-matrix-table thead th:first-child {
  z-index: 7;
  background: rgba(226, 231, 238, 0.9);
}

.payment-matrix-table.calendar-edit-mode th:first-child {
  width: 410px;
  min-width: 410px;
  max-width: 410px;
}

.matrix-inline-editor {
  display: grid;
  grid-template-columns: 26px minmax(120px, 1fr) 28px auto 28px;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.matrix-section-row .matrix-inline-editor {
  grid-template-columns: 26px minmax(140px, 1fr) auto 28px;
}

.matrix-inline-editor button,
.matrix-inline-editor input {
  min-height: 28px;
  margin: 0;
}

.matrix-inline-drag,
.matrix-inline-delete {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  place-items: center;
}

.matrix-inline-drag {
  color: #737b89;
  cursor: grab;
  font-size: 16px;
}

.matrix-inline-drag:active {
  cursor: grabbing;
}

.matrix-inline-delete {
  color: #b43e3e;
  font-size: 18px;
}

.matrix-inline-drag:hover,
.matrix-inline-delete:hover {
  border-color: #ccd2dd;
  background: #fff;
}

.matrix-inline-label {
  width: 100%;
  height: 28px;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid #cbd1dc;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-weight: 650;
}

.matrix-inline-color {
  width: 28px;
  height: 28px;
  padding: 2px;
  border: 1px solid #cbd1dc;
  border-radius: 4px;
  background: #fff;
}

.matrix-inline-color-control,
.matrix-inline-color-presets {
  display: flex;
  align-items: center;
  gap: 4px;
}

.matrix-inline-color-preset {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px !important;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  background: var(--preset-color);
  box-shadow: 0 0 0 1px #bdc5d1;
}

.matrix-inline-color-preset:hover,
.matrix-inline-color-preset[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #2f54d7;
  transform: scale(1.08);
}

.matrix-inline-map {
  min-width: 78px;
  height: 28px;
  padding: 3px 7px;
  border: 1px solid #cbd1dc;
  border-radius: 4px;
  background: #fff;
  color: #4a5363;
  font-size: 10px;
  white-space: nowrap;
}

.matrix-layout-edit-row.dragging {
  opacity: 0.45;
}

.matrix-layout-edit-row.layout-drag-over th,
.matrix-layout-edit-row.layout-drag-over td {
  box-shadow: inset 0 3px 0 var(--accent);
}

.matrix-inline-settings-row td {
  height: auto;
  padding: 10px 12px;
  background: #f5f7fa;
  text-align: left;
}

.matrix-inline-settings {
  position: sticky;
  left: 12px;
  width: min(980px, calc(100vw - 92px));
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #d7dce5;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(41, 47, 58, 0.09);
}

.matrix-inline-settings-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 260px) 120px 100px auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 10px;
}

.matrix-inline-settings-head > strong {
  align-self: center;
  font-size: 12px;
}

.matrix-inline-settings-head label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 9px;
}

.matrix-inline-settings-head input,
.matrix-inline-settings-head select {
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid #cbd1dc;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
}

.matrix-inline-settings-head .matrix-inline-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  font-size: 10px;
}

.matrix-inline-checkbox input {
  width: 16px;
  min-height: 16px;
}

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

.matrix-inline-category-option {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  padding: 6px 4px;
  border-bottom: 1px solid #edf0f4;
  cursor: pointer;
}

.matrix-inline-category-option[hidden] {
  display: none;
}

.matrix-inline-category-option input {
  width: 15px;
  min-height: 15px;
  margin: 1px 0 0;
}

.matrix-inline-category-option span,
.matrix-inline-category-option strong,
.matrix-inline-category-option small {
  display: block;
  min-width: 0;
}

.matrix-inline-category-option strong {
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-inline-category-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.matrix-date-head strong,
.matrix-date-head span {
  display: block;
  white-space: nowrap;
}

.matrix-date-head strong {
  color: var(--text);
  font-size: 12px;
}

.matrix-date-head span {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 500;
}

.payment-matrix-table .weekend {
  background: #f8f9fb;
}

.payment-matrix-table .transition-day {
  background: #eef0f4;
  color: #6f7582;
}

.payment-matrix-table thead th.weekend {
  background: rgba(244, 246, 249, 0.86);
}

.payment-matrix-table thead th.transition-day {
  background: rgba(230, 234, 240, 0.88);
}

.matrix-row-label {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-row-label i {
  width: 7px;
  height: 22px;
  flex: 0 0 7px;
  margin-right: 7px;
  border-radius: 2px;
  background: var(--matrix-row-color);
}

/* Рабочие строки операционных расходов читаются с первого взгляда. */
.payment-matrix-table .matrix-operating-detail .matrix-row-label {
  font-size: 12px;
  font-weight: 650;
}

.payment-matrix-table .matrix-operating-detail .matrix-row-label i {
  width: 6px;
  height: 20px;
  flex-basis: 6px;
  margin-right: 8px;
}

.payment-matrix-table .matrix-section-row th,
.payment-matrix-table .matrix-section-row td {
  height: 32px;
  border-top: 2px solid color-mix(in srgb, var(--matrix-row-color) 42%, #c9d0db);
  border-bottom: 2px solid color-mix(in srgb, var(--matrix-row-color) 42%, #c9d0db);
  background: color-mix(in srgb, var(--matrix-row-color) 18%, #f1f4f7);
  color: #343b47;
  font-weight: 750;
}

.payment-matrix-table .matrix-section-row th {
  border-left: 5px solid var(--matrix-row-color);
}

/* Внутренние группы календаря используют один уровень иерархии.
   Широкие полосы остаются только у главных видов деятельности. */
.payment-matrix-table .matrix-group-row th,
.payment-matrix-table .matrix-group-row td,
.payment-matrix-table .matrix-subsection-row th,
.payment-matrix-table .matrix-subsection-row td {
  height: 24px;
  padding-top: 1px;
  padding-bottom: 1px;
  border-top: 1px solid color-mix(in srgb, var(--matrix-row-color) 55%, #c9d0db);
  border-bottom: 1px solid color-mix(in srgb, var(--matrix-row-color) 30%, #d9dee7);
  background: color-mix(in srgb, var(--matrix-row-color) 8%, #f8fafc);
  color: #596579;
  font-size: 11px;
  font-weight: 750;
}

.payment-matrix-table .matrix-subsection-row th {
  border-left-width: 3px;
}

.payment-matrix-table .matrix-group-divider-before th,
.payment-matrix-table .matrix-group-divider-before td {
  border-top: 1px solid #aeb9c8;
}

.matrix-summary th,
.matrix-summary td {
  background: #343a46;
  color: #fff;
  font-weight: 700;
}

.matrix-summary th:first-child {
  background: #343a46;
}

.payment-matrix-table .matrix-summary td.weekend,
.payment-matrix-table .matrix-summary td.transition-day {
  background: #343a46;
  color: #fff;
}

.payment-matrix-table tbody tr.matrix-summary:hover th,
.payment-matrix-table tbody tr.matrix-summary:hover td {
  background: #343a46;
}

.payment-matrix-table tbody tr.matrix-opening-row:hover th,
.payment-matrix-table tbody tr.matrix-opening-row:hover td {
  background: #eef1f6;
}

.matrix-opening-row th,
.matrix-opening-row td {
  background: #eef1f6;
  color: #303744;
}

.matrix-opening-row th:first-child {
  background: #eef1f6;
}

.payment-matrix-table .matrix-opening-row td.weekend,
.payment-matrix-table .matrix-opening-row td.transition-day {
  background: #eef1f6;
  color: #303744;
}

.matrix-closing-row th,
.matrix-closing-row td {
  background: #daf0df;
  color: #155f34;
}

.matrix-closing-row th:first-child {
  background: #daf0df;
}

.payment-matrix-table .matrix-closing-row td.weekend,
.payment-matrix-table .matrix-closing-row td.transition-day {
  background: #daf0df;
  color: #155f34;
}

.matrix-number.negative,
.matrix-closing-row .negative {
  background: #f9dada;
  color: #a32d2d;
}

.matrix-location th:first-child {
  font-weight: 700;
}

.matrix-location-бк th:first-child {
  background: #e1f1dc;
}

.matrix-location-вг th:first-child {
  background: #dfe9fa;
}

.matrix-location-чтз th:first-child {
  background: #f5e5bd;
}

.matrix-payment-cell {
  padding: 0 !important;
}

.matrix-cell-button {
  display: grid;
  align-content: center;
  width: 100%;
  height: 37px;
  min-height: 37px;
  padding: 3px 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: right;
}

.matrix-cell-button:hover {
  background: transparent;
}

.matrix-cell-button[draggable="true"] {
  cursor: grab;
}

.matrix-cell-button[draggable="true"]:active {
  cursor: grabbing;
}

.matrix-cell-button.dragging {
  opacity: 0.45;
}

.matrix-plan-value,
.matrix-fact-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-plan-value {
  color: #314fa6;
  font-weight: 750;
}

.matrix-overdue-value {
  color: var(--danger);
}

.matrix-plan-value b {
  display: inline-block;
  min-width: 15px;
  margin-left: 3px;
  padding: 1px 3px;
  border-radius: 7px;
  background: #dfe7ff;
  font-size: 9px;
  text-align: center;
}

.matrix-fact-value {
  margin-top: 1px;
  color: #168254;
  font-size: 11px;
  font-weight: 650;
}

.matrix-plan-badge {
  display: inline-block !important;
  margin: 0 0 3px !important;
  padding: 2px 5px;
  border-radius: 4px;
  background: #e1e9ff;
  color: #314fa6 !important;
  font-size: 10px !important;
  font-weight: 700;
}

.matrix-plan-badge.overdue {
  background: #fee5e5;
  color: #b23838 !important;
}

.matrix-flow-out .matrix-fact-value {
  color: #168254;
}

.matrix-revenue-forecast {
  color: #3b8d62;
  font-style: italic;
}

.matrix-add-mark {
  color: transparent;
  font-size: 17px;
  line-height: 1;
  text-align: center;
}

.matrix-empty-cell {
  display: block;
  padding-right: 5px;
  color: #c2c7d0;
  text-align: right;
}

.matrix-cell-button:hover .matrix-add-mark {
  color: transparent;
}

.matrix-payment-cell.drag-over {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.matrix-payment-popover {
  position: fixed;
  z-index: 300;
  width: 328px;
  max-height: min(460px, calc(100vh - 24px));
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(36, 42, 56, 0.2);
}

.matrix-move-popover {
  position: fixed;
  z-index: 310;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(360px, calc(100vw - 24px));
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 54px rgba(36, 42, 56, 0.24);
  transform: translate(-50%, -50%);
}

.matrix-move-popover > p {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 12px;
}

.matrix-move-list {
  display: grid;
  max-height: 260px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.matrix-move-list label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.matrix-move-list label:last-child {
  border-bottom: 0;
}

.matrix-move-list span,
.matrix-move-list small {
  display: block;
}

.matrix-move-list small {
  margin-top: 2px;
  color: var(--muted);
}

.matrix-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.matrix-popover-header strong,
.matrix-popover-header span,
.matrix-popover-payment strong,
.matrix-popover-payment span {
  display: block;
}

.matrix-popover-header span,
.matrix-popover-payment span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.matrix-popover-payment {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  cursor: grab;
}

.matrix-popover-payment.dragging {
  opacity: 0.45;
}

.matrix-popover-payment > div {
  min-width: 0;
}

.matrix-popover-actions {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.matrix-pay-button {
  color: #16734f;
  font-weight: 750;
}

.matrix-popover-fact {
  width: 100%;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.matrix-popover-fact:hover,
.matrix-popover-fact:focus-visible {
  background: #f3fbf7;
}

.matrix-fact-badge {
  display: inline-block;
  margin: 0;
  padding: 3px 5px;
  border-radius: 4px;
  background: #d9f2e5;
  color: #16734f !important;
  font-size: 10px !important;
  font-weight: 700;
  white-space: nowrap;
}

.matrix-open-arrow {
  margin: 0 !important;
  color: var(--accent) !important;
  font-size: 22px !important;
  line-height: 1;
}

.matrix-popover-payment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-popover-payment .matrix-payment-identity {
  margin-top: 3px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.matrix-drag-handle {
  color: #8a919e;
  font-size: 13px;
  letter-spacing: 0;
}

.matrix-popover-add {
  width: 100%;
  margin-top: 10px;
}

.planning-metrics,
.plan-fact-metrics {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.planning-metrics .metric,
.plan-fact-metrics .metric {
  min-height: 100px;
  padding: 16px 18px;
}

.planning-metrics .metric strong,
.plan-fact-metrics .metric strong {
  font-size: 25px;
}

.planning-metrics .metric small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.planning-metrics .metric.danger {
  border-color: #e9b0b0;
  background: #fff7f7;
}

.planning-metrics .metric.danger strong,
.danger-text {
  color: var(--danger) !important;
}

.calendar-panel-header {
  gap: 18px;
}

.calendar-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}

.legend-dot.plan {
  background: var(--accent);
}

.legend-dot.fact {
  background: var(--income);
}

.legend-dot.gap {
  background: var(--danger);
}

.calendar-wrap {
  max-height: calc(100vh - 330px);
}

.calendar-table {
  min-width: 980px;
}

.calendar-table th:first-child,
.calendar-table td:first-child {
  width: 170px;
}

.calendar-day-row.today td {
  background: #f0f4ff;
}

.calendar-day-row.cash-gap td {
  background: #fff6f6;
}

.calendar-day-row.overdue td:first-child strong,
.forecast-balance.negative {
  color: var(--danger);
}

.calendar-date-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-date-cell > div {
  min-width: 0;
}

.calendar-date-cell strong,
.calendar-date-cell span {
  display: block;
}

.calendar-date-cell span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.calendar-expand-button {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
}

.calendar-row-actions {
  width: 88px;
  white-space: nowrap;
  text-align: right;
}

.calendar-count {
  display: inline-block;
  min-width: 18px;
  margin-right: 5px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.icon-button.small {
  width: 30px;
  min-height: 30px;
  padding: 0;
}

.calendar-detail-row > td {
  padding: 0;
  background: #f7f9fd;
}

.calendar-detail-row:hover > td {
  background: #f7f9fd;
}

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

.calendar-detail-grid > section {
  min-width: 0;
  padding: 14px 16px;
}

.calendar-detail-grid > section + section {
  border-left: 1px solid var(--line);
}

.calendar-detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-lines {
  display: grid;
}

.calendar-line {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.calendar-line:first-child {
  border-top: 0;
}

.calendar-line-copy {
  min-width: 0;
}

.calendar-line-copy strong,
.calendar-line-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-line-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-line-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
}

.calendar-line-actions .link-button {
  min-height: 28px;
  font-size: 12px;
}

.empty.compact {
  padding: 12px 0;
  text-align: left;
}

.plan-fact-summary {
  color: var(--muted);
  font-size: 12px;
}

.plan-fact-wrap {
  max-height: calc(100vh - 330px);
}

.plan-fact-table {
  min-width: 720px;
}

.plan-fact-table th:first-child,
.plan-fact-table td:first-child {
  width: 46%;
}

.plan-fact-group td {
  background: #edf2ff;
  color: var(--accent-strong);
  font-weight: 700;
}

.plan-fact-group.out td {
  background: #fff2f2;
  color: #8f2f2f;
}

.category-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--category-color);
}

.variance.favorable {
  color: var(--income);
  font-weight: 700;
}

.variance.unfavorable {
  color: var(--danger);
  font-weight: 700;
}

.plan-modal-card {
  width: min(560px, calc(100vw - 28px));
}

.report-cell.reconciled {
  color: var(--income);
  font-weight: 700;
}

.directory-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.directory-grid > * {
  min-width: 0;
}

.audit-panel {
  grid-column: 1 / -1;
}

.directory-sidebar {
  display: grid;
  gap: 14px;
}

.category-manager {
  min-width: 0;
}

.catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.checkbox-control input,
.category-select {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.bulk-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #b9c7ff;
  background: var(--surface-blue);
  border-radius: 8px;
}

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

.category-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6fc;
  overflow: hidden;
}

.category-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.category-column-header h3 {
  margin: 0;
  font-size: 15px;
}

.category-groups {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 8px;
  max-height: calc(100vh - 330px);
  min-height: 260px;
  overflow: auto;
}

.direction-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.direction-group:hover {
  border-color: #bbc6d8;
}

.direction-group.drop-target {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 8px 22px rgba(51, 76, 219, 0.1);
}

.direction-header {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 7px 8px;
  background: #f7f9ff;
  border-bottom: 1px solid var(--line);
}

.direction-toggle {
  width: 22px;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.direction-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.direction-title strong {
  min-width: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.category-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.direction-count {
  color: var(--muted);
  font-size: 12px;
}

.direction-actions {
  display: flex;
  gap: 3px;
}

.mini-icon-button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.mini-icon-button:hover {
  border-color: var(--line);
  background: var(--surface-blue);
  color: var(--accent-strong);
}

.color-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: var(--swatch, #64748b);
}

.category-items {
  display: grid;
}

.category-row {
  display: grid;
  grid-template-columns: 18px 12px 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

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

.category-row:hover {
  background: #f8faff;
}

.category-row.dragging {
  opacity: 0.45;
}

.category-row.archived {
  background: #f4f5f8;
  opacity: 0.72;
}

.drag-handle {
  color: #9aa7ac;
  cursor: grab;
  user-select: none;
}

.category-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.category-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-row .ghost-button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.group-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.audit-wrap {
  max-height: 330px;
}

.audit-wrap table {
  min-width: 680px;
}

.audit-change-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.audit-version {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.audit-version h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.audit-record {
  display: grid;
  gap: 5px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.audit-record:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.audit-record span,
.audit-json {
  color: var(--muted);
  font-size: 12px;
}

.audit-json {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}

.directory-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.directory-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
  background: #fff;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.directory-item:hover {
  border-color: #bac7f6;
  background: #f8faff;
}

.directory-item strong {
  font-size: 14px;
}

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

.directory-record {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.directory-record.archived {
  opacity: 0.65;
  background: #f7f7f7;
}

.directory-record-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.directory-record-copy strong,
.directory-record-copy span {
  overflow-wrap: anywhere;
}

.directory-record .ghost-button {
  align-self: center;
}

.directory-tabs-shell {
  position: sticky;
  top: 0;
  z-index: 9;
  padding: 8px 0 10px;
  background: rgba(242, 246, 253, 0.9);
  backdrop-filter: blur(18px) saturate(135%);
}

.directory-tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid rgba(185, 197, 220, 0.82);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 24px rgba(29, 45, 82, 0.06);
  scrollbar-width: none;
}

.directory-tabs::-webkit-scrollbar {
  display: none;
}

.directory-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #42506a;
  font-size: 14px;
  font-weight: 700;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.directory-tab:hover {
  background: #eef3ff;
  color: #2942b8;
}

.directory-tab.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(51, 76, 219, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.directory-tab-count {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 7px;
  background: #edf1f8;
  color: #66748c;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.directory-tab.active .directory-tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.directory-tab-archive:not(.active) {
  color: #78531d;
}

.directory-tab-archive:not(.active) .directory-tab-count {
  background: #fff3d9;
  color: #8a5d17;
}

.directory-workspace {
  margin-top: 4px;
}

.directory-pane {
  min-width: 0;
}

.directory-pane[hidden],
.category-structure-view[hidden],
.directory-table-wrap[hidden] {
  display: none !important;
}

.directory-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(165px, auto) minmax(170px, auto) auto auto;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
}

.directory-toolbar-sticky {
  position: sticky;
  top: 70px;
  z-index: 7;
  padding: 10px;
  border: 1px solid rgba(206, 215, 230, 0.84);
  border-radius: 12px;
  background: rgba(251, 253, 255, 0.92);
  backdrop-filter: blur(16px) saturate(125%);
  box-shadow: 0 8px 22px rgba(29, 45, 82, 0.06);
}

.counterparty-directory-toolbar {
  grid-template-columns: minmax(300px, 1fr);
  margin-top: 16px;
}

.category-manager .directory-toolbar {
  grid-template-columns: minmax(280px, 1fr) minmax(165px, auto) minmax(170px, auto) auto;
}

.employee-directory-panel .directory-toolbar {
  grid-template-columns: minmax(280px, 1fr) minmax(180px, auto);
}

.directory-view-switch {
  justify-self: end;
}

.directory-view-switch button {
  min-height: 36px;
  padding: 0 12px;
}

.directory-view-switch button.active {
  border-color: rgba(49, 86, 220, 0.3);
  background: rgba(232, 239, 255, 0.96);
  color: #2948bd;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.directory-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

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

.directory-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #f2f5fb;
  color: #66748c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.directory-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e3e8f1;
  color: #252e3f;
  vertical-align: middle;
}

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

.directory-table tbody tr {
  transition: background-color 150ms ease;
}

.directory-table tbody tr:hover {
  background: #f7f9fe;
}

.directory-table tbody tr.archived {
  opacity: 0.62;
  background: #f6f7f9;
}

.directory-table strong {
  font-size: 13px;
  font-weight: 750;
}

.directory-primary-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.directory-primary-cell strong,
.directory-primary-cell span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.directory-cell-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

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

.directory-comment {
  max-width: 440px;
  color: #68758b;
  overflow-wrap: anywhere;
}

.directory-amount {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.directory-select-column {
  width: 42px;
}

.directory-action-column {
  width: 1%;
}

.directory-edit-button {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.user-directory-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.user-invite-button {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.category-directory-table {
  min-width: 920px;
}

.category-structure-view {
  margin-top: 14px;
}

.category-structure-view .category-groups {
  max-height: none;
  overflow: visible;
}

.directory-subsection + .directory-subsection {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.accounts-directory-pane .payment-group-directory {
  margin-top: 14px;
}

.audit-panel .audit-wrap {
  margin-top: 14px;
}

.audit-panel .directory-table-wrap,
.audit-panel .audit-wrap {
  max-height: none;
}

.archive-type-summary {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.archive-type-button {
  --archive-color: #6b7280;
  display: grid;
  min-width: 0;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid #d9e0eb;
  border-left: 4px solid var(--archive-color);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  color: #4b566b;
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.archive-type-button:hover {
  border-color: color-mix(in srgb, var(--archive-color) 44%, #d9e0eb);
  background: #fff;
  box-shadow: 0 7px 18px rgba(38, 50, 77, 0.08);
}

.archive-type-button.active {
  border-color: color-mix(in srgb, var(--archive-color) 55%, #d9e0eb);
  background: color-mix(in srgb, var(--archive-color) 8%, #fff);
  color: #222b3b;
  box-shadow: 0 7px 18px rgba(38, 50, 77, 0.1);
}

.archive-type-button span {
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.archive-type-button strong {
  align-self: end;
  color: #1f2937;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

[data-archive-color="all"] {
  --archive-color: #596273;
}

[data-archive-color="category"] {
  --archive-color: #3156dc;
}

[data-archive-color="counterparty"] {
  --archive-color: #11816c;
}

[data-archive-color="wallet"] {
  --archive-color: #9b5b14;
}

[data-archive-color="employee"] {
  --archive-color: #a33e55;
}

[data-archive-color="user"] {
  --archive-color: #6e50ad;
}

[data-archive-color="payment_group"] {
  --archive-color: #4c6b7b;
}

.archive-toolbar {
  grid-template-columns: minmax(300px, 1fr) minmax(210px, auto);
}

.archive-bulk-toolbar {
  position: sticky;
  top: 132px;
  z-index: 6;
  grid-template-columns: auto minmax(190px, 1fr) minmax(210px, auto) auto;
  margin: 0 0 12px;
}

.archive-bulk-toolbar .danger-ghost-button:disabled {
  border-color: #d7dce7;
  background: #f4f6fa;
  color: #8a93a5;
  cursor: not-allowed;
}

.archive-safety-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #ecd9ad;
  border-radius: 8px;
  background: #fff9e9;
  color: #73561d;
  font-size: 12px;
  line-height: 1.45;
}

.archive-table {
  min-width: 900px;
}

.archive-table th:last-child,
.archive-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: -8px 0 14px rgba(38, 50, 77, 0.05);
}

.archive-table th:last-child {
  background: #f2f5fb;
}

.archive-table tbody tr:hover td:last-child {
  background: #f7f9fe;
}

.archive-entity-mark {
  width: 5px;
  height: 30px;
  flex: 0 0 5px;
  border-radius: 3px;
  background: var(--archive-color);
}

.archive-name-cell {
  min-width: 185px;
}

.archive-name-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.archive-name-copy span {
  color: #7a8699;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
}

.archive-type-tag {
  --archive-color: #6b7280;
  display: inline-flex;
  max-width: 170px;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--archive-color) 23%, #dce2ec);
  border-radius: 7px;
  background: color-mix(in srgb, var(--archive-color) 8%, #fff);
  color: color-mix(in srgb, var(--archive-color) 78%, #172033);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.archive-reference-text {
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-row-actions {
  display: grid;
  justify-items: stretch;
  gap: 7px;
  min-width: 142px;
}

.archive-row-actions .ghost-button,
.archive-row-actions .danger-ghost-button {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.archive-empty {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 34px 16px;
  color: #718097;
  text-align: center;
}

.archive-empty strong {
  color: #343e50;
  font-size: 15px;
}

@media (max-width: 1180px) {
  .directory-toolbar {
    grid-template-columns: minmax(260px, 1fr) minmax(160px, 0.55fr) minmax(160px, 0.55fr);
  }

  .directory-toolbar .checkbox-control,
  .directory-view-switch {
    justify-self: start;
  }

  .archive-type-summary {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .archive-toolbar {
    grid-template-columns: minmax(260px, 1fr) minmax(190px, auto);
  }
}

@media (max-width: 760px) {
  .directory-tabs-shell {
    top: 0;
    margin-inline: -2px;
  }

  .directory-tab {
    min-height: 40px;
    padding-inline: 12px;
  }

  .directory-toolbar,
  .counterparty-directory-toolbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .directory-toolbar > * {
    width: 100%;
  }

  .directory-view-switch {
    justify-self: stretch;
  }

  .directory-view-switch button {
    flex: 1;
  }

  .directory-table {
    min-width: 760px;
  }

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

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

  .archive-toolbar {
    grid-template-columns: 1fr;
  }

  .archive-bulk-toolbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .archive-bulk-toolbar > * {
    width: 100%;
  }
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 5, 0.38);
  backdrop-filter: blur(4px);
  place-items: stretch end;
  padding: 0;
  z-index: 20;
}

.modal.open {
  display: grid;
}

.modal-card {
  width: min(520px, 100%);
  height: 100vh;
  background: #fff;
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 24px;
  overflow: auto;
  border-top: 6px solid var(--accent);
}

.user-invitation-modal {
  place-items: center;
  padding: 24px;
}

.user-invitation-card {
  width: min(620px, 100%);
  height: auto;
  max-height: min(720px, calc(100vh - 48px));
  border-radius: 18px;
}

.user-invitation-card .modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.user-invitation-link-field {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.user-invitation-link-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  resize: none;
}

.user-invitation-warning {
  margin: 14px 0 0;
  padding: 11px 12px;
  border-radius: 9px;
  background: #fff5df;
  color: #6d4c00;
  font-size: 12px;
  line-height: 1.45;
}

.user-invitation-copy-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--income);
  font-size: 13px;
  font-weight: 700;
}

.user-invitation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 520px) {
  .user-invitation-modal {
    align-items: end;
    padding: 0;
  }

  .user-invitation-card {
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
  }

  .user-invitation-actions > button {
    width: 100%;
    justify-content: center;
  }
}

.modal-header,
.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-header h2,
.drawer-header h2 {
  font-size: 22px;
}

.form-stack {
  display: grid;
  gap: 10px;
}

.form-stack label {
  display: grid;
  gap: 6px;
  color: #4e566c;
  font-size: 13px;
  font-weight: 500;
}

.field-transfer,
.field-recount {
  display: none !important;
}

.mode-transfer .field-transfer,
.mode-recount .field-recount {
  display: grid !important;
}

.mode-transfer .field-normal,
.mode-recount .field-normal {
  display: none !important;
}

.mode-recount .field-amount {
  display: none !important;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 100vw);
  height: 100vh;
  transform: translateX(105%);
  transition: transform 180ms ease;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 18;
  padding: 22px;
  overflow: auto;
  border-top: 6px solid var(--accent);
}

.catalog-drawer {
  width: min(520px, 100vw);
  z-index: 22;
}

.calendar-layout-drawer {
  width: min(640px, 100vw);
  z-index: 24;
}

.report-layout-inline {
  margin: 0 16px 16px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.report-layout-inline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
}

.report-layout-inline-header h3,
.report-layout-inline-header p {
  margin: 0;
}

.report-layout-inline-header h3 {
  margin-top: 4px;
  color: #1f2d43;
  font-size: 20px;
}

.report-layout-inline-header > div > p:last-child {
  margin-top: 4px;
  color: #6d7a8e;
  font-size: 13px;
}

.report-layout-breadcrumb {
  color: #4167c8;
  font-size: 12px;
  font-weight: 700;
}

.report-layout-current {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 0 20px 14px;
  padding: 14px;
  border: 1px solid #dfe6f0;
  border-radius: 10px;
  background: #f9fbfe;
}

.report-layout-current-copy {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 14px;
  flex: 1;
}

.report-layout-current-copy label:first-child {
  display: grid;
  gap: 5px;
  color: #59677c;
  font-size: 12px;
  font-weight: 600;
}

.report-layout-current-copy input[type="text"] {
  height: 38px;
  padding: 7px 10px;
  border: 1px solid #d4ddea;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.report-layout-current-visible {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 600;
}

.danger-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #efb5b5;
  border-radius: 8px;
  background: #fff7f7;
  color: #b42323;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.report-layout-note {
  margin: 0 20px 14px;
  padding: 10px 12px;
  border: 1px solid #dbe5f3;
  border-radius: 10px;
  background: #f7faff;
  color: #516078;
  font-size: 13px;
  line-height: 1.45;
}

.report-layout-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 230px);
  padding: 0 20px 18px;
  overflow: auto;
}

.report-layout-search {
  display: grid;
  gap: 5px;
  padding: 0 20px 12px;
  color: #59677c;
  font-size: 12px;
  font-weight: 600;
}

.report-layout-search input {
  height: 38px;
  padding: 7px 11px;
  border: 1px solid #d8e0eb;
  border-radius: 9px;
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.report-layout-empty {
  padding: 28px 12px;
  color: #718096;
  text-align: center;
}

.report-layout-editor-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 32px 32px auto auto;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 5px 7px 5px calc(7px + var(--report-editor-level, 0) * 18px);
  border: 1px solid #dfe6f0;
  border-radius: 9px;
  background: #fff;
}

.report-layout-row-select {
  min-width: 0;
  padding: 2px 5px;
  border: 1px dashed transparent;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.report-layout-row-select:hover,
.report-layout-row-select:focus-visible {
  border-color: #8fa9e8;
  background: #eef3ff;
  outline: none;
}

.report-layout-editor-row.is-hidden {
  background: #f5f6f8;
  opacity: .7;
}

.report-layout-editor-row input[type="text"] {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 5px 9px;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  font-weight: 600;
}

.report-layout-editor-row input[type="text"]:focus {
  border-color: #9db4ed;
  background: #fff;
  outline: none;
}

.report-layout-visibility {
  display: grid;
  place-items: center;
}

.report-layout-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px 20px;
  border-top: 1px solid #e3e8f0;
  background: #fff;
}

@media (max-width: 640px) {
  .report-layout-inline-header,
  .report-layout-current,
  .report-layout-current-copy {
    display: grid;
    grid-template-columns: 1fr;
  }

  .report-layout-editor-row {
    grid-template-columns: 30px minmax(0, 1fr) 32px 32px;
  }

  .report-layout-editor-row .compact-button {
    grid-column: 2 / -1;
  }

  .report-layout-footer {
    flex-direction: column-reverse;
  }
}

.quick-entry-drawer {
  width: min(520px, 100vw);
  z-index: 26;
}

.calendar-layout-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-layout-list {
  border-top: 1px solid var(--line);
}

.calendar-layout-editor-row {
  display: grid;
  grid-template-columns: 18px 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.calendar-layout-editor-row.section {
  background: #f3f4f7;
}

.calendar-layout-editor-row.dragging {
  opacity: 0.45;
}

.calendar-layout-editor-row.drag-over {
  box-shadow: inset 0 2px 0 var(--accent);
}

.calendar-layout-drag {
  color: #8a919e;
  cursor: grab;
  font-size: 13px;
}

.calendar-layout-editor-row > i {
  width: 7px;
  height: 32px;
  border-radius: 2px;
  background: var(--layout-color);
}

.calendar-layout-editor-copy {
  min-width: 0;
}

.calendar-layout-editor-copy strong,
.calendar-layout-editor-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-layout-editor-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.calendar-layout-editor-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.compact-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.calendar-layout-footer {
  position: sticky;
  bottom: -22px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 14px -22px -22px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.calendar-layout-item-form .checkbox-field {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.calendar-layout-item-form .checkbox-field input {
  width: 18px;
  min-height: 18px;
}

.calendar-layout-category-list {
  max-height: 44vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.calendar-layout-category-option {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: 9px !important;
  min-height: 48px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.calendar-layout-category-option:last-child {
  border-bottom: 0;
}

.calendar-layout-category-option:hover {
  background: #f6f8fd;
}

.calendar-layout-category-option input {
  width: 17px;
  min-height: 17px;
  margin-top: 2px;
}

.calendar-layout-category-option span,
.calendar-layout-category-option strong,
.calendar-layout-category-option small {
  display: block;
  min-width: 0;
}

.calendar-layout-category-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

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

.drawer-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  padding-top: 6px;
}

.system-lock-note {
  padding: 11px 12px;
  border-left: 4px solid var(--warning);
  background: #fff5df;
  color: #6d4c00;
  font-size: 12px;
  line-height: 1.45;
}

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

#drawerContent table {
  min-width: 0;
  table-layout: fixed;
}

#drawerContent td {
  padding: 9px 6px;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  vertical-align: top;
}

#drawerContent td:nth-child(1) {
  width: 72px;
}

#drawerContent td:nth-child(2),
#drawerContent td:nth-child(3) {
  width: 88px;
}

#drawerContent td:nth-child(4) {
  width: 66px;
}

#cellDrawer.operations-report-drawer {
  width: min(600px, 100vw);
}

#cellDrawer.operations-report-drawer #drawerContent td {
  padding: 10px 8px;
  font-size: 12px;
  overflow-wrap: normal;
}

#cellDrawer.operations-report-drawer #drawerContent td:nth-child(1) {
  width: 86px;
  white-space: nowrap;
}

#cellDrawer.operations-report-drawer #drawerContent td:nth-child(2) {
  width: 104px;
}

#cellDrawer.operations-report-drawer #drawerContent td:nth-child(3) {
  width: 128px;
}

#cellDrawer.operations-report-drawer #drawerContent td:nth-child(4) {
  width: 82px;
  text-align: right;
  white-space: nowrap;
}

#cellDrawer.operations-report-drawer #drawerContent td:nth-child(5) {
  overflow-wrap: anywhere;
}

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

.disabled-note {
  color: var(--danger);
  font-size: 12px;
  margin-top: 8px;
}

.cash-closing-launch {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.cash-closing-modal {
  z-index: 24;
}

.cash-closing-card {
  width: min(980px, 100%);
  padding: 0;
  min-width: 0;
}

.closing-header {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0;
  padding: 20px 24px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

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

.closing-form {
  display: grid;
  gap: 0;
  padding: 0 24px 24px;
  width: 100%;
  min-width: 0;
}

.closing-form label {
  display: grid;
  gap: 6px;
  color: #4e566c;
  font-size: 12px;
  font-weight: 600;
}

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

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

.paper-cash-grid label > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.paper-cash-grid input[readonly],
.payment-entry-row input[readonly] {
  background: #f2f4f7;
  color: #414957;
  font-weight: 700;
}

.closing-section {
  padding: 18px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.closing-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.iiko-import-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(390px, 52%);
}

.iiko-import-control > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}

.iiko-import-control > span.is-ok {
  color: #087b58;
}

.iiko-import-control > span.is-error {
  color: var(--danger);
}

.iiko-import-control .ghost-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.closing-section h3,
.drawer-section-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.closing-section p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.payment-entry-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.closing-review-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding-top: 14px;
}

.closing-review-actions p {
  margin: 0;
  text-align: right;
}

#cashClosingExpensesSection {
  scroll-margin-top: 92px;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

#cashClosingExpensesSection.is-review-active {
  background: rgba(232, 244, 238, 0.64);
  box-shadow: 0 0 0 10px rgba(232, 244, 238, 0.64);
}

.payment-entry-head,
.payment-entry-row {
  min-width: 780px;
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) 115px 125px 95px 105px 120px;
  gap: 10px;
  align-items: center;
}

.payment-entry-head {
  min-height: 36px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
}

.payment-entry-row {
  min-height: 56px;
  border-top: 1px solid var(--line);
}

.payment-entry-row.derived-cash-payment {
  background: #f7f9fc;
}

.payment-entry-name {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.payment-entry-name strong,
.payment-entry-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-entry-name span,
.payment-rate {
  color: var(--muted);
  font-size: 11px;
}

.payment-fee,
.payment-net,
.payment-iiko-amount,
.payment-difference {
  text-align: right;
  font-size: 13px;
}

.payment-fee {
  color: var(--expense);
}

.payment-iiko-amount {
  color: var(--text);
}

.payment-difference.is-extra {
  color: #b45309;
}

.payment-difference.is-shortage {
  color: var(--expense);
}

.payment-entry-row:not(.is-reconciliation-editing) .payment-amount-input {
  background: #f7f9fc;
  color: var(--muted);
}

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

.payment-discrepancy-empty {
  padding: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}

.payment-discrepancy-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(145px, 0.9fr) minmax(165px, 1fr) 105px minmax(190px, 1.2fr) auto;
  gap: 8px;
  align-items: center;
}

.payment-discrepancy-row input,
.payment-discrepancy-row select {
  min-width: 0;
}

.payment-discrepancy-resolved {
  color: #147657;
  font-size: 11px;
  font-weight: 700;
}

.payment-discrepancy-total {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid #d0942e;
  background: #fff8e8;
  color: #74520d;
  font-size: 12px;
  font-weight: 700;
}

.evening-cash-confirmation {
  min-width: 250px;
  display: grid;
  gap: 7px;
  align-content: center;
}

.evening-cash-confirmation > span {
  color: var(--muted);
  font-size: 11px;
}

.evening-cash-confirmation > strong {
  font-size: 22px;
}

.evening-cash-confirmation > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-resolve-button {
  min-height: 30px;
  white-space: nowrap;
}

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

.paper-expense-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -2px 0 12px;
}

.paper-expense-presets button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #4a5262;
  font-size: 11px;
}

.paper-expense-presets button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.cash-expense-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  padding: 13px;
}

.cash-expense-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) 120px minmax(130px, 0.8fr) minmax(170px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

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

.cash-expense-row .mini-icon-button {
  width: 36px;
  height: 36px;
}

.cash-expense-row.requires-review {
  margin: 0 -6px;
  padding: 6px;
  border: 1px solid #efb9b4;
  border-radius: 6px;
  background: #fff1f0;
}

.cash-expense-row.requires-review.is-suggested,
.cash-expense-row.requires-review.is-learning {
  border-color: #e6c785;
  background: #fff9ea;
}

.cash-expense-learning-status {
  grid-column: 1 / -1;
  color: #8c3d3d;
  font-size: 11px;
  line-height: 1.35;
}

.cash-expense-courier-status {
  grid-column: 1 / -1;
  margin-top: -3px;
  color: #315b9d;
  font-size: 11px;
  line-height: 1.35;
}

.cash-expense-recipient:is(select) {
  min-width: 0;
  color: #24344f;
  font-weight: 600;
}

.cash-expense-row .cash-expense-split-courier {
  border-color: #b9c9e8;
  background: #f1f5ff;
  color: #315b9d;
}

.cash-expense-row.is-suggested .cash-expense-learning-status,
.cash-expense-row.is-learning .cash-expense-learning-status {
  color: #80601b;
}

.cash-expense-row.is-learned .cash-expense-learning-status {
  color: #28755e;
}

.cash-expense-row .cash-expense-confirm {
  border-color: #ddb26b;
  color: #8b5d12;
  background: #fff7e8;
}

.cash-expense-row .cash-expense-delete {
  color: var(--danger);
}

.iiko-cash-movements {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  font-size: 12px;
}

.iiko-cash-movements[hidden] {
  display: none;
}

.iiko-cash-movement-summary,
.iiko-cash-payins > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.iiko-cash-movement-summary span,
.iiko-cash-payins small {
  color: var(--muted);
}

.iiko-cash-payins {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid #efb9b4;
  color: #9f312a;
}

.iiko-cash-payin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid #f0c5c1;
  border-radius: 6px;
  background: #fffafa;
}

.iiko-cash-payin-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.iiko-cash-payin-copy small {
  overflow-wrap: anywhere;
}

.iiko-cash-payin-row.is-confirmed {
  border-color: #b8dfce;
  background: #f0faf6;
  color: #146c4b;
}

.iiko-cash-payin-status {
  color: #146c4b;
  font-weight: 700;
  white-space: nowrap;
}

.iiko-transfer-context {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #b9d0f8;
  border-radius: 8px;
  background: #f1f6ff;
}

.iiko-transfer-context[hidden] {
  display: none;
}

.iiko-transfer-context > div {
  display: grid;
  gap: 3px;
}

.iiko-transfer-context span {
  color: var(--muted);
  font-size: 12px;
}

.iiko-transfer-context p {
  margin: 0;
  color: #305778;
  font-size: 12px;
  line-height: 1.4;
}

.iiko-transfer-context p.is-warning {
  color: #9b5012;
}

#operationModal.iiko-payin-sidecar {
  z-index: 25;
  padding-right: var(--cash-sidecar-offset, 0);
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
}

#operationModal.iiko-payin-sidecar .modal-card {
  width: min(460px, 100%);
  border-right: 1px solid var(--line);
  box-shadow: -18px 0 46px rgba(24, 37, 65, 0.16);
  pointer-events: auto;
}

.closing-zip-section {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(420px, 1.7fr);
  gap: 22px;
  align-items: start;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.zip-fact-field input {
  min-height: 56px;
  font-size: 24px;
  font-weight: 700;
}

.zip-fact-field > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.closing-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.closing-summary > div {
  min-width: 0;
  min-height: 72px;
  padding: 11px;
  border-left: 1px solid var(--line);
  display: grid;
  align-content: center;
  gap: 5px;
}

.closing-summary > div:first-child {
  border-left: 0;
}

.closing-summary span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.closing-summary strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.closing-summary .difference-line.is-error {
  background: #fff0f0;
  color: var(--danger);
}

.closing-control-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 0 18px;
}

.closing-control-checks > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
}

.closing-control-checks span {
  color: var(--muted);
  font-size: 11px;
}

.closing-control-checks strong {
  white-space: nowrap;
}

.closing-control-checks .is-ok {
  border-color: #a7ddca;
  background: #edf9f4;
  color: var(--income);
}

.closing-control-checks .is-error {
  border-color: #e4a5a5;
  background: #fff0f0;
  color: var(--danger);
}

.closing-summary.has-error {
  border-color: #e4a5a5;
}

.discrepancy-field {
  padding: 14px;
  border-left: 4px solid var(--danger);
  background: #fff0f0;
}

.closing-footer {
  position: sticky;
  bottom: -24px;
  z-index: 3;
  margin: 20px -24px -24px;
  padding: 14px 24px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.closing-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.closing-footer p.is-ok {
  color: var(--income);
  font-weight: 700;
}

.closing-footer p.is-error {
  color: var(--danger);
  font-weight: 700;
}

.closing-footer-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.cash-closing-row.has-difference td {
  background: #fff6f6;
}

.cash-closing-row.has-difference td:first-child {
  box-shadow: inset 4px 0 0 var(--danger);
}

.cash-closing-row.is-accounted td {
  background: #f4f8f6;
}

.cash-closing-row.is-accounted td:first-child {
  box-shadow: inset 4px 0 0 #77ad94;
}

.tag.closing-error {
  color: #9f2525;
  background: #ffe0e0;
  border-color: #e9aaaa;
}

.tag.closing-ok {
  color: #086244;
  background: #e4f7ef;
  border-color: #a7ddca;
}

.tag.closing-accounted {
  color: #426557;
  background: #e8f1ed;
  border-color: #bad0c5;
}

.closing-row-summary {
  color: var(--muted);
  font-size: 11px;
}

.inline-ledger-link {
  margin-left: 4px;
  padding: 2px 0;
  min-height: 0;
  font-size: 11px;
}

.payment-group-panel {
  grid-column: 1 / -1;
}

.payment-group-directory,
.payment-group-list {
  display: grid;
}

.payment-group-directory {
  gap: 18px;
}

.payment-group-block {
  --payment-location-color: #7c8798;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--payment-location-color) 38%, #d9dee7);
  border-top: 4px solid var(--payment-location-color);
  border-radius: 5px;
  background: color-mix(in srgb, var(--payment-location-color) 3%, #fff);
}

.payment-group-block[data-payment-location="БК"] {
  --payment-location-color: #3f956d;
}

.payment-group-block[data-payment-location="ВГ"] {
  --payment-location-color: #5279c7;
}

.payment-group-block[data-payment-location="ЧТЗ"] {
  --payment-location-color: #c28634;
}

.payment-group-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 9px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--payment-location-color) 28%, #dce1e9);
  background: color-mix(in srgb, var(--payment-location-color) 13%, #f7f9fb);
}

.payment-group-block-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.payment-group-block-title > div,
.payment-group-block-title strong,
.payment-group-block-title small {
  display: block;
  min-width: 0;
}

.payment-group-block-title small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.payment-group-location-code {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 4px;
  background: var(--payment-location-color);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  place-items: center;
}

.payment-group-block-header span {
  color: var(--muted);
  font-size: 11px;
}

.payment-group-block-header .payment-group-location-code {
  color: #fff;
}

.payment-group-list {
  padding: 0 14px 4px;
}

.payment-group-directory-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.2fr) minmax(150px, 0.7fr) minmax(210px, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 64px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.payment-group-directory-row:first-child {
  border-top: 0;
}

.payment-group-directory-row:hover {
  background: color-mix(in srgb, var(--payment-location-color) 5%, transparent);
}

.payment-group-directory-row.archived {
  opacity: 0.58;
}

.payment-group-copy,
.payment-group-rate,
.payment-group-category {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.payment-group-copy span,
.payment-group-rate span,
.payment-group-category span {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-group-category strong,
.payment-group-copy strong {
  overflow-wrap: anywhere;
}

.closing-detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  background: var(--line);
  border: 1px solid var(--line);
}

.closing-detail-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  background: #fff;
}

.closing-detail-summary span {
  color: var(--muted);
  font-size: 11px;
}

.closing-detail-error {
  border-color: #e4a5a5;
}

.closing-detail-error > div:last-child {
  color: var(--danger);
  background: #fff0f0;
}

.closing-detail-ok > div:last-child {
  color: var(--income);
  background: #edf9f4;
}

.closing-detail-accounted {
  border-color: #bad0c5;
}

.closing-detail-accounted > div:last-child {
  color: #426557;
  background: #e8f1ed;
}

.closing-discrepancy-copy {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 4px solid var(--danger);
  background: #fff0f0;
  color: #8c2727;
  font-size: 12px;
}

.closing-discrepancy-copy.is-accounted {
  border-left-color: #77ad94;
  background: #f4f8f6;
  color: #426557;
}

.closing-accounted-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding: 11px 12px;
  border-left: 4px solid #77ad94;
  background: #eef6f2;
  color: #426557;
  font-size: 12px;
}

.closing-resolution-actions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 16px;
}

.tag.closing-pending {
  background: #fff4d6;
  color: #8a5b00;
}

.payroll-toolbar {
  padding: 14px 16px;
}

.payroll-filters {
  display: grid;
  grid-template-columns: 160px minmax(220px, 1fr) 170px 170px;
  gap: 10px;
}

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

.payroll-register-panel .table-wrap { overflow-x: auto; }
.payroll-table { min-width: 1260px; }
.payroll-detail-table + h3 { margin-top: 22px; }

.payroll-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.tag.payroll-unpaid { background: #fde9e7; color: #a33a31; }
.tag.payroll-partial { background: #fff4d6; color: #8a5b00; }
.tag.payroll-paid { background: #e5f4eb; color: #28734b; }
.tag.payroll-planned { background: #e8eefc; color: #3154a5; }
.tag.payroll-overpaid { background: #f1ebfb; color: #6f42a1; }

.closing-payroll-step {
  padding: 0 24px 22px;
}

.closing-step-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.closing-step-heading h3 {
  margin: 8px 0 4px;
  font-size: 20px;
}

.closing-step-heading p {
  margin: 0;
  color: var(--muted);
}

.closing-advance-reference {
  min-width: 160px;
  text-align: right;
}

.closing-advance-reference span,
.payroll-shift-total span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.closing-advance-reference strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.closing-payroll-employees {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.payroll-iiko-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #b8dfcf;
  border-left: 3px solid #15966f;
  border-radius: 6px;
  background: #f0faf6;
}

.payroll-iiko-status.is-review {
  border-color: #ead39f;
  border-left-color: #c78b18;
  background: #fff9eb;
}

.payroll-iiko-status strong,
.payroll-iiko-status span {
  display: block;
}

.payroll-iiko-status span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.payroll-iiko-status details {
  grid-column: 1 / -1;
  font-size: 12px;
}

.payroll-iiko-status summary { cursor: pointer; font-weight: 700; }
.payroll-iiko-status ul { margin: 8px 0 0; padding-left: 18px; }
.payroll-iiko-status li + li { margin-top: 7px; }

.iiko-help {
  position: relative;
  display: inline-flex !important;
  margin: 0 0 0 6px !important;
  vertical-align: middle;
}

.iiko-help-trigger {
  display: inline-grid;
  width: 18px;
  height: 18px;
  padding: 0;
  place-items: center;
  border: 1px solid #c78b18;
  border-radius: 999px;
  background: #fff;
  color: #8a5b00;
  font-size: 12px;
  font-weight: 800;
  cursor: help;
}

.iiko-help-popover {
  position: absolute;
  right: 0;
  top: 24px;
  z-index: 5;
  display: none !important;
  width: min(320px, 78vw);
  padding: 10px 12px;
  border: 1px solid #ead39f;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 41, 55, .16);
  color: var(--text) !important;
  font-size: 12px !important;
  font-weight: 500;
  line-height: 1.45;
}

.iiko-help:hover .iiko-help-popover,
.iiko-help:focus-within .iiko-help-popover {
  display: block !important;
}

.iiko-trouble-guide {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #ead39f;
  border-radius: 6px;
  background: #fffdf5;
}

.iiko-trouble-guide strong,
.iiko-trouble-guide span {
  display: block;
}

.iiko-trouble-guide span {
  margin: 0;
  color: #6f5b2c;
  font-size: 12px;
}

.iiko-rule-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 8px;
  vertical-align: middle;
}

.payroll-shift-row {
  display: grid;
  grid-template-columns: 34px minmax(150px, 1.35fr) repeat(5, minmax(80px, .65fr)) minmax(120px, .9fr) 90px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid #cbd5e1;
  border-radius: 6px;
  background: #fafbfc;
}

.payroll-shift-row.is-working {
  border-left-color: #3154d9;
  background: #fff;
}

.payroll-shift-row.is-iiko-filled { border-left-color: #15966f; }

.payroll-shift-row.has-time-override {
  border-left-color: #c78b18;
  background: #fffaf0;
}

.payroll-shift-row.is-manual-added {
  border-left-color: #c78b18;
  background: #fffaf0;
}

.payroll-shift-row label {
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
}

.payroll-shift-row input {
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  padding: 8px;
}

.payroll-shift-row input[readonly] {
  border-color: #b8dfcf;
  background: #f0faf6;
  color: #16634f;
  cursor: not-allowed;
}

.payroll-worked-toggle {
  align-self: center;
  display: grid;
  place-items: center;
}

.payroll-worked-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.payroll-employee-copy {
  align-self: center;
  min-width: 0;
}

.payroll-employee-copy strong,
.payroll-employee-copy span {
  display: block;
}

.payroll-employee-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.payroll-employee-copy small {
  display: block;
  margin-top: 4px;
  color: #18775e;
  font-size: 11px;
  line-height: 1.3;
}

.payroll-employee-copy em {
  display: block;
  margin-top: 5px;
  color: #5d687a;
  font-size: 11px;
  font-style: normal;
  line-height: 1.3;
}

.iiko-row-rule-action {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding: 0;
  font-size: 11px;
}

.payroll-remove-manual {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding: 0;
  font-size: 11px;
}

.payroll-manual-add {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed #c9a85f;
  border-radius: 6px;
  background: #fffaf0;
}

.payroll-manual-add[hidden] { display: none; }

.payroll-manual-add > div {
  align-self: center;
}

.payroll-manual-add strong,
.payroll-manual-add span {
  display: block;
}

.payroll-manual-add span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.payroll-manual-add label {
  color: var(--muted);
  font-size: 12px;
}

.payroll-manual-add select {
  width: 100%;
  margin-top: 5px;
}

.payroll-shift-row.has-time-override .payroll-employee-copy em {
  color: #8a5b00;
  font-weight: 700;
}

.payroll-time-reason-field {
  grid-column: 2 / -1;
  padding: 8px 10px 10px;
  border: 1px solid #ead39f;
  border-radius: 6px;
  background: #fff7e5;
  color: #76500c !important;
}

.payroll-time-reason-field[hidden] { display: none; }

.payroll-time-reason-field input {
  border-color: #dcb96a;
  background: #fff;
}

.payroll-advance-field {
  position: relative;
}

.payroll-advance-field input {
  padding-right: 44px;
}

.payroll-advance-500 {
  position: absolute;
  right: 5px;
  bottom: 6px;
  padding: 3px;
  font-size: 11px;
}

.payroll-shift-total {
  min-width: 0;
  align-self: center;
  text-align: right;
}

.payroll-shift-total strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.payroll-late-toggle {
  display: inline-grid;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 3px 5px;
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  background: #f6f8fb;
  color: #617089;
  font: inherit;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.15;
  white-space: normal;
  cursor: pointer;
}

.payroll-late-toggle-label {
  color: inherit;
  font-size: 9px;
  font-weight: 500;
  opacity: 0.78;
}

.payroll-late-toggle.is-late {
  border-color: #e5bd76;
  background: #fff6e7;
  color: #9b5b13;
}

.payroll-late-toggle:hover:not(:disabled),
.payroll-late-toggle:focus-visible {
  border-color: #6f8be7;
  box-shadow: 0 0 0 2px rgba(49, 84, 217, 0.12);
}

.payroll-late-toggle:disabled {
  cursor: default;
  opacity: 0.72;
}

.closing-payroll-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  background: #f6f8fc;
}

.closing-payroll-summary > div {
  padding: 12px 14px;
  border-right: 1px solid var(--border);
}

.closing-payroll-summary > div:last-child { border-right: 0; }
.closing-payroll-summary span { display: block; color: var(--muted); font-size: 12px; }
.closing-payroll-summary strong { display: block; margin-top: 4px; font-size: 18px; }

.employee-modal-card { width: min(620px, calc(100vw - 32px)); }
.employee-rate-history { display: grid; gap: 5px; padding: 10px 0; }
.employee-rate-history span { color: var(--muted); font-size: 13px; }

@media (max-width: 1100px) {
  .payroll-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .payroll-shift-row {
    grid-template-columns: 34px minmax(180px, 1fr) repeat(3, minmax(100px, .7fr));
  }
  .payroll-manual,
  .payroll-comment-field,
  .payroll-shift-total { grid-column: auto; }
}

@media (max-width: 760px) {
  .payroll-filters,
  .payroll-metrics,
  .closing-payroll-summary { grid-template-columns: 1fr; }
  .payroll-manual-add { grid-template-columns: 1fr; }
  .payroll-shift-row { grid-template-columns: 30px 1fr; }
  .payroll-shift-row > label:not(.payroll-worked-toggle),
  .payroll-shift-total { grid-column: 2; }
  .closing-step-heading { display: grid; }
  .closing-advance-reference { text-align: left; }
  .payroll-iiko-status { grid-template-columns: 1fr; }
}

.drawer-section-title {
  margin-bottom: 8px;
}

/* Light visual layer: restrained Liquid Glass with the existing blue identity. */
body.visual-polish-v2 {
  --bg: #eef3fa;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-soft: rgba(246, 249, 253, 0.9);
  --surface-blue: #eaf0ff;
  --surface-glass: rgba(255, 255, 255, 0.76);
  --line: rgba(124, 145, 180, 0.24);
  --line-strong: rgba(103, 125, 164, 0.42);
  --text: #141b2a;
  --muted: #647086;
  --accent: #3156dc;
  --accent-strong: #203fb8;
  --danger: #b54848;
  --warning: #976512;
  --income: #147657;
  --expense: #b54848;
  --radius-control: 8px;
  --radius-card: 8px;
  --shadow-card: 0 1px 2px rgba(25, 45, 82, 0.04), 0 10px 28px rgba(39, 67, 118, 0.07);
  --shadow-raised: 0 2px 5px rgba(22, 44, 84, 0.06), 0 16px 36px rgba(39, 67, 118, 0.11);
  --shadow: var(--shadow-raised);
  --transition-fast: 180ms ease;
  min-height: 100vh;
  background: linear-gradient(180deg, #f5f8fd 0%, #edf3fa 54%, #f4f7fb 100%);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.visual-polish-v2 .app-shell {
  grid-template-columns: 232px minmax(0, 1fr);
}

.visual-polish-v2 .sidebar {
  z-index: 20;
  gap: 30px;
  padding: 24px 16px 18px;
  border-right-color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  box-shadow: 1px 0 0 rgba(113, 136, 174, 0.12), 12px 0 34px rgba(61, 88, 134, 0.055);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
}

.visual-polish-v2 .brand {
  min-height: 44px;
}

.visual-polish-v2 .brand-mark {
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, #4969ea 0%, #2f4fd7 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 8px 20px rgba(49, 86, 220, 0.22);
}

.visual-polish-v2 .brand-title {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0;
}

.visual-polish-v2 .sidebar .brand-subtitle,
.visual-polish-v2 .role-box label,
.visual-polish-v2 .storage-status {
  color: var(--muted);
}

.visual-polish-v2 .role-box,
.visual-polish-v2 .storage-status,
.visual-polish-v2 #storageStatusText {
  min-width: 0;
}

.visual-polish-v2 #storageStatusText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visual-polish-v2 .nav {
  gap: 5px;
}

.visual-polish-v2 .nav-item {
  min-height: 42px;
  border-radius: var(--radius-control);
  color: #353f53;
  font-weight: 560;
  line-height: 1.2;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.visual-polish-v2 .nav-item:hover {
  border-color: rgba(76, 105, 190, 0.16);
  background: rgba(229, 237, 255, 0.72);
  color: #1f3fae;
}

.visual-polish-v2 .nav-item.active,
.visual-polish-v2 .nav-item.active:hover {
  border-color: #3156dc;
  background: linear-gradient(180deg, #3f61e6 0%, #3153d4 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 7px 18px rgba(49, 86, 220, 0.2);
}

.visual-polish-v2 .role-box {
  border-top-color: rgba(120, 141, 176, 0.24);
}

.visual-polish-v2 .role-box select {
  border-color: rgba(118, 140, 176, 0.28);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
}

.visual-polish-v2 .main {
  padding: 28px 30px 38px;
}

.visual-polish-v2 .topbar {
  align-items: center;
  min-height: 64px;
  margin-bottom: 24px;
}

.visual-polish-v2 h1 {
  color: #121927;
  font-size: 32px;
  font-weight: 720;
  line-height: 1.08;
  letter-spacing: 0;
}

.visual-polish-v2 h2 {
  color: #1d2638;
  font-size: 18px;
  font-weight: 680;
  line-height: 1.25;
  letter-spacing: 0;
}

.visual-polish-v2 #viewSubtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.visual-polish-v2 .top-actions {
  gap: 9px;
}

.visual-polish-v2 .primary-button,
.visual-polish-v2 .ghost-button,
.visual-polish-v2 .danger-ghost-button,
.visual-polish-v2 .icon-button {
  min-height: 40px;
  border-radius: var(--radius-control);
  font-weight: 600;
  line-height: 1;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.visual-polish-v2 .primary-button {
  border-color: var(--accent);
  background: linear-gradient(180deg, #4263e6 0%, #3153d4 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 7px 16px rgba(49, 86, 220, 0.16);
}

.visual-polish-v2 .primary-button:hover {
  border-color: #2948c2;
  background: linear-gradient(180deg, #4a6aec 0%, #294bc9 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 22px rgba(49, 86, 220, 0.22);
  transform: translateY(-1px);
}

.visual-polish-v2 .ghost-button,
.visual-polish-v2 .icon-button {
  border-color: rgba(117, 139, 176, 0.28);
  background: rgba(255, 255, 255, 0.74);
  color: #283348;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68), 0 3px 10px rgba(39, 65, 108, 0.045);
}

.visual-polish-v2 .metric,
.visual-polish-v2 .panel,
.visual-polish-v2 .wallet-card {
  border-color: var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), var(--shadow-card);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
}

.visual-polish-v2 .metric {
  min-height: 132px;
  padding: 20px 21px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.visual-polish-v2 .metric span {
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.visual-polish-v2 .metric strong {
  font-size: 29px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
}

.visual-polish-v2 .metric:first-child {
  border-color: rgba(74, 104, 226, 0.7);
  background: linear-gradient(145deg, #3d5fe0 0%, #2d4bc3 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 16px 34px rgba(42, 72, 186, 0.2);
}

.visual-polish-v2 .metric:first-child::after {
  display: none;
}

.visual-polish-v2 .metric:first-child span {
  color: rgba(255, 255, 255, 0.74);
}

.visual-polish-v2 .calendar-liability.coverage-good {
  border-color: rgba(73, 158, 120, 0.34);
  background: rgba(237, 249, 243, 0.82);
  color: #17674e;
}

.visual-polish-v2 .calendar-liability.coverage-warning {
  border-color: rgba(194, 148, 59, 0.36);
  background: rgba(255, 248, 231, 0.84);
  color: #865d0d;
}

.visual-polish-v2 .calendar-liability.coverage-bad {
  border-color: rgba(201, 94, 94, 0.34);
  background: rgba(255, 240, 241, 0.84);
  color: #9b4141;
}

.visual-polish-v2 .calendar-liability small {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
}

.visual-polish-v2 .wallet-card {
  min-height: 122px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
}

.visual-polish-v2 .wallet-card::before {
  width: 3px;
  background: linear-gradient(180deg, #6580ed 0%, #3156dc 100%);
}

.visual-polish-v2 .wallet-card:hover {
  border-color: rgba(80, 108, 194, 0.4);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84), var(--shadow-raised);
  transform: translateY(-2px);
}

.visual-polish-v2 .wallet-card .balance {
  margin: 12px 0 7px;
  font-size: 27px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
}

.visual-polish-v2 .wallet-card > strong {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}

.visual-polish-v2 .wallet-meta {
  color: #707b90;
  font-size: 13px;
  line-height: 1.35;
}

.visual-polish-v2 .wallet-section {
  margin-bottom: 20px;
}

.visual-polish-v2 .wallet-section h2 {
  margin-bottom: 10px;
  color: #536079;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.visual-polish-v2 .panel {
  padding: 18px;
}

.visual-polish-v2 .panel-header {
  min-height: 40px;
  align-items: center;
}

.visual-polish-v2 .table-wrap {
  margin-top: 14px;
  border-color: rgba(122, 144, 179, 0.23);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 7px 20px rgba(45, 70, 112, 0.045);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.visual-polish-v2 th,
.visual-polish-v2 td {
  padding: 11px 13px;
  border-bottom-color: rgba(129, 150, 184, 0.18);
  line-height: 1.35;
}

.visual-polish-v2 th {
  background: rgba(239, 244, 252, 0.96);
  color: #536079;
  font-size: 12px;
  font-weight: 700;
}

.visual-polish-v2 tbody tr:hover td {
  background: rgba(241, 246, 255, 0.82);
}

.visual-polish-v2 input,
.visual-polish-v2 select,
.visual-polish-v2 textarea {
  min-height: 42px;
  border-color: rgba(113, 136, 174, 0.3);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.visual-polish-v2 input:hover,
.visual-polish-v2 select:hover,
.visual-polish-v2 textarea:hover {
  border-color: rgba(74, 104, 180, 0.5);
}

.visual-polish-v2 input:focus,
.visual-polish-v2 select:focus,
.visual-polish-v2 textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 86, 220, 0.13);
}

.visual-polish-v2 .tag {
  border-radius: 6px;
  font-weight: 600;
}

.visual-polish-v2 .action-strip {
  gap: 9px;
  margin: 16px 0 22px;
}

.visual-polish-v2 .action-strip .primary-button {
  border-color: var(--accent);
  background: linear-gradient(180deg, #4263e6 0%, #3153d4 100%);
  color: #fff;
}

.visual-polish-v2 .action-strip .primary-button:hover {
  border-color: #2948c2;
  background: linear-gradient(180deg, #4a6aec 0%, #294bc9 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 22px rgba(49, 86, 220, 0.22);
}

.visual-polish-v2 .action-strip .cash-closing-launch {
  border-color: #18359f;
  background: linear-gradient(180deg, #2849bc 0%, #1c3698 100%);
  color: #fff;
}

.visual-polish-v2 .action-strip .cash-closing-launch:hover {
  border-color: #142d87;
  background: linear-gradient(180deg, #3152c7 0%, #172f8c 100%);
}

.visual-polish-v2 .action-strip [data-open-operation="income"] {
  border-color: var(--accent);
  color: #fff;
}

.visual-polish-v2 .action-strip [data-open-operation="expense"] {
  border-color: var(--accent);
  color: #fff;
}

.visual-polish-v2 .quick-entry {
  border-left: 3px solid var(--accent);
}

.visual-polish-v2 .report-legend {
  color: #5c6880;
}

.visual-polish-v2 #reportView > .panel {
  background: rgba(255, 255, 255, 0.8);
}

.visual-polish-v2 .report-view-toolbar {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(112, 135, 174, 0.18);
}

.visual-polish-v2 .report-density-control > span {
  color: #657188;
}

.visual-polish-v2 .report-density-switch {
  background: rgba(232, 238, 248, 0.76);
}

.visual-polish-v2 .report-wrap {
  border-color: rgba(103, 126, 164, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 26px rgba(42, 66, 108, 0.065);
}

.visual-polish-v2 .report-table th:first-child {
  background: #eaf0fb;
}

.visual-polish-v2 .report-table .section-row td,
.visual-polish-v2 .report-table .section-row th {
  background: #26375f;
}

.visual-polish-v2 .report-table .section-row.report-kind-default td {
  background: #5c4829;
}

.visual-polish-v2 .report-table .section-row.report-kind-default:hover td {
  background: #4e3d23;
}

.visual-polish-v2 .planning-toolbar {
  padding: 10px;
  background: rgba(255, 255, 255, 0.76);
}

.visual-polish-v2 .segmented-control {
  border-color: rgba(118, 140, 176, 0.25);
  border-radius: var(--radius-control);
  background: rgba(232, 238, 248, 0.82);
}

.visual-polish-v2 .segmented-control button {
  min-height: 34px;
  border-radius: 6px;
}

.visual-polish-v2 .segmented-control button.active {
  color: #1d2d59;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 #fff, 0 3px 9px rgba(36, 60, 102, 0.09);
}

.visual-polish-v2 .payment-matrix-panel {
  border-color: rgba(118, 140, 176, 0.27);
}

.visual-polish-v2 .payment-matrix-header {
  min-height: 66px;
  border-bottom-color: rgba(118, 140, 176, 0.24);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
}

.visual-polish-v2 .payment-matrix-table thead th,
.visual-polish-v2 .payment-matrix-table thead th:first-child {
  background: rgba(239, 244, 252, 0.9);
  color: #536079;
}

.visual-polish-v2 .payment-matrix-table th,
.visual-polish-v2 .payment-matrix-table td {
  border-right-color: rgba(107, 131, 171, 0.34);
  border-bottom-color: rgba(107, 131, 171, 0.34);
}

.visual-polish-v2 .payment-matrix-table .matrix-section-row th,
.visual-polish-v2 .payment-matrix-table .matrix-section-row td {
  background: color-mix(in srgb, var(--matrix-row-color) 18%, #eff4fb);
  color: #303b50;
}

.visual-polish-v2 .matrix-summary th,
.visual-polish-v2 .matrix-summary td,
.visual-polish-v2 .matrix-summary th:first-child,
.visual-polish-v2 .payment-matrix-table .matrix-summary td.weekend,
.visual-polish-v2 .payment-matrix-table .matrix-summary td.transition-day {
  background: #26375f;
  color: #fff;
}

.visual-polish-v2 .matrix-opening-row th,
.visual-polish-v2 .matrix-opening-row td,
.visual-polish-v2 .matrix-opening-row th:first-child,
.visual-polish-v2 .payment-matrix-table .matrix-opening-row td.weekend,
.visual-polish-v2 .payment-matrix-table .matrix-opening-row td.transition-day {
  background: #edf2f9;
  color: #354159;
}

.visual-polish-v2 .payment-matrix-table tbody tr.matrix-summary:hover th,
.visual-polish-v2 .payment-matrix-table tbody tr.matrix-summary:hover td {
  background: #26375f;
}

.visual-polish-v2 .payment-matrix-table tbody tr.matrix-opening-row:hover th,
.visual-polish-v2 .payment-matrix-table tbody tr.matrix-opening-row:hover td {
  background: #edf2f9;
}

.visual-polish-v2 .matrix-closing-row th,
.visual-polish-v2 .matrix-closing-row td,
.visual-polish-v2 .matrix-closing-row th:first-child,
.visual-polish-v2 .payment-matrix-table .matrix-closing-row td.weekend,
.visual-polish-v2 .payment-matrix-table .matrix-closing-row td.transition-day {
  background: #e1f1e8;
  color: #155f3d;
}

.visual-polish-v2 .matrix-cell-button:hover {
  background: #eef2ff;
}

.visual-polish-v2 .matrix-add-mark {
  color: #c4cbc5;
}

.visual-polish-v2 .matrix-cell-button:hover .matrix-add-mark {
  color: var(--accent);
}

.visual-polish-v2 .calendar-inline-actions {
  gap: 5px;
}

.visual-polish-v2 .matrix-inline-settings {
  border-color: rgba(113, 136, 174, 0.32);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-raised);
}

.visual-polish-v2 .modal {
  background: rgba(24, 34, 55, 0.36);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.visual-polish-v2 .modal-card,
.visual-polish-v2 .drawer {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 64px rgba(29, 48, 82, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  backdrop-filter: blur(22px) saturate(120%);
}

.visual-polish-v2 .modal-header,
.visual-polish-v2 .drawer-header {
  border-bottom-color: rgba(118, 140, 176, 0.22);
}

.visual-polish-v2 .directory-layout .panel,
.visual-polish-v2 .directory-panel {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76), 0 5px 18px rgba(41, 66, 108, 0.045);
}

.visual-polish-v2 .danger-ghost-button {
  border-color: rgba(190, 78, 78, 0.28);
  background: rgba(255, 250, 250, 0.72);
  color: var(--danger);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.visual-polish-v2 .danger-ghost-button:hover {
  border-color: rgba(190, 78, 78, 0.48);
  background: rgba(255, 241, 242, 0.92);
  box-shadow: 0 7px 17px rgba(159, 61, 61, 0.09);
  transform: translateY(-1px);
}

.visual-polish-v2 .ghost-button:hover,
.visual-polish-v2 .icon-button:hover {
  border-color: rgba(74, 104, 180, 0.42);
  background: rgba(239, 244, 255, 0.92);
  color: var(--accent-strong);
  box-shadow: 0 7px 17px rgba(45, 71, 116, 0.08);
  transform: translateY(-1px);
}

.visual-polish-v2 .primary-button:active,
.visual-polish-v2 .ghost-button:active,
.visual-polish-v2 .danger-ghost-button:active,
.visual-polish-v2 .icon-button:active,
.visual-polish-v2 .nav-item:active {
  transform: translateY(0);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .visual-polish-v2 .sidebar,
  .visual-polish-v2 .metric,
  .visual-polish-v2 .panel,
  .visual-polish-v2 .wallet-card,
  .visual-polish-v2 .modal-card,
  .visual-polish-v2 .drawer,
  .visual-polish-v2 .payment-matrix-header {
    background-color: #fff;
  }
}

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

@media (max-width: 1400px) {
  .quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #journalView .filters {
    grid-template-columns: minmax(220px, 1fr) 150px 170px minmax(180px, 220px);
  }

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

  .planning-toolbar .segmented-control {
    width: fit-content;
  }

  #reportView .report-controls {
    align-items: stretch;
    flex-direction: column;
  }

  #reportView .report-filter-controls {
    width: 100%;
    grid-template-columns: 112px minmax(170px, 1fr) minmax(170px, 1fr) 155px;
  }
}

@media (min-width: 1101px) and (max-width: 1400px) {
  .report-table.density-comfortable:not(.single-month) {
    font-size: 10.5px;
  }
}

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

  .visual-polish-v2 .sidebar {
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-right: 0;
    border-bottom-color: rgba(111, 135, 174, 0.24);
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(24, 45, 168, 0.06);
  }

  .nav {
    display: flex;
  }

  .role-box {
    margin-top: 0;
    min-width: 170px;
    padding-top: 0;
    border-top: 0;
  }

  .metric-row,
  .directory-grid,
  .category-columns {
    grid-template-columns: 1fr;
  }

  .planning-metrics,
  .plan-fact-metrics {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

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

  .planning-filters {
    grid-template-columns: 170px minmax(180px, 1fr) 180px auto auto;
  }

  .quick-grid,
  .filters,
  .catalog-toolbar,
  .bulk-toolbar {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .audit-change-grid {
    grid-template-columns: 1fr;
  }

  .closing-zip-section {
    grid-template-columns: 1fr;
  }

  .closing-summary {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

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

  .cash-expense-row {
    grid-template-columns: minmax(180px, 1fr) 120px minmax(150px, 1fr) 36px;
  }

  .payment-discrepancy-row {
    grid-template-columns: repeat(2, minmax(160px, 1fr)) 105px 36px;
  }

  .payment-discrepancy-comment {
    grid-column: 1 / 4;
  }

  .cash-expense-comment {
    grid-column: 1 / 4;
  }

  .cash-expense-actions {
    grid-column: 4;
    grid-row: 1;
  }
}

@media (max-width: 900px) {
  .payroll-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visual-polish-v2 .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: center;
    gap: 12px 18px;
    overflow: visible;
  }

  .visual-polish-v2 .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .visual-polish-v2 .role-box {
    grid-column: 2;
    grid-row: 1;
    width: 220px;
    min-width: 0;
  }

  .visual-polish-v2 .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
  }

  .visual-polish-v2 .nav-item {
    min-width: 0;
    padding: 8px 6px;
    text-align: center;
    white-space: normal;
  }
}

@media (max-width: 700px) {
  .journal-summary {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px 14px;
    white-space: normal;
  }

  .journal-summary span:first-child {
    width: 100%;
    margin-right: 0;
  }

  .closing-review-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .closing-review-actions p {
    text-align: left;
  }

  .iiko-import-control {
    width: 100%;
    min-width: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .iiko-import-control > span {
    text-align: left;
  }

  .visual-polish-v2 .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 145px;
    align-items: start;
    gap: 10px;
    padding: 12px 14px;
  }

  .visual-polish-v2 .role-box {
    width: 145px;
  }

  .visual-polish-v2 .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .visual-polish-v2 .main {
    padding: 14px;
  }

  .visual-polish-v2 .topbar {
    align-items: flex-start;
    padding-bottom: 14px;
  }

  .visual-polish-v2 h1 {
    font-size: 27px;
  }

  .visual-polish-v2 .nav-item {
    min-height: 38px;
    padding: 8px 4px;
    font-size: 11px;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 145px;
    align-items: start;
    gap: 10px;
    padding: 12px 14px;
    overflow: visible;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .brand-title,
  .brand-subtitle {
    white-space: nowrap;
  }

  .role-box {
    grid-column: 2;
    grid-row: 1;
    width: 145px;
    min-width: 0;
  }

  .role-box label {
    display: none;
  }

  .role-box select {
    min-height: 34px;
  }

  .storage-status {
    font-size: 10px;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
  }

  .nav-item {
    min-width: 0;
    padding: 9px 4px;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .top-actions button {
    flex: 1 1 150px;
  }

  h1 {
    font-size: 28px;
  }

  .panel {
    padding: 14px;
  }

  .report-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .report-filter-controls,
  .control-report-summary {
    grid-template-columns: 1fr;
  }

  .control-report-summary > div,
  .control-report-summary > div:first-child {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .control-report-summary > div:first-child {
    border-top: 0;
  }

  .report-subtoolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented-control.control-report-tabs {
    grid-template-columns: 1fr;
  }

  .report-subtoolbar .hint {
    max-width: none;
    text-align: left;
  }

  .planning-filters,
  .planning-metrics,
  .plan-fact-metrics {
    grid-template-columns: 1fr;
  }

  .balance-overview,
  .wallet-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    min-width: 0;
    padding: 0 8px;
  }

  .payment-matrix-wrap {
    max-height: calc(100vh - 300px);
  }

  .calendar-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .payment-matrix-header,
  .payment-matrix-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .payment-matrix-actions {
    width: 100%;
  }

  .payment-matrix-actions > button {
    width: 100%;
  }

  .calendar-layout-editor-row {
    grid-template-columns: 18px 7px minmax(0, 1fr);
    padding: 7px 0;
  }

  .calendar-layout-editor-actions {
    grid-column: 3;
    flex-wrap: wrap;
  }

  .calendar-legend {
    flex-wrap: wrap;
  }

  .calendar-detail-grid {
    grid-template-columns: 1fr;
  }

  .calendar-detail-grid > section + section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .calendar-line {
    grid-template-columns: minmax(140px, 1fr) auto;
  }

  .calendar-line .tag {
    grid-column: 1;
    width: max-content;
  }

  .calendar-line > strong {
    grid-column: 2;
    grid-row: 1;
  }

  .quick-entry .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .quick-entry-controls {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .quick-entry-status {
    order: 3;
    width: 100%;
    text-align: left;
  }

  .report-filter-controls {
    width: 100%;
    grid-template-columns: minmax(90px, 0.7fr) minmax(160px, 1.3fr);
  }

  #reportView .report-filter-controls {
    grid-template-columns: 1fr;
  }

  .report-legend-divider {
    display: none;
  }

  .action-strip .primary-button {
    flex: 1 1 calc(50% - 8px);
  }

  .modal-card,
  .drawer {
    width: 100%;
    max-width: none;
  }

  .closing-form {
    padding: 0 14px 18px;
  }

  .closing-header {
    padding: 16px 14px 13px;
  }

  .closing-main-grid,
  .paper-cash-grid,
  .closing-summary,
  .closing-control-checks,
  .payment-group-directory-row {
    grid-template-columns: 1fr;
  }

  .closing-summary > div,
  .closing-summary > div:first-child {
    min-height: 48px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .closing-summary > div:first-child {
    border-top: 0;
  }

  .cash-expense-row {
    grid-template-columns: 1fr 100px 36px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .payment-discrepancy-row {
    grid-template-columns: 1fr 1fr 36px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .payment-discrepancy-type,
  .payment-discrepancy-comment {
    grid-column: 1 / 3;
  }

  .cash-expense-recipient,
  .cash-expense-comment {
    grid-column: 1 / 3;
  }

  .cash-expense-actions {
    grid-column: 3;
    grid-row: 1;
  }

  .closing-footer {
    bottom: -18px;
    margin: 16px -14px -18px;
    padding: 12px 14px;
    align-items: stretch;
    flex-direction: column;
  }

  .closing-footer-actions button {
    flex: 1;
  }

  .iiko-cash-payin-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .iiko-cash-payin-row .ghost-button,
  .iiko-cash-payin-status {
    grid-column: 1 / -1;
    justify-self: stretch;
    text-align: center;
  }
}

/* Report workspace: journal-like density with more room for the pivot table. */
@media (min-width: 1101px) {
  #reportView > .panel {
    padding: 14px 18px 18px;
  }

  #reportView .report-view-toolbar {
    min-height: 40px;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  #reportView .report-controls {
    display: grid;
    grid-template-columns: minmax(250px, 0.8fr) minmax(0, 2.2fr);
    min-height: 0;
    align-items: end;
    gap: 16px;
    padding: 4px 0 10px;
  }

  #reportView .report-heading h2 {
    font-size: 18px;
  }

  #reportView .report-heading p {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.35;
  }

  #reportView .report-legend {
    gap: 5px 10px;
    margin-top: 7px;
    font-size: 11.5px;
  }

  #reportView .report-legend-swatch {
    width: 12px;
    height: 12px;
  }

  #reportView .report-filter-controls {
    width: 100%;
    grid-template-columns: 80px minmax(125px, 1fr) minmax(135px, 1fr) minmax(132px, auto);
    gap: 8px;
  }

  #reportView .report-filter-controls label {
    gap: 3px;
    font-size: 11px;
  }

  #reportView .report-filter-controls select {
    min-height: 36px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  #reportView .report-checkbox-control {
    min-height: 34px;
    font-size: 12px;
  }

  #reportView .report-wrap {
    max-height: calc(100vh - 235px);
    margin-top: 10px;
  }
}

/* Summary report: restrained spreadsheet density with the app's blue hierarchy. */
.report-tree-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid #dce3ee;
  border-radius: 9px;
  background: #f1f4f9;
}

.report-tree-actions .ghost-button {
  min-height: 30px;
  padding: 0 9px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: #526078;
  font-size: 11.5px;
}

.report-tree-actions .ghost-button:hover,
.report-tree-actions .ghost-button:focus-visible {
  border-color: #d5deeb;
  background: #fff;
  color: #263a58;
}

.report-tree-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.report-tree-action svg,
.workspace-fullscreen-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.report-fullscreen-button {
  margin-left: 0;
}

.workspace-fullscreen-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: #526078;
}

.visual-polish-v2 .report-tree-actions .report-fullscreen-button {
  display: inline-flex;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
}

.workspace-fullscreen-button:hover,
.workspace-fullscreen-button:focus-visible,
.workspace-fullscreen-button[aria-pressed="true"] {
  border-color: #d5deeb;
  background: #fff;
  color: #294fc2;
}

.workspace-fullscreen-button .fullscreen-exit-icon,
.workspace-fullscreen-button[aria-pressed="true"] .fullscreen-enter-icon {
  display: none;
}

.workspace-fullscreen-button[aria-pressed="true"] .fullscreen-exit-icon {
  display: block;
}

body.report-fullscreen-open {
  overflow: hidden;
}

#reportWorkspacePanel.report-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  flex-direction: column;
  padding: 12px 16px 14px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f7f9fd;
  box-shadow: none;
}

#reportWorkspacePanel.report-fullscreen .report-view-toolbar {
  flex: 0 0 auto;
}

#reportWorkspacePanel.report-fullscreen .report-controls {
  flex: 0 0 auto;
}

#reportWorkspacePanel.report-fullscreen #summaryReportPanel {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
}

#reportWorkspacePanel.report-fullscreen .report-layout-inline {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
  flex: 1 1 0;
  overflow: hidden;
}

#reportWorkspacePanel.report-fullscreen .report-layout-inline-header,
#reportWorkspacePanel.report-fullscreen .report-layout-note,
#reportWorkspacePanel.report-fullscreen .report-layout-current,
#reportWorkspacePanel.report-fullscreen .report-layout-search,
#reportWorkspacePanel.report-fullscreen .report-layout-footer {
  flex: 0 0 auto;
}

#reportWorkspacePanel.report-fullscreen .report-layout-list {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#reportWorkspacePanel.report-fullscreen .report-layout-footer {
  position: static;
  z-index: 2;
}

#reportView .report-wrap {
  margin-top: 8px;
  border-color: rgba(103, 126, 164, 0.24);
  background: #fff;
  box-shadow: none;
}

#reportView .report-table {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: #273247;
  font-size: 12px;
  line-height: 1.2;
}

#reportView .report-table.year-report {
  min-width: 1190px;
  font-size: 11px;
}

#reportView .report-table.daily-report {
  min-width: 2180px;
}

#reportView .report-table th,
#reportView .report-table td,
#reportView .report-table:not(.single-month) th,
#reportView .report-table:not(.single-month) td {
  height: 28px;
  padding: 2px 6px;
  border-right: 1px solid #edf0f5;
  border-bottom: 1px solid #e6eaf1;
  background: #fff;
}

#reportView .report-table thead th {
  height: 34px;
  background: #f5f7fa;
  color: #4d596e;
  font-size: 11px;
  font-weight: 700;
  box-shadow: inset 0 -1px 0 #dbe2ed;
}

#reportView .report-table th:first-child,
#reportView .report-table td:first-child,
#reportView .report-table.density-compact th:first-child,
#reportView .report-table.density-compact td:first-child,
#reportView .report-table.single-month th:first-child,
#reportView .report-table.single-month td:first-child {
  width: 244px;
  min-width: 244px;
  background: #fff;
  box-shadow: 1px 0 0 #dfe5ee;
}

#reportView .report-table th:first-child {
  background: #f2f5fa;
}

#reportView .report-table.year-report th,
#reportView .report-table.year-report td {
  padding-right: 3px;
  padding-left: 3px;
}

#reportView .report-table.year-report th:first-child,
#reportView .report-table.year-report td:first-child {
  width: 258px;
  min-width: 258px;
  padding-right: 8px;
  padding-left: 8px;
}

#reportView .report-table.year-report th:not(:first-child):not(:last-child),
#reportView .report-table.year-report td:not(:first-child):not(:last-child) {
  width: 68px;
  min-width: 68px;
}

#reportView .report-table th:last-child,
#reportView .report-table td:last-child,
#reportView .report-table:not(.single-month) th:last-child,
#reportView .report-table:not(.single-month) td:last-child,
#reportView .report-table.density-compact:not(.single-month) th:last-child,
#reportView .report-table.density-compact:not(.single-month) td:last-child {
  width: 98px;
  border-left: 1px solid #d8e0ec;
  background: #f5f8fd;
  box-shadow: -1px 0 0 rgba(100, 123, 162, 0.12);
}

#reportView .report-table th:last-child {
  background: #eaf0fa;
}

#reportView .report-table.year-report th:last-child,
#reportView .report-table.year-report td:last-child {
  width: 106px;
  min-width: 106px;
}

#reportView .report-table.year-report th:nth-child(5),
#reportView .report-table.year-report td:nth-child(5),
#reportView .report-table.year-report th:nth-child(8),
#reportView .report-table.year-report td:nth-child(8),
#reportView .report-table.year-report th:nth-child(11),
#reportView .report-table.year-report td:nth-child(11) {
  border-left: 2px solid #d7deea;
}

#reportView .report-table .section-row td,
#reportView .report-table .section-row th,
.visual-polish-v2 #reportView .report-table .section-row td,
.visual-polish-v2 #reportView .report-table .section-row th,
#reportView .report-table .section-row.report-kind-default td,
.visual-polish-v2 #reportView .report-table .section-row.report-kind-default td {
  height: 30px;
  border-top: 1px solid #c9d5e8;
  border-right-color: #dbe3ef;
  border-bottom-color: #cfd9e8;
  background: #edf2f8;
  color: #22314e;
  font-weight: 750;
}

#reportView .report-table tbody .section-row:not(:first-child) td {
  border-top-width: 1px;
  border-top-color: #c9d5e8;
}

#reportView .report-table .section-row:hover td,
#reportView .report-table .section-row.report-kind-default:hover td,
.visual-polish-v2 #reportView .report-table .section-row.report-kind-default:hover td {
  background: #e7edf6;
}

#reportView .report-table .report-warning-row td,
#reportView .report-table .report-warning-row:hover td {
  border-top-color: #e7b4b4;
  border-bottom-color: #edcaca;
  background: #fff1f1;
  color: #9f3337;
}

#reportView .report-table .report-kind-revenue:not(.section-row) td,
#reportView .report-table .report-kind-supplier:not(.section-row) td,
#reportView .report-table .report-kind-tax:not(.section-row) td,
#reportView .report-table .report-kind-payroll:not(.section-row) td,
#reportView .report-table .report-kind-revenue:not(.section-row):hover td,
#reportView .report-table .report-kind-supplier:not(.section-row):hover td,
#reportView .report-table .report-kind-tax:not(.section-row):hover td,
#reportView .report-table .report-kind-payroll:not(.section-row):hover td {
  background: #fff;
}

#reportView .report-table .report-node-group td {
  border-top: 1px solid #d8dfe9;
  background: #f8fafc;
  font-weight: 700;
}

#reportView .report-table .report-node-project td {
  border-top: 0;
  background: #fff;
  font-weight: 650;
}

#reportView .report-table .report-row-expanded:not(.section-row) td {
  border-top-color: #c8d4e5;
  border-bottom-color: #cbd6e6;
  background: #f1f5fa;
}

#reportView .report-table .report-row-expanded:not(.section-row):hover td {
  background: #edf2f8;
}

#reportView .report-row-in-expanded-branch .report-row-label {
  position: relative;
}

#reportView .report-row-in-expanded-branch .report-row-label::before {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: calc(var(--report-level, 1) * 13px - 7px);
  width: 1px;
  background: #cbd6e6;
  content: "";
}

#reportView .report-node-project .report-row-label > span:last-child {
  white-space: nowrap;
}

#reportView .report-table .report-node-project.report-location-bk td:first-child,
#reportView .report-table .report-node-project.report-location-vg td:first-child,
#reportView .report-table .report-node-project.report-location-chtz td:first-child,
#reportView .report-table .report-node-balance td {
  background: #fff;
}

#reportView .report-table tbody tr:not(.section-row):hover td,
#reportView .report-table tbody tr:not(.section-row):hover td.report-column-hover {
  background: #f7f9fd;
  box-shadow: none;
}

#reportView .report-table td.report-column-hover:not(:first-child),
#reportView .report-table th.report-column-hover:not(:first-child) {
  box-shadow: inset 0 0 0 9999px rgba(49, 86, 220, 0.025);
}

#reportView .report-row-label,
#reportView .density-compact .report-row-label {
  min-height: 20px;
  gap: 6px;
  padding-left: calc(var(--report-level, 0) * 13px);
  font-size: 11.5px;
  line-height: 1.15;
}

#reportView .report-table .section-row .report-row-label,
#reportView .report-node-group .report-row-label,
#reportView .report-node-project .report-row-label,
#reportView .density-compact .section-row .report-row-label,
#reportView .density-compact .report-node-group .report-row-label,
#reportView .density-compact .report-node-project .report-row-label {
  min-height: 20px;
  font-size: 11.5px;
}

#reportView .report-expand-button,
#reportView .report-expand-spacer,
#reportView .density-compact .report-expand-button,
#reportView .density-compact .report-expand-spacer {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

#reportView .report-direction-swatch {
  width: 3px;
  height: 16px;
  flex-basis: 3px;
}

#reportView .report-location-badge {
  min-width: 31px;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 9.5px;
}

#reportView .report-location-bk td:first-child,
#reportView .report-location-vg td:first-child,
#reportView .report-location-chtz td:first-child {
  border-left-width: 2px;
}

#reportView .report-cell button,
#reportView .report-cell > span,
#reportView .density-compact .report-cell button,
#reportView .density-compact .report-cell > span {
  min-height: 20px;
  line-height: 20px;
  border-radius: 4px;
  font-weight: 500;
}

#reportView .report-cell.income {
  color: #273247;
}

#reportView .report-cell.expense {
  color: #a84247;
}

#reportView .report-table .report-annual-total,
#reportView .report-table.density-compact .report-annual-total {
  font-size: 11.5px;
  font-weight: 750;
}

@media (max-width: 1100px) {
  .report-tree-actions {
    width: auto;
    align-self: flex-end;
  }

  .report-tree-actions .ghost-button {
    flex: 0 0 auto;
  }

  #reportView .report-table.year-report {
    min-width: 1190px;
  }
}

@media (max-width: 650px) {
  .report-tree-action {
    width: 30px;
    padding: 0 !important;
  }

  .report-tree-action span {
    display: none;
  }
}

/* ФОТ 2.0 */
.payroll-workspace-panel {
  padding: 14px 18px 18px;
}

.payroll-view-toolbar,
.payroll-toolbar-actions,
.payroll-register-head,
.payroll-sheet-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.payroll-view-toolbar {
  min-height: 40px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(112, 133, 166, 0.18);
}

.payroll-report-heading h2 {
  margin: 0;
  color: #273247;
  font-size: 18px;
}

.payroll-report-heading p {
  margin: 2px 0 0;
  color: #6b778b;
  font-size: 12px;
}

.payroll-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.payroll-toolbar-actions .ghost-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12px;
}

.payroll-fullscreen-button {
  flex: 0 0 30px;
}

body.payroll-fullscreen-open {
  overflow: hidden;
}

body.payroll-fullscreen-open #cellDrawer {
  z-index: 260;
}

body.payroll-fullscreen-open .modal.open {
  z-index: 320;
}

#payrollWorkspacePanel.payroll-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  flex-direction: column;
  padding: 10px 14px 12px;
  border: 0;
  border-radius: 0;
  background: #f7f9fd;
  box-shadow: none;
}

#payrollWorkspacePanel.payroll-fullscreen .payroll-view-toolbar,
#payrollWorkspacePanel.payroll-fullscreen .payroll-filter-controls,
#payrollWorkspacePanel.payroll-fullscreen .payroll-summary-strip,
#payrollWorkspacePanel.payroll-fullscreen .payroll-register-head {
  flex: 0 0 auto;
}

#payrollWorkspacePanel.payroll-fullscreen .payroll-sheet-wrap {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
}

.payroll-filter-controls {
  display: grid;
  grid-template-columns: 140px minmax(210px, 1.5fr) 130px 150px;
  gap: 8px;
  padding: 9px 0 8px;
}

.payroll-filter-controls label {
  display: grid;
  gap: 3px;
  color: #66748a;
  font-size: 11px;
}

.payroll-filter-controls input,
.payroll-filter-controls select {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12px;
}

.payroll-summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid #d8e0ec;
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
}

.payroll-summary-strip > div {
  min-width: 0;
  padding: 7px 10px 8px;
  border-right: 1px solid #e3e8f0;
}

.payroll-summary-strip > div:last-child {
  border-right: 0;
}

.payroll-summary-strip span,
.payroll-summary-strip strong {
  display: block;
}

.payroll-summary-strip span {
  color: #6a7689;
  font-size: 10px;
}

.payroll-summary-strip strong {
  margin-top: 2px;
  color: #273247;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.payroll-summary-strip .is-total {
  background: #edf2f8;
}

.payroll-summary-strip .is-total strong {
  color: #244f82;
}

.payroll-register-head {
  min-height: 31px;
  padding: 7px 2px 0;
}

.payroll-register-head p {
  margin: 0;
  color: #6a7689;
  font-size: 10.5px;
}

.payroll-sheet-legend {
  justify-content: flex-end;
  gap: 10px;
}

.payroll-sheet-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #6a7689;
  font-size: 10px;
}

.payroll-sheet-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #fff1f1;
}

.payroll-sheet-legend i.is-total {
  background: #eaf0fa;
}

.payroll-sheet-wrap {
  max-height: calc(100vh - 278px);
  min-height: 320px;
  margin-top: 4px;
  border-color: rgba(103, 126, 164, 0.24);
  border-radius: 5px;
  background: #fff;
  box-shadow: none;
}

.payroll-table {
  min-width: 1000px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: #273247;
}

.payroll-table th,
.payroll-table td {
  height: 28px;
  padding: 2px 5px;
  border-right: 1px solid #edf0f5;
  border-bottom: 1px solid #e6eaf1;
  background: #fff;
  vertical-align: middle;
  font-size: 10.5px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.payroll-table thead th {
  position: sticky;
  z-index: 4;
  text-align: center;
  box-shadow: inset 0 -1px 0 #dbe2ed;
}

.payroll-table .payroll-sheet-groups th {
  top: 0;
  height: 25px;
  padding: 3px 5px;
  border-right-color: #dfe5ee;
  background: #eef2f7;
  color: #5b687c;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: none;
}

.payroll-table .payroll-sheet-columns th {
  top: 25px;
  height: 31px;
  background: #f5f7fa;
  color: #4d596e;
  font-size: 9.5px;
  font-weight: 700;
}

.payroll-table .payroll-sheet-columns .payroll-col-employee,
.payroll-table .payroll-sheet-groups .payroll-col-identity {
  background: #f2f5fa;
}

.payroll-table .payroll-col-employee {
  position: sticky;
  z-index: 2;
}

.payroll-table .payroll-col-employee {
  left: 0;
}

.payroll-table .payroll-sheet-columns .payroll-col-employee {
  z-index: 6;
}

.payroll-table .payroll-location-row td {
  position: sticky;
  left: 0;
  z-index: 3;
  height: 28px;
  padding: 3px 7px;
  border-top: 1px solid #c9d5e8;
  border-bottom-color: #cfd9e8;
  background: #edf2f8;
  color: #22314e;
}

.payroll-location-row td strong {
  display: inline-block;
  min-width: 52px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.payroll-location-row td span {
  margin-left: 5px;
  color: #66748a;
  font-size: 9.5px;
  font-weight: 600;
}

.payroll-location-tone-0 {
  --payroll-location-color: #315d9a;
}

.payroll-location-tone-1 {
  --payroll-location-color: #36735a;
}

.payroll-location-tone-2 {
  --payroll-location-color: #76588f;
}

.payroll-location-tone-3 {
  --payroll-location-color: #9a6631;
}

.payroll-location-tone-4 {
  --payroll-location-color: #6a7084;
}

.payroll-employee-row .payroll-col-employee {
  border-left: 2px solid var(--payroll-location-color);
}

.payroll-employee-link {
  display: flex;
  width: 100%;
  min-height: 20px;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.payroll-employee-link strong {
  overflow: hidden;
  border-bottom: 1px dotted #a7b1c1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payroll-employee-link:hover strong {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.payroll-review-warning {
  display: inline-grid;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  place-items: center;
  border-radius: 50%;
  background: #fff0d7;
  color: #9a6514;
  font-size: 9px;
  font-weight: 800;
}

.payroll-compact-pair {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 3px;
}

.payroll-compact-pair span,
.payroll-inline-note {
  color: #7a8597;
  font-size: 8.5px;
  font-weight: 500;
}

.payroll-inline-note {
  display: inline;
  margin-left: 3px;
}

.payroll-number {
  text-align: right;
}

.payroll-debt-cell .tag {
  display: none;
}

.payroll-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 4px;
  border-radius: 50%;
  vertical-align: middle;
}

.payroll-status-dot.payroll-unpaid { background: #c75b55; }
.payroll-status-dot.payroll-partial { background: #d59a28; }
.payroll-status-dot.payroll-paid { background: #4f9b72; }
.payroll-status-dot.payroll-planned { background: #5577bd; }
.payroll-status-dot.payroll-overpaid { background: #8561aa; }

.payroll-table .payroll-cell-deduction.has-value {
  color: #a84247;
}

.payroll-table .payroll-debt-cell {
  border-left: 1px solid #d8e0ec;
  background: #f5f8fd;
}

.payroll-location-total td {
  height: 29px;
  border-top: 1px solid #d8dfe9;
  border-bottom: 1px solid #c9d5e8;
  background: #f8fafc;
  color: #263a58;
  font-weight: 700;
}

.payroll-location-total .payroll-col-employee {
  background: #f8fafc;
}

.payroll-location-total .payroll-col-employee {
  border-left: 2px solid var(--payroll-location-color);
}

.visual-polish-v2 .payroll-table .payroll-employee-row:hover td {
  background: #f7f9fd;
}

.visual-polish-v2 .payroll-table .payroll-employee-row:hover .payroll-debt-cell {
  background: #edf3fb;
}

.payroll-width-employee { width: 172px; }
.payroll-width-hours { width: 82px; }
.payroll-width-rate { width: 62px; }
.payroll-width-premium { width: 72px; }
.payroll-width-accrued { width: 79px; }
.payroll-width-advance { width: 77px; }
.payroll-width-deduction { width: 70px; }
.payroll-width-official { width: 76px; }
.payroll-width-issued { width: 72px; }
.payroll-width-remaining { width: 82px; }

.payroll-inline-money {
  width: 68px;
  min-width: 0;
  min-height: 22px !important;
  padding: 1px 4px !important;
  border-radius: 3px !important;
  text-align: right;
  font-size: 10px;
}

.payroll-fine-input {
  width: 49px;
}

.payroll-rate-input {
  width: 56px;
  font-weight: 700;
}

.payroll-line-period {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: #7a8597;
  font-size: 8.5px;
  line-height: 1;
  text-overflow: ellipsis;
}

.payroll-inline-add {
  width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid #ccd6e5;
  border-radius: 4px;
  background: #fff;
  color: #3157b7;
  font-size: 13px;
  font-weight: 750;
  line-height: 16px;
  vertical-align: middle;
  cursor: pointer;
}

.payroll-payment-warning {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #efcf8d;
  border-radius: 10px;
  background: #fff8e7;
  color: #7a4b00;
  font-size: 13px;
  line-height: 1.4;
}

.payroll-payment-warning.is-overpay {
  border-color: #e6aaaa;
  background: #fff0f0;
  color: var(--danger);
}

.payroll-detail-subform {
  display: grid;
  gap: 10px;
  margin: 10px 0 20px;
  padding: 12px;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #f8fafc;
}

.payroll-detail-subform .ghost-button {
  justify-self: start;
}

.payroll-history-reversed {
  color: #8b94a3;
  text-decoration: line-through;
}

.payroll-inline-add:hover {
  border-color: #9eb2dc;
  background: #f3f6fd;
}

.payroll-courier-panel {
  margin-top: 14px;
  padding: 14px 18px 18px;
  background: #fff;
}

.courier-register-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  gap: 12px;
  margin-bottom: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #dce3ee;
}

.courier-register-heading h2 {
  margin: 0;
  color: #17233b;
  font-size: 18px;
}

.courier-register-heading p {
  margin: 3px 0 0;
  color: #6b778b;
  font-size: 12px;
}

.courier-register-heading .primary-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12px;
}

.courier-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 4px;
  overflow: hidden;
  border: 1px solid #d8e0ec;
  border-radius: 5px;
  background: #fff;
}

.courier-summary-strip > div,
.courier-location-summary > div {
  min-width: 0;
  padding: 7px 10px 8px;
  border: 0;
  border-right: 1px solid #e1e7f0;
  border-radius: 0;
  background: #fff;
}

.courier-summary-strip > .is-total {
  border-right: 0;
  background: #edf2f8;
}

.courier-summary-strip span {
  display: block;
  color: #6a768a;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.courier-summary-strip strong {
  display: block;
  margin-top: 3px;
  color: #17233b;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.courier-location-summary {
  display: contents;
}

.courier-register-toolbar {
  display: grid;
  grid-template-columns: 150px minmax(230px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 0;
  padding: 9px 0 8px;
}

.courier-register-toolbar label {
  display: grid;
  gap: 3px;
  color: #66748a;
  font-size: 11px;
}

.courier-register-toolbar input,
.courier-register-toolbar select {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12px;
}

.courier-register-meta {
  align-self: center;
  color: #52617a;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.courier-payment-form {
  display: grid;
  grid-template-columns: 145px 110px minmax(180px, 1fr) 120px minmax(180px, 1fr) auto auto;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid #cbd6ec;
  border-radius: 8px;
  background: #fff;
}

.courier-payment-form[hidden],
.courier-row-actions [hidden],
.courier-name-cell [hidden],
.courier-name-edit-wrap[hidden] {
  display: none;
}

.courier-register-wrap {
  max-height: 620px;
  border: 1px solid #cfd8e8;
  border-radius: 5px;
  background: #fff;
}

.payroll-courier-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.payroll-courier-table thead th {
  position: sticky;
  z-index: 4;
  height: 31px;
  padding: 3px 5px;
  border-right: 1px solid #dce3ed;
  border-bottom: 1px solid #cfd8e4;
  background: #f5f7fa;
  color: #4f5d73;
  font-size: 9.5px;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
  white-space: nowrap;
}

.payroll-courier-table thead .courier-sheet-groups th {
  top: 0;
  height: 25px;
  padding: 3px 5px;
  background: #eef2f7;
  color: #617087;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .035em;
}

.payroll-courier-table thead .courier-sheet-columns th {
  top: 25px;
}

.payroll-courier-table td {
  height: 28px;
  padding: 2px 5px;
  border-right: 1px solid #e2e7ef;
  border-bottom: 1px solid #e3e8f0;
  color: #28364d;
  font-size: 10.5px;
  vertical-align: middle;
}

.payroll-courier-table .amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.courier-width-name { width: auto; }
.courier-width-days { width: 64px; }
.courier-width-count { width: 72px; }
.courier-width-amount { width: 112px; }
.courier-width-period { width: 160px; }
.courier-width-action { width: 112px; }

.courier-location-row td {
  height: 28px;
  padding: 0;
  border-top: 1px solid #cbd5e3;
  border-bottom: 1px solid #cbd5e3;
  background: #edf2f8;
}

.courier-location-row div {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 3px 7px;
}

.courier-location-row strong {
  color: #27364d;
  font-size: 10.5px;
}

.courier-location-row span {
  color: #63718a;
  font-size: 9.5px;
}

.courier-location-row b {
  color: #27364d;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.courier-payment-row:hover td {
  background: #f7f9fd;
}

.courier-person-row td {
  height: 28px;
  background: #fff;
}

.courier-person-row td:first-child,
.courier-total-row td:first-child {
  border-left: 2px solid var(--payroll-location-color, #8ca0bf);
}

.courier-person-row:hover td,
.courier-person-row.is-expanded td {
  background: #f7f9fd;
}

.courier-person-name strong,
.courier-person-total strong {
  color: #17233b;
  font-size: 10.5px;
}

.courier-person-period {
  color: #657187;
  font-variant-numeric: tabular-nums;
  font-size: 9.5px;
}

.courier-group-actions {
  text-align: right;
}

.courier-expand-button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  padding: 2px 0 2px 5px;
  border: 0;
  background: transparent;
  color: #3159ad;
  font: inherit;
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
}

.courier-expand-button b {
  display: inline-block;
  color: #66748a;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  transition: transform .15s ease;
}

.courier-expand-button[aria-expanded="true"] b {
  transform: rotate(180deg);
}

.courier-details-row > td {
  height: auto;
  padding: 0 7px 7px 18px;
  border-bottom: 1px solid #ccd6e7;
  background: #f7f9fd;
}

.courier-details-panel {
  overflow: hidden;
  border: 1px solid #d8e0ec;
  border-radius: 4px;
  background: #fff;
}

.courier-details-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  table-layout: fixed;
}

.courier-details-table .is-date { width: 90px; }
.courier-details-table .is-amount { width: 100px; }
.courier-details-table .is-source { width: 125px; }
.courier-details-table .is-action { width: 170px; }

.courier-details-table th {
  height: 25px;
  padding: 3px 6px;
  border-bottom: 1px solid #dfe5ef;
  background: #eef2f8;
  color: #69758a;
  font-size: 8.5px;
  letter-spacing: .035em;
  text-align: left;
  text-transform: uppercase;
}

.courier-details-table td {
  height: 28px;
  padding: 2px 6px;
  border-bottom: 1px solid #e7ebf2;
  font-size: 9.5px;
}

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

.courier-details-table .amount {
  text-align: right;
}

.courier-date-cell {
  color: #657187;
  font-variant-numeric: tabular-nums;
}

.courier-name-cell strong {
  color: #17233b;
  font-size: 10px;
}

.courier-amount-cell strong {
  color: #17233b;
  font-size: 10.5px;
}

.courier-name-edit {
  width: 135px;
  min-width: 120px;
  height: 24px;
}

.courier-name-edit-wrap {
  display: inline-block;
  margin-right: 5px;
  vertical-align: middle;
}

.courier-source-badge {
  display: inline-flex;
  max-width: 100%;
  padding: 2px 5px;
  overflow: hidden;
  border: 1px solid #d2dae8;
  border-radius: 999px;
  background: #f3f5f9;
  color: #5b687d;
  font-size: 8.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.courier-source-badge.is-cash_closing {
  border-color: #b9d9c8;
  background: #eaf7ef;
  color: #23704a;
}

.courier-source-badge.is-import {
  border-color: #e0d3b0;
  background: #faf5e8;
  color: #82641b;
}

.courier-source-badge.is-manual {
  border-color: #c9d4ef;
  background: #edf2ff;
  color: #36589c;
}

.courier-comment {
  display: block;
  overflow: hidden;
  color: #69758a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.courier-row-actions {
  white-space: nowrap;
}

.courier-row-actions .link-button {
  padding: 2px 3px;
  font-size: 9px;
}

.courier-row-actions .link-button + .link-button {
  margin-left: 4px;
}

.courier-total-row td {
  height: 29px;
  border-bottom: 2px solid #bbc7dc;
  background: #f8fafc;
  color: #25344d;
  font-weight: 700;
}

.payroll-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.payroll-detail-summary > div,
.payslip-grid > div {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
}

.payroll-detail-summary span,
.payslip-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.payroll-detail-summary strong,
.payslip-grid strong {
  display: block;
  margin-top: 3px;
}

.payroll-detail-controls {
  margin: 0 0 20px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.payroll-shift-row {
  grid-template-columns:
    34px minmax(180px, 1.3fr) minmax(155px, .9fr) minmax(155px, .9fr)
    repeat(3, minmax(92px, .6fr)) minmax(120px, .7fr) minmax(170px, 1fr) 105px;
}

.payroll-shift-total small {
  display: block;
  margin-top: 4px;
  color: #a35d16;
  font-size: 11px;
}

.shortage-allocation-rows {
  display: grid;
  gap: 10px;
}

.shortage-allocation-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px 36px;
  gap: 8px;
  align-items: end;
}

.payroll-print-area {
  display: none;
}

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

.print-signature {
  margin-top: 42px;
}

@media (max-width: 1100px) {
  .payroll-view-toolbar {
    align-items: flex-start;
  }

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

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

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

@media (max-width: 760px) {
  .payroll-view-toolbar {
    flex-direction: column;
  }

  .payroll-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .payroll-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .payroll-register-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .courier-payment-form,
  .payroll-detail-summary,
  .payslip-grid {
    grid-template-columns: 1fr;
  }

  .courier-register-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .courier-register-toolbar {
    grid-template-columns: 1fr;
  }

  .courier-register-meta {
    text-align: left;
  }

  .shortage-allocation-row {
    grid-template-columns: 1fr 110px 36px;
  }
}

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

  body[data-payroll-print="true"] * {
    visibility: hidden !important;
  }

  body[data-payroll-print="true"] #payrollPrintArea,
  body[data-payroll-print="true"] #payrollPrintArea * {
    visibility: visible !important;
  }

  body[data-payroll-print="true"] #payrollPrintArea {
    display: block !important;
    position: absolute;
    inset: 0;
    width: 100%;
    padding: 0;
    color: #111;
    background: #fff;
  }

  body[data-payroll-print="true"] #payrollPrintArea h1 {
    margin: 0 0 6px;
    font-size: 20px;
  }

  body[data-payroll-print="true"] #payrollPrintArea > p {
    margin: 0 0 18px;
  }

  body[data-payroll-print="true"] #payrollPrintArea table {
    width: 100%;
    border-collapse: collapse;
  }

  body[data-payroll-print="true"] #payrollPrintArea th,
  body[data-payroll-print="true"] #payrollPrintArea td {
    height: 34px;
    padding: 6px;
    border: 1px solid #111;
    text-align: left;
  }

  body[data-payroll-print-mode="payslips"] #payrollPrintArea {
    font-family: Arial, sans-serif;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-list {
    display: block;
    width: 100%;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-card {
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    width: 100%;
    height: 49mm;
    margin: 0 0 2mm;
    padding: 2.2mm 2.8mm;
    overflow: hidden;
    border: .35mm solid #111;
    color: #111;
    background: #fff;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-card:nth-child(5n) {
    margin-bottom: 0;
    break-after: page;
    page-break-after: always;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4mm;
    padding-bottom: 1.2mm;
    border-bottom: .25mm solid #111;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-header > div {
    display: flex;
    align-items: baseline;
    gap: 2.4mm;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-header strong {
    font-size: 8.5pt;
    line-height: 1;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-header span {
    font-size: 6.5pt;
    line-height: 1;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-period {
    justify-content: flex-end;
    white-space: nowrap;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-employee {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 2mm;
    align-items: baseline;
    padding: 1.2mm 0;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-employee span,
  body[data-payroll-print-mode="payslips"] .payroll-payslip-employee small {
    color: #444;
    font-size: 6.3pt;
    white-space: nowrap;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-employee strong {
    overflow: hidden;
    font-size: 8.5pt;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-self: stretch;
    border-top: .25mm solid #111;
    border-left: .25mm solid #111;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-metrics > div {
    box-sizing: border-box;
    min-width: 0;
    padding: 1mm 1.2mm;
    border-right: .25mm solid #111;
    border-bottom: .25mm solid #111;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-metrics span {
    display: block;
    overflow: hidden;
    color: #444;
    font-size: 5.8pt;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-metrics strong {
    display: block;
    margin-top: .8mm;
    overflow: hidden;
    font-size: 7.6pt;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-footer {
    display: grid;
    grid-template-columns: 45mm minmax(0, 1fr);
    gap: 4mm;
    align-items: end;
    padding-top: 1.3mm;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-footer > div:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2mm;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-footer span {
    font-size: 6.5pt;
    font-weight: 700;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-footer strong {
    font-size: 10pt;
    line-height: 1;
  }

  body[data-payroll-print-mode="payslips"] .payroll-payslip-signature {
    text-align: right;
    font-size: 6.5pt;
    white-space: nowrap;
  }

  body[data-payroll-print-mode="salary"] #payrollPrintArea {
    font-family: Arial, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5mm;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-card {
    box-sizing: border-box;
    display: grid;
    grid-template-rows: 10mm 12mm 38mm 1fr;
    width: 100%;
    height: 92mm;
    padding: 3mm;
    overflow: hidden;
    border: .45mm solid #080b10;
    color: #111;
    background: #fff;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-card:nth-child(3n):not(:last-child) {
    break-after: page;
    page-break-after: always;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-header {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    border-bottom: .35mm solid #111;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-header h2 {
    margin: .7mm 0 0;
    font-size: 9.5pt;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-header > div {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
    gap: .5mm;
    font-size: 7.4pt;
    font-weight: 700;
    line-height: 1;
    text-align: right;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-employee {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1mm;
    text-align: center;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-employee span {
    font-size: 7.8pt;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-employee strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 13.5pt;
    font-weight: 900;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    border-top: .35mm solid #1f2937;
    border-left: .35mm solid #1f2937;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-metrics > div {
    box-sizing: border-box;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2mm;
    padding: 1.5mm;
    border-right: .35mm solid #1f2937;
    border-bottom: .35mm solid #1f2937;
    text-align: center;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-metrics span {
    font-size: 8pt;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-metrics strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 13pt;
    font-weight: 900;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-card footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 0;
    margin-top: 2.5mm;
    border: .35mm solid #1f2937;
    background: #edf0f4;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-total {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1.8mm;
    padding: 2.5mm 4mm;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-total span {
    font-size: 9pt;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-total strong {
    font-size: 18pt;
    font-weight: 900;
    line-height: 1;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-signature {
    display: flex;
    align-items: flex-end;
    gap: 2mm;
    padding: 0 4mm 3mm 2mm;
    font-size: 9pt;
    font-weight: 800;
    line-height: 1;
  }

  body[data-payroll-print-mode="salary"] .payroll-salary-statement-signature i {
    min-width: 0;
    flex: 1;
    border-bottom: .4mm solid #111;
  }
}
