:root {
  --brand: #008b52;
  --brand-2: #00b86b;
  --brand-3: #00d97e;
  --brand-dark: #005c36;
  --mint: #e9f8f0;
  --mint-2: #dff5ea;
  --bg: #f6fbf8;
  --surface: #ffffff;
  --ink: #0d1f17;
  --muted: #6b7f78;
  --soft: #e2ebe6;
  --line: #d8e5df;
  --warning: #b7791f;
  --danger: #b42318;
  --info: #1d4ed8;
  --grad: linear-gradient(135deg, #008b52 0%, #00b86b 55%, #00d97e 100%);
  --grad-soft: linear-gradient(135deg, #e6f7ee 0%, #d2f1e0 100%);
  --shadow: 0 12px 40px rgba(0, 90, 55, .1);
  --shadow-lg: 0 30px 60px rgba(0, 90, 55, .16);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 251, 248, .88);
  color: var(--ink);
  border-bottom: 1px solid rgba(0, 139, 82, .1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.app-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  font-size: 17px;
  font-weight: 800;
}

.brand-logo-img {
  display: block;
  width: 120px;
  height: auto;
}

.brand em {
  color: var(--brand);
  font-style: normal;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--grad);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(0, 139, 82, .28);
}

.dashboard-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 28px 28px;
}

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

.topbar-title-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.eyebrow,
.panel-label {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -.02em;
}

h2 {
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -.02em;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sales-link-pill {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: 1px solid rgba(0, 139, 82, .18);
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #edfdf5 100%);
  color: var(--brand-dark);
  box-shadow: 0 8px 22px rgba(0, 90, 55, .06);
}

.sales-link-pill svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sales-link-pill span,
.sales-link-pill small,
.sales-link-pill strong {
  display: block;
  text-align: left;
}

.sales-link-pill small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.1;
}

.sales-link-pill strong {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.2;
}

.account-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand);
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(16, 35, 26, .05);
}

.account-chip {
  min-width: 168px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid rgba(0, 139, 82, .12);
  border-radius: 12px;
  padding: 7px 10px;
  box-shadow: none;
  color: var(--ink);
}

.header-account {
  min-width: 176px;
  cursor: pointer;
}

.account-chip small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
}

.account-chip strong,
.account-chip small {
  display: block;
  text-align: left;
}

.account-balance-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
}

.account-balance-pill strong {
  color: #b7791f;
  font-size: 18px;
  line-height: 1;
}

.chevron-icon {
  width: 16px;
  height: 16px;
  margin-left: auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: 176px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(0, 90, 55, .14);
}

.account-menu-item {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  font-weight: 800;
  color: var(--ink);
}

.account-menu-item:hover {
  background: #f7fbf8;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--grad);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 900;
  overflow: hidden;
  position: relative;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar span {
  display: none;
}

.avatar.is-fallback img {
  display: none;
}

.avatar.is-fallback span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-action {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 139, 82, .18);
  border-radius: 12px;
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 8px 22px rgba(0, 90, 55, .06);
}

.icon-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.danger-action {
  color: #7a271a;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.filters,
.metric-card,
.panel,
.orders-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 90, 55, .06);
}

.btn-primary,
.btn-secondary {
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
}

.btn-primary {
  background: var(--grad);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 139, 82, .28);
}

.btn-secondary {
  background: #ffffff;
  color: var(--brand-dark);
  border: 1px solid rgba(0, 139, 82, .25);
  box-shadow: 0 8px 18px rgba(0, 90, 55, .06);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px;
  margin-bottom: 14px;
  background: #ffffff;
}

.table-filter-row {
  gap: 8px;
  padding: 8px 10px;
}

.table-filter-row .compact-field label {
  top: 5px;
  left: 11px;
  font-size: 9px;
}

.table-filter-row .compact-field input,
.table-filter-row .compact-field select {
  height: 40px;
  border-radius: 12px;
  padding: 14px 10px 3px;
  font-size: 14px;
  box-shadow: none;
}

.settlement-filter-field {
  flex: 0 0 190px;
}

