:root {
  --sidebar-bg: #142033;
  --sidebar-bg-soft: #1b2a42;
  --sidebar-text: #dce5f4;
  --sidebar-muted: #8ea0bb;
  --accent: #2aa39a;
  --accent-dark: #16887f;
  --canvas: #f4f6f9;
  --panel: #ffffff;
  --line: #e3e8ef;
  --line-strong: #cad3df;
  --text: #182233;
  --muted: #667085;
  --warning-bg: #fff3d6;
  --warning-text: #8a5a00;
  --success-bg: #dff6ef;
  --success-text: #16724f;
  --shadow: 0 18px 45px rgba(20, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px 76px;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0f1828 100%);
  color: var(--sidebar-text);
}

.brand {
  display: inline-flex;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 74px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #ffffff;
  color: var(--sidebar-bg);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.user-label {
  display: block;
  margin-bottom: 2px;
  color: var(--sidebar-muted);
  font-size: 11px;
}

.user-panel strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.logout-form {
  position: absolute;
  right: 18px;
  bottom: 22px;
  left: 18px;
}

.logout-form button {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: transparent;
  color: var(--sidebar-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.logout-form button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
}

.main-nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-weight: 600;
}

.nav-link.active {
  background: #ffffff;
  color: var(--sidebar-bg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.16);
}

.nav-link.disabled {
  cursor: default;
  opacity: 0.58;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: currentColor;
  font-size: 10px;
  font-weight: 800;
}

.nav-link.active .nav-icon {
  background: var(--accent);
  color: #fff;
}

.content {
  min-width: 0;
  padding: 30px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(42, 163, 154, 0.14), rgba(219, 39, 119, 0.08)),
    var(--canvas);
}

.auth-content {
  width: min(440px, calc(100vw - 32px));
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 26px;
}

.auth-brand {
  margin-bottom: 22px;
}

.auth-heading {
  margin-bottom: 20px;
}

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

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 0 13px;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 163, 154, 0.14);
}

.auth-form button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

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

.auth-error,
.auth-alert,
.auth-note,
.auth-help {
  margin: 0 0 16px;
  border-radius: 7px;
  padding: 10px 12px;
  line-height: 1.4;
}

.auth-error {
  background: #ffe1df;
  color: #a61616;
  font-weight: 700;
}

.auth-alert,
.auth-note {
  background: #fff3d6;
  color: #8a5a00;
  font-weight: 700;
}

.auth-help {
  background: #eef7f6;
  color: #315f5b;
}

.auth-link {
  display: inline-flex;
  margin-top: 16px;
  color: var(--accent-dark);
  font-weight: 800;
}

.reference-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.reference-panel span,
.reference-panel small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reference-panel strong {
  display: inline-grid;
  width: max-content;
  min-width: 92px;
  min-height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--reference-color);
  color: #ffffff;
  font-size: 24px;
  letter-spacing: 3px;
}

.otp-input {
  font-size: 22px !important;
  font-weight: 800 !important;
  letter-spacing: 5px;
  text-align: center;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-kicker {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 760;
  letter-spacing: 0;
}

.omnibox {
  display: grid;
  width: min(410px, 100%);
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.omnibox input,
.filters-row input,
.filters-row select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}

.omnibox input {
  height: 42px;
  padding: 0 14px;
  box-shadow: 0 8px 22px rgba(20, 32, 51, 0.06);
}

.omnibox input:focus,
.filters-row input:focus,
.filters-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 163, 154, 0.14);
}

.period-picker {
  display: grid;
  width: min(240px, 100%);
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.period-picker select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 0 12px;
  box-shadow: 0 8px 22px rgba(20, 32, 51, 0.06);
}

.period-picker select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 163, 154, 0.14);
}

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

.table-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.table-summary > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.table-summary strong {
  color: var(--text);
  font-size: 20px;
}

.reset-filters {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 0 12px;
}

.reset-filters:hover {
  background: #eef7f6;
  border-color: var(--accent);
}

.table-wrap {
  padding: 0 18px 18px;
}

table.dataTable.invoice-table {
  table-layout: fixed;
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
}

.dt-container {
  position: relative;
}

