/* =========================================================================
   templates/atomic/showcase/css/dashboard.css

   STRUCTURE ONLY. Must pass `node tools/atomic-lint.mjs --kind=structure-paint`.
   Linked by dashboard.html and nothing else. Every pixel of paint (surface,
   border, type, status colour, chart bars) comes from components.css (core +
   floor) resolved against the previewed style's tokens; this sheet only decides
   WHERE things sit.

   THE ONLY APP-SHELL PAGE. The other ten pages use the site topbar; this one
   uses the SIDEBAR shell (core .sidebar, painted by floor/chrome.css) and, under
   the spec's 900px collapse, a TABBAR (core .tabbar) plus a slim mobile topbar.
   Core's own app-skeleton rules key on body[data-app] at 1024px; the showcase
   collapse is 900px, so this page lays the shell out itself and does not set
   data-app.

   Sections:
     1. shell     — sidebar | content at >=900px, topbar + tabbar below
     2. content   — rows, card heads, KPI strip
     3. orders    — the data table and its mobile column rule
     4. feed, saved, links, empty
   ========================================================================= */

/* ---- 1. shell ------------------------------------------------------------ */

/* Mobile first: no sidebar, a slim topbar, a fixed tabbar. */
.dash-side { display: none; }

.dash-top { gap: var(--space-3); }
.dash-top > .brand { flex: none; }
.dash-top-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
}

.dash-tabbar .tabbar-slot {
  /* five slots across 390px: the label must be able to truncate, not push */
  padding-inline: var(--space-1);
}
.dash-tabbar .tabbar-slot > span {
  max-inline-size: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-main {
  display: grid;
  gap: var(--space-6);
  align-content: start;
  width: 100%;
  max-inline-size: var(--content-max);
  margin-inline: auto;
  min-width: 0;
  padding-inline: var(--gutter);
  padding-block-start: var(--space-5);
  /* clear the fixed tabbar, including the home-indicator inset */
  padding-block-end: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--space-6));
}


@media (min-width: 900px) {
  .dash {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    align-items: start;
  }
  .dash-side { display: flex; }
  .dash-top, .dash-tabbar { display: none; }
  .dash-main {
    padding-block: var(--space-6) var(--space-8);
  }
}

/* the sidebar brand and the user block are pinned by core; the nav scrolls
   with the column when a style's rows are tall */
.dash-side .nav-list {
  display: grid;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}
.dash-side .nav-link,
.dash-links .nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--control-h);
}
.dash-side .nav-link > svg,
.dash-tabbar svg { flex: none; }
.dash-user { padding-block-start: var(--space-2); }

/* ---- 2. content ---------------------------------------------------------- */

.dash-main > .view-header { margin-block-end: 0; }

/* two-up rows. Under 1100px (sidebar included) they stack: a 2fr/1fr split
   leaves the narrow card under 280px at 900-1099. */
