:root {
  --dash-bg: #0a0a0b;
  --dash-surface: #141417;
  --dash-elevated: #1c1c21;
  --dash-line: #2f2f35;
  --dash-hover: #2a2a30;
  --dash-text: #f4f4f5;
  --dash-muted: #a1a1aa;
  --dash-accent: #ff6b35;
  --dash-mint: #8fb8ac;
  --dash-debt: #e08a8a;
  --dash-credit: #8fb8ac;
  --dash-warn: #f2b705;
  --dash-err: #e11d2e;
}

.dash-page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--dash-elevated) 0%, var(--dash-bg) 40%);
  color: var(--dash-text);
}

/* styles.css همه headerها را position:relative !important می‌کند؛ اینجا override */
body.dash-page header.dash-top,
.dash-top {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 10001 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 14px !important;
  padding-top: env(safe-area-inset-top, 0px) !important;
  height: calc(58px + env(safe-area-inset-top, 0px)) !important;
  min-height: calc(58px + env(safe-area-inset-top, 0px)) !important;
  max-height: calc(58px + env(safe-area-inset-top, 0px)) !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  border-bottom: 1px solid var(--dash-line);
  background:
    rgba(14, 14, 16, 0.97) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: none !important;
  box-shadow: none !important;
  overflow: hidden;
}

.dash-home {
  position: absolute;
  left: max(16px, env(safe-area-inset-left, 0px) + 12px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  color: #fff;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  box-sizing: border-box;
  transition: none;
}

.dash-home svg {
  width: 22px;
  height: 22px;
  display: block;
  flex: none;
}

.dash-home:hover,
.dash-home:focus-visible {
  background: rgba(255, 107, 53, 0.12);
  border-color: rgba(255, 107, 53, 0.45);
  color: var(--dash-accent);
  outline: none;
}

.dash-brand-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  max-width: calc(100% - 120px);
  pointer-events: none;
}

.dash-brand {
  margin: 0;
  max-width: 100%;
  font-size: clamp(1.05rem, 3.8vw, 1.28rem);
  font-weight: 800;
  color: var(--dash-text);
  text-align: center;
  line-height: 1.25;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.dash-brand::after {
  content: '';
  display: block;
  width: 28px;
  height: 2px;
  margin: 5px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--dash-accent), transparent);
}

