/* EMII Admin v6.9.7.4 — Home Dashboard Hero Refinement */

/* ── Hero ─────────────────────────────────────────── */
.app-hero {
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 14px;
}
.app-hero h2 {
  margin: 4px 0 6px;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 900;
  letter-spacing: -0.4px;
}
.app-hero p {
  margin: 0;
  color: var(--emii-muted);
  font-size: 13px;
  line-height: 1.8;
  max-width: 680px;
}

/* ── Home two-column grid ────────────────────────── */
.app-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 640px) {
  .app-home-grid { grid-template-columns: 1fr; }
}

/* ── Entity scroller (حساب‌ها) ──────────────────── */
.app-entity-scroller {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.app-entity-scroller::-webkit-scrollbar { display: none; }

.app-entity-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 80px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--emii-field-bg);
  border: 1px solid var(--emii-line);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
}
.app-entity-card:hover { background: var(--emii-hover); }
.app-entity-card.is-active { border-color: var(--emii-blue); background: rgba(0,122,255,.07); }
.app-entity-card strong { font-size: 12px; font-weight: 800; display: block; }
.app-entity-card small  { font-size: 11px; color: var(--emii-muted); font-weight: 700; display: block; }

.app-entity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c, var(--emii-blue));
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Supply chips ────────────────────────────────── */
.app-supply-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.app-supply-chips::-webkit-scrollbar { display: none; }

.app-supply-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 90px;
  padding: 12px 10px;
  border-radius: 16px;
  background: var(--emii-field-bg);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  border-color: color-mix(in srgb, var(--c) 25%, transparent);
}
.app-supply-chip:hover { background: color-mix(in srgb, var(--c) 8%, var(--emii-field-bg)); }
.app-supply-chip span { font-size: 20px; }
.app-supply-chip b    { font-size: 12px; font-weight: 800; white-space: nowrap; }
.app-supply-chip small{ font-size: 11px; color: var(--emii-muted); font-weight: 700; }

/* ── Page visibility ─────────────────────────────── */
.emii-page { display: block; }
.emii-page--hidden { display: none; }

/* ── Toast global fix: بالای صفحه ────────────────── */
.emii-toast-stack {
  position: fixed !important;
  top: 20px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  bottom: auto !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 260px !important;
  max-width: min(420px, calc(100vw - 32px)) !important;
  pointer-events: none !important;
}
.emii-toast {
  pointer-events: auto !important;
  width: 100% !important;
}


/* v6.9.7.18 — mobile layout, orders and charts polish */

.app-hero--dashboard {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.app-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.app-hero--dashboard h2 {
  margin: 0;
  max-width: 640px;
}

.app-hero--dashboard p {
  max-width: 760px;
}

.app-hero-rate {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--emii-line);
  background: var(--emii-field-bg);
  border-radius: 16px;
  padding: 9px 10px;
}

.app-hero-rate strong {
  font-size: 12px;
  font-weight: 900;
}

.home-shortcut-scroller {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.home-shortcut-scroller::-webkit-scrollbar {
  display: none;
}

.home-shortcut-card {
  position: relative;
  min-width: 112px;
  min-height: 118px;
  border: 1px solid var(--emii-line);
  background: var(--emii-field-bg);
  border-radius: 18px;
  padding: 11px;
  text-align: center;
  display: grid;
  place-items: center;
  gap: 4px;
  cursor: pointer;
}

.home-shortcut-card.is-active {
  border-color: var(--emii-blue);
  background: rgba(0,122,255,.07);
}

.home-shortcut-card.is-disabled {
  opacity: .62;
  cursor: not-allowed;
}

.home-shortcut-card strong {
  font-size: 12px;
  font-weight: 950;
}

.home-shortcut-card small {
  font-size: 10.5px;
  color: var(--emii-muted);
  line-height: 1.55;
}

.home-shortcut-card em {
  font-style: normal;
  font-size: 10px;
}

.home-shortcut-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--c, var(--emii-blue));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 950;
}

.home-chart-grid,
.home-ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.home-chart-card {
  min-height: 210px;
}

.home-bar-chart {
  height: 116px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 9px;
  padding: 12px 4px 4px;
  border-bottom: 1px solid var(--emii-line);
}

.home-bar-chart span {
  flex: 1;
  min-width: 18px;
  height: var(--h);
  border-radius: 14px 14px 6px 6px;
  background: color-mix(in srgb, var(--emii-green) 72%, transparent);
  position: relative;
}

.home-bar-chart b {
  position: absolute;
  bottom: -23px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--emii-muted);
}

.home-line-chart {
  width: 100%;
  height: 116px;
  color: var(--emii-blue);
  background: linear-gradient(180deg, rgba(0,122,255,.08), transparent);
  border-radius: 16px;
  padding: 8px;
}

.home-line-chart circle {
  fill: currentColor;
}

.home-chart-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 11px;
  color: var(--emii-muted);
  font-weight: 850;
}

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

.home-action-card {
  border: 1px solid var(--emii-line);
  background: var(--emii-field-bg);
  border-radius: 18px;
  padding: 12px;
  text-align: right;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.home-action-card.is-disabled {
  opacity: .62;
  cursor: not-allowed;
}

.home-action-icon {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 950;
  font-size: 18px;
}

.home-action-icon.is-green { background: var(--emii-green); }
.home-action-icon.is-red { background: var(--emii-red); }
.home-action-icon.is-orange { background: var(--emii-orange); }
.home-action-icon.is-gray { background: #94a3b8; }

.home-action-card strong {
  font-size: 13px;
  font-weight: 950;
}

.home-action-card small {
  color: var(--emii-muted);
  line-height: 1.6;
  font-size: 11px;
}

.home-action-card em {
  justify-self: start;
  font-style: normal;
}

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

.home-manager-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--emii-line);
  background: var(--emii-field-bg);
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: right;
}

.home-manager-list b {
  font-size: 12px;
  font-weight: 950;
}

@media (max-width: 760px) {

  .home-chart-grid,
  .home-ops-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 420px) {
  .app-hero--dashboard {
    padding: 14px;
  }

  .home-shortcut-card {
    min-width: 104px;
  }

  .home-action-grid {
    grid-template-columns: 1fr;
  }
}


/* v6.9.7.6 — restored old home management cards */
.home-restored-cards {
  display: grid;
  gap: 12px;
}