.order-search-field-select {
  flex: 0 0 145px;
}

.table-search-field {
  flex: 0 1 235px;
}

.table-filter-row .btn-secondary {
  min-height: 40px;
  padding: 0 13px;
  border-radius: 12px;
}

.range-select-field {
  flex: 0 0 210px;
}

.date-range-field {
  min-width: 390px;
  flex: 1 1 390px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fcfa;
}

.date-range-field .field input {
  border: 0;
  box-shadow: none;
}

.range-separator {
  width: 18px;
  height: 2px;
  justify-self: center;
  border-radius: 999px;
  background: #bfd4ca;
}

.filter-icon-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: var(--grad);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 139, 82, .24);
}

.table-filter-row .filter-icon-btn {
  width: auto;
  min-width: 104px;
  height: 40px;
  display: inline-flex;
  gap: 8px;
  padding: 0 14px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 139, 82, .2);
}

.filter-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.management-layout {
  display: block;
}

.main-column {
  min-width: 0;
}

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

.field {
  position: relative;
  display: grid;
}

.field label {
  position: absolute;
  top: 6px;
  left: 12px;
  z-index: 1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.field input,
.field select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 12px 4px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 90, 55, .035);
}

.field select {
  padding-right: 34px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 420px));
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.koc-page-tabs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 0;
  margin: 0;
  background: transparent;
}

.koc-page-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
  height: 44px;
  padding: 0 2px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.koc-page-tab.active {
  border-bottom: 2px solid var(--brand);
  color: var(--brand-dark);
}

.period-metric-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  justify-content: stretch;
}

.income-compact-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.overview-settlement-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 14px;
}

.overview-payout-panel {
  min-width: 0;
}

.metric-card {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 18px;
  min-height: 118px;
  position: relative;
  text-align: center;
  overflow: hidden;
}

.metric-card::after {
  display: none;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 16px;
}

.metric-card > strong {
  display: block;
  margin: 10px 0 0;
  font-size: 34px;
  line-height: 1.1;
  color: var(--brand-dark);
}

.commission-card {
  grid-column: 1 / -1;
}

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

.commission-state {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfefc;
}

.commission-state-paid {
  border-color: rgba(0, 184, 107, .34);
  background: #ecfff5;
}

.commission-state-paid strong {
  color: var(--brand-dark);
  font-size: 23px;
}

.commission-state-pending {
  border-color: rgba(183, 121, 31, .28);
  background: #fffaf0;
}

.commission-stack strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, .9fr);
  gap: 14px;
  margin-bottom: 14px;
}

.payout-panel {
  min-height: 100%;
}

.income-compact-layout .panel,
.income-compact-layout .orders-panel {
  padding: 14px;
}

.income-compact-layout .panel-head {
  margin-bottom: 10px;
}

.income-compact-layout .table-filter-row {
  margin-bottom: 10px;
}

.chart-note {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--grad-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.chart-frame {
  min-height: 280px;
}

.chart-svg {
  width: 100%;
  height: 280px;
  overflow: visible;
}

.chart-axis {
  stroke: #dbe8e2;
  stroke-width: 1;
}

.chart-area {
  fill: rgba(0, 184, 107, .16);
}

.chart-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: #ffffff;
  stroke: var(--brand);
  stroke-width: 3;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.bar-chart {
  min-height: 180px;
  display: grid;
  align-items: end;
  grid-template-columns: repeat(var(--bar-count, 5), 1fr);
  gap: 10px;
  padding-top: 10px;
}

.bar-item {
  display: grid;
  align-items: end;
  gap: 8px;
  min-height: 160px;
}

.bar-track {
  height: 122px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: 12px;
  background: #f0f7f3;
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  min-height: 8px;
  border-radius: 12px 12px 0 0;
  background: var(--grad);
}

.bar-item strong,
.bar-item span {
  text-align: center;
}

.bar-item strong {
  color: var(--brand-dark);
  font-size: 13px;
}

.bar-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.panel,
.orders-panel {
  padding: 16px;
}

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

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

.payout-list-main {
  grid-template-columns: 1fr;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.payout-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fbfefc;
}

.payout-icon-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  align-self: stretch;
}