.dash-year {
  margin: 0;
  min-height: 1.2em;
  color: var(--dash-muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.dash-year[hidden] {
  display: block !important;
  visibility: hidden;
}

.dash-wrap {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: calc(70px + env(safe-area-inset-top, 0px)) 16px 28px;
}

.dash-hero {
  text-align: center;
  padding: 28px 16px 20px;
  margin-bottom: 18px;
}

.dash-hero-lite {
  padding: 4px 12px 6px;
  margin-bottom: 8px;
}

.dash-meta {
  margin: 0;
  color: var(--dash-mint);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

.dash-site-card {
  margin-bottom: 14px;
  min-height: 0;
  padding: 12px;
  align-items: stretch;
  box-sizing: border-box;
}

.dash-site-card[hidden] {
  display: none !important;
}

.dash-site-board {
  display: grid;
  grid-template-columns: minmax(0, 0.5fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 8px;
  width: 100%;
  align-items: stretch;
  box-sizing: border-box;
}

.dash-site-seg,
.dash-site-kpi {
  display: contents;
}

.dash-site-seg__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 52px;
  margin: 0;
  border: 1px solid var(--dash-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--dash-muted);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 4px 2px;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
  box-sizing: border-box;
}

.dash-site-seg__btn[data-days="1"] {
  grid-column: 1;
  grid-row: 1;
}

.dash-site-seg__btn[data-days="30"] {
  grid-column: 1;
  grid-row: 2;
}

.dash-site-seg__btn.is-on {
  background: rgba(255, 107, 53, 0.18);
  border-color: rgba(255, 107, 53, 0.55);
  color: var(--dash-accent);
}

.dash-site-status {
  margin: 0 0 10px;
  text-align: center;
  color: var(--dash-muted);
  font-size: 0.74rem;
}

.dash-site-status.is-err {
  color: var(--dash-debt);
}

.dash-site-kpi__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 52px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid var(--dash-line);
  background: rgba(255, 255, 255, 0.02);
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
}

.dash-site-kpi__btn:nth-child(1) { grid-column: 2; grid-row: 1; }
.dash-site-kpi__btn:nth-child(2) { grid-column: 3; grid-row: 1; }
.dash-site-kpi__btn:nth-child(3) { grid-column: 2; grid-row: 2; }
.dash-site-kpi__btn:nth-child(4) { grid-column: 3; grid-row: 2; }

.dash-site-kpi__btn.is-on {
  border-color: rgba(255, 107, 53, 0.5);
  background: rgba(255, 107, 53, 0.1);
}

.dash-site-kpi__btn.is-ok .dash-site-kpi__value { color: var(--dash-mint); }
.dash-site-kpi__btn.is-bad .dash-site-kpi__value { color: var(--dash-debt); }

.dash-site-kpi__label {
  font-size: 0.66rem;
  color: var(--dash-muted);
  line-height: 1.3;
}

.dash-site-kpi__value {
  font-size: clamp(0.72rem, 3.2vw, 0.95rem);
  font-weight: 800;
  color: var(--dash-text);
  line-height: 1.2;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .dash-site-board {
    gap: 6px;
  }

  .dash-site-seg__btn {
    font-size: 0.56rem;
    border-radius: 10px;
    min-height: 48px;
  }

  .dash-site-kpi__btn {
    border-radius: 10px;
    padding: 7px 4px;
    min-height: 48px;
  }
}

.dash-site-detail {
  margin-top: 12px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--dash-line);
  background: #121218;
  width: 100%;
  box-sizing: border-box;
}

.dash-site-detail[hidden] {
  display: none !important;
}

.dash-site-detail h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  text-align: center;
}

.dash-site-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.dash-site-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}

.dash-site-table th,
.dash-site-table td {
  padding: 7px 4px;
  border-bottom: 1px solid #25252c;
  text-align: center;
  vertical-align: middle;
}

.dash-site-table th {
  color: #a1a1aa;
  background: #18181f;
}

.dash-site-table td.col-name {
  text-align: right;
  line-height: 1.4;
}

.dash-site-empty {
  margin: 0;
  text-align: center;
  color: var(--dash-muted);
  font-size: 0.76rem;
}

.dash-site-invoice-row {
  cursor: pointer;
}

.dash-site-invoice-row:hover td,
.dash-site-invoice-row.is-open td {
  background: rgba(255, 107, 53, 0.06);
}

.dash-site-invoice-row:focus-visible {
  outline: 2px solid #ff6b35;
  outline-offset: -2px;
}

.dash-site-invoice-no {
  color: #ff6b35;
  font-weight: 700;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.dash-site-invoice-detail > td {
  padding: 0 6px 10px;
  background: rgba(255, 255, 255, 0.02);
}

.dash-site-invoice {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--dash-line);
  background: #0a0a0b;
  text-align: right;
}

.dash-site-invoice__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-bottom: 8px;
  font-size: 0.68rem;
  color: var(--dash-muted);
}

.dash-site-invoice__contact {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--dash-line);
  font-size: 0.7rem;
  line-height: 1.6;
}

.dash-site-invoice__contact div {
  display: flex;
  gap: 8px;
}

.dash-site-invoice__contact dt {
  flex: 0 0 auto;
  color: var(--dash-muted);
}

.dash-site-invoice__contact dd {
  margin: 0;
  min-width: 0;
  color: #f4f4f5;
  overflow-wrap: anywhere;
}

.dash-site-invoice__contact a {
  color: #ff6b35;
  text-decoration: none;
  direction: ltr;
  unicode-bidi: isolate;
}

