:root {
  --midnight: #030b2f;
  --graphite: #07090c;
  --carbon: #10141a;
  --steel: #7d8792;
  --silver: #d8dee8;
  --paramount: #0057ff;
  --sky: #edf2f8;
  --ink: #11151c;
  --line: #dce3ee;
  --danger: #c5162e;
  --ok: #087f5b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(3, 11, 47, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(3, 11, 47, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #f7f9fc 0%, #edf2f8 100%);
  background-size: 32px 32px, 32px 32px, auto;
  color: var(--ink);
  font-family: Montserrat, Arial, sans-serif;
}

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

.shell {
  display: grid;
  grid-template-columns: 286px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  height: calc(100vh - 32px);
  margin: 16px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.11), transparent 34%),
    linear-gradient(180deg, #181c23 0%, #05070a 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  color: white;
}

.brand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
}

.brand-lockup {
  min-width: 0;
}

.brand-logo {
  width: 100%;
  max-width: 168px;
  height: auto;
}

.brand-logout {
  margin: 0;
}

.logout-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.logout-button:hover {
  border-color: rgba(255, 255, 255, 0.54);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.brand-control {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1;
}

.brand-descriptor {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
}

.nav a.active {
  border-color: rgba(255, 255, 255, 0.68);
  background: linear-gradient(180deg, #ffffff, #dfe5ef);
  color: #080a0e;
}

.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 14px 0 0;
}

.module-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(21, 25, 47, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: rgba(21, 25, 47, 0.62);
  font-size: 12px;
  font-weight: 900;
}

.module-tabs a.active {
  border-color: rgba(0, 87, 255, 0.36);
  background: var(--midnight);
  color: white;
}

.content {
  min-width: 0;
  padding: 16px 18px 32px 0;
}

.panel {
  border: 1px solid rgba(17, 21, 28, 0.14);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 55px rgba(17, 21, 28, 0.08);
}

.panel-dark {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 32px;
  background:
    radial-gradient(circle at 62% 38%, rgba(0, 87, 255, 0.23), transparent 26%),
    radial-gradient(circle at 34% 62%, rgba(255, 255, 255, 0.12), transparent 22%),
    linear-gradient(145deg, #1a1f27 0%, #030406 100%);
  color: white;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px;
  background:
    linear-gradient(90deg, rgba(0, 87, 255, 0.09), transparent 48%),
    rgba(255, 255, 255, 0.94);
}

.eyebrow {
  color: var(--paramount);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--midnight);
}

h1 {
  margin-top: 8px;
  font-size: 44px;
  font-weight: 900;
  line-height: 0.98;
}

h2 {
  font-size: 24px;
  font-weight: 900;
}

.grid {
  display: grid;
  gap: 20px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
}

.metric {
  position: relative;
  min-height: 132px;
  padding: 19px;
  overflow: hidden;
}

.metric::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--paramount), rgba(0, 87, 255, 0.08));
  content: "";
}

.metric-title {
  color: rgba(21, 25, 47, 0.58);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  color: var(--midnight);
  font-size: 31px;
  font-weight: 900;
  line-height: 1;
}

.metric-value small {
  color: rgba(21, 25, 47, 0.56);
  font-size: 15px;
  font-weight: 900;
}

.section-grid {
  grid-template-columns: 1.1fr 0.9fr;
  margin-top: 20px;
}

.control-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
}