.home-restored-cards > .emii-card {
  margin-top: 0;
}

.home-restored-cards .app-home-grid {
  margin-top: 0;
}

@media (min-width: 980px) {
  .home-restored-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .home-restored-cards > .emii-card {
    min-height: 100%;
  }

  .home-restored-cards > .emii-card:nth-child(2),
  .home-restored-cards > .emii-card:nth-child(3) {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .home-restored-cards {
    gap: 10px;
  }
}


/* v6.9.7.7 — Falcon-style blue payment chart */
.home-blue-chart-card {
  position: relative;
  overflow: hidden;
  min-height: 332px;
  border: 0;
  background-color: #075fd6;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.28), transparent 30%),
    linear-gradient(135deg, #1677ff 0%, #0057d8 54%, #0046b7 100%);
  color: #fff;
  box-shadow: 0 28px 80px rgba(0,87,216,.28);
}

.home-blue-chart-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.10) 1px, transparent 1px) 0 0 / 96px 100%,
    linear-gradient(180deg, rgba(255,255,255,.08) 1px, transparent 1px) 0 34px / 100% 45px;
  opacity: .42;
  pointer-events: none;
}

.home-blue-chart-card > * {
  position: relative;
  z-index: 1;
}

.home-blue-chart-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.home-blue-chart-kicker {
  display: block;
  color: rgba(255,255,255,.78);
  font-size: 11px;
  font-weight: 850;
  margin-bottom: 5px;
}

.home-blue-chart-top strong {
  display: block;
  color: #fff;
  font-size: clamp(24px, 4vw, 37px);
  font-weight: 950;
  letter-spacing: -.8px;
  line-height: 1.05;
}

.home-blue-chart-top small {
  display: block;
  margin-top: 7px;
  color: rgba(255,255,255,.74);
  font-size: 11.5px;
  font-weight: 800;
}

.home-blue-chart-top small b {
  color: #fff;
  font-weight: 950;
}

.home-blue-chart-tabs {
  display: flex;
  gap: 5px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
  white-space: nowrap;
}

.home-blue-chart-tabs button {
  border: 0;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: rgba(255,255,255,.78);
  background: transparent;
  font-size: 10.5px;
  font-weight: 950;
  cursor: pointer;
}

.home-blue-chart-tabs button.is-active {
  color: #075fc8;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,.10);
}

.home-blue-chart-body {
  margin: 4px -8px 0;
}

.home-blue-chart-svg {
  display: block;
  width: 100%;
  min-height: 192px;
  overflow: visible;
}

.home-blue-chart-grid line {
  stroke: rgba(255,255,255,.17);
  stroke-width: 1;
}

.home-blue-chart-area {
  fill: url(#homeBlueChartArea);
  opacity: .96;
  transition: d .24s ease;
}

.home-blue-chart-line {
  fill: none;
  stroke: #fff;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.16));
  transition: d .24s ease;
}

.home-blue-chart-points circle {
  fill: #fff;
  stroke: rgba(255,255,255,.45);
  stroke-width: 5;
  filter: drop-shadow(0 7px 14px rgba(0,0,0,.18));
  transition: cx .24s ease, cy .24s ease;
}

.home-blue-chart-axis text {
  fill: rgba(255,255,255,.74);
  font-size: 19px;
  font-weight: 850;
  text-anchor: middle;
}

.home-blue-chart-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: -4px;
}

.home-blue-chart-foot span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,.78);
  font-size: 11.5px;
  font-weight: 850;
}

.home-blue-chart-foot i {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.16);
}

.home-blue-chart-foot i.is-soft {
  background: rgba(255,255,255,.55);
}

.home-blue-chart-foot b {
  color: #fff;
  font-weight: 950;
}

[data-theme="dark"] .home-blue-chart-card,
.emii-app[data-theme="dark"] .home-blue-chart-card {
  background-color: #073270;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.18), transparent 30%),
    linear-gradient(135deg, #0b63db 0%, #06499f 54%, #073270 100%);
  box-shadow: 0 28px 80px rgba(0,0,0,.30);
}

@media (max-width: 760px) {
  .home-blue-chart-card {
    min-height: 300px;
    padding: 14px;
  }

  .home-blue-chart-top {
    display: grid;
    gap: 10px;
  }

  .home-blue-chart-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .home-blue-chart-tabs button {
    flex: 1;
  }

  .home-blue-chart-body {
    margin-inline: -12px;
  }

  .home-blue-chart-svg {
    min-height: 170px;
  }

  .home-blue-chart-foot {
    gap: 8px;
  }
}




/* v6.9.7.9 — finance chart grid and hard light-mode backgrounds */
.home-finance-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

#pagHome .home-finance-chart-grid > .home-blue-chart-card.emii-card.emii-glass {
  min-height: 332px;
  margin: 0;
}

#pagHome .home-blue-chart-card.emii-card.emii-glass {
  background: #075fd6
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.28), transparent 30%);
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.28), transparent 30%),
    linear-gradient(135deg, #1677ff 0%, #0057d8 54%, #0046b7 100%);
  color: #fff;
  border-color: transparent;
}

#pagHome .home-red-chart-card.emii-card.emii-glass {
  background: #d92736
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.24), transparent 30%);
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.24), transparent 30%),
    linear-gradient(135deg, #ff4d5e 0%, #d92736 56%, #ad1524 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 28px 80px rgba(217,39,54,.25);
}

[data-theme="dark"] #pagHome .home-blue-chart-card.emii-card.emii-glass,
.emii-app[data-theme="dark"] #pagHome .home-blue-chart-card.emii-card.emii-glass {
  background: #073270;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.18), transparent 30%),
    linear-gradient(135deg, #0b63db 0%, #06499f 54%, #073270 100%);
  box-shadow: 0 28px 80px rgba(0,0,0,.30);
}

[data-theme="dark"] #pagHome .home-red-chart-card.emii-card.emii-glass,
.emii-app[data-theme="dark"] #pagHome .home-red-chart-card.emii-card.emii-glass {
  background: #741222;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.16), transparent 30%),
    linear-gradient(135deg, #c92b3e 0%, #9f1d30 56%, #741222 100%);
  box-shadow: 0 28px 80px rgba(0,0,0,.30);
}