.dt-scroll {
  overflow: visible !important;
}

.dt-scroll-head {
  position: relative;
  z-index: 30;
  overflow: visible !important;
}

.dt-scroll-headInner {
  overflow: visible !important;
}

.dt-scroll-body {
  position: relative;
  z-index: 1;
}

.invoice-table thead th {
  border-bottom: 1px solid var(--line-strong);
  color: #465468;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-table tbody td {
  border-bottom: 1px solid var(--line);
  color: #263244;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

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

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

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

.invoice-table th:nth-child(4),
.invoice-table td:nth-child(4) {
  width: 7%;
  text-align: center !important;
}

.invoice-table th:nth-child(5),
.invoice-table td:nth-child(5) {
  width: 9%;
  text-align: center !important;
}

.invoice-table th:nth-child(6),
.invoice-table td:nth-child(6) {
  width: 6%;
  text-align: center !important;
}

.invoice-table th:nth-child(7),
.invoice-table td:nth-child(7),
.invoice-table th:nth-child(8),
.invoice-table td:nth-child(8),
.invoice-table th:nth-child(9),
.invoice-table td:nth-child(9) {
  width: 8%;
  text-align: center !important;
}

.invoice-table th:nth-child(10),
.invoice-table td:nth-child(10),
.invoice-table th:nth-child(11),
.invoice-table td:nth-child(11) {
  width: 7%;
  text-align: right !important;
}

.invoice-table th:nth-child(12),
.invoice-table td:nth-child(12) {
  width: 9%;
}

.invoice-table tbody tr:hover td {
  background: #f8fbfc;
}

.invoice-row {
  cursor: pointer;
}

.invoice-number-with-status {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.invoice-number-with-status > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commission-status-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9aa7b5;
  box-shadow: 0 0 0 2px rgba(154, 167, 181, 0.18);
}

.commission-status-dot.mine {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(42, 163, 154, 0.2);
}

.commission-status-dot.mine::after {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
  opacity: 0.88;
}

.commission-row {
  cursor: pointer;
}

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

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

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

.commissions-table th:nth-child(4),
.commissions-table td:nth-child(4) {
  width: 7%;
  text-align: center !important;
}

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

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

.commissions-table th:nth-child(7),
.commissions-table td:nth-child(7) {
  width: 11%;
  text-align: right !important;
}

.commissions-table th:nth-child(8),
.commissions-table td:nth-child(8) {
  width: 14%;
}

.commissions-table tbody td {
  line-height: 1.35;
  white-space: normal;
}

.commission-line {
  display: block;
  min-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.filters-row th {
  background: #f8fafc;
  overflow: visible !important;
  position: relative;
  z-index: 20;
  vertical-align: top;
}

.filters-row th:has(.menu-filter.open) {
  z-index: 100;
}

.filters-row input,
.filters-row select {
  height: 30px;
  min-width: 0;
  padding: 0 8px;
  font-size: 12px;
}

.filters-row select {
  appearance: auto;
  cursor: pointer;
}

.menu-filter {
  position: relative;
  min-width: 0;
  width: 100%;
}

.filter-trigger {
  display: flex;
  width: 100%;
  height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  outline: none;
  padding: 0 8px;
  min-width: 0;
}

.filter-trigger:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 163, 154, 0.14);
}

.filter-trigger span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filters-row th:nth-child(4) .filter-trigger,
.filters-row th:nth-child(5) .filter-trigger,
.filters-row th:nth-child(6) .filter-trigger,
.filters-row th:nth-child(7) .filter-trigger,
.filters-row th:nth-child(8) .filter-trigger,
.filters-row th:nth-child(9) .filter-trigger,
.filters-row th:nth-child(4) select,
.filters-row th:nth-child(5) select,
.filters-row th:nth-child(6) select,
.filters-row th:nth-child(7) select,
.filters-row th:nth-child(8) select,
.filters-row th:nth-child(9) select {
  text-align: center;
}

.filters-row th:nth-child(10) .filter-trigger,
.filters-row th:nth-child(11) .filter-trigger {
  text-align: right;
}

.filter-caret {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 11px;
}

