/* DASH-DONEZO-1 — dashboard layout + cards (desktop/tablet only, >= 861px). Phones keep the mobile dashboard.
   Loaded after layout-polish.css so it wins over aeux-theme / page-unify. Scoped to #view-dashboard:not(.hm-new). */
.dz-c.dz-live, .dz-c.dz-src, .dz-c.dz-ord, .dz-c.dz-chan { display: none; }

@media (min-width: 861px) {
  #view-dashboard:not(.hm-new) {
    --dz-green: #168A4E; --dz-green-dark: #0D4A2C; --dz-green-mid: #1F8A52; --dz-green-light: #78C79A;
    --dz-ink: #0B1512; --dz-mute: #6B8A7E; --dz-line: #E3E3E3;
  }

  /* ---------- grid ---------- */
  #view-dashboard:not(.hm-new) .dash-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: stretch;
    grid-template-rows: auto auto auto minmax(250px, auto) minmax(92px, auto) minmax(196px, auto);
  }
  #view-dashboard:not(.hm-new) #hmHome { grid-column: 1 / -1; grid-row: 1; }
  #view-dashboard:not(.hm-new) #hmHome[hidden] ~ #dashToolbar { margin-top: -12px; }
  #view-dashboard:not(.hm-new) #dashToolbar { grid-column: 1 / -1; grid-row: 2; }
  #view-dashboard:not(.hm-new) #statGrid { grid-column: 1 / -1; grid-row: 3; }
  #view-dashboard:not(.hm-new) .dash-pair { display: contents; }
  #view-dashboard:not(.hm-new) #dashStatsPanel { grid-column: 1 / 7;  grid-row: 4; }
  #view-dashboard:not(.hm-new) #dzLive         { grid-column: 7 / 10; grid-row: 4; }
  #view-dashboard:not(.hm-new) #dzSrc          { grid-column: 10 / 13; grid-row: 4 / 6; }
  #view-dashboard:not(.hm-new) #dzOrd          { grid-column: 1 / 6;  grid-row: 5 / 7; }
  #view-dashboard:not(.hm-new) #revGaugeCard   { grid-column: 6 / 10; grid-row: 5 / 7; }
  #view-dashboard:not(.hm-new) #dzChan         { grid-column: 10 / 13; grid-row: 6; }
  #view-dashboard:not(.hm-new) .dash-inv-card  { grid-column: 1 / -1; grid-row: 7; }
  #view-dashboard:not(.hm-new) #dashShare      { grid-column: 1 / -1; grid-row: 8; }
  /* replaced by the new cards (their render code still runs, nothing is removed) */
  #view-dashboard:not(.hm-new) #dashChannels,
  #view-dashboard:not(.hm-new) .dash-orders-card,
  #view-dashboard:not(.hm-new) #dashSources { display: none !important; }

  /* ---------- shared card shell ---------- */
  #view-dashboard:not(.hm-new) .dz-c {
    display: flex; flex-direction: column; min-width: 0; padding: 16px; background: #fff;
    border: 1px solid var(--dz-line); border-radius: 14px; box-shadow: none;
  }
  #view-dashboard:not(.hm-new) .dz-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; min-height: 28px; }
  #view-dashboard:not(.hm-new) .dz-h h3,
  #view-dashboard:not(.hm-new) .dz-c > .dash-card-head h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 22px; color: var(--dz-ink); }
  #view-dashboard:not(.hm-new) .dz-c > .dash-card-head { margin: 0 0 12px; padding: 0; border: 0; min-height: 28px; align-items: center; }
  #view-dashboard:not(.hm-new) #dashStatsPanel .dash-head-tools { display: none; }   /* period = the toolbar picker; bars only */
  #view-dashboard:not(.hm-new) #revGaugeCard .dash-kebab { display: none; }

  /* ---------- KPI cards (4 separate cards, the selected one is the green card) ---------- */
  #view-dashboard:not(.hm-new) #statGrid.dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; background: transparent; border: 0; box-shadow: none; overflow: visible; }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi:hover,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi[data-metric="revenue"],
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi[data-metric="revenue"]:hover {
    position: relative; min-height: 128px; padding: 16px 18px 14px; display: flex; flex-direction: column; justify-content: space-between;
    background: #fff; color: var(--dz-ink); border: 1px solid var(--dz-line) !important; border-radius: 14px; box-shadow: none; cursor: pointer;
  }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi:hover { border-color: #C9D8D0 !important; }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi::after {
    content: "\2197"; position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; display: grid; place-items: center;
    border: 1px solid #C9D8D0; border-radius: 50%; font-size: 14px; line-height: 1; color: var(--dz-ink); background: #fff;
  }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi .dash-kpi-label,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi[data-metric="revenue"] .dash-kpi-label { padding-right: 38px; font-size: 13px; font-weight: 500; color: var(--dz-ink); }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi .dash-kpi-val,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi[data-metric="revenue"] .dash-kpi-val { margin: 6px 0 0; font-size: 34px; line-height: 40px; font-weight: 600; letter-spacing: -.02em; color: var(--dz-ink); }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi .dash-kpi-val .cur,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi[data-metric="revenue"] .dash-kpi-val .cur { font-size: 15px; font-weight: 500; color: var(--dz-mute); }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi .dash-kpi-cmp { margin-top: 10px; min-height: 22px; }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi .dash-pill,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi[data-metric="revenue"] .dash-pill { gap: 6px; padding: 0; background: none; border-radius: 0; font-size: 12px; font-weight: 500; color: var(--dz-mute); }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi .dash-pill.is-up,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi .dash-pill.is-down { color: var(--dz-mute); }
  .dz-bdg { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1px solid #C9D8D0; border-radius: 6px; font-size: 11px; line-height: 1; color: var(--dz-green); background: #fff; }
  .dash-pill.is-down .dz-bdg { color: #D14343; }

  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active:hover,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi[data-metric="revenue"].is-active,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi[data-metric="revenue"].is-active:hover {
    color: #fff; border-color: transparent !important;
    background: radial-gradient(120% 90% at 85% 100%, rgba(120, 199, 154, .35) 0%, rgba(120, 199, 154, 0) 60%), linear-gradient(160deg, #2B7F57 0%, #0D4A2C 100%);
  }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active::after { background: #fff; border-color: #fff; color: var(--dz-green-dark); }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active .dash-kpi-label,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active .dash-kpi-val,
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active .dash-kpi-val .cur { color: #fff; }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active .dash-kpi-val .cur { opacity: .8; }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active .dash-pill { color: rgba(255, 255, 255, .85); }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi.is-active .dz-bdg { background: transparent; border-color: rgba(255, 255, 255, .55); color: #fff; }
  #view-dashboard:not(.hm-new) #statGrid .dash-kpi:focus-visible { outline: 2px solid var(--dz-green); outline-offset: 2px; }

  /* ---------- pill-bar chart ---------- */
  #view-dashboard:not(.hm-new) #dashStatsPanel #revChart { position: relative; flex: 1; min-height: 190px; height: auto; margin: 0; }
  .dz-bars { position: absolute; inset: 0; display: flex; align-items: stretch; justify-content: space-between; gap: 8px; padding-top: 26px; }
  .dz-bars.is-dense { gap: 4px; }
  .dz-col { position: relative; flex: 1 1 0; min-width: 0; max-width: 56px; display: flex; flex-direction: column; align-items: center; outline: none; }
  .dz-pillbar { position: relative; flex: 1; width: 100%; min-height: 0; }
  .dz-pillbar i { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); display: block; width: 100%; max-width: 48px; min-height: 8px; border-radius: 999px; box-sizing: border-box; transition: height .25s ease; }
  .dz-pillbar i.is-r1 { background: var(--dz-green-dark); }
  .dz-pillbar i.is-r2 { background: var(--dz-green-mid); }
  .dz-pillbar i.is-r3 { background: var(--dz-green-light); }
  .dz-pillbar i.is-hatch, .dz-pillbar i.is-zero {
    background: repeating-linear-gradient(-45deg, #B9C6BF 0 1.5px, #fff 1.5px 6px); border: 1px solid #D3DDD8;
  }
  .dz-col em { margin-top: 8px; height: 16px; font-style: normal; font-size: 12px; line-height: 16px; color: var(--dz-mute); white-space: nowrap; }
  .dz-bub {
    position: absolute; top: -26px; left: 50%; transform: translateX(-50%); display: none; padding: 2px 8px; border: 1px solid #BFE3CE; border-radius: 999px;
    background: #fff; font-size: 11px; font-weight: 600; line-height: 16px; color: var(--dz-green-dark); white-space: nowrap; z-index: 1;
  }
  .dz-col.is-pick .dz-bub { display: block; }
  .dz-col:focus-visible .dz-pillbar i { outline: 2px solid var(--dz-green); outline-offset: 2px; }

  /* ---------- lists (traffic sources / recent orders) ---------- */
  .dz-list { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .dz-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 9px 0; color: inherit; text-decoration: none; border-top: 1px solid #F1F5F3; }
  .dz-row:first-child { border-top: 0; }
  .dz-row:hover .dz-tx b { color: var(--dz-green); }
  .dz-tx { flex: 1; min-width: 0; display: block; }
  .dz-tx b { display: block; font-size: 14px; font-weight: 600; line-height: 20px; color: var(--dz-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dz-tx small { display: block; font-size: 12px; line-height: 16px; color: var(--dz-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dz-ic { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: #F4F8F6; overflow: hidden; font-weight: 600; color: var(--dz-green-dark); }
  .dz-ic img { width: 28px; height: 28px; display: block; }
  .dz-av { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font-size: 14px; font-weight: 600; }
  .dz-st { flex: none; max-width: 42%; padding: 2px 10px; border: 1px solid; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dz-st.is-completed  { color: #0F6E3E; background: #EEF8F2; border-color: #BFE3CE; }
  .dz-st.is-processing { color: #B26A00; background: #FFF6E5; border-color: #F5D9A1; }
  .dz-st.is-pending    { color: #C0392B; background: #FDEEEC; border-color: #F3C1BB; }
  .dz-st.is-cancelled  { color: #64748B; background: #F1F5F9; border-color: #D9E1EA; }
  .dz-empty { padding: 24px 8px; text-align: center; font-size: 13px; color: var(--dz-mute); }

  /* ---------- live customers ---------- */
  .dz-live-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .dz-live-n b { font-size: 44px; line-height: 48px; font-weight: 600; letter-spacing: -.02em; color: var(--dz-green-dark); font-variant-numeric: tabular-nums; }
  .dz-live-body p { margin: 4px 0 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--dz-ink); }
  .dz-live-body small { display: block; margin-top: 6px; font-size: 12px; line-height: 16px; color: var(--dz-mute); }
  .dz-live-btn { margin-top: auto; width: 100%; justify-content: center; }

  /* ---------- monthly target gauge ---------- */
  #view-dashboard:not(.hm-new) #revGaugeCard .dash-target-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: 0; }
  .dz-gauge { position: relative; width: 100%; max-width: 280px; }
  .dz-gauge svg { display: block; width: 100%; height: auto; }
  .dz-gauge-c { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; }
  .dz-gauge-c b { display: block; font-size: 36px; line-height: 40px; font-weight: 700; letter-spacing: -.02em; color: var(--dz-ink); }
  .dz-gauge-c span { display: block; font-size: 12px; line-height: 16px; color: var(--dz-mute); }
  .dz-leg { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--dz-mute); }
  .dz-leg li { display: inline-flex; align-items: center; gap: 6px; }
  .dz-leg b { font-weight: 600; color: var(--dz-ink); }
  .dz-dot { width: 8px; height: 8px; border-radius: 50%; }
  .dz-dot.is-on { background: var(--dz-green); }
  .dz-dot.is-off { background: repeating-linear-gradient(-45deg, #B9C6BF 0 1px, #fff 1px 3px); border: 1px solid #B9C6BF; }
  .dz-tg-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--dz-mute); }

  /* ---------- sales by channel: the dark green card ---------- */
  #view-dashboard:not(.hm-new) #dzChan {
    color: #fff; border-color: transparent; justify-content: flex-start;
    background: radial-gradient(90% 80% at 90% 110%, rgba(120, 199, 154, .30) 0%, rgba(120, 199, 154, 0) 60%), linear-gradient(160deg, #0F5A36 0%, #072F1C 100%);
  }
  #view-dashboard:not(.hm-new) #dzChan .dz-h h3 { color: rgba(255, 255, 255, .85); font-size: 13px; font-weight: 500; }
  .dz-chan-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .dz-chan-big { display: flex; align-items: baseline; gap: 8px; }
  .dz-chan-big b { font-size: 36px; line-height: 40px; font-weight: 600; letter-spacing: -.02em; color: #fff; font-variant-numeric: tabular-nums; }
  .dz-chan-big span { font-size: 13px; color: rgba(255, 255, 255, .75); }
  .dz-chan-bar { display: flex; gap: 4px; height: 10px; margin-top: 14px; }
  .dz-chan-bar i { display: block; height: 100%; border-radius: 999px; }
  .dz-chan-bar .c0, .dz-chan-leg .c0 { background: #78C79A; }
  .dz-chan-bar .c1, .dz-chan-leg .c1 { background: #fff; }
  .dz-chan-bar .c2, .dz-chan-leg .c2 { background: #2F9A66; }
  .dz-chan-leg { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 12px; color: rgba(255, 255, 255, .8); }
  .dz-chan-leg li { display: flex; align-items: center; gap: 8px; }
  .dz-chan-leg li i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
  .dz-chan-leg b { margin-left: auto; font-weight: 600; color: #fff; }
  .dz-chan-empty { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .75); }
}

/* reveal the new cards only where the layout above applies */
@media (min-width: 861px) {
  #view-dashboard:not(.hm-new) .dz-c.dz-live, #view-dashboard:not(.hm-new) .dz-c.dz-src, #view-dashboard:not(.hm-new) .dz-c.dz-ord, #view-dashboard:not(.hm-new) .dz-c.dz-chan { display: flex; }
}

/* tablet: two columns of cards */
@media (min-width: 861px) and (max-width: 1179px) {
  #view-dashboard:not(.hm-new) .dash-grid { grid-template-rows: auto auto auto auto auto auto auto auto auto; }
  #view-dashboard:not(.hm-new) #statGrid.dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-dashboard:not(.hm-new) #dashStatsPanel { grid-column: 1 / -1; grid-row: 4; }
  #view-dashboard:not(.hm-new) #dzLive { grid-column: 1 / 7; grid-row: 5; }
  #view-dashboard:not(.hm-new) #dzChan { grid-column: 7 / 13; grid-row: 5; }
  #view-dashboard:not(.hm-new) #dzSrc { grid-column: 1 / 7; grid-row: 6; }
  #view-dashboard:not(.hm-new) #dzOrd { grid-column: 7 / 13; grid-row: 6; }
  #view-dashboard:not(.hm-new) #revGaugeCard { grid-column: 1 / -1; grid-row: 7; }
  #view-dashboard:not(.hm-new) .dash-inv-card { grid-row: 8; }
  #view-dashboard:not(.hm-new) #dashShare { grid-row: 9; }
}
@media (prefers-reduced-motion: reduce) { .dz-pillbar i { transition: none; } }

/* Red count badges on nav items (Orders = pending orders, Products = out/low stock) */
.nav-link { position: relative; }
.nav-link .nav-count { position: static; margin-left: auto; box-shadow: none; flex: none; }
.sb-collapsed .nav-link .nav-count { position: absolute; top: 2px; right: 4px; margin: 0; }
#view-dashboard #dmAttention { display: none !important; }