.dash-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  align-items: stretch;
}
@media (min-width: 1100px) {
  .dash-split[data-ratio="2-1"] { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .dash-split[data-ratio="1-1"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* every panel is a card that stacks its own children on one rhythm */
.dash-card {
  display: grid;
  gap: var(--space-4);
  align-content: start;
  min-width: 0;
}
.dash-card > .card-title,
.dash-card-head > .card-title { margin-block-end: 0; }
.dash-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
}
.dash-card-head > .card-sub { margin: 0; }

/* KPI tiles: label, value, note stack tightly (core .stat-card); the loyalty
   tile carries a progress meter, which must fill the tile width */
.dash-kpi .progress { width: 100%; }

/* ---- 3. orders table ------------------------------------------------------ */

.dash-table-card { padding-inline: var(--space-4); }
@media (min-width: 640px) {
  .dash-table-card { padding-inline: var(--space-5); }
}
.dash-table-card .table th:first-child,
.dash-table-card .table td:first-child { padding-inline-start: 0; }
.dash-table-card .table th:last-child,
.dash-table-card .table td:last-child { padding-inline-end: 0; }

.dash-order {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.dash-thumb {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  overflow: hidden;
}
.dash-thumb img {
  display: block;
  width: 100%;
  height: 100%;
}
.dash-order-text { display: grid; min-width: 0; }
.dash-order-text > * { margin: 0; }
.dash-nowrap { white-space: nowrap; }

/* 390px: Order | Status | Total fits without scrolling. The Placed column
   (its date is repeated under the order name) drops out. Both the th and td
   carry the class, so the grid stays rectangular. */
@media (max-width: 639px) {
  .dash-col-date { display: none; }
  .dash-table-card .table th,
  .dash-table-card .table td { padding-inline: var(--space-2); }
  .dash-thumb { width: 2.25rem; height: 2.25rem; }
  .dash-order { gap: var(--space-2); }
}
/* the date line under the name is only needed when the Placed column is gone */
@media (min-width: 640px) {
  .dash-order-date { display: none; }
}

/* ---- 4. feed, saved, links, empty ------------------------------------------ */

.dash-feed {
  display: grid;
  gap: var(--space-4);
  list-style: none;
  padding: 0;
  margin: 0;
}
.dash-feed > li {
  display: grid;
  gap: var(--space-1);
  justify-items: start;
  min-width: 0;
}
.dash-feed p { margin: 0; }

.dash-saved {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-5) var(--space-4);
  list-style: none;
  padding: 0;
  margin: 0;
}
.dash-saved > li { min-width: 0; }
.dash-saved-item {
  display: grid;
  gap: var(--space-2);
  align-content: start;
  justify-items: start;
}
.dash-saved-item > * { margin: 0; }
.dash-saved-media {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}
.dash-saved-media img {
  display: block;
  width: 100%;
  height: 100%;
}
.dash-saved-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-2); }

.dash-links {
  display: grid;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}
.dash-links .nav-link > :last-child { margin-inline-start: auto; }

.dash-card .empty { padding-block: var(--space-5); }

.dash-legal { padding-block-start: var(--space-2); }

/* the spending chart takes whatever height its row-mate gives the card */
.dash-card[data-fill] { grid-template-rows: auto minmax(0, 1fr); }
.dash-card[data-fill] > .chart { display: grid; grid-template-rows: minmax(13rem, 1fr) auto; }
.dash-card[data-fill] .chart-plot { height: auto; }


/* KPI tiles: as many columns as fit at a readable tile width, so a style with a
   wide gutter (editorial) collapses to one column instead of crushing four
   words into 53px. Replaces core's viewport-keyed 1/2/4 steps. */
.dash-kpi { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: var(--space-3); }
@media (min-width: 640px) {
  .dash-kpi { gap: var(--space-4); }
}
.dash-kpi > .card { min-width: 0; }
@media (max-width: 639px) {
  .dash-kpi > .card { padding: var(--space-4); }
}

/* ORDERS BELOW 640px: each row becomes a block. The order (thumbnail, name,
   number) takes the full width; status sits left and total right beneath it, so
   Total is never off-screen. The table elements keep their native semantics
   and the head row is collapsed to 1px but kept for screen readers; Total also carries a visible label. */
@media (max-width: 639px) {
  .dash-orders,
  .dash-orders tbody { display: block; }
  /* visually collapsed, still exposed to assistive tech (same mechanics as
     core's .sr-only, minus clip-path which layout CSS may not author) */
  .dash-orders thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
  }
  .dash-orders tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding-block: var(--space-3);
  }
  .dash-orders td {
    display: block;
    padding: 0;
    min-width: 0;
  }
  .dash-orders .dash-cell-order { grid-column: 1 / -1; }
  .dash-orders .dash-cell-status { grid-column: 1; justify-self: start; }
  .dash-orders .dash-cell-total { grid-column: 2; }
}

/* the "Total" prefix exists only for the stacked layout */
.dash-label { display: none; }
@media (max-width: 639px) {
  .dash-label { display: inline; }
}

/* core keeps view actions on one row below 640px because it assumes icon-only
   buttons; these are labelled, and editorial's 48px gutter leaves 294px */
.dash-main .view-actions { flex-wrap: wrap; }

/* the stacked-row td rule above is more specific than .dash-col-date */
@media (max-width: 639px) {
  .dash-orders td.dash-col-date { display: none; }
}
