/* Profit Check layout. Desktop source: design/Main.dc.html (1360px). Phone: design/Phone.dc.html (390px). */

.app {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  min-height: 100vh;
}
.app__side { flex: 1 1 248px; max-width: 280px; min-width: 0; }
.app__content { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; }
.is-tv .app__side { display: none; }

/* ---- sidebar */
.sidebar {
  height: 100%;
  padding: var(--space-6) var(--space-4);
  background: var(--surface-raised);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.wordmark { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2); }
.wordmark__name { font-family: var(--font-display); font-weight: 800; font-stretch: 90%; font-size: 20px; line-height: 24px; letter-spacing: -0.01em; }
.wordmark__rule { width: 1px; height: 18px; background: var(--line); }
.wordmark__sub { font-weight: 500; font-size: 14px; line-height: 21px; color: var(--ink-muted); }
.business-card { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-sunken); }
.business-card__name { font-size: 15px; line-height: 22px; font-weight: 600; }
.dash-nav__title, .saved-views__title { padding: 0 var(--space-2) var(--space-2); }
.dash-nav__list, .saved-views__list { list-style: none; margin: 0; padding: 0; }
.dash-nav__list { display: flex; flex-direction: column; gap: var(--space-1); }
.dash-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.dash-nav__link[aria-current="page"] { background: var(--insights-soft); color: var(--insights); font-weight: 700; }
@media (hover: hover) and (pointer: fine) {
  .dash-nav__link:not([aria-current="page"]):hover { background: var(--paper); }
}
.saved-views__list { padding: 0 var(--space-2); font-size: 14px; line-height: 21px; }
.saved-views__list li { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.saved-views__list li:last-child { border-bottom: 0; }
.data-status {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
}
.data-status__ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }

/* ---- top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-8);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
}
.topbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.alert-count {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
}

/* ---- main column */
.main {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.sections { display: flex; flex-direction: column; gap: var(--space-6); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-6); }
.page-head__text { min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.page-title { font-family: var(--font-display); font-weight: 700; font-stretch: 90%; font-size: 26px; line-height: 32px; text-wrap: balance; }
.page-sub { font-size: 14px; line-height: 21px; color: var(--ink-muted); }
.mp-filter { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.card {
  min-width: 0;
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}


.page-foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-muted);
}
.page-foot strong { color: var(--ink); }

/* ---- below 900px the sidebar becomes a compact header row (design/Phone.dc.html) */
@media (max-width: 899px) {
  .app__side { flex-basis: 100%; max-width: none; }
  .sidebar {
    height: auto;
    padding: var(--space-3) var(--space-4) 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: var(--space-2);
  }
  .business-card, .saved-views, .data-status, .dash-nav__title { display: none; }
  .dash-nav__list { flex-direction: row; overflow-x: auto; gap: var(--space-1); padding-bottom: var(--space-2); scrollbar-width: thin; }
  .dash-nav__link { white-space: nowrap; }
}

@media (max-width: 599px) {
  .topbar { padding: var(--space-3) var(--space-4); }
  .main { padding: 20px var(--space-4) 40px; gap: var(--space-4); }
  .sections { gap: var(--space-4); }
  .card { padding: var(--space-4); }
  .page-title { font-size: 22px; line-height: 28px; }
  .mp-filter { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--space-1); }
  .mp-filter .chip { flex: 0 0 auto; white-space: nowrap; }
}

/* ---- shared section pieces */
.row { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: stretch; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.card-sub { font-size: 14px; line-height: 21px; color: var(--ink-muted); }
.note { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.spark { display: block; margin-top: var(--space-1); }
.spark polyline { stroke: var(--insights); }
.spark--on-insights polyline { stroke: var(--on-insights); }

/* ---- headline (S-02) */
.headline { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.hero {
  flex: 1.6 1 340px;
  min-width: 0;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--insights);
  color: var(--on-insights);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.hero__eyebrow { color: var(--on-insights); }
.hero__value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 44px; line-height: 48px; font-weight: 500; }
.hero__delta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: 14px; line-height: 21px; }
.delta { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.goal { display: flex; flex-direction: column; gap: 6px; padding-top: var(--space-2); }
.goal__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-3); font-size: 13px; line-height: 18px; }
.goal__label { font-weight: 600; }
.goal__track { position: relative; height: 8px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--on-insights) 28%, transparent); }
.goal__fill { position: absolute; left: 0; top: 0; height: 8px; border-radius: var(--radius-sm); background: var(--on-insights); }
.goal__gap { font-size: 13px; line-height: 18px; }
.kpi {
  flex: 1 1 200px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi__value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 28px; line-height: 34px; font-weight: 500; }
.kpi__delta { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 600; }
.kpi__sub { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.kpi__caption { font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* From 900px the hero sits beside a 2 x 2 of KPI tiles; one row of five when there is room for it. */
@media (min-width: 900px) {
  .headline { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); }
  .hero { grid-row: span 2; }
  .hero .spark { flex: 1 1 40px; min-height: 40px; }
}
@media (min-width: 1560px) {
  .headline { grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); }
  .hero { grid-row: auto; }
}
@media (min-width: 1268px) {
  .is-tv .headline { grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); }
  .is-tv .hero { grid-row: auto; }
}

/* ---- the month in brief and Ask (S-02) */
.card--brief { flex: 1.3 1 520px; gap: var(--space-3); }
.card--ask { flex: 1 1 400px; gap: var(--space-3); }
.brief-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.brief-list li { display: flex; gap: var(--space-3); align-items: flex-start; }
.brief-list li::before { content: ''; flex: 0 0 4px; align-self: stretch; border-radius: 2px; background: var(--insights); }
.brief-list span { font-size: 17px; line-height: 26px; text-wrap: pretty; }
.ask-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip--wrap { justify-content: flex-start; padding: var(--space-2) 14px; text-align: left; }
.answer { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-md); background: var(--insights-soft); }
.answer__q { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--insights); }
.answer__a { font-size: 15px; line-height: 23px; }
.answer__link { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--insights); }

@media (max-width: 599px) {
  .row { gap: var(--space-4); }
  .headline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .hero { grid-column: 1 / -1; padding: 20px; gap: 6px; }
  .hero__value { font-size: 38px; line-height: 42px; }
  .hero .spark { height: 36px; }
  .kpi { padding: 14px; gap: var(--space-1); }
  .kpi__label { font-size: 11px; letter-spacing: 0.1em; }
  .kpi__value { font-size: 22px; line-height: 28px; }
  .kpi__delta, .kpi__sub { font-size: 12px; line-height: 16px; }
  .kpi .spark { height: 24px; }
  .kpi__caption { display: none; }
  .card--brief, .card--ask { gap: 10px; }
  .brief-list span { font-size: 15px; line-height: 22px; }
  .ask-chips { flex-direction: column; gap: 6px; }
  .answer { padding: 14px; }
  .answer__a { font-size: 14px; line-height: 21px; }
}

/* ---- phone pass (S-06): exports at the end of the page, a slimmer top bar */
.phone-actions { display: none; }
@media (max-width: 599px) {
  .topbar__wide { display: none; }
  .topbar { gap: var(--space-2); }
  .topbar__group { width: 100%; justify-content: space-between; }
  .topbar__group:first-child { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .phone-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); order: 18; }
  .phone-actions .btn { flex: 1 1 140px; }
}
@media (max-width: 380px) {
  .topbar__group:first-child { grid-template-columns: minmax(0, 1fr); }
}