.control-card {
  position: relative;
  display: grid;
  min-height: 292px;
  align-content: space-between;
  gap: 18px;
  padding: 20px;
  overflow: hidden;
  border-width: 2px;
  border-color: color-mix(in srgb, var(--module-color, #0057ff) 50%, rgba(17, 21, 28, 0.14));
}

.control-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 8px;
  background: var(--module-color, #0057ff);
  content: "";
}

.control-card h2 {
  margin-top: 18px;
  font-size: 28px;
  line-height: 1;
}

.control-card p {
  margin: 0;
  font-weight: 800;
  line-height: 1.35;
}

.control-card-grid {
  display: grid;
  gap: 8px;
}

.control-card-grid span {
  display: grid;
  gap: 3px;
  color: rgba(21, 25, 47, 0.52);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.control-card-grid strong {
  color: var(--midnight);
  font-size: 15px;
  text-transform: none;
}

.revenue-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 16px;
}

.revenue-filters label {
  display: grid;
  gap: 7px;
  color: rgba(21, 25, 47, 0.58);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  margin-top: 12px;
}

.pie-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 12px;
}

.pie-chart {
  width: 210px;
  aspect-ratio: 1;
  border: 12px solid white;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(21, 25, 47, 0.12), 0 18px 42px rgba(17, 21, 28, 0.12);
}

.dashboard-chart-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  margin-top: 20px;
}

.section {
  padding: 20px;
}

.chart-panel {
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 87, 255, 0.1), transparent 48%),
    linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
}

.chart-link {
  display: block;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.chart-link:hover {
  border-color: rgba(0, 87, 255, 0.34);
  box-shadow: 0 24px 70px rgba(0, 87, 255, 0.13);
  transform: translateY(-1px);
}

.chart-open-label {
  margin-top: 12px;
  color: var(--paramount);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

.chart-total {
  min-width: max-content;
  padding: 9px 13px;
  border: 1px solid rgba(0, 87, 255, 0.2);
  border-radius: 14px;
  background: white;
  color: var(--paramount);
  font-size: 18px;
  font-weight: 900;
}

.area-chart-shell {
  width: 100%;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(21, 25, 47, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.area-chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart-grid-line {
  stroke: rgba(3, 11, 47, 0.1);
  stroke-dasharray: 7 7;
  stroke-width: 2;
}

.chart-y-label,
.chart-x-label {
  fill: rgba(21, 25, 47, 0.52);
  font-size: 15px;
  font-weight: 800;
}

.chart-area-fill {
  opacity: 1;
}

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

.chart-point-halo {
  fill: white;
  stroke: rgba(0, 87, 255, 0.18);
  stroke-width: 10;
}

.chart-point {
  fill: var(--paramount);
  stroke: white;
  stroke-width: 5;
}

.sales-lines-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 249, 252, 0.92));
}

.chart-line-product {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
  opacity: 0.86;
}

.chart-point-product {
  stroke: white;
  stroke-width: 4;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(21, 25, 47, 0.1);
  border-radius: 999px;
  background: white;
  color: var(--midnight);
  font-size: 12px;
  font-weight: 900;
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(21, 25, 47, 0.06);
}

.source-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.source-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 14px 16px;
  border: 1px solid rgba(21, 25, 47, 0.1);
  border-radius: 16px;
  background: white;
}

.source-card strong,
.source-card b {
  color: var(--midnight);
  font-weight: 900;
}

.source-card span {
  display: block;
  margin-top: 4px;
  color: rgba(21, 25, 47, 0.54);
  font-size: 13px;
  font-weight: 800;
}

.empty-state {
  margin-top: 12px;
  padding: 20px;
  border: 1px solid rgba(21, 25, 47, 0.08);
  border-radius: 18px;
  background: white;
  color: rgba(21, 25, 47, 0.6);
  font-weight: 800;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

th {
  color: rgba(21, 25, 47, 0.5);
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 15px 14px;
  border-top: 1px solid rgba(21, 25, 47, 0.08);
  border-bottom: 1px solid rgba(21, 25, 47, 0.08);
  background: white;
  font-weight: 700;
}

td:first-child {
  border-left: 1px solid rgba(21, 25, 47, 0.08);
  border-radius: 14px 0 0 14px;
}

td:last-child {
  border-right: 1px solid rgba(21, 25, 47, 0.08);
  border-radius: 0 14px 14px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--midnight);
  border-radius: 14px;
  background: white;
  color: var(--midnight);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.btn-primary {
  background: var(--paramount);
  color: white;
}

.form-row {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(17, 21, 28, 0.2);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: rgba(21, 25, 47, 0.66);
  font-size: 13px;
  font-weight: 800;
}

.remember-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--paramount);
}