.filter-popover {
  position: absolute;
  top: 35px;
  left: 0;
  z-index: 1000;
  width: 268px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(20, 32, 51, 0.16);
  padding: 8px;
}

.range-popover {
  width: 310px;
}

.filters-row th:nth-child(10) .filter-popover,
.filters-row th:nth-child(11) .filter-popover {
  right: 0;
  left: auto;
}

.filter-clear,
.filter-specials button,
.tree-choice,
.month-grid button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  min-height: 28px;
  padding: 6px 8px;
  text-align: left;
}

.filter-clear {
  color: var(--accent-dark);
  font-weight: 800;
}

.filter-specials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 6px 0;
}

.filter-specials button {
  border: 1px solid var(--line);
  text-align: center;
}

.filter-clear:hover,
.filter-specials button:hover,
.tree-choice:hover,
.month-grid button:hover {
  background: #eef7f6;
}

.tree-list {
  display: grid;
  gap: 2px;
}

.tree-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 2px;
}

.tree-toggle {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: #eef2f6;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.tree-toggle:hover {
  background: #dfe7ef;
  color: var(--text);
}

.tree-children {
  margin-left: 15px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 4px 0 7px 15px;
  padding-left: 10px;
}

.range-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}

.dual-range {
  position: relative;
  height: 28px;
  margin: 8px 0 12px;
}

.dual-range::before {
  position: absolute;
  top: 12px;
  right: 0;
  left: 0;
  height: 4px;
  border-radius: 999px;
  background: #dfe7ef;
  content: "";
}

.dual-range::after {
  position: absolute;
  top: 12px;
  right: calc(100% - var(--range-end, 100%));
  left: var(--range-start, 0%);
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.range-zero-marker {
  position: absolute;
  top: 17px;
  left: var(--zero-position, 50%);
  z-index: 1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  transform: translateX(-50%);
}

.range-zero-marker::before {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 2px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent-dark);
  content: "";
  transform: translateX(-50%);
}

.dual-range input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 28px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
  z-index: 2;
}

.dual-range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
}

.dual-range input[type="range"]::-moz-range-track {
  height: 4px;
  background: transparent;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(20, 32, 51, 0.25);
  cursor: pointer;
  margin-top: -5px;
  pointer-events: auto;
}

.dual-range input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(20, 32, 51, 0.25);
  cursor: pointer;
  pointer-events: auto;
}

