:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --text: #161b26;
  --muted: #667085;
  --line: #e2e6ee;
  --border: #e2e6ee;
  --brand: #c5102e;
  --brand-dark: #8f0c22;
  --brand-soft: #fff1f4;
  --accent: #e43f5a;
  --accent-strong: #b20d28;
  --nav: #ffffff;
  --nav-muted: #4f5b6f;
  --good: #11845b;
  --warn: #b76e00;
  --bad: #b42318;
  --shadow: 0 18px 42px rgba(25, 31, 44, 0.09);
  --shadow-soft: 0 8px 22px rgba(25, 31, 44, 0.06);
}

* {
  box-sizing: border-box;
}

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

.login-screen {
  align-items: center;
  background: linear-gradient(135deg, #f8f9fb, #eef1f6);
  display: grid;
  inset: 0;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  position: fixed;
  z-index: 10;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 24px;
  width: 100%;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 14px;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: var(--brand-dark);
  box-shadow: 0 10px 22px rgba(197, 16, 46, 0.2);
  transform: translateY(-1px);
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 16px 28px;
  position: sticky;
  top: 0;
  z-index: 3;
}

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

h1 {
  font-size: 25px;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.header-shop-name {
  color: var(--brand);
  font-size: 14px;
  font-weight: 850;
  margin: 2px 0 7px;
}

h2 {
  font-size: 24px;
  letter-spacing: -0.02em;
}

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

.section-head {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 22px;
}

.section-head h3 {
  margin-bottom: 4px;
}

.compact-field {
  min-width: 260px;
}

.topbar p,
.message,
.muted {
  color: var(--muted);
}

.made-by {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.shop-name {
  color: var(--text);
  font-weight: 800;
}

.data-until-date {
  color: var(--brand);
  font-weight: 900;
}

.controls,
.grid-two,
.section-title,
.dialog-actions {
  align-items: end;
  display: flex;
  gap: 12px;
}

.user-pill {
  align-items: center;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  gap: 10px;
  padding: 6px;
}

.user-pill span {
  font-size: 13px;
  font-weight: 800;
  padding-left: 6px;
}

.user-pill button {
  border-radius: 999px;
  padding: 7px 12px;
}

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 82px);
}

.sidebar {
  background: var(--nav);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 28px rgba(25, 31, 44, 0.04);
  padding: 20px 14px;
}

.nav {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--nav-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 7px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.nav::before {
  align-items: center;
  background: #f3f5f8;
  border: 1px solid #e5e8ef;
  border-radius: 8px;
  color: var(--brand);
  content: attr(data-icon);
  display: inline-flex;
  flex: 0 0 28px;
  font-size: 13px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

.nav.active,
.nav:hover {
  background: var(--brand-soft);
  border-color: #f0bdc7;
  box-shadow: inset 4px 0 0 var(--brand);
  color: var(--brand-dark);
}

.nav.active::before,
.nav:hover::before {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

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

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.hidden {
  display: none;
}

.panel,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

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

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

input,
select {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 40px;
  padding: 8px 10px;
}

input:focus,
select:focus {
  border-color: #f2a5b2;
  box-shadow: 0 0 0 4px rgba(197, 16, 46, 0.12);
  outline: 0;
}

.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.dashboard-kpi-section {
  margin-bottom: 22px;
}

.primary-kpi-section {
  background: #fff;
  border: 1px solid #efbec7;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.primary-kpi-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.secondary-kpi-cards {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.success-panel {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  display: flex;
  gap: 18px;
  margin-bottom: 24px;
  padding: 20px;
}

.success-panel.split {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
}

.store-success-panel {
  background: #ffffff;
  border-color: #efbec7;
}

.store-result-main {
  display: grid;
  gap: 18px;
  grid-template-columns: 140px minmax(0, 1fr);
}

.success-ring-large {
  flex-basis: 128px;
  height: 128px;
  width: 128px;
}

.success-ring-large::after {
  height: 88px;
  width: 88px;
}

.trend-compare {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 14px;
}

.trend-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.trend-card span,
.trend-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.trend-card strong {
  font-size: 22px;
}

.trend-shop {
  border-color: #efbec7;
}

.trend-good {
  border-color: rgba(20, 132, 88, 0.35);
}

.trend-bad {
  border-color: rgba(197, 16, 46, 0.35);
}

.panel-part + .panel-part {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.success-ring {
  align-items: center;
  background: conic-gradient(#c5102e calc(var(--value) * 1%), #f0e8eb 0);
  border-radius: 50%;
  display: grid;
  flex: 0 0 112px;
  height: 112px;
  place-items: center;
  position: relative;
  width: 112px;
}

.success-ring::after {
  background: var(--panel-solid);
  border-radius: 50%;
  content: "";
  height: 78px;
  position: absolute;
  width: 78px;
}

.success-ring strong {
  display: grid;
  font-size: 20px;
  line-height: 1.1;
  place-items: center;
  position: relative;
  z-index: 1;
}

.success-ring small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.status-banner {
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  margin-top: 12px;
  padding: 8px 10px;
  text-align: center;
}

.status-banner.ok-bg {
  background: var(--good);
}

.status-banner.bad-bg {
  background: var(--bad);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  cursor: grab;
  padding: 17px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.card:hover {
  border-color: #ecc0c8;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card:active {
  cursor: grabbing;
}

.card.dragging {
  opacity: 0.55;
  outline: 2px dashed var(--brand);
  outline-offset: 3px;
}

.kpi-card .kpi-number {
  color: var(--text);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  margin: 4px 0 14px;
}

.primary-kpi-card {
  background: #fff;
  border-color: #efbec7;
  box-shadow: 0 16px 36px rgba(119, 13, 31, 0.11);
  padding: 19px;
}

.primary-kpi-card h4 {
  color: #8d1026;
  font-size: 15px;
}

.primary-kpi-card .kpi-number {
  color: #c5102e;
  font-size: 36px;
}

.additional-offer-card {
  background: linear-gradient(180deg, #ffffff, #fff1f4);
}

.ratio-card {
  background: linear-gradient(180deg, #ffffff, #fff5f7);
  border: 1px solid #f0a8b5;
}

.ratio-visual {
  align-items: center;
  display: flex;
  gap: 14px;
  margin: 12px 0;
}

.ratio-ring {
  align-items: center;
  background: conic-gradient(#c5102e calc(var(--value) * 1%), #f0e8eb 0);
  border-radius: 50%;
  display: grid;
  flex: 0 0 88px;
  height: 88px;
  place-items: center;
  position: relative;
  width: 88px;
}

.ratio-ring::after {
  background: var(--panel-solid);
  border-radius: 50%;
  content: "";
  height: 62px;
  position: absolute;
  width: 62px;
}

.ratio-ring strong {
  font-size: 16px;
  position: relative;
  z-index: 1;
}

.card h4 {
  font-size: 14px;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

.metric {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  line-height: 1.85;
}

.metric span:first-child {
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px;
}

.summary-grid .metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 16px;
  margin: 12px 0;
}

.bar-chart {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.bar-group,
.column-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.bar-label {
  font-weight: 800;
  margin-bottom: 10px;
}

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr minmax(70px, auto);
  gap: 10px;
  align-items: center;
}

.bar-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #f0e8eb;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.column-list {
  display: flex;
  align-items: end;
  gap: 12px;
  min-height: 240px;
  overflow-x: auto;
  padding: 8px 0 4px;
}

.column-list.comparison-columns {
  justify-content: center;
}

.column-item {
  display: grid;
  grid-template-rows: auto 180px auto;
  gap: 8px;
  min-width: 96px;
  text-align: center;
  align-items: end;
}

.column-item strong {
  font-size: 13px;
}

.column-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.column-track {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  height: 180px;
  border-radius: 8px;
  background: #f0e8eb;
  overflow: hidden;
}

.column-fill {
  width: 100%;
  max-width: 48px;
  min-height: 3px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
}

.business-chart {
  background: linear-gradient(180deg, #ffffff, #fbf7f8);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  margin-top: 16px;
  min-width: 0;
  padding: 18px;
  width: 100%;
}

.business-chart-head {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.business-chart-head h3 {
  margin: 0 0 4px;
}

.business-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: flex-end;
}

.business-legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
  white-space: nowrap;
}

.business-legend i {
  border-radius: 3px;
  display: inline-block;
  height: 10px;
  width: 18px;
}

.business-chart-body {
  display: grid;
  gap: 10px;
  grid-template-columns: 64px minmax(0, 1fr);
}

.business-y-axis {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  height: 300px;
  text-align: right;
}

.business-plot {
  border-bottom: 2px solid #d9a7b1;
  border-left: 2px solid #d9a7b1;
  height: 300px;
  overflow-x: auto;
  position: relative;
}

.business-grid-lines {
  display: grid;
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.business-grid-lines span {
  border-top: 1px solid #ead4d8;
}

.business-columns {
  align-items: stretch;
  display: flex;
  gap: 20px;
  height: 100%;
  min-width: max-content;
  padding: 18px 16px 0;
  position: relative;
  z-index: 1;
}

.business-group {
  align-items: stretch;
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 118px;
  text-align: center;
}

.business-bars {
  align-items: end;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.business-bar-wrap {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: end;
  min-width: 42px;
}

.business-bar-wrap strong {
  color: var(--text);
  font-size: 11px;
  margin-bottom: 5px;
  max-width: 74px;
  overflow-wrap: anywhere;
}

.business-bar {
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.08);
  min-height: 4px;
  width: 34px;
}

.business-x-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  min-height: 38px;
  overflow-wrap: anywhere;
  padding-top: 8px;
}

.progress {
  background: #f0e8eb;
  border-radius: 999px;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
}

.progress div {
  background: linear-gradient(90deg, #c5102e, #e84d67);
  height: 100%;
  max-width: 100%;
}

.ok {
  color: var(--good);
}

.warn {
  color: var(--warn);
}

.bad {
  color: var(--bad);
}

.grid-two {
  align-items: start;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact {
  max-width: 720px;
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  overflow: auto;
}

.wide-table table {
  min-width: 1480px;
}

tr.selected-row td {
  background: #fff5f5;
  border-top: 1px solid #fecaca;
  border-bottom: 1px solid #fecaca;
}

tr.locked-row td {
  background: #fef2f2;
  border-top: 1px solid #fca5a5;
  border-bottom: 1px solid #fca5a5;
}

.button-row {
  display: flex;
  gap: 10px;
}

.security-box {
  background: #fbf7f8;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 12px;
  padding: 12px;
}

.security-code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  margin-top: 8px;
  overflow-wrap: anywhere;
  padding: 10px;
}

.final-payout-box {
  align-items: center;
  background: #ecfdf3;
  border: 1px solid #b7e3c4;
  border-radius: 12px;
  color: #166534;
  display: flex;
  font-size: 16px;
  font-weight: 900;
  justify-content: space-between;
  padding: 12px 14px;
}

.final-payout-box strong {
  color: #15803d;
  font-size: 20px;
}

.final-payout-row td {
  background: transparent;
  padding: 10px;
}

.segmented {
  background: #fbf7f8;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: inline-flex;
  gap: 4px;
  margin: 10px 0 16px;
  padding: 4px;
}

.segmented button {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.segmented button.active {
  background: linear-gradient(180deg, #e43f5a, var(--brand));
  color: #fff;
}

.segmented button:hover {
  box-shadow: none;
  transform: none;
}

.small-input {
  max-width: 90px;
}

.warning-text {
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #fbf7f8;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td:last-child,
th:last-child {
  text-align: right;
}

.money {
  font-weight: 900;
}

.total-row td {
  background: #fbf7f8;
  font-weight: 800;
}

.cancelled-panel {
  margin-top: 18px;
}

.cancelled-panel h3 {
  color: var(--bad);
}

.cancelled-row td {
  background: #fff6f5;
}

.cancelled-row td:nth-child(3),
.cancelled-row td:last-child {
  color: var(--bad);
  font-weight: 800;
}

.input-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.payout-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.payout-item {
  background: #fbf7f8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.reward-total-card {
  align-self: stretch;
  background: linear-gradient(135deg, #eaf8ef, #f6fff8);
  border: 1px solid #b7e3c4;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(22, 128, 74, 0.12);
  color: #166534;
  display: grid;
  min-width: 170px;
  padding: 18px;
  place-content: center;
  text-align: center;
}

.reward-total-card span,
.reward-total-card small {
  color: #2f7d4b;
  font-weight: 800;
}

.reward-total-card strong {
  color: #14532d;
  font-size: 30px;
  line-height: 1.1;
  margin: 8px 0;
}

.reward-highlight,
.reward-final-line {
  background: #ecfdf3;
  border-color: #b7e3c4;
  border-radius: 10px;
  border-style: solid;
  border-width: 1px;
  padding: 8px 10px;
}

.reward-highlight strong,
.reward-final-line strong,
.final-payout-row .money {
  color: #15803d;
  font-size: 17px;
}

.reward-final-line {
  margin-top: 8px;
}

.reward-addon {
  background: #fbf7f8;
  border-radius: 10px;
  padding: 6px 10px;
}

.reward-projection {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  color: #9a3412;
  padding: 8px 10px;
}

.reward-projection strong {
  color: #c2410c;
}

.reward-projection-panel {
  background: #fff7ed;
  border-color: #fed7aa;
}

.projection-shell {
  width: 100%;
}

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

.projection-head h3 {
  color: #9a3412;
  margin: 0 0 4px;
}

.projection-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.projection-card {
  background: #fff;
  border: 1px solid #fdba74;
  border-radius: 14px;
  color: #9a3412;
  cursor: pointer;
  display: grid;
  gap: 6px;
  padding: 16px;
  text-align: left;
}

.projection-card strong {
  color: #c2410c;
  font-size: 28px;
  line-height: 1.1;
}

.projection-card small {
  color: #9a3412;
}

.projection-details {
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  margin-top: 14px;
  padding: 14px;
}

.projection-details h4 {
  margin: 16px 0 10px;
}

.projection-details h4:first-child {
  margin-top: 0;
}

.projection-table {
  box-shadow: none;
  margin-bottom: 12px;
}

.projection-table table {
  min-width: 720px;
}

.projection-table th {
  background: #fff7ed;
}

.projection-total-row td {
  background: #ffedd5;
  color: #9a3412;
  font-weight: 900;
}

.compact-title {
  align-items: center;
  margin-bottom: 8px;
}

.compact-title h3 {
  margin: 0;
}

.ai-summary-text {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 8px;
  white-space: pre-line;
}

.danger {
  background: var(--bad);
}

.danger:hover {
  background: #8f1f16;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-width: 460px;
  width: calc(100% - 32px);
}

dialog form {
  display: grid;
  gap: 14px;
}

.check {
  align-items: center;
  display: flex;
}

.check input {
  min-height: auto;
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
  }

  .topbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 14px;
    padding: 14px 16px;
    position: static;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .header-shop-name {
    font-size: 13px;
  }

  .topbar p {
    font-size: 13px;
    margin-bottom: 4px;
  }

  .controls {
    gap: 10px;
  }

  .controls label,
  .controls select,
  .controls input {
    width: 100%;
  }

  .user-pill {
    border-radius: 12px;
    justify-content: space-between;
    width: 100%;
  }

  .user-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar {
    background: var(--nav);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 8px;
    overflow: auto;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 2;
    -webkit-overflow-scrolling: touch;
  }

  .nav {
    border: 1px solid var(--line);
    flex: 0 0 auto;
    font-size: 13px;
    margin: 0;
    padding: 10px 12px;
    white-space: nowrap;
    width: auto;
  }

  .nav.active,
  .nav:hover {
    box-shadow: inset 0 -3px 0 var(--brand);
  }

  .content {
    padding: 16px;
  }

  h2 {
    font-size: 21px;
  }

  h3 {
    font-size: 15px;
    margin: 18px 0 9px;
  }

  .section-title {
    align-items: stretch;
    gap: 10px;
    justify-content: space-between;
  }

  .panel,
  .empty {
    border-radius: 12px;
    padding: 16px;
  }

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

  .primary-kpi-section {
    border-radius: 14px;
    padding: 14px;
  }

  .primary-kpi-cards,
  .secondary-kpi-cards {
    grid-template-columns: 1fr;
  }

  .primary-kpi-card .kpi-number {
    font-size: 31px;
  }

  .card {
    cursor: default;
    padding: 15px;
  }

  .card:hover {
    transform: none;
  }

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

  .success-panel {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
  }

  .success-panel.split {
    grid-template-columns: 1fr;
  }

  .store-result-main {
    grid-template-columns: 1fr;
  }

  .trend-compare {
    grid-template-columns: 1fr;
  }

  .panel-part + .panel-part {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 14px;
  }

  .success-ring {
    flex-basis: 92px;
    height: 92px;
    width: 92px;
  }

  .success-ring::after {
    height: 64px;
    width: 64px;
  }

  .success-ring strong {
    font-size: 16px;
  }

  .ratio-visual {
    align-items: flex-start;
  }

  .ratio-ring {
    flex-basis: 74px;
    height: 74px;
    width: 74px;
  }

  .ratio-ring::after {
    height: 52px;
    width: 52px;
  }

  .metric {
    align-items: flex-start;
    gap: 10px;
  }

  .metric strong {
    text-align: right;
  }

  .summary-grid,
  .input-grid,
  .payout-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    border-radius: 12px;
    margin-inline: -2px;
  }

  table {
    min-width: 620px;
  }

  .wide-table table {
    min-width: 1280px;
  }

  th,
  td {
    padding: 10px 12px;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-row strong {
    text-align: right;
  }

  .column-list {
    min-height: 190px;
  }

  .column-item {
    grid-template-rows: auto 140px auto;
    min-width: 82px;
  }

  .column-track {
    height: 140px;
  }

  dialog {
    width: calc(100% - 24px);
  }
}

@media (max-width: 560px) {
  .login-screen {
    padding: 14px;
  }

  .login-card {
    border-radius: 14px;
    padding: 18px;
  }

  .topbar {
    padding: 12px;
  }

  .made-by {
    font-size: 11px;
  }

  .content {
    padding: 12px;
  }

  button,
  input,
  select {
    min-height: 42px;
  }

  button {
    padding: 10px 12px;
  }

  .section-title {
    flex-direction: column;
  }

  .section-title button,
  .button-row,
  .button-row button,
  .segmented,
  .segmented button {
    width: 100%;
  }

  .button-row,
  .segmented {
    flex-direction: column;
  }

  .user-pill {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sidebar {
    padding: 8px 10px;
  }

  .nav {
    border-radius: 999px;
    font-size: 12px;
    padding: 9px 11px;
  }

  .card h4 {
    font-size: 13px;
  }

  .metric {
    line-height: 1.55;
  }

  .ratio-visual {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .ai-summary-text {
    font-size: 14px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .sidebar,
  .section-title button,
  .button-row,
  .message,
  .tab:not(.active) {
    display: none !important;
  }

  .layout,
  .content {
    display: block;
    padding: 0;
  }

  .panel,
  .table-wrap {
    box-shadow: none;
  }

  .print-report {
    border: 0;
    padding: 0;
  }
}
