:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #6c6f75;
  --line: #dedbd2;
  --green: #157f57;
  --red: #bd4634;
  --blue: #2f6f9f;
  --gold: #b6842d;
  --sidebar: #252a2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.impersonation-banner {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: #fff5d6;
  border-bottom: 1px solid #e5c973;
  color: var(--ink);
  font-size: 14px;
}

.environment-banner {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  padding: 10px 18px;
  background: #eaf2ff;
  border-bottom: 1px solid #8ab4f8;
  color: #174ea6;
  font-size: 14px;
  font-weight: 750;
}

body.has-environment-banner .sidebar {
  top: 40px;
  height: calc(100vh - 40px);
}

body.has-environment-banner .page {
  padding-top: 68px;
}

body.auth-page.has-environment-banner {
  padding-top: 64px;
}

.impersonation-banner button {
  height: 30px;
}

body.auth-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04);
}

.auth-brand {
  padding: 0;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.auth-hint {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

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

.toast {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  gap: 8px;
  align-items: start;
  padding: 12px 34px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(20, 20, 20, 0.12);
  font-size: 13px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 999px;
  background: #eef4f0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.toast-message {
  overflow-wrap: anywhere;
}

.toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.toast-clear {
  justify-self: end;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(20, 20, 20, 0.12);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: rgba(21, 127, 87, 0.35);
}

.toast-error {
  border-color: rgba(189, 70, 52, 0.45);
  background: #fff7f4;
  color: #7c2d21;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(189, 70, 52, 0.14);
}

.toast-error .toast-close {
  color: #7c2d21;
}

.toast-error .toast-icon {
  background: #bd4634;
  color: #ffffff;
}

.toast-loading {
  border-color: rgba(47, 111, 159, 0.35);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(36, 39, 42, 0.28);
  opacity: 0;
  transition: opacity 160ms ease;
}

.modal-backdrop.show {
  opacity: 1;
}

.confirm-dialog {
  position: relative;
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  box-shadow: 0 22px 60px rgba(20, 20, 20, 0.22);
}

.confirm-dialog h2 {
  margin: 0;
  padding-right: 28px;
  font-size: 18px;
}

.confirm-dialog p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

button.danger {
  background: #9f3a2b;
  color: #ffffff;
}

.sidebar {
  height: 100vh;
  padding: 22px 16px;
  background: var(--sidebar);
  color: #f7f3ea;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 24px;
}

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f0c36a;
  color: #242424;
  font-weight: 800;
}

.brand-name {
  font-weight: 750;
  line-height: 1.1;
}

.brand-subtitle {
  margin-top: 3px;
  color: #b9c0c5;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 4px;
  overflow-y: auto;
  padding-bottom: 14px;
}

.nav-item {
  color: #cdd2d5;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.nav-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

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

.nav-subitem {
  margin-left: 18px;
  padding: 8px 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  color: #cdd2d5;
  font-size: 13px;
  text-decoration: none;
}

.nav-subitem.active,
.nav-subitem:hover {
  color: #ffffff;
}

.account-panel {
  margin-top: auto;
  padding: 14px 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
}

.account-name {
  color: #ffffff;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.account-email,
.account-role,
.account-impersonation {
  margin-top: 3px;
  color: #b9c0c5;
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.account-impersonation {
  color: #f0c36a;
  font-weight: 650;
}

.account-logout {
  width: 100%;
  height: 34px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.account-logout:hover {
  background: rgba(255, 255, 255, 0.14);
}

.page {
  padding: 28px;
  display: grid;
  align-content: start;
  gap: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

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

.topbar p,
.panel p,
.kpi small {
  color: var(--muted);
}

.topbar p {
  margin-top: 8px;
}

.status {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions select {
  min-width: 230px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.inline-field {
  min-width: 220px;
}

select {
  min-width: 180px;
  height: 36px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

input,
textarea,
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
}

input,
button {
  height: 36px;
}

input {
  width: 100%;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  background: #ffffff;
  color: var(--ink);
  resize: vertical;
}

input[type="color"] {
  padding: 4px;
}

button {
  padding: 0 12px;
  background: var(--sidebar);
  color: #ffffff;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  filter: grayscale(0.25);
}

.status.is-working .dot {
  animation: status-dot-pulse 0.9s ease-in-out infinite;
}

@keyframes status-dot-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(21, 127, 87, 0.42);
    opacity: 1;
  }

  50% {
    box-shadow: 0 0 0 7px rgba(21, 127, 87, 0);
    opacity: 0.45;
  }
}

button.secondary {
  background: #ffffff;
  color: var(--ink);
}

.small-button {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.button-link.secondary {
  background: #ffffff;
  color: var(--ink);
}

.icon-button {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

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

.distribution-kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 320px));
  justify-content: start;
}

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

.kpi,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04);
}

.kpi {
  min-height: 128px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  gap: 16px;
}

.distribution-kpi {
  min-height: 86px;
  padding: 12px 14px;
  gap: 8px;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.kpi strong {
  font-size: 27px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.distribution-kpi strong {
  font-size: 26px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.content-grid.single-panel {
  grid-template-columns: minmax(0, 1fr);
}

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

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

.panel-wide {
  min-height: 350px;
}

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

.panel-head p {
  margin-top: 5px;
  font-size: 13px;
}

canvas {
  width: 100%;
  max-width: 100%;
}

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

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

.work-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-decoration: none;
}

.work-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.work-row span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.work-row strong {
  overflow-wrap: anywhere;
}

.work-row.work-review {
  border-color: rgba(189, 70, 52, 0.28);
  background: #fffaf7;
}

.work-row.work-ok {
  border-color: rgba(21, 127, 87, 0.24);
  background: #fbfefb;
}

.finance-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.finance-strip div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #fffdf8;
}

.finance-strip div:last-child {
  border-right: 0;
}

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

.finance-strip strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.field-invalid {
  border-color: rgba(189, 70, 52, 0.75) !important;
}

label.field-invalid,
.file-drop.field-invalid,
.preview-correction.field-invalid,
.ocr-preview-list.field-invalid {
  padding: 8px;
  border: 1px solid rgba(189, 70, 52, 0.65);
  border-radius: 8px;
  background: #fff4f1;
  color: #8d3727;
}

input.field-invalid,
select.field-invalid,
textarea.field-invalid {
  background: #fff9f7;
  box-shadow: 0 0 0 3px rgba(189, 70, 52, 0.14);
}

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

.comment-details,
.closing-comment-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.comment-details {
  padding: 10px;
}

.comment-details summary,
.closing-comment-details summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.comment-details label {
  margin-top: 10px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.tooltip {
  position: relative;
  display: inline-flex;
}

.help-button {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tooltip-panel {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 5;
  width: min(320px, 72vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.tooltip:hover .tooltip-panel,
.tooltip:focus-within .tooltip-panel {
  opacity: 1;
  transform: translateX(-50%);
}

.filters-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.filters-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.filters-actions {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  align-self: end;
}

.quick-date-group {
  grid-column: 2 / -1;
  display: block;
  margin-top: -2px;
}

.top-actions .quick-date-group {
  flex-basis: 100%;
  margin-top: 0;
}

.top-actions .receipts-quick-dates {
  order: 10;
}

.receipts-review-filters {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(190px, 0.7fr) minmax(190px, 0.7fr) auto;
  grid-template-areas:
    "salon date-from date-to refresh"
    ". quick quick .";
  gap: 8px 14px;
  align-items: end;
  justify-content: stretch;
}

.receipts-review-filters #filterSalonField {
  grid-area: salon;
}

.receipts-review-filters label:nth-of-type(2) {
  grid-area: date-from;
}

.receipts-review-filters label:nth-of-type(3) {
  grid-area: date-to;
}

.receipts-review-filters .field,
.receipts-review-filters select {
  width: 100%;
}

.receipts-review-filters .receipts-quick-dates {
  grid-area: quick;
  order: initial;
  flex-basis: auto;
  align-self: start;
  padding-top: 2px;
}

.receipts-review-filters #refreshClosings {
  grid-area: refresh;
  align-self: end;
  min-width: 118px;
}

.quick-date-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-date-button {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.quick-date-button.active {
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.info-strip div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.info-strip strong {
  font-size: 13px;
}

.info-strip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.info-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.checklist {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.checklist div {
  padding-left: 14px;
  border-left: 3px solid var(--line);
}

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

.rules-panel {
  max-width: 1180px;
}

.category-group {
  display: grid;
  gap: 0;
}

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

.category-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f3efe7;
}

.category-group-head h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.category-group-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.category-tree {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.checkbox-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.form-grid .checkbox-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  text-transform: none;
}

.form-grid .checkbox-row input {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
}

.checkbox-row span {
  overflow-wrap: anywhere;
}

.crud-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.category-row {
  min-height: 42px;
  padding: 6px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
}

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

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

.crud-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.crud-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.category-row .crud-title {
  font-size: 13px;
}

.category-row .crud-meta {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.2;
}

.category-row .crud-actions button,
.category-row .crud-actions .quick-link {
  min-height: 28px;
  height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

.rule-group + .rule-group {
  margin-top: 8px;
}

.rule-group-head {
  padding: 7px 10px;
}

.rule-tree {
  background: #ffffff;
}

.rule-row {
  min-height: 48px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
}

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

.rule-row:hover {
  background: #fbfaf7;
}

.rule-title {
  gap: 10px;
  font-size: 13px;
  background: transparent;
}

.rule-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.rule-meta {
  margin-top: 2px;
  font-size: 12px;
}

.rule-conditions {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.rule-row .crud-actions button,
.rule-row .crud-actions .quick-link {
  min-height: 28px;
  height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

.distribution-rule-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.distribution-rule-row.is-editing {
  align-items: start;
  background: #fbfaf7;
}

.distribution-rule-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.distribution-rule-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.distribution-rule-active {
  align-content: end;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 11px;
}

.distribution-rule-lines {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 10px;
}

.distribution-rule-edit-actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

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

.crud-actions button,
.crud-actions .button-link {
  height: 30px;
}

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

.closing-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.closing-card.needs-attention {
  border-color: rgba(189, 70, 52, 0.34);
}

.closing-card.is-verified {
  background: #f8f8f5;
  border-color: rgba(47, 52, 55, 0.12);
}

.closing-card.is-verified .closing-summary-item {
  background: #fbfbf8;
}

.closing-card.is-verified .closing-status-badge {
  color: #2f6f4e;
  border-color: rgba(21, 127, 87, 0.28);
  background: #f1f8f3;
}

.closing-card.is-open {
  box-shadow: inset 3px 0 0 rgba(189, 70, 52, 0.22);
}

.closing-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.closing-card-side {
  display: flex;
  align-items: center;
  justify-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.closing-card-side span {
  color: var(--muted);
  font-size: 12px;
}

.closing-card-side strong {
  font-size: 16px;
  white-space: nowrap;
}

.closing-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.closing-card h3 {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.closing-card h3 small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.closing-card p,
.closing-comment {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.closing-card p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.closing-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
}

.closing-comment {
  white-space: pre-wrap;
}

.closing-comment-details {
  padding: 9px 10px;
}

.closing-comment-details .closing-comment {
  margin-top: 8px;
}

.closing-review-hint {
  padding: 8px 10px;
  border: 1px solid rgba(189, 70, 52, 0.28);
  border-radius: 8px;
  background: #fff8f3;
  color: #7a3328;
  font-size: 13px;
  line-height: 1.35;
}

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

.closing-summary-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.closing-summary-item strong {
  font-size: 14px;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.check-ok {
  border-color: rgba(21, 127, 87, 0.35);
}

.check-review {
  border-color: rgba(189, 70, 52, 0.4);
}

.closing-summary-item.check-review strong {
  color: #9f3a2b;
}

.day-closing-content {
  display: grid;
  gap: 12px;
}

.day-closing-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.day-closing-metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  background: #fffdf8;
}

.day-closing-metric:last-child {
  border-right: 0;
}

.day-closing-metric span,
.day-closing-check span {
  color: var(--muted);
  font-size: 12px;
}

.day-closing-metric strong,
.day-closing-check strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.day-closing-checks {
  display: grid;
  gap: 6px;
}

.day-closing-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.day-closing-check em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.day-closing-files {
  display: grid;
  border-top: 1px solid var(--line);
}

.day-closing-file-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) minmax(150px, 1fr) repeat(3, minmax(82px, 0.55fr)) minmax(100px, 0.75fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.day-closing-file-row span:first-child {
  color: var(--ink);
  font-weight: 700;
}

.metric-ok {
  box-shadow: inset 0 3px 0 rgba(21, 127, 87, 0.35);
}

.metric-review {
  box-shadow: inset 0 3px 0 rgba(189, 70, 52, 0.4);
}

.closing-files {
  display: grid;
  gap: 0;
}

.closing-files-details {
  padding-top: 2px;
  border-top: 1px solid var(--line);
}

.closing-files-details summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.closing-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}

.closing-file-row > div:first-child > strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.closing-file-row .mini-note {
  margin-top: 4px;
}

.ocr-correction-details {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ocr-correction-details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

.ocr-correction-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 118px)) auto;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
  max-width: 560px;
}

.ocr-correction-form label {
  display: grid;
  gap: 3px;
}

.ocr-correction-form span {
  color: var(--muted);
  font-size: 11px;
}

.ocr-correction-form input {
  height: 30px;
  padding: 5px 8px;
  font-size: 13px;
}

.preview-correction {
  grid-template-columns: repeat(3, minmax(110px, 150px));
  max-width: 520px;
  margin-top: 10px;
}

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

.ocr-preview-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.ocr-preview-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.ocr-preview-main {
  display: grid;
  gap: 10px;
}

.ocr-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.ocr-preview-head strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ocr-preview-head span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.animated-ellipsis::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
  animation: ellipsis-blink 1.1s steps(4, end) infinite;
}

@keyframes ellipsis-blink {
  0% {
    width: 0;
  }

  100% {
    width: 1.2em;
  }
}

.preview-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
}

.preview-amounts div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.preview-amounts strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.preview-alert,
.preview-ok {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.35;
}

.preview-alert {
  border: 1px solid #e0a092;
  background: #fff4f1;
  color: #8d3727;
  font-weight: 700;
}

.preview-ok {
  border: 1px solid #afd3bf;
  background: #f2fbf5;
  color: #277243;
}

.ocr-preview-row.is-loading {
  color: var(--muted);
  font-size: 13px;
}

.ocr-details {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.ocr-details summary,
.ocr-metrics summary,
.ocr-text-details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

.technical-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 6px;
  font-size: 12px;
}

.technical-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.ocr-metrics {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ocr-metric-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 72px 46px minmax(110px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-top: 1px solid var(--line);
}

.ocr-metric-row strong {
  color: var(--ink);
}

.ocr-details pre {
  max-height: 220px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.altegio-table {
  min-width: 1320px;
}

.altegio-table .detail-toggle-col {
  width: 44px;
  min-width: 44px;
  padding-right: 4px;
  text-align: center;
}

.altegio-table th,
.altegio-table td {
  padding: 12px 14px;
}

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

.altegio-table th:nth-child(2),
.altegio-table td:nth-child(2),
.altegio-table th:nth-child(3),
.altegio-table td:nth-child(3) {
  width: 112px;
  white-space: nowrap;
}

.altegio-table th:nth-child(4),
.altegio-table td:nth-child(4) {
  width: 112px;
  white-space: nowrap;
}

.altegio-table .amount-col {
  width: 150px;
  white-space: nowrap;
}

.altegio-table th.amount-col {
  white-space: normal;
}

.imports-table {
  min-width: 860px;
}

.imports-table th,
.imports-table td {
  padding: 12px 14px;
}

.imports-table th:nth-child(1),
.imports-table td:nth-child(1) {
  width: auto;
}

.imports-table th:nth-child(2),
.imports-table td:nth-child(2) {
  width: 130px;
}

.imports-table .amount-col {
  width: 128px;
}

.imports-table td:first-child strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.imports-table td:nth-child(2) {
  white-space: nowrap;
}

.upload-box {
  display: grid;
  gap: 12px;
}

.import-upload-panel .upload-box {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.file-drop {
  min-height: 140px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  cursor: pointer;
  text-align: center;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-drop span {
  font-weight: 750;
}

.file-drop small {
  max-width: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.distribution-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.distribution-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.distribution-title {
  max-width: 100%;
  overflow-wrap: anywhere;
  background: transparent;
  font-size: 14px;
}

.distribution-amount {
  display: grid;
  gap: 2px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.distribution-amount span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

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

.allocation-entry-row {
  align-items: center;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  gap: 12px;
}

.allocation-line {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(0, 120px) 36px;
  gap: 8px;
}

.allocation-line span,
.allocation-line small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.allocation-line small {
  text-align: left;
}

.allocation-line input {
  height: 38px;
}

.allocation-quick-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.allocation-quick-actions span {
  font-weight: 700;
  text-transform: uppercase;
}

.allocation-tools {
  display: grid;
  grid-template-columns: minmax(170px, 210px) minmax(240px, 1fr);
  gap: 8px;
  align-items: end;
}

.allocation-tools select,
.allocation-tools input {
  height: 38px;
}

.distribution-actions {
  margin-top: 0;
}

.auto-rule-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.rule-hint {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

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

.rule-fields div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.rule-fields span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.rule-fields strong {
  min-width: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.rule-variants-field {
  grid-column: 1 / -1;
}

.rule-variants-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rule-variants-help {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.rule-variants-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.rule-variant-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.rule-variant-row label {
  min-width: 0;
}

.auto-rule-box[hidden] {
  display: none;
}

.allocation-tools label,
.auto-rule-box label,
.allocation-grid label:not(.allocation-line) {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.rule-toggle,
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.rule-toggle input,
.checkbox-field input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.checkbox-field {
  align-self: end;
  min-height: 36px;
  text-transform: none;
}

.quick-links {
  display: grid;
  gap: 8px;
}

.quick-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfaf7;
  text-decoration: none;
  font-size: 14px;
}

.compact-link {
  min-height: 32px;
  white-space: nowrap;
}

.quick-link:hover {
  border-color: #bfc4c7;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 16px 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.preview-head span {
  color: var(--muted);
  font-weight: 700;
}

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

.rank-row {
  display: grid;
  gap: 6px;
}

.rank-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.rank-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.rank-note {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.rank-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.rank-footer a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.uncategorized-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

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

.fill {
  height: 100%;
  border-radius: inherit;
}

.fill.outflow {
  background: var(--red);
}

.fill.inflow {
  background: var(--green);
}

.table-wrap {
  overflow: auto;
}

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

.operations-table {
  min-width: 1180px;
}

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

.operations-table th:nth-child(2),
.operations-table td:nth-child(2) {
  width: 210px;
}

.operations-table th:nth-child(4),
.operations-table td:nth-child(4) {
  width: 190px;
}

.operations-table th:nth-child(5),
.operations-table td:nth-child(5) {
  width: 180px;
}

.operations-table th:nth-child(7),
.operations-table td:nth-child(7) {
  width: 190px;
}

.table-select {
  width: 100%;
  min-width: 0;
  height: 32px;
  font-size: 12px;
}

.row-actions {
  display: grid;
  gap: 4px;
}

.row-actions a {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.mini-note {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.load-more-marker {
  min-height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.detail-row td,
.panel-detail {
  background: #fbfaf7;
}

.panel-detail {
  margin-top: -6px;
  padding: 10px 0;
}

.detail-row > td {
  padding: 8px 16px 14px;
}

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

.detail-section {
  max-height: 360px;
  overflow: auto;
}

.detail-section h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.detail-table th,
.detail-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(221, 216, 205, 0.75);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.detail-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  text-align: left;
}

.detail-table .amount-col {
  white-space: nowrap;
}

.day-detail-table {
  min-width: 860px;
}

.detail-empty {
  padding: 6px 0;
}

.discrepancy-row {
  align-items: start;
}

.discrepancy-actions {
  display: grid;
  grid-template-columns: minmax(140px, 180px) auto;
  gap: 8px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.25;
}

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

tbody tr:hover {
  background: #f3efe7;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

th:nth-child(1),
td:nth-child(1) {
  width: 116px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 190px;
}

.amount-col {
  width: 150px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.amount-positive {
  color: var(--green);
  font-weight: 750;
}

.amount-negative {
  color: var(--red);
  font-weight: 750;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ksef-table-wrap {
  overflow-x: auto;
}

.ksef-table {
  width: 100%;
  min-width: 1080px;
  table-layout: fixed;
}

.ksef-table th,
.ksef-table td {
  padding: 14px 16px;
}

.ksef-table th:nth-child(1),
.ksef-table td:nth-child(1) {
  width: 24%;
}

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

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

.ksef-table th:nth-child(4),
.ksef-table td:nth-child(4) {
  width: 150px;
}

.ksef-table th:nth-child(5),
.ksef-table td:nth-child(5) {
  width: 148px;
}

.ksef-table th:nth-child(6),
.ksef-table td:nth-child(6) {
  width: 130px;
}

.ksef-table th:nth-child(7),
.ksef-table td:nth-child(7) {
  width: 82px;
}

.ksef-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 150px 170px;
  gap: 10px;
  align-items: end;
}

.ksef-invoice-cell strong,
.ksef-seller-cell strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.ksef-invoice-cell strong {
  white-space: nowrap;
}

.ksef-seller-cell strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.ksef-number {
  max-width: 280px;
  margin-top: 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ksef-date-cell {
  white-space: nowrap;
}

.ksef-amount-cell {
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.ksef-docs-cell {
  white-space: nowrap;
}

.ksef-doc-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin-right: 6px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.ksef-doc-badge.is-present {
  border-color: rgba(21, 127, 87, 0.28);
  background: #eef7f2;
  color: var(--green);
}

.ksef-doc-badge.is-missing {
  border-color: rgba(189, 70, 52, 0.24);
  background: #fff4f1;
  color: var(--red);
}

.ksef-payment-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.ksef-payment-badge.is-paid {
  border-color: rgba(21, 127, 87, 0.28);
  background: #eef7f2;
  color: var(--green);
}

.ksef-payment-badge.is-partial {
  border-color: rgba(182, 132, 45, 0.32);
  background: #fff9e8;
  color: #8a641d;
}

.ksef-payment-badge.is-unpaid {
  border-color: rgba(189, 70, 52, 0.24);
  background: #fff4f1;
  color: var(--red);
}

.ksef-action-cell {
  text-align: right;
  white-space: nowrap;
}

.ksef-action-cell button + button {
  margin-left: 6px;
}

.ksef-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.ksef-detail-dialog {
  width: min(920px, 100%);
}

.ksef-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.ksef-detail-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.ksef-detail-grid span,
.ksef-match-row span,
.ksef-match-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ksef-detail-grid strong,
.ksef-match-row strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.3;
}

.ksef-detail-subtitle {
  margin-top: 18px;
}

.ksef-match-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  margin-top: 10px;
  overflow: auto;
}

.ksef-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.ksef-match-row > div:last-child {
  text-align: right;
}

@media (max-width: 1080px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    overflow-y: visible;
  }

  .account-panel {
    margin-top: 14px;
    padding: 14px 6px 0;
  }

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

  .top-actions {
    justify-content: flex-start;
  }

  .content-grid,
  .kpi-grid,
  .day-summary-grid,
  .day-closing-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .day-closing-metric:nth-child(even) {
    border-right: 0;
  }

  .day-closing-file-row {
    grid-template-columns: minmax(0, 1.4fr) minmax(120px, 1fr) repeat(3, minmax(70px, 0.5fr)) minmax(90px, 0.7fr) auto;
  }

  .closing-card-head,
  .closing-file-row {
    grid-template-columns: 1fr;
  }

  .closing-card-side {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 680px) {
  .page {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
  }

  .receipts-review-filters,
  .receipts-review-filters .receipts-quick-dates {
    grid-template-columns: 1fr;
    grid-template-areas: none;
    grid-column: 1;
  }

  .receipts-review-filters #filterSalonField,
  .receipts-review-filters label:nth-of-type(2),
  .receipts-review-filters label:nth-of-type(3),
  .receipts-review-filters .receipts-quick-dates,
  .receipts-review-filters #refreshClosings {
    grid-area: auto;
  }

  .field,
  select,
  .status {
    width: 100%;
  }

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

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

  .ocr-preview-head {
    display: grid;
  }

  .ocr-preview-head span {
    white-space: normal;
  }

  .preview-amounts {
    grid-template-columns: 1fr;
  }

  .nav,
  .filters-grid,
  .info-strip,
  .discrepancy-actions,
  .allocation-tools,
  .auto-rule-box,
  .rule-fields,
  .rule-variant-row,
  .distribution-rule-form,
  .distribution-rule-lines,
  .allocation-entry-row,
  .import-upload-panel .upload-box,
  .allocation-grid,
  .distribution-head,
  .content-grid,
  .kpi-grid,
  .day-summary-grid,
  .day-closing-summary,
  .finance-strip,
  .day-closing-file-row,
  .closing-summary {
    grid-template-columns: 1fr;
  }

  .finance-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .finance-strip div:last-child {
    border-bottom: 0;
  }

  .closing-card {
    padding: 12px;
  }

  .closing-card-side,
  .closing-actions,
  .crud-actions {
    justify-content: flex-start;
  }

  .day-closing-metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .day-closing-metric:last-child {
    border-bottom: 0;
  }

  .distribution-amount {
    text-align: left;
  }

  .quick-date-group {
    grid-column: 1 / -1;
  }

  h1 {
    font-size: 25px;
  }
}