.payout-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--mint);
  color: var(--brand-dark);
}

.payout-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.payout-list-main .payout-item {
  padding: 10px 12px;
  background: linear-gradient(135deg, #ffffff 0%, #effcf5 100%);
}

.payout-item strong,
.payout-item span,
.payout-item small {
  display: block;
}

.payout-item strong {
  color: var(--brand-dark);
}

.payout-list-main .payout-item strong {
  font-size: 16px;
  line-height: 1.15;
}

.payout-content {
  min-width: 0;
}

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

.payout-time {
  white-space: nowrap;
}

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

.payout-item .payout-icon {
  display: grid;
  place-items: center;
  color: var(--brand-dark);
}

.payout-list-main .payout-item span {
  margin-top: 1px;
}

.payout-list-main .payout-item small {
  color: var(--brand-dark);
  font-size: 11px;
}

.payout-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 13px;
  background: #fbfefc;
}

.payout-empty strong,
.payout-empty span {
  display: block;
}

.result-count {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.table-wrap {
  max-height: 520px;
  overflow: auto;
}

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

.page-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand-dark);
  font-weight: 800;
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

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

th,
td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--soft);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

td strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-code-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: center;
}

.copy-order-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 139, 82, .16);
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-dark);
}

.copy-order-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-line,
.promo-line,
td small {
  color: var(--muted);
}

.table-line,
.promo-line {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promo-line {
  color: var(--brand-dark);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 100%;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11px;
  white-space: nowrap;
}

.col-order {
  width: 17%;
}

.col-customer {
  width: 17%;
}

.col-money {
  width: 11%;
}

.col-status {
  width: 11%;
}

.col-date {
  width: 14%;
}

.status-paid,
.status-issued,
.status-activated,
.status-paid-commission {
  color: var(--brand-dark);
  background: var(--mint);
}

.status-pending {
  color: var(--warning);
  background: #fff7e6;
}

.status-failed,
.status-expired {
  color: var(--danger);
  background: #fff1f0;
}

.status-processing {
  color: var(--info);
  background: #eef4ff;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 36px;
  color: var(--muted);
}

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

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 31, 23, .42);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
}

.modal-panel,
.modal-card {
  position: relative;
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 10px;
}

.modal-header h2,
.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-head p {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #f4faf7;
  color: var(--brand-dark);
  font-size: 22px;
  line-height: 1;
}

.change-password-form {
  display: grid;
  gap: 14px;
  padding: 14px 20px 20px;
}

.change-password-form input {
  width: 100%;
}

.change-password-field {
  position: relative;
}

.change-password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}