.status-pill {
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
  justify-content: center;
  overflow: hidden;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.paid {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-pill.pending {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.expected-payment.overdue-yellow {
  background: #fff4cc;
  color: #7a5200;
  font-weight: 800;
}

.expected-payment.overdue-orange {
  background: #ffe4c7;
  color: #9a3d00;
  font-weight: 800;
}

.expected-payment.overdue-red {
  background: #ffe1df;
  color: #a61616;
  font-weight: 800;
}

.overflow-tooltip {
  position: fixed;
  z-index: 3000;
  max-width: min(420px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(20, 32, 51, 0.18);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
  white-space: normal;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0 0;
  color: var(--muted);
}

.dt-container .dt-length select {
  margin-right: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

.dt-container .dt-paging .dt-paging-button {
  border-radius: 7px !important;
  color: var(--text) !important;
}

.dt-container .dt-paging .dt-paging-button.current {
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  color: #fff !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 24, 40, 0.42);
}

.commission-modal {
  width: min(860px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(15, 24, 40, 0.28);
}

.commission-modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-kicker {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.commission-modal h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.modal-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 24px;
  line-height: 1;
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--text);
}

.commission-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.commission-summary div {
  display: grid;
  min-height: 74px;
  align-content: center;
  gap: 6px;
  padding: 12px 16px;
  background: #f8fafc;
}

.commission-summary span,
.commission-category span,
.commission-result span,
.commission-input-group label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.commission-summary strong,
.commission-category strong,
.commission-result strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commission-feedback {
  margin: 16px 22px 0;
  border-radius: 7px;
  padding: 10px 12px;
  font-weight: 700;
}

.commission-feedback.error {
  background: #ffe1df;
  color: #a61616;
}

.commission-feedback.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.commission-form {
  display: grid;
  gap: 10px;
  padding: 18px 22px;
}

.commission-rate-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(300px, 1.5fr) minmax(130px, 0.8fr);
  gap: 14px;
  align-items: center;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.commission-category,
.commission-result,
.commission-input-group label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.commission-input-group {
  display: grid;
  gap: 8px;
}

.commission-input-group input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 0 10px;
}

.commission-input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 163, 154, 0.14);
}

.commission-input-group input.input-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

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

.quick-rates button,
.secondary-button,
.primary-button {
  min-height: 34px;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.quick-rates button,
.secondary-button {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--accent-dark);
}

.quick-rates button:hover,
.secondary-button:hover {
  border-color: var(--accent);
  background: #eef7f6;
}

.commission-result {
  justify-items: end;
  text-align: right;
}

.commission-result strong {
  min-height: 22px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.empty-commission {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.commission-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
}

.primary-button {
  min-width: 132px;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 15px;
}

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

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.commission-invoice-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.commission-invoice-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.commission-invoice-meta div {
  display: grid;
  gap: 5px;
  padding: 14px 18px;
  background: #f8fafc;
}

.commission-invoice-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.commission-invoice-meta strong {
  color: var(--text);
  font-size: 14px;
}

.commission-invoice-body {
  padding: 28px 32px 32px;
}

.commission-invoice-section {
  margin: 0 auto 30px;
  max-width: 1040px;
}

.commission-invoice-section-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 16px;
}

.commission-invoice-section-title h2 {
  margin: 0;
  color: #3d4856;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

.commission-invoice-section-title strong {
  color: #3d4856;
  font-size: 20px;
  font-weight: 800;
  text-align: right;
}

.commission-invoice-bu {
  margin: 0 0 20px;
  padding-left: 92px;
}

.commission-invoice-bu-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: end;
  border-bottom: 1px solid #8b8f95;
  color: #3d4856;
  font-size: 16px;
}

.commission-invoice-bu-header strong:last-child {
  text-align: right;
}

.commission-invoice-lines {
  display: grid;
  gap: 2px;
  padding-top: 2px;
}

.commission-invoice-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: baseline;
  min-height: 20px;
  color: #344054;
  font-size: 16px;
}

.commission-invoice-line span {
  min-width: 0;
  overflow: hidden;
  padding-left: 32px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commission-invoice-line strong {
  font-weight: 500;
  text-align: right;
}

.commission-invoice-totals {
  display: grid;
  width: min(100%, 520px);
  overflow: hidden;
  margin: 46px 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(20, 32, 51, 0.06);
}

.commission-invoice-total-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  align-items: center;
  gap: 16px;
  min-height: 46px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: #344054;
  font-size: 14px;
}

.commission-invoice-total-row > :first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commission-invoice-total-row > :last-child {
  text-align: right;
}

.commission-invoice-total-row:last-child {
  border-bottom: 0;
}

.commission-invoice-total-row strong {
  color: var(--text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.commission-invoice-total-row.total-ttc {
  background: #f3f6f8;
  font-weight: 800;
}

.commission-invoice-total-row.total-ttc span,
.commission-invoice-total-row.total-ttc strong {
  color: #243043;
  font-size: 18px;
}

.invoice-empty {
  margin: 22px;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 24px 18px;
  }

  .logout-form {
    position: static;
    margin-top: 18px;
  }

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

  .content {
    padding: 22px 16px;
  }

  .page-header,
  .table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .commission-summary,
  .commission-rate-row {
    grid-template-columns: 1fr;
  }

  .commission-result {
    justify-items: start;
    text-align: left;
  }

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

  .commission-invoice-meta,
  .commission-invoice-section-title,
  .commission-invoice-total-row {
    grid-template-columns: 1fr;
  }

  .commission-invoice-bu {
    padding-left: 0;
  }

  .commission-invoice-bu-header,
  .commission-invoice-line {
    grid-template-columns: minmax(0, 1fr) 128px;
    font-size: 14px;
  }

  .commission-invoice-line span {
    padding-left: 14px;
  }

  .commission-invoice-section-title strong,
  .commission-invoice-total-row > :last-child {
    text-align: left;
  }
}