.home-blue-chart-body {
  position: relative;
}

.home-blue-chart-tooltip {
  position: absolute;
  right: var(--x, 50%);
  top: var(--y, 50%);
  min-width: 128px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  color: #0f172a;
  box-shadow: 0 18px 44px rgba(0,0,0,.18);
  display: grid;
  gap: 3px;
  transform: translate(50%, calc(-100% - 14px));
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
  z-index: 5;
}

.home-blue-chart-tooltip::after {
  content: "";
  position: absolute;
  right: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: rgba(255,255,255,.96);
  transform: translateX(50%) rotate(45deg);
}

.home-blue-chart-tooltip.is-visible {
  opacity: 1;
  transform: translate(50%, calc(-100% - 10px));
}

.home-blue-chart-tooltip b {
  font-size: 11px;
  font-weight: 950;
}

.home-blue-chart-tooltip span {
  color: #64748b;
  font-size: 10.5px;
  font-weight: 850;
}

.home-blue-chart-tooltip strong {
  font-size: 13px;
  font-weight: 950;
}

@media (max-width: 980px) {
  .home-finance-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .home-finance-chart-grid {
    gap: 10px;
  }

  .home-blue-chart-tooltip {
    min-width: 112px;
    padding: 8px 9px;
  }
}


/* v6.9.7.13 — merged elements on legacy Home, without rebuilding dashboard */
.home-legacy-elements {
  display: grid;
  gap: 12px;
}

.home-legacy-elements > .emii-card {
  margin: 0;
}

.home-legacy-product-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--emii-line);
  margin: 12px -16px -16px;
}

.home-legacy-product-list article {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
  min-height: 82px;
  padding: 12px 14px;
  border-left: 1px solid var(--emii-line);
  cursor: default;
}

.home-legacy-product-list article:last-child {
  border-left: 0;
}

.home-legacy-product-list article:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--emii-primary, #2f7de1) 32%, transparent);
  outline-offset: -3px;
}

.home-legacy-product-list img {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--emii-line);
  background: var(--emii-surface, #fff);
  object-fit: cover;
}

.home-legacy-product-list strong {
  display: block;
  color: var(--emii-text);
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-legacy-product-list span {
  display: block;
  margin-top: 2px;
  color: var(--emii-muted);
  font-size: 11px;
  font-weight: 850;
}

.home-legacy-product-list b {
  display: block;
  height: 5px;
  margin-top: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--emii-line) 74%, transparent);
  overflow: hidden;
}