.password-toggle:hover {
  background: var(--mint);
  color: var(--brand-dark);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

.modal-actions button:disabled {
  cursor: wait;
  opacity: .72;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #0f2119;
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

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

@media (max-width: 1080px) {
  .app-nav-inner {
    padding: 16px 20px;
    align-items: center;
  }

  .dashboard-shell {
    padding: 20px;
  }

  .chart-grid,
  .income-compact-layout,
  .overview-settlement-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-nav {
    position: static;
  }

  .app-nav-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
  }

  .brand-logo-img {
    width: 104px;
  }

  .account-menu {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-left: 0;
  }

  .header-account {
    min-width: 150px;
    width: auto;
  }

  .account-dropdown {
    left: 0;
    right: 0;
    width: auto;
  }

  .account-balance-pill {
    justify-content: flex-start;
    font-size: 11px;
  }

  .koc-page-tabs {
    grid-column: 1 / -1;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 20px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 14px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(170px, auto);
    gap: 8px;
  }

  .sales-link-pill {
    width: 100%;
    min-height: 42px;
  }

  .icon-action {
    width: 100%;
    height: 42px;
  }

  .filters,
  .income-compact-layout,
  .metric-grid,
  .overview-settlement-grid,
  .commission-stack {
    grid-template-columns: 1fr;
  }

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

  .period-metric-grid .metric-card {
    min-height: 86px;
    padding: 10px 8px;
    border-radius: 10px;
  }

  .period-metric-grid .metric-card span {
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(10px, 2.7vw, 12px);
    line-height: 1.15;
  }

  .period-metric-grid .metric-card > strong {
    margin-top: 6px;
    font-size: clamp(17px, 4.8vw, 22px);
    line-height: 1.05;
    white-space: nowrap;
  }

  .filters {
    display: grid;
    gap: 8px;
    padding: 8px;
  }

  .range-select-field,
  .date-range-field,
  .settlement-filter-field,
  .order-search-field-select,
  .table-search-field {
    min-width: 0;
    flex-basis: auto;
    width: 100%;
  }

  .date-range-field {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
    gap: 6px;
  }

  .range-separator {
    display: block;
    width: 12px;
  }

  .global-filter-section .filter-icon-btn,
  .table-filter-row .filter-icon-btn,
  .table-filter-row .btn-secondary {
    width: 100%;
  }

  .global-filter-section {
    grid-template-columns: minmax(118px, .9fr) minmax(0, 1.7fr) 42px;
    align-items: stretch;
  }

  .global-filter-section .filter-icon-btn {
    height: 40px;
    align-self: center;
  }

  .table-filter-row {
    grid-template-columns: minmax(112px, .86fr) minmax(0, 1.35fr) 40px auto;
    align-items: stretch;
  }

  .table-filter-row .filter-icon-btn,
  .table-filter-row .btn-secondary {
    min-height: 40px;
  }

  .table-filter-row .filter-icon-btn {
    grid-column: auto;
  }

  .table-filter-row .btn-secondary {
    grid-column: auto;
  }

  .commission-card {
    grid-column: auto;
  }

  .dashboard-shell {
    padding: 14px;
  }

  .koc-page-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .koc-page-tab {
    min-width: 0;
    width: 100%;
    height: 40px;
  }

  .panel,
  .orders-panel {
    padding: 12px;
  }

  .panel-head {
    gap: 10px;
    margin-bottom: 10px;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    border-collapse: separate;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 9px 10px;
    border-bottom: 1px solid var(--soft);
    font-size: 12px;
  }

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

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .order-code-cell {
    grid-template-columns: minmax(0, 1fr) 30px;
  }

  .copy-order-btn {
    width: 30px;
    height: 30px;
  }

  .table-line,
  .promo-line {
    white-space: normal;
  }
}

@media (max-width: 520px) {
  .app-nav-inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .account-menu {
    grid-template-columns: 1fr;
  }

  .header-account {
    width: 100%;
  }

  .dashboard-shell {
    padding: 10px;
  }

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

  .global-filter-section {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .range-select-field {
    grid-column: 1;
  }

  .global-filter-section > .filter-icon-btn {
    grid-column: 2;
  }

  .date-range-field {
    grid-column: 1 / -1;
  }

  .table-filter-row {
    grid-template-columns: minmax(106px, .82fr) minmax(0, 1.35fr);
  }

  .table-filter-row .filter-icon-btn {
    grid-column: 1;
  }

  .table-filter-row .btn-secondary {
    grid-column: 2;
  }

  .eyebrow,
  .panel-label {
    font-size: 10px;
    letter-spacing: .08em;
  }

  h1 {
    font-size: 20px;
  }

  .metric-card {
    min-height: 96px;
    padding: 14px;
  }

  .period-metric-grid {
    gap: 6px;
  }

  .period-metric-grid .metric-card {
    min-height: 76px;
    padding: 8px 5px;
  }

  .period-metric-grid .metric-card span {
    min-height: 22px;
    font-size: clamp(9px, 2.6vw, 11px);
  }

  .period-metric-grid .metric-card > strong {
    font-size: clamp(15px, 4.3vw, 18px);
  }

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

  .metric-card > strong {
    font-size: 26px;
  }

  .commission-stack {
    grid-template-columns: 1fr;
  }

  .payout-item {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .payout-topline {
    display: grid;
    gap: 2px;
  }

  .payout-time {
    white-space: normal;
  }

  td {
    grid-template-columns: 86px minmax(0, 1fr);
  }
}