textarea {
  min-height: 98px;
  padding-top: 12px;
  resize: vertical;
}

.login-page {
  display: grid;
  grid-template-columns: minmax(360px, 620px) minmax(320px, 1fr);
  min-height: 100vh;
  gap: 18px;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 15%, rgba(255, 255, 255, 0.11), transparent 24%),
    radial-gradient(circle at 82% 80%, rgba(0, 87, 255, 0.24), transparent 26%),
    linear-gradient(145deg, #191e26 0%, #020304 58%, #000000 100%);
}

.login-hero {
  display: flex;
  min-height: calc(100vh - 36px);
  flex-direction: column;
  justify-content: space-between;
  padding: 34px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 32px 90px rgba(0, 0, 0, 0.38);
}

.login-identity {
  display: grid;
  gap: 24px;
  align-content: start;
}

.login-hero img {
  width: 280px;
  max-width: 100%;
}

.login-app-icon {
  width: 184px !important;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 38px;
  box-shadow: 0 22px 70px rgba(0, 87, 255, 0.22), 0 18px 45px rgba(0, 0, 0, 0.5);
}

.login-control {
  margin-top: 6px;
  color: #f5f7fb;
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
}

.login-db {
  width: max-content;
  padding: 8px 12px;
  border: 1px solid rgba(0, 122, 255, 0.45);
  border-radius: 999px;
  color: #5aa9ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.24em;
}

.login-copy {
  max-width: 520px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
}

.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-form {
  width: 100%;
  max-width: 520px;
  padding: 30px;
  border-color: rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 243, 249, 0.94));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

.passkey-login-button {
  width: 100%;
  margin-top: 12px;
  border-color: rgba(0, 87, 255, 0.28);
  background: #11151c;
  color: white;
}

.passkey-status {
  min-height: 18px;
  margin-top: 10px;
  color: rgba(21, 25, 47, 0.58);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.passkey-status.is-error {
  color: var(--danger);
}

.error {
  margin-top: 16px;
  padding: 14px;
  border: 3px solid rgba(197, 22, 46, 0.3);
  border-radius: 18px;
  background: #fff1f3;
  color: var(--danger);
  font-weight: 800;
}

.cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
}

.product-card {
  overflow: hidden;
  border-color: var(--product-accent, var(--midnight));
}

.product-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-bottom: 4px solid var(--product-accent, var(--paramount));
  background: var(--product-accent, var(--sky));
  object-fit: cover;
}

.product-body {
  padding: 18px;
}

.sku {
  color: var(--product-accent, var(--paramount));
  font-size: 13px;
  font-weight: 900;
}

.product-title {
  margin-top: 10px;
  color: var(--midnight);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.08;
}

.product-coverage {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(21, 25, 47, 0.1);
}

.product-coverage strong {
  color: var(--product-accent, var(--paramount));
  font-size: 15px;
  font-weight: 900;
  line-height: 1.18;
}