.dash-site-invoice__table th,
.dash-site-invoice__table td {
  padding: 6px 4px;
  font-size: 0.68rem;
}

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

@media (min-width: 900px) {
  .dash-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.dash-stat {
  background: var(--dash-surface);
  border: 1px solid var(--dash-line);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.dash-stat__label {
  margin: 0;
  color: var(--dash-muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.dash-stat__value {
  margin: 0;
  color: var(--dash-text);
  font-size: clamp(0.92rem, 3.4vw, 1.1rem);
  font-weight: 800;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-line;
}

.dash-stat.is-avg .dash-stat__value {
  color: #7aa2ff;
}

.dash-stat.is-mint .dash-stat__value {
  color: var(--dash-mint);
}

.dash-stat.is-credit .dash-stat__value {
  color: #7aa2ff;
}

.dash-stat.is-debt .dash-stat__value,
.dash-stat.is-unpaid .dash-stat__value {
  color: var(--dash-debt);
}

.dash-invoices-card {
  margin-bottom: 14px;
  min-height: auto;
  padding: 14px 0 0;
  align-items: stretch;
  box-sizing: border-box;
  overflow: hidden;
}

.dash-invoices-card > h2.dash-invoices-hint {
  margin: 0 auto 12px;
  padding: 0 12px;
  max-width: 40em;
  text-align: center;
  color: var(--dash-credit);
  font-size: clamp(0.78rem, 2.5vw, 1rem);
  font-weight: 600;
  line-height: 1.55;
}

.dash-invoices-card > h2.dash-invoices-hint > span {
  display: block;
  white-space: nowrap;
}

@media (min-width: 720px) {
  .dash-invoices-card > h2.dash-invoices-hint {
    font-size: 1rem;
  }

  .dash-invoices-card > h2.dash-invoices-hint > span {
    display: inline;
    white-space: normal;
  }

  .dash-invoices-card > h2.dash-invoices-hint > span + span {
    margin-right: 0.25em;
  }
}

.dash-invoices {
  width: 100%;
}

.dash-inv-table-wrap {
  width: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dash-inv-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.86rem;
}

.dash-inv-table thead th {
  padding: 10px 1px;
  background: #18181c;
  color: #d4d4d8;
  font-weight: 700;
  border-top: 1px solid var(--dash-line);
  border-bottom: 1px solid #2e2e36;
  text-align: center;
  vertical-align: middle;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: nowrap;
}

.dash-inv-table tbody td {
  padding: 11px 1px;
  border-bottom: 1px solid #222228;
  text-align: center;
  vertical-align: middle;
  color: #f4f4f5;
  line-height: 1.35;
  box-sizing: border-box;
}

.dash-inv-table tbody tr.dash-inv-row > td {
  white-space: nowrap;
}

.dash-inv-table tbody tr.dash-inv-row {
  cursor: pointer;
}

.dash-inv-table tbody tr.dash-inv-row:hover td {
  background: #1a1a20;
}

.dash-inv-table tbody tr.dash-inv-row.is-open td {
  background: #1c1c24;
}

.dash-inv-table tbody tr.dash-inv-detail > td {
  padding: 0;
  text-align: center;
  vertical-align: middle;
  background: #0e0e12;
  border-bottom: 1px solid #2a2a32;
}

.dash-inv-table tbody tr:last-child > td {
  border-bottom: 0;
}

/* چاپ | فاکتور | تاریخ | روز | مبلغ | مانده */
.dash-inv-table th:nth-child(1),
.dash-inv-table td.col-pdf { width: 36px; }
.dash-inv-table th:nth-child(2),
.dash-inv-table td.col-no { width: 13%; }
.dash-inv-table th:nth-child(3),
.dash-inv-table td.col-date { width: 12%; }
.dash-inv-table th:nth-child(4),
.dash-inv-table td.col-days { width: 12%; }
.dash-inv-table th:nth-child(5),
.dash-inv-table td.col-total { width: 25%; }
.dash-inv-table th:nth-child(6),
.dash-inv-table td.col-remain { width: 25%; }

.dash-inv-table td.col-no {
  font-weight: 800;
  font-size: 0.84rem;
  letter-spacing: 0.01em;
}

.dash-inv-table td.col-pdf {
  padding: 8px 0;
}

.dash-inv-table th:first-child,
.dash-inv-table td.col-pdf {
  padding-inline-start: 2px;
}

.dash-inv-table th:last-child,
.dash-inv-table td.col-remain {
  padding-inline-end: 2px;
}

.dash-inv-table td.col-no.is-settled { color: #4ade80; }
.dash-inv-table td.col-no.is-partial { color: #facc15; }
.dash-inv-table td.col-no.is-unpaid { color: #f87171; }

.dash-inv-table td.col-date {
  color: var(--dash-muted);
  font-size: 0.8rem;
}

.dash-inv-table td.col-days {
  font-weight: 700;
  color: #e6d48a;
  font-size: 0.76rem;
}

.dash-inv-table td.col-total,
.dash-inv-table td.col-remain {
  color: var(--dash-muted);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.dash-inv-detail-box {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.dash-inv-pdf {
  appearance: none;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 9px;
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dash-inv-pdf:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.4);
  color: #e0e7ff;
}

.dash-inv-pdf:disabled,
.dash-inv-pdf.is-busy {
  opacity: 0.55;
  cursor: wait;
}

.dash-inv-pdf__icon {
  display: block;
  width: 18px;
  height: 18px;
}

.dash-inv-more-wrap {
  margin: 0;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 12px;
}

.dash-inv-more {
  appearance: none;
  border: 1px solid rgba(143, 184, 172, 0.35);
  background: rgba(143, 184, 172, 0.08);
  color: var(--dash-credit);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.3;
}

.dash-inv-more:hover {
  background: rgba(143, 184, 172, 0.16);
  border-color: rgba(143, 184, 172, 0.55);
  color: var(--dash-credit);
}

.dash-inv-more-meta {
  margin: 0;
  color: var(--dash-muted);
  font-size: 0.7rem;
  text-align: center;
  white-space: nowrap;
  line-height: 1.3;
}

.dash-inv-more-meta.is-done {
  margin-top: 10px;
  text-align: center;
}

.dash-inv-empty.is-loading-detail {
  color: #a1a1aa;
}

.dash-inv-section {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 10px;
  border: 1px solid #26262e;
  border-radius: 10px;
  background: #121218;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.dash-inv-section h3 {
  margin: 0;
  width: 100%;
  font-size: 0.76rem;
  font-weight: 700;
  color: #e4e4e7;
  text-align: center;
  line-height: 1.45;
}

.dash-inv-section p.dash-inv-empty {
  margin: 0;
  width: 100%;
  color: var(--dash-muted);
  font-size: 0.7rem;
  text-align: center;
  line-height: 1.5;
  padding: 4px 0;
}

.dash-inv-mini {
  width: 100%;
  margin: 0 auto;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.66rem;
  text-align: center;
}

.dash-inv-table tbody tr.dash-inv-detail .dash-inv-mini th,
.dash-inv-table tbody tr.dash-inv-detail .dash-inv-mini td {
  padding-block: 16px !important;
  padding-inline: 6px !important;
  border-bottom: 1px solid #25252c;
  text-align: center !important;
  vertical-align: middle !important;
  line-height: 1.5;
  box-sizing: border-box;
}

.dash-inv-mini tbody tr:last-child td {
  border-bottom: none;
}

.dash-inv-mini th {
  color: #a1a1aa;
  font-weight: 600;
  background: #18181f;
}

.dash-inv-mini td {
  color: #e4e4e7;
}

.dash-inv-mini .col-name {
  text-align: center !important;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.dash-inv-mini .col-qty,
.dash-inv-mini .col-amt,
.dash-inv-mini .col-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: center !important;
}

.dash-inv-mini .col-amt {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dash-inv-mini .col-type {
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: center !important;
}

/* اقلام: نام کالا پهن، تعداد کم، مبلغ متوسط */
.dash-inv-mini.is-items .col-name { width: 52%; }
.dash-inv-mini.is-items .col-qty { width: 16%; }
.dash-inv-mini.is-items .col-amt { width: 32%; }

/* پرداخت‌ها: تاریخ، نوع، مبلغ */
.dash-inv-mini.is-pays .col-date { width: 32%; }
.dash-inv-mini.is-pays .col-type { width: 28%; }
.dash-inv-mini.is-pays .col-amt { width: 40%; }

/* برگشتی‌ها: کالا بیشترین فضا */
.dash-inv-mini.is-rets .col-date { width: 22%; }
.dash-inv-mini.is-rets .col-name { width: 40%; }
.dash-inv-mini.is-rets .col-qty { width: 14%; }
.dash-inv-mini.is-rets .col-amt { width: 24%; }

.dash-inv-mini .is-prize {
  color: #c4b5fd;
}

@media (max-width: 380px) {
  .dash-inv-mini {
    font-size: 0.62rem;
  }
  .dash-inv-table tbody tr.dash-inv-detail .dash-inv-mini th,
  .dash-inv-table tbody tr.dash-inv-detail .dash-inv-mini td {
    padding-block: 14px !important;
    padding-inline: 4px !important;
  }
  .dash-inv-mini.is-items .col-name { width: 48%; }
  .dash-inv-mini.is-items .col-qty { width: 16%; }
  .dash-inv-mini.is-items .col-amt { width: 36%; }
  .dash-inv-mini.is-pays .col-date { width: 30%; }
  .dash-inv-mini.is-pays .col-type { width: 28%; }
  .dash-inv-mini.is-pays .col-amt { width: 42%; }
}

.dash-invoices-empty {
  margin: 0;
  padding: 22px 14px 24px;
  text-align: center;
  color: var(--dash-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

@media (max-width: 420px) {
  .dash-inv-table {
    font-size: 0.82rem;
  }
  .dash-inv-table thead th {
    font-size: 0.7rem;
    padding: 9px 1px;
  }
  .dash-inv-table tbody td {
    padding: 10px 1px;
  }
  .dash-inv-table td.col-no {
    font-size: 0.8rem;
  }
  .dash-inv-table td.col-date {
    font-size: 0.78rem;
  }
  .dash-inv-table td.col-days {
    font-size: 0.74rem;
  }
  .dash-inv-table td.col-total,
  .dash-inv-table td.col-remain {
    font-size: 0.78rem;
  }
  .dash-inv-pdf {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
  }
  .dash-inv-pdf__icon {
    width: 16px;
    height: 16px;
  }
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dash-card {
  background: var(--dash-surface);
  border: 1px solid var(--dash-line);
  border-radius: 16px;
  padding: 16px 14px 14px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dash-card.wide {
  grid-column: 1 / -1;
}

.dash-card.dash-site-card {
  min-height: 0;
  padding: 12px;
  gap: 0;
}

.dash-card.dash-chart-card {
  min-height: 0;
  padding: 14px 12px 12px;
  align-items: stretch;
}

.dash-card.dash-chart-card > h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--dash-credit);
}

.dash-card h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--dash-text);
  text-align: center;
  width: 100%;
}

.dash-chart-box {
  position: relative;
  height: 240px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.dash-chart-box.tall {
  height: 270px;
}

.dash-products-card {
  margin-bottom: 14px;
  min-height: auto;
  padding: 14px 0 0;
  align-items: stretch;
  box-sizing: border-box;
  overflow: hidden;
}

.dash-products-card > h2 {
  margin: 0 auto 12px;
  padding: 0 14px;
  text-align: center;
  font-size: clamp(0.88rem, 2.7vw, 1rem);
  font-weight: 700;
  line-height: 1.6;
  color: var(--dash-credit);
}

.dash-products {
  width: 100%;
}

.dash-prod-table-wrap {
  width: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dash-prod-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.84rem;
}

.dash-prod-table thead th {
  padding: 11px 3px;
  background: #18181c;
  color: #d4d4d8;
  font-weight: 700;
  border-top: 1px solid var(--dash-line);
  border-bottom: 1px solid #2e2e36;
  text-align: center;
  vertical-align: middle;
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: nowrap;
}

.dash-prod-table tbody td {
  padding: 11px 6px;
  border-bottom: 1px solid #222228;
  text-align: center;
  vertical-align: middle;
  color: #f4f4f5;
  line-height: 1.35;
}

.dash-prod-table tbody tr.dash-prod-row:last-child td {
  border-bottom: none;
}

.dash-prod-table tbody tr.dash-prod-row:hover td {
  background: #1a1a20;
}

.dash-prod-table th:nth-child(1),
.dash-prod-table td.col-rank { width: 16%; }

.dash-prod-table th:nth-child(2),
.dash-prod-table td.col-name { width: 54%; }

.dash-prod-table th:nth-child(3),
.dash-prod-table td.col-qty { width: 30%; }

.dash-prod-table td.col-rank {
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}

.dash-prod-table td.col-name {
  text-align: right;
  padding-inline: 8px;
}

.dash-prod-name {
  margin: 0 0 6px;
  color: #f4f4f5;
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dash-prod-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(42, 42, 48, 0.9);
  overflow: hidden;
}

.dash-prod-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--dash-mint);
}

.dash-prod-table td.col-qty {
  color: var(--dash-muted);
  font-size: 0.82rem;
  font-weight: 400;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dash-products-empty {
  margin: 0;
  padding: 22px 14px 24px;
  text-align: center;
  color: var(--dash-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.dash-products .dash-inv-more-wrap {
  border-top: 1px solid var(--dash-line);
}

@media (max-width: 420px) {
  .dash-prod-table {
    font-size: 0.74rem;
  }
  .dash-prod-table thead th {
    font-size: 0.68rem;
    padding: 9px 2px;
  }
  .dash-prod-table tbody td {
    padding: 9px 4px;
  }
  .dash-prod-table td.col-rank {
    font-size: 0.78rem;
  }
  .dash-prod-table td.col-name,
  .dash-prod-table td.col-qty {
    font-size: 0.72rem;
  }
}

.dash-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--dash-muted);
}

.dash-state.is-loading:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.dash-state[hidden] {
  display: none !important;
}

.dash-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #fb923c;
  box-sizing: border-box;
  animation: dash-spin 0.75s linear infinite;
}

.dash-gate-msg {
  display: block;
}

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

.dash-state a {
  color: var(--dash-mint);
}

.dash-state.is-err {
  color: var(--dash-debt);
}

@media (max-width: 860px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .dash-card.wide {
    grid-column: auto;
  }
  .dash-chart-box.tall {
    height: 255px;
  }
  .dash-chart-box {
    height: 210px;
  }
}

@media (max-width: 560px) {
  body.dash-page header.dash-top,
  .dash-top {
    padding: 0 14px !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
    height: calc(58px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(58px + env(safe-area-inset-top, 0px)) !important;
    max-height: calc(58px + env(safe-area-inset-top, 0px)) !important;
  }
  .dash-wrap {
    padding-top: calc(70px + env(safe-area-inset-top, 0px));
  }
  .dash-home {
    left: max(16px, env(safe-area-inset-left, 0px) + 12px);
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    border-radius: 12px;
  }
  .dash-brand-wrap {
    max-width: calc(100% - 112px);
  }
  .dash-brand {
    font-size: clamp(1rem, 4.4vw, 1.18rem);
  }
  .dash-brand::after {
    width: 22px;
    margin-top: 4px;
  }
}