.home-legacy-product-list em {
  display: block;
  width: var(--p);
  height: 100%;
  border-radius: inherit;
  background: var(--emii-primary, #2f7de1);
}

.home-legacy-product-list small {
  color: var(--emii-muted);
  font-size: 11px;
  font-weight: 950;
  text-align: left;
}

.home-legacy-table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.home-legacy-table-actions button {
  border: 1px solid var(--emii-line);
  background: var(--emii-surface, #fff);
  color: var(--emii-text);
  min-height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 850;
  cursor: pointer;
}

.home-legacy-order-table {
  display: grid;
  margin: 12px -16px -16px;
  border-top: 1px solid var(--emii-line);
}

.home-legacy-order-table [role="row"] {
  display: grid;
  grid-template-columns: 82px 100px minmax(170px, 1fr) 150px 90px;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--emii-line);
}

.home-legacy-order-table [role="row"]:last-child {
  border-bottom: 0;
}

.home-legacy-order-table .is-head {
  background: var(--emii-surface-soft, #f6f8fb);
}

.home-legacy-order-table span {
  color: var(--emii-text);
  font-size: 12px;
  font-weight: 850;
}

.home-legacy-order-table .is-head span {
  color: var(--emii-muted);
  font-size: 11px;
  font-weight: 950;
}

.home-legacy-order-table .is-success,
.home-legacy-order-table .is-blocked {
  justify-self: start;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
}

.home-legacy-order-table .is-success {
  color: var(--emii-success, #10b981);
  background: color-mix(in srgb, var(--emii-success, #10b981) 14%, transparent);
}

.home-legacy-order-table .is-blocked {
  color: var(--emii-muted);
  background: color-mix(in srgb, var(--emii-line) 54%, transparent);
}

.home-info-tooltip {
  position: absolute;
  right: var(--x, 50%);
  top: var(--y, 50%);
  z-index: 40;
  min-width: 180px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--emii-text, #0f172a) 92%, transparent);
  color: #fff;
  box-shadow: 0 18px 44px rgba(15,23,42,.22);
  font-size: 11.5px;
  font-weight: 850;
  line-height: 1.7;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, calc(-100% - 12px));
  transition: opacity .14s ease, transform .14s ease;
}

.home-info-tooltip::after {
  content: "";
  position: absolute;
  right: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: inherit;
  transform: translateX(50%) rotate(45deg);
}

.home-info-tooltip.is-visible {
  opacity: 1;
  transform: translate(50%, calc(-100% - 8px));
}

@media (max-width: 1180px) {
  .home-legacy-product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-legacy-product-list article:nth-child(2n) {
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .home-legacy-product-list {
    grid-template-columns: 1fr;
  }

  .home-legacy-product-list article,
  .home-legacy-product-list article:nth-child(2n),
  .home-legacy-product-list article:last-child {
    border-left: 0;
    border-bottom: 1px solid var(--emii-line);
  }

  .home-legacy-product-list article:last-child {
    border-bottom: 0;
  }

  .home-legacy-order-table [role="row"] {
    grid-template-columns: 60px 78px minmax(0, 1fr);
    padding: 0 12px;
  }

  .home-legacy-order-table [role="row"] span:nth-child(4),
  .home-legacy-order-table [role="row"] span:nth-child(5) {
    display: none;
  }

  .home-legacy-table-actions {
    width: 100%;
  }

  .home-legacy-table-actions button {
    flex: 1;
  }
}


/* v6.9.7.14 — structured legacy additions without Home rebuild */
#pagHome .app-hero--dashboard {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  grid-template-areas:
    "meta art"
    "title art"
    "greet art"
    "rate art"
    "shortcuts shortcuts";
  gap: 10px 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 12%, color-mix(in srgb, var(--emii-primary, #1677ff) 18%, transparent), transparent 30%),
    linear-gradient(135deg, color-mix(in srgb, var(--emii-surface, #fff) 90%, var(--emii-primary-soft, #eef6ff) 10%), var(--emii-surface, #fff));
}

#pagHome .app-hero--dashboard .app-hero-meta {
  grid-area: meta;
}

#pagHome .app-hero--dashboard h2 {
  grid-area: title;
}

#pagHome .app-hero--dashboard #homeGreeting {
  grid-area: greet;
}

#pagHome .app-hero--dashboard .app-hero-rate {
  grid-area: rate;
}

#pagHome .app-hero--dashboard .home-shortcut-scroller {
  grid-area: shortcuts;
}

.home-hero-store-art {
  grid-area: art;
  align-self: center;
  justify-self: center;
  width: min(260px, 100%);
  min-height: 150px;
}

.home-hero-store-art svg {
  width: 100%;
  height: auto;
  display: block;
}

.home-store-shadow {
  fill: none;
  stroke: color-mix(in srgb, var(--emii-muted, #718096) 20%, transparent);
  stroke-width: 10;
  stroke-linecap: round;
}

.home-store-awning {
  fill: color-mix(in srgb, var(--emii-primary, #1677ff) 76%, #fff 24%);
}

.home-store-stripes path:nth-child(odd) {
  fill: url(#homeStoreRoof);
}

.home-store-stripes path:nth-child(even) {
  fill: color-mix(in srgb, var(--emii-surface, #fff) 78%, var(--emii-primary-soft, #eef6ff) 22%);
}

.home-store-base {
  fill: color-mix(in srgb, var(--emii-surface, #fff) 88%, var(--emii-primary-soft, #eef6ff) 12%);
  stroke: color-mix(in srgb, var(--emii-primary, #1677ff) 28%, var(--emii-line, #dbe3ee));
  stroke-width: 4;
}

.home-store-door {
  fill: color-mix(in srgb, var(--emii-primary, #1677ff) 16%, var(--emii-surface, #fff));
}

.home-store-window {
  fill: color-mix(in srgb, var(--emii-primary, #1677ff) 22%, #fff);
  stroke: color-mix(in srgb, var(--emii-primary, #1677ff) 18%, transparent);
  stroke-width: 3;
}

.home-store-sign {
  fill: var(--emii-primary, #1677ff);
}

.home-hero-store-art text {
  fill: #fff;
  font-size: 18px;
  font-weight: 950;
}

.home-store-dot {
  fill: var(--emii-success, #10b981);
}

.home-store-dot.is-b {
  fill: var(--emii-warning, #f59e0b);
}

#pagHome .home-shortcut-scroller {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
}

.home-dashboard-shortcut {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--emii-line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--emii-surface, #fff) 92%, var(--emii-primary-soft, #eef6ff) 8%);
  color: var(--emii-text);
  text-align: right;
  cursor: pointer;
}

.home-dashboard-shortcut:hover {
  border-color: color-mix(in srgb, var(--emii-primary, #1677ff) 40%, var(--emii-line));
}

.home-dashboard-shortcut.is-active {
  border-color: color-mix(in srgb, var(--emii-primary, #1677ff) 48%, var(--emii-line));
  background: color-mix(in srgb, var(--emii-primary, #1677ff) 10%, var(--emii-surface, #fff));
}

.home-dashboard-shortcut.is-disabled {
  opacity: .68;
  cursor: default;
}

.home-dashboard-shortcut-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  color: var(--emii-primary, #1677ff);
  background: color-mix(in srgb, var(--emii-primary, #1677ff) 12%, transparent);
  font-weight: 950;
}

.home-dashboard-shortcut strong {
  color: var(--emii-text);
  font-size: 13px;
  font-weight: 950;
}

.home-dashboard-shortcut small {
  color: var(--emii-muted);
  font-size: 11px;
  font-weight: 850;
}

.home-dashboard-shortcut em {
  display: none;
}

.home-legacy-analytics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.home-legacy-mini-card {
  min-height: 146px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.home-legacy-mini-card:focus-visible,
.home-legacy-large-bars [data-home-info-tooltip]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--emii-primary, #1677ff) 32%, transparent);
  outline-offset: 3px;
}

.home-legacy-card-copy {
  justify-self: end;
  text-align: left;
}

.home-legacy-card-copy h3,
.home-legacy-channel-list h3 {
  margin: 0;
  color: var(--emii-text);
  font-size: 13px;
  font-weight: 950;
}

.home-legacy-card-copy strong {
  display: block;
  margin-top: 12px;
  color: var(--emii-text);
  font-size: 25px;
  font-weight: 950;
}

.home-legacy-card-copy span {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
}

.home-legacy-card-copy .is-up {
  color: var(--emii-success, #10b981);
  background: color-mix(in srgb, var(--emii-success, #10b981) 13%, transparent);
}

.home-legacy-card-copy .is-info {
  color: var(--emii-primary, #1677ff);
  background: color-mix(in srgb, var(--emii-primary, #1677ff) 12%, transparent);
}

.home-legacy-gauge {
  width: 132px;
  height: 74px;
  position: relative;
  overflow: hidden;
}

.home-legacy-gauge::before,
.home-legacy-gauge i {
  content: "";
  position: absolute;
  inset: 0;
  border: 17px solid color-mix(in srgb, var(--emii-line) 72%, transparent);
  border-bottom: 0;
  border-radius: 132px 132px 0 0;
}

.home-legacy-gauge i {
  border-color: var(--emii-primary, #1677ff);
  clip-path: polygon(0 0, var(--p) 0, var(--p) 100%, 0 100%);
}

.home-legacy-gauge small {
  position: absolute;
  right: 26px;
  bottom: 1px;
  color: var(--emii-muted);
  font-size: 11px;
  font-weight: 850;
}

.home-legacy-bars {
  display: flex;
  align-items: end;
  gap: 8px;
  width: 118px;
  height: 76px;
}

.home-legacy-bars i {
  width: 9px;
  height: var(--h);
  border-radius: 999px;
  background: var(--emii-primary, #1677ff);
}

.home-legacy-bars i:nth-child(3),
.home-legacy-bars i:nth-child(5) {
  background: color-mix(in srgb, var(--emii-line) 72%, transparent);
}

.home-legacy-spark {
  width: 142px;
  height: 76px;
}

.home-legacy-spark svg {
  width: 100%;
  height: 100%;
}

.home-legacy-spark path {
  fill: none;
  stroke: var(--emii-primary, #1677ff);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-legacy-donut {
  width: 106px;
  height: 106px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, var(--emii-surface, #fff) 0 49%, transparent 50%),
    conic-gradient(var(--emii-primary, #1677ff) 0 57%, #38bdf8 57% 79%, var(--emii-warning, #f59e0b) 79% 100%);
}

.home-legacy-donut b {
  color: var(--emii-text);
  font-size: 18px;
  font-weight: 950;
}

.home-legacy-channel-list {
  display: grid;
  gap: 6px;
}

.home-legacy-channel-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--emii-muted);
  font-size: 11.5px;
  font-weight: 850;
}

.home-legacy-channel-list i {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--emii-primary, #1677ff);
}

.home-legacy-channel-list i.is-cyan {
  background: #38bdf8;
}

.home-legacy-channel-list i.is-warm {
  background: var(--emii-warning, #f59e0b);
}

.home-legacy-large-bar-chart {
  overflow: hidden;
}

.home-legacy-large-bars {
  height: 280px;
  margin: 14px 0 4px;
  padding: 16px 8px 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  border-radius: 20px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--emii-line) 36%, transparent) 1px, transparent 1px) 0 0 / 100% 52px,
    color-mix(in srgb, var(--emii-surface-soft, #f6f8fb) 68%, transparent);
}

.home-legacy-large-bars div {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 24px;
  grid-template-columns: repeat(2, 16px);
  gap: 0 5px;
  align-items: end;
  justify-content: center;
  position: relative;
}

.home-legacy-large-bars span {
  display: block;
  height: var(--h);
  min-height: 14px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--emii-primary, #1677ff), color-mix(in srgb, var(--emii-primary, #1677ff) 70%, #001b54));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--emii-primary, #1677ff) 20%, transparent);
}

.home-legacy-large-bars span.is-woo {
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
}

.home-legacy-large-bars b {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--emii-muted);
  font-size: 12px;
  font-weight: 950;
}

.home-legacy-chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--emii-muted);
  font-size: 12px;
  font-weight: 850;
}

.home-legacy-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.home-legacy-chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--emii-primary, #1677ff);
}

.home-legacy-chart-legend i.is-woo {
  background: #38bdf8;
}

@media (max-width: 1180px) {
  #pagHome .app-hero--dashboard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "art"
      "meta"
      "title"
      "greet"
      "rate"
      "shortcuts";
  }

  .home-hero-store-art {
    width: min(260px, 100%);
    min-height: 132px;
    order: -1;
  }

  .home-legacy-analytics,
  #pagHome .home-shortcut-scroller {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #pagHome .app-hero--dashboard {
    gap: 8px;
  }

  .home-hero-store-art {
    width: min(220px, 100%);
    min-height: 118px;
    justify-self: center;
  }

  .home-legacy-analytics,
  #pagHome .home-shortcut-scroller {
    grid-template-columns: 1fr;
  }

  .home-legacy-mini-card {
    min-height: 124px;
  }

  .home-legacy-large-bars {
    height: 230px;
    gap: 6px;
    padding-inline: 4px;
  }

  .home-legacy-large-bars div {
    grid-template-columns: repeat(2, 11px);
    gap: 0 4px;
  }
}


/* v6.9.7.15 — 2x2 analytics, compare chart toggles, tooltip positioning fix */
.home-legacy-analytics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-blue-chart-tooltip {
  right: auto;
  left: var(--x, 50%);
  transform: translate(-50%, calc(-100% - 12px));
}

.home-blue-chart-tooltip::after {
  right: auto;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.home-blue-chart-tooltip.is-visible {
  transform: translate(-50%, calc(-100% - 8px));
}

.home-info-tooltip {
  right: auto;
  left: var(--tooltip-left, 50%);
  top: var(--tooltip-top, 50%);
  transform: translate(-50%, calc(-100% - 12px));
}

.home-info-tooltip::after {
  right: auto;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.home-info-tooltip.is-visible {
  transform: translate(-50%, calc(-100% - 8px));
}

.home-legacy-compare-chart {
  overflow: hidden;
  --home-compare-bg: #1677ff;
}

.home-compare-head {
  align-items: flex-start;
  gap: 14px;
}

.home-compare-head p {
  margin: 4px 0 0;
  color: var(--emii-muted);
  font-size: 12px;
  font-weight: 800;
}

.home-compare-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.home-compare-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--emii-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--emii-surface, #fff) 92%, var(--emii-primary-soft, #eef6ff) 8%);
  color: var(--emii-text);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.home-compare-controls input[type="checkbox"] {
  accent-color: var(--emii-primary, #1677ff);
}

.home-compare-color input[type="color"] {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.home-compare-chart-shell {
  position: relative;
  min-height: 330px;
  margin-top: 12px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--home-compare-bg) 32%, transparent), transparent 32%),
    linear-gradient(135deg, color-mix(in srgb, var(--home-compare-bg) 86%, #fff 14%), color-mix(in srgb, var(--home-compare-bg) 66%, #001f70 34%));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 18%, transparent);
}

.home-compare-axis {
  position: absolute;
  inset: 22px 18px 52px auto;
  width: 42px;
  display: grid;
  align-content: space-between;
  color: rgba(255,255,255,.76);
  font-size: 11px;
  font-weight: 900;
  z-index: 2;
}

.home-compare-bars {
  position: absolute;
  inset: 26px 64px 42px 20px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18) 1px, transparent 1px) 0 0 / 100% 25%;
}

.home-compare-day {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 24px;
  align-items: end;
  justify-items: center;
  min-width: 0;
}

.home-compare-day-bars {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--series-count, 5), minmax(5px, 1fr));
  gap: 4px;
  align-items: end;
  justify-content: center;
}

.home-compare-day b {
  color: rgba(255,255,255,.86);
  font-size: 12px;
  font-weight: 950;
}

.home-compare-bar {
  display: block;
  height: var(--h);
  min-height: 10px;
  border-radius: 999px 999px 7px 7px;
  background: rgba(255,255,255,.9);
  position: relative;
  transform-origin: center bottom;
  animation: homeCompareBarIn .34s cubic-bezier(.2,.8,.2,1) both;
  cursor: default;
}

.home-compare-bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  box-shadow: 0 10px 26px rgba(0,0,0,.16);
}

.home-compare-bar.is-sales { color: #ffffff; }
.home-compare-bar.is-purchase { color: #7dd3fc; }
.home-compare-bar.is-return { color: #fbbf24; }
.home-compare-bar.is-received { color: #86efac; }
.home-compare-bar.is-paid { color: #fda4af; }

@keyframes homeCompareBarIn {
  from {
    transform: scaleY(.16);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.home-compare-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--emii-muted);
  font-size: 12px;
  font-weight: 850;
}

.home-compare-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  opacity: .52;
}

.home-compare-legend span.is-active {
  opacity: 1;
}

.home-compare-legend i {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: currentColor;
}

.home-compare-legend .is-sales { color: var(--emii-primary, #1677ff); }
.home-compare-legend .is-purchase { color: #0ea5e9; }
.home-compare-legend .is-return { color: var(--emii-warning, #f59e0b); }
.home-compare-legend .is-received { color: var(--emii-success, #10b981); }
.home-compare-legend .is-paid { color: var(--emii-danger, #e11d48); }

@media (max-width: 760px) {
  .home-legacy-analytics {
    grid-template-columns: 1fr;
  }

  .home-compare-head {
    display: grid;
  }

  .home-compare-controls {
    justify-content: stretch;
  }

  .home-compare-controls label {
    flex: 1 1 auto;
    justify-content: center;
  }

  .home-compare-chart-shell {
    min-height: 280px;
  }

  .home-compare-bars {
    inset: 26px 50px 42px 12px;
    gap: 6px;
  }

  .home-compare-day-bars {
    gap: 2px;
  }
}


/* v6.9.7.16 — Total Sales line chart + fixed metric tooltip */
.home-info-tooltip {
  position: fixed;
  right: auto;
  left: var(--tooltip-left, 50vw);
  top: var(--tooltip-top, 50vh);
  transform: translate(-50%, calc(-100% - 12px));
}

.home-info-tooltip::after {
  right: auto;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.home-info-tooltip.is-visible {
  transform: translate(-50%, calc(-100% - 8px));
}

.home-legacy-total-line-chart {
  overflow: hidden;
}

.home-total-line-head {
  align-items: flex-start;
  gap: 14px;
}

.home-total-line-head h2 {
  white-space: nowrap;
}

.home-total-line-menu {
  border: 1px solid var(--emii-line);
  background: var(--emii-surface, #fff);
  color: var(--emii-muted);
  min-width: 36px;
  height: 32px;
  border-radius: 10px;
  font-weight: 950;
  cursor: pointer;
}

.home-total-line-options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  color: var(--emii-muted);
  font-size: 12px;
  font-weight: 850;
}

.home-total-line-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.home-total-line-options input {
  accent-color: var(--emii-primary, #1677ff);
}

.home-total-line-options b {
  color: var(--emii-text);
  font-weight: 950;
}

.home-total-line-shell {
  position: relative;
  min-height: 354px;
  margin-top: 10px;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--emii-surface, #fff) 96%, var(--emii-primary-soft, #eef6ff) 4%), var(--emii-surface, #fff));
}

.home-total-line-svg {
  display: block;
  width: 100%;
  height: 354px;
  overflow: visible;
}

.home-total-line-grid line {
  stroke: color-mix(in srgb, var(--emii-line) 72%, transparent);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.home-total-line-y text,
.home-total-line-x text {
  fill: var(--emii-muted);
  font-size: 12px;
  font-weight: 850;
}

.home-total-line-x text {
  text-anchor: middle;
}

.home-total-line-path {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
  stroke-dasharray: 900;
  stroke-dashoffset: 0;
  transition: opacity .18s ease, stroke-dashoffset .34s ease;
  animation: homeTotalLineIn .42s ease both;
}

.home-total-line-path.is-current {
  stroke: var(--emii-primary, #1677ff);
}

.home-total-line-path.is-previous {
  stroke: rgba(245, 128, 62, .62);
}

.home-total-line-path.is-hidden,
.home-total-line-area.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.home-total-line-area {
  fill: color-mix(in srgb, var(--emii-primary, #1677ff) 10%, transparent);
  opacity: .75;
  transition: opacity .18s ease;
}

.home-total-line-points circle {
  fill: var(--emii-surface, #fff);
  stroke-width: 3;
  cursor: pointer;
  animation: homeTotalPointIn .22s ease both;
}

.home-total-line-points[data-home-total-line-points="current"] circle {
  stroke: var(--emii-primary, #1677ff);
}

.home-total-line-points[data-home-total-line-points="previous"] circle {
  stroke: rgba(245, 128, 62, .70);
}

.home-total-line-tooltip {
  position: absolute;
  right: auto;
  left: var(--x, 50%);
  top: var(--y, 50%);
  min-width: 154px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--emii-text, #0f172a) 92%, transparent);
  color: #fff;
  box-shadow: 0 18px 44px rgba(15,23,42,.22);
  display: grid;
  gap: 4px;
  transform: translate(-50%, calc(-100% - 12px));
  opacity: 0;
  pointer-events: none;
  z-index: 12;
  transition: opacity .14s ease, transform .14s ease;
  font-size: 11.5px;
  font-weight: 850;
}

.home-total-line-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}

.home-total-line-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 8px));
}

.home-total-line-tooltip b {
  font-weight: 950;
}

@keyframes homeTotalLineIn {
  from {
    opacity: 0;
    stroke-dashoffset: 240;
  }
  to {
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

@keyframes homeTotalPointIn {
  from {
    opacity: 0;
    transform: scale(.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 760px) {
  .home-total-line-head {
    display: grid;
  }

  .home-total-line-options {
    justify-content: flex-start;
  }

  .home-total-line-shell {
    min-height: 300px;
  }

  .home-total-line-svg {
    height: 300px;
  }

  .home-total-line-x text {
    font-size: 10px;
  }
}


/* v6.9.7.17 — RTL chart controls, custom line background, precise finance chart, DNI recent orders */
#pagHome .emii-section-title,
#pagHome .home-compare-head,
#pagHome .home-total-line-head,
#pagHome .home-recent-dni-head {
  direction: rtl;
  text-align: right;
}

#pagHome .home-compare-controls,
#pagHome .home-total-line-options,
#pagHome .home-legacy-table-actions {
  direction: rtl;
}

.home-total-line-bg-control {
  background: color-mix(in srgb, var(--emii-surface, #fff) 92%, var(--emii-primary-soft, #eef6ff) 8%);
  border: 1px solid var(--emii-line);
  border-radius: 999px;
  min-height: 32px;
  padding: 0 10px;
}

.home-total-line-bg-control input[type="color"] {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.home-total-line-shell {
  background:
    radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--home-total-line-bg, #f6f8fb) 42%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--home-total-line-bg, #f6f8fb) 88%, var(--emii-surface, #fff) 12%), var(--emii-surface, #fff));
}

/* More precise finance-card SVG sizing/alignment */
#pagHome .home-blue-chart-card .home-blue-chart-body,
#pagHome .home-red-chart-card .home-blue-chart-body {
  margin: 10px 0 6px;
  overflow: visible;
}

#pagHome .home-blue-chart-card .home-blue-chart-svg,
#pagHome .home-red-chart-card .home-blue-chart-svg {
  width: 100%;
  height: 260px;
  min-height: 0;
  aspect-ratio: 640 / 260;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

#pagHome .home-blue-chart-card .home-blue-chart-line,
#pagHome .home-red-chart-card .home-blue-chart-line,
#pagHome .home-blue-chart-card .home-blue-chart-points circle,
#pagHome .home-red-chart-card .home-blue-chart-points circle {
  vector-effect: non-scaling-stroke;
}

#pagHome .home-blue-chart-card .home-blue-chart-line,
#pagHome .home-red-chart-card .home-blue-chart-line {
  stroke-width: 4.5;
}

#pagHome .home-blue-chart-card .home-blue-chart-points circle,
#pagHome .home-red-chart-card .home-blue-chart-points circle {
  stroke-width: 3.5;
}

/* DNI UI Kit closer recent orders */
.home-recent-dni-head {
  align-items: flex-start;
}

.home-recent-dni-head p {
  margin: 4px 0 0;
  color: var(--emii-muted);
  font-size: 12px;
  font-weight: 800;
}

.home-dni-order-table {
  border-radius: 18px;
  overflow: hidden;
  background: color-mix(in srgb, var(--emii-surface, #fff) 94%, var(--emii-primary-soft, #eef6ff) 6%);
}

.home-dni-order-table [role="row"] {
  grid-template-columns: 82px 82px minmax(150px, 1fr) 110px 120px 90px 44px;
  min-height: 56px;
  background: var(--emii-surface, #fff);
  transition: background .15s ease, transform .15s ease;
}

.home-dni-order-table [role="row"]:not(.is-head):hover {
  background: color-mix(in srgb, var(--emii-primary-soft, #eef6ff) 42%, var(--emii-surface, #fff) 58%);
}

.home-dni-order-table .is-head {
  background: var(--emii-surface-soft, #f6f8fb);
}

.home-dni-order-table .home-order-date,
.home-dni-order-table .home-order-time {
  color: var(--emii-muted);
  font-size: 11.5px;
  font-weight: 900;
}

.home-dni-order-table .home-order-customer {
  font-weight: 950;
}

.home-dni-order-table .home-order-total {
  font-weight: 950;
  color: var(--emii-text);
}

.home-dni-order-table .home-order-payment {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--emii-primary, #1677ff) 10%, transparent);
  color: var(--emii-primary, #1677ff);
  font-size: 11px;
  font-weight: 950;
}

.home-order-action {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--emii-line);
  background: var(--emii-surface, #fff);
  color: var(--emii-muted);
  font-weight: 950;
  cursor: pointer;
}

.home-order-action:hover {
  color: var(--emii-primary, #1677ff);
  border-color: color-mix(in srgb, var(--emii-primary, #1677ff) 38%, var(--emii-line));
}

@media (max-width: 760px) {
  .home-dni-order-table {
    gap: 8px;
    background: transparent;
    border-top: 0;
    margin: 12px 0 0;
  }

  .home-dni-order-table .is-head {
    display: none;
  }

  .home-dni-order-table [role="row"] {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) 84px 38px;
    grid-template-rows: 1fr 1fr;
    min-height: 70px;
    padding: 10px 12px;
    border: 1px solid var(--emii-line);
    border-radius: 16px;
    background: var(--emii-surface, #fff);
    box-shadow: 0 10px 28px rgba(15,23,42,.05);
  }

  .home-dni-order-table .home-order-date {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
  }

  .home-dni-order-table .home-order-time {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
  }

  .home-dni-order-table .home-order-customer {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .home-dni-order-table .home-order-total {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    justify-self: end;
  }

  .home-dni-order-table .home-order-payment,
  .home-dni-order-table .is-success,
  .home-dni-order-table .is-blocked {
    display: none;
  }

  .home-dni-order-table .home-order-action {
    grid-column: 4;
    grid-row: 1 / 3;
    align-self: center;
    justify-self: end;
  }
}


/* v6.9.7.18 — mobile layout, orders and charts polish */
.home-total-line-periods {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--emii-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--emii-surface, #fff) 92%, var(--emii-primary-soft, #eef6ff) 8%);
}

.home-total-line-periods button {
  border: 0;
  background: transparent;
  color: var(--emii-muted);
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
  cursor: pointer;
}

.home-total-line-periods button.is-active {
  color: var(--emii-primary, #1677ff);
  background: var(--emii-surface, #fff);
  box-shadow: 0 8px 20px rgba(15,23,42,.06);
}

.home-total-line-shell {
  min-height: 300px;
}

.home-total-line-svg {
  height: 300px;
}

.home-total-line-y text,
.home-total-line-x text {
  font-size: 11px;
}

.home-legacy-card-copy,
.home-legacy-channel-list,
.home-legacy-channel-list h3 {
  text-align: right;
}

.home-legacy-card-copy {
  justify-self: stretch;
}

.home-legacy-mini-card {
  direction: rtl;
}

.home-legacy-channel-list span {
  flex-direction: row-reverse;
}

/* Keep product management grid compact and 3-up on mobile */
.home-restored-cards > .emii-card:first-child .emii-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.home-restored-cards > .emii-card:first-child .emii-data-box {
  min-height: 66px;
  padding: 10px 6px;
}

.home-restored-cards > .emii-card:first-child .emii-data-box strong {
  font-size: 17px;
}

.home-restored-cards > .emii-card:first-child .emii-data-box span {
  font-size: 10.5px;
  line-height: 1.45;
}

/* Recent orders: DNI table and mobile card rows with visible payment/order status */
.home-dni-order-table [role="row"] {
  grid-template-columns: 82px 74px minmax(130px, 1fr) 96px 112px 102px 44px;
}

.home-order-pay-status,
.home-order-status {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.home-order-pay-status.is-paid {
  color: var(--emii-success, #10b981);
  background: color-mix(in srgb, var(--emii-success, #10b981) 14%, transparent);
}

.home-order-pay-status.is-failed {
  color: var(--emii-danger, #ff3b30);
  background: color-mix(in srgb, var(--emii-danger, #ff3b30) 13%, transparent);
}

.home-order-pay-status.is-refund {
  color: var(--emii-warning, #f59e0b);
  background: color-mix(in srgb, var(--emii-warning, #f59e0b) 13%, transparent);
}

.home-order-pay-status.is-waiting {
  color: var(--emii-primary, #1677ff);
  background: color-mix(in srgb, var(--emii-primary, #1677ff) 11%, transparent);
}

.home-order-status.is-success {
  color: var(--emii-success, #10b981);
  background: color-mix(in srgb, var(--emii-success, #10b981) 14%, transparent);
}

.home-order-status.is-info {
  color: var(--emii-primary, #1677ff);
  background: color-mix(in srgb, var(--emii-primary, #1677ff) 11%, transparent);
}

.home-order-status.is-warn {
  color: var(--emii-warning, #f59e0b);
  background: color-mix(in srgb, var(--emii-warning, #f59e0b) 13%, transparent);
}

/* Quick actions closer to compact iPhone Settings rows */
.home-ops-grid {
  grid-template-columns: 1fr;
}

.home-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.home-action-card {
  min-height: 72px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
  padding: 10px 12px;
  border-radius: 16px;
  text-align: right;
}

.home-action-card .home-action-icon {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
}

.home-action-card strong {
  font-size: 13px;
}

.home-action-card small {
  font-size: 11px;
  line-height: 1.45;
}

.home-action-card em {
  grid-row: 1 / 3;
  align-self: center;
  margin: 0;
}

@media (max-width: 760px) {
  /* 4 analytics cards: 2 per row, 2 rows */
  .home-legacy-analytics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .home-legacy-mini-card {
    min-height: 116px;
    padding: 12px 10px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .home-legacy-gauge,
  .home-legacy-bars,
  .home-legacy-spark,
  .home-legacy-donut {
    justify-self: center;
    transform: scale(.82);
    transform-origin: center;
  }

  .home-legacy-card-copy,
  .home-legacy-channel-list {
    text-align: right;
  }

  .home-legacy-card-copy strong {
    font-size: 20px;
    margin-top: 6px;
  }

  .home-legacy-card-copy h3,
  .home-legacy-channel-list h3 {
    font-size: 12px;
  }

  .home-legacy-card-copy span {
    margin-top: 5px;
    padding: 3px 7px;
  }

  /* Total Sales: mobile defaults to 7d by JS and uses more space */
  .home-total-line-head {
    gap: 10px;
  }

  .home-total-line-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .home-total-line-periods {
    overflow-x: auto;
    justify-content: flex-start;
    width: 100%;
  }

  .home-total-line-periods button {
    white-space: nowrap;
  }

  .home-total-line-shell {
    min-height: 250px;
    margin-top: 6px;
  }

  .home-total-line-svg {
    height: 250px;
  }

  .home-total-line-x text {
    font-size: 10px;
  }

  /* Recent orders mobile card view */
  .home-dni-order-table {
    display: grid;
    gap: 8px;
    background: transparent;
    border-top: 0;
    margin: 12px 0 0;
  }

  .home-dni-order-table .is-head {
    display: none;
  }

  .home-dni-order-table [role="row"] {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr) auto 34px;
    grid-template-rows: auto auto auto;
    gap: 3px 8px;
    min-height: 78px;
    padding: 10px 11px;
    border: 1px solid var(--emii-line);
    border-radius: 16px;
    background: var(--emii-surface, #fff);
    box-shadow: 0 10px 28px rgba(15,23,42,.05);
  }

  .home-dni-order-table .home-order-date {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    font-size: 11px;
  }

  .home-dni-order-table .home-order-time {
    grid-column: 1;
    grid-row: 2 / 4;
    align-self: start;
    font-size: 12px;
  }

  .home-dni-order-table .home-order-customer {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
  }

  .home-dni-order-table .home-order-total {
    grid-column: 3;
    grid-row: 1;
    align-self: end;
    justify-self: end;
    font-size: 13px;
    white-space: nowrap;
  }

  .home-dni-order-table .home-order-pay-status {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    display: inline-flex;
  }

  .home-dni-order-table .home-order-status {
    grid-column: 2;
    grid-row: 3;
    justify-self: start;
    display: inline-flex;
  }

  .home-dni-order-table .home-order-action {
    grid-column: 4;
    grid-row: 1 / 4;
    align-self: center;
    justify-self: end;
  }

  .home-dni-order-table .home-order-payment,
  .home-dni-order-table .is-success,
  .home-dni-order-table .is-blocked {
    display: none;
  }

  /* Product grid: exactly 3 in one row on mobile */
  .home-restored-cards > .emii-card:first-child .emii-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-restored-cards > .emii-card:first-child .emii-settings-card {
    margin-top: 10px;
  }

  /* Quick actions: compact iPhone-settings-like rows */
  .home-action-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .home-action-card {
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 14px;
  }

  .home-action-card .home-action-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .home-action-card em {
    font-size: 10.5px;
    padding: 3px 7px;
  }
}


/* v6.9.7.18 — keep new mobile order statuses visible */
@media (max-width: 760px) {
  .home-dni-order-table .home-order-pay-status,
  .home-dni-order-table .home-order-status,
  .home-dni-order-table .home-order-status.is-success,
  .home-dni-order-table .home-order-status.is-info,
  .home-dni-order-table .home-order-status.is-warn {
    display: inline-flex;
  }
}