.product-coverage span {
  color: rgba(21, 25, 47, 0.52);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.product-fact {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(21, 25, 47, 0.09);
  border-radius: 12px;
  background: rgba(247, 249, 252, 0.92);
}

.product-fact span,
.product-fact em {
  display: block;
  overflow: hidden;
  color: rgba(21, 25, 47, 0.52);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.product-fact strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: var(--midnight);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.16;
}

.product-fact em {
  margin-top: 3px;
  color: var(--product-accent, var(--paramount));
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.muted {
  color: rgba(21, 25, 47, 0.58);
}

.bars {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bar-row {
  position: relative;
  display: grid;
  grid-template-columns: 96px 1fr auto;
  align-items: center;
  gap: 12px;
}

.bar-track {
  height: 24px;
  overflow: hidden;
  border: 3px solid rgba(21, 25, 47, 0.08);
  border-radius: 999px;
  background: var(--sky);
}

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

.bar-row[data-tooltip]:hover::after {
  position: absolute;
  z-index: 5;
  left: 96px;
  bottom: calc(100% + 8px);
  max-width: 320px;
  padding: 12px;
  border: 3px solid rgba(3, 11, 47, 0.12);
  border-radius: 18px;
  background: white;
  box-shadow: 0 18px 40px rgba(3, 11, 47, 0.14);
  color: var(--midnight);
  content: attr(data-tooltip);
  font-size: 13px;
  font-weight: 800;
}

.status {
  display: inline-flex;
  padding: 7px 12px;
  border: 3px solid rgba(21, 25, 47, 0.1);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status.arrived {
  border-color: rgba(8, 127, 91, 0.25);
  color: var(--ok);
}

.status.expected {
  border-color: rgba(0, 87, 255, 0.25);
  color: var(--paramount);
}

.status.received {
  border-color: rgba(8, 127, 91, 0.25);
  color: var(--ok);
}

.status.accrued {
  border-color: rgba(255, 0, 55, 0.25);
  color: #c51657;
}

.status.cancelled {
  border-color: rgba(197, 22, 46, 0.25);
  color: var(--danger);
}

.mobile-only {
  display: none;
}

.install-prompt {
  position: fixed;
  z-index: 50;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 14px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto 38px;
  align-items: center;
  gap: 12px;
  max-width: 620px;
  margin: 0 auto;
  padding: 12px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  background: rgba(3, 11, 47, 0.96);
  box-shadow: 0 24px 60px rgba(3, 11, 47, 0.26);
  color: white;
}

.install-prompt[hidden] {
  display: none;
}

.install-prompt-icon {
  width: 54px;
  height: 54px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  object-fit: cover;
}

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

.install-prompt-copy strong {
  font-size: 14px;
  font-weight: 900;
}

.install-prompt-copy span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.install-prompt-action,
.install-prompt-close {
  min-height: 38px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.install-prompt-action {
  padding: 0 12px;
  background: white;
  color: var(--midnight);
  font-size: 12px;
}

.install-prompt-close {
  width: 38px;
  background: transparent;
  color: white;
  font-size: 20px;
}

@media (max-width: 980px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    margin: 8px;
    padding: 10px;
    border-width: 3px;
    border-radius: 24px;
  }

  .brand {
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-width: 2px;
    border-radius: 20px;
  }

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

  .brand-logo {
    flex: 0 0 auto;
    width: 118px;
  }

  .brand-control {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    font-size: 16px;
  }

  .brand-descriptor {
    font-size: 8px;
  }

  .nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .nav a {
    justify-content: center;
    min-height: 44px;
    padding: 0 6px;
    border-width: 2px;
    border-radius: 16px;
    font-size: 11px;
  }

  .logout-button {
    min-height: 38px;
    padding: 0 13px;
    border-width: 2px;
  }

  .content {
    padding: 0 8px 24px;
  }

  .page-header {
    align-items: start;
    flex-direction: column;
    padding: 20px;
    border-radius: 24px;
  }

  h1 {
    font-size: 42px;
  }

  .grid {
    gap: 14px;
  }

  .metrics {
    margin-top: 14px;
  }

  .metric {
    min-height: 126px;
    padding: 18px;
    border-radius: 24px;
  }

  .metric-value {
    margin-top: 14px;
    font-size: 30px;
  }

  .section {
    padding: 18px;
  }

  .chart-panel,
  .section,
  .panel {
    border-radius: 24px;
  }

  .dashboard-chart-grid,
  .section-grid {
    grid-template-columns: 1fr;
  }

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

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

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

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

  .login-page {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .login-hero {
    min-height: 520px;
    padding: 26px;
  }

  .login-app-icon {
    width: 144px !important;
    border-radius: 30px;
  }

  .login-control {
    font-size: 44px;
  }
}

@media (max-width: 720px) {
  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .brand-logo {
    width: 112px;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 34px;
  }

  .sidebar {
    margin: 6px;
    padding: 8px;
  }

  .brand {
    gap: 10px;
  }

  .brand-logo {
    width: 102px;
  }

  .logout-button {
    min-height: 36px;
    padding: 0 11px;
    font-size: 9px;
  }

  .nav {
    gap: 6px;
  }

  .nav a {
    min-height: 42px;
    font-size: 10px;
  }

  .page-header {
    padding: 16px;
  }

  .login-page {
    gap: 12px;
  }

  .login-hero {
    min-height: 460px;
    padding: 22px;
  }

  .login-copy {
    font-size: 15px;
  }

  .login-form-wrap {
    padding: 0;
  }

  .login-form {
    padding: 22px;
  }

  .metric-value {
    font-size: 28px;
  }

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

  .control-cards,
  .revenue-filters,
  .form-grid,
  .pie-layout {
    grid-template-columns: 1fr;
  }

  .pie-chart {
    width: min(240px, 100%);
    justify-self: center;
  }

  .install-prompt {
    grid-template-columns: 48px minmax(0, 1fr) 34px;
    gap: 10px;
    padding: 10px;
    border-radius: 22px;
  }

  .install-prompt-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
  }

  .install-prompt-action {
    grid-column: 1 / -1;
    min-height: 42px;
  }

  .install-prompt-close {
    width: 34px;
    min-height: 34px;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 12px;
    border: 3px solid rgba(21, 25, 47, 0.08);
    border-radius: 20px;
    background: white;
  }

  td,
  td:first-child,
  td:last-child {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    padding: 11px 14px;
    border: 0;
    border-radius: 0;
  }

  td::before {
    color: rgba(21, 25, 47, 0.48);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

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

  .bar-row > strong:last-child {
    grid-column: 2;
  }
}

@media (max-width: 460px) {
  body {
    background-size: 24px 24px, 24px 24px, auto;
    -webkit-text-size-adjust: 100%;
  }

  .login-page {
    min-height: 100svh;
    gap: 10px;
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .login-hero {
    min-height: auto;
    padding: 18px;
    border-radius: 26px;
  }

  .login-identity {
    gap: 12px;
  }

  .login-app-icon {
    width: 112px !important;
    border-radius: 24px;
  }

  .login-hero img:not(.login-app-icon) {
    width: 180px;
  }

  .login-control {
    font-size: 32px;
    letter-spacing: 0.06em;
  }

  .login-db {
    padding: 7px 10px;
    font-size: 10px;
  }

  .login-copy {
    margin-top: 28px;
    font-size: 13px;
    line-height: 1.35;
  }

  .login-form {
    padding: 18px;
    border-radius: 24px;
  }

  .login-form h1 {
    font-size: 32px;
  }

  .form-row {
    margin-top: 13px;
    font-size: 11px;
  }

  .remember-row {
    margin-top: 13px;
    font-size: 12px;
  }

  input,
  select,
  textarea {
    min-height: 48px;
    padding: 0 14px;
    border-radius: 13px;
    font-size: 15px;
  }

  .sidebar {
    margin:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      8px
      max(8px, env(safe-area-inset-left));
    border-radius: 22px;
  }

  .brand {
    padding: 8px;
    border-radius: 18px;
  }

  .brand-logo {
    width: 86px;
  }

  .brand-control {
    font-size: 14px;
    letter-spacing: 0.1em;
  }

  .brand-descriptor {
    font-size: 7px;
  }

  .nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex: 0 0 auto;
    min-width: 84px;
    min-height: 40px;
    padding: 0 11px;
    font-size: 10px;
    scroll-snap-align: start;
  }

  .logout-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 8px;
  }

  .content {
    padding:
      0
      max(10px, env(safe-area-inset-right))
      calc(112px + env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .page-header {
    gap: 14px;
    padding: 15px;
    border-radius: 22px;
  }

  .page-header > div:last-child {
    width: 100%;
  }

  .page-header .btn {
    width: 100%;
  }

  .eyebrow {
    font-size: 10px;
  }

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

  h2 {
    font-size: 19px;
  }

  .grid {
    gap: 11px;
  }

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

  .module-tabs {
    flex-wrap: nowrap;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

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

  .module-tabs a {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 11px;
    font-size: 10px;
  }

  .control-cards {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 11px;
  }

  .control-card {
    min-height: 228px;
    padding: 15px;
    border-radius: 20px;
  }

  .control-card h2 {
    font-size: 24px;
  }

  .revenue-filters {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

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

  .metric {
    min-height: 106px;
    padding: 13px;
    border-radius: 20px;
  }

  .metric-title {
    font-size: 9px;
    line-height: 1.2;
  }

  .metric-value {
    gap: 5px;
    margin-top: 12px;
    font-size: 23px;
    line-height: 1.03;
  }

  .metric-value small {
    font-size: 10px;
  }

  .section {
    padding: 14px;
  }

  .dashboard-chart-grid,
  .section-grid {
    gap: 11px;
    margin-top: 11px;
  }

  .chart-heading {
    gap: 10px;
    margin-bottom: 8px;
  }

  .chart-total {
    padding: 7px 9px;
    border-radius: 12px;
    font-size: 13px;
  }

  .area-chart-shell {
    margin-top: 8px;
    border-radius: 16px;
  }

  .chart-y-label,
  .chart-x-label {
    font-size: 22px;
  }

  .chart-line {
    stroke-width: 10;
  }

  .chart-line-product {
    stroke-width: 8;
  }

  .chart-point-halo {
    stroke-width: 12;
  }

  .chart-legend {
    gap: 6px;
    margin-top: 10px;
  }

  .chart-legend-item {
    min-height: 30px;
    padding: 0 9px;
    font-size: 10px;
  }

  .source-stack {
    gap: 8px;
    margin-top: 12px;
  }

  .source-card {
    min-height: 58px;
    padding: 11px 12px;
    border-radius: 14px;
  }

  .source-card span {
    font-size: 11px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-card {
    border-radius: 18px;
  }

  .product-body {
    padding: 12px;
  }

  .sku {
    font-size: 10px;
  }

  .product-title {
    font-size: 15px;
    line-height: 1.12;
  }

  .product-coverage {
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
  }

  .product-coverage strong {
    font-size: 12px;
  }

  .product-coverage span {
    font-size: 8px;
    letter-spacing: 0.06em;
  }

  .product-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 9px;
  }

  .product-fact {
    padding: 7px 6px;
    border-radius: 10px;
  }

  .product-fact span,
  .product-fact em {
    font-size: 8px;
  }

  .product-fact strong {
    font-size: 9px;
  }

  .muted {
    font-size: 12px;
  }

  .bar-row {
    grid-template-columns: 76px 1fr;
    gap: 8px;
  }

  .bar-row strong {
    font-size: 11px;
  }

  .bar-track {
    height: 20px;
    border-width: 1px;
  }

  table {
    border-spacing: 0;
  }

  tr {
    border-width: 1px;
    border-radius: 16px;
  }

  td,
  td:first-child,
  td:last-child {
    grid-template-columns: 96px minmax(0, 1fr);
    padding: 9px 11px;
    font-size: 12px;
  }

  td::before {
    font-size: 9px;
  }

  .install-prompt {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    grid-template-columns: 44px minmax(0, 1fr) 32px;
    border-radius: 20px;
  }

  .install-prompt-icon {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 390px) {
  .metrics,
  .cards {
    grid-template-columns: 1fr;
  }
}
