/* The two admin consoles' page furniture (shared/consoleKit.js, shared/consoleOverview.js): page
   heading, summary strip, toolbar with sliding status tabs, loading shimmer, empty states, row
   entrance, and the Overview page's panels. Linked after styles.css and built only from its tokens,
   so the consoles look like the customer app. Spark violet means "on"; green, amber and red stay
   reserved for food dates (and the payment chips' own tones in payments.css). */

/* ---- Page heading ---- */
.console-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1.5rem; flex-wrap: wrap; }
.console-head-text { min-width: 0; }
.console-lead { margin: 0.375rem 0 0; font-size: 0.9375rem; color: var(--ink-muted); max-width: 46rem; }
.console-head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.console-head-actions :is(.btn-primary, .btn-outline) { min-height: 2.75rem; }
.console-section-title { margin: 2rem 0 0; font-size: 1.0625rem; }
.console-section-lead { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--ink-muted); }

/* ---- Summary strip ---- */
.console-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); margin: 1.25rem 0 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-raised); box-shadow: var(--shadow-card); overflow: hidden; }
.console-summary-item { padding: 0.875rem 1.125rem; border-right: 1px solid var(--line); min-width: 0; }
.console-summary-item:last-child { border-right: 0; }
.console-summary dt { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.console-summary dd { margin: 0.25rem 0 0; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.console-summary-item.is-spark dd { color: var(--spark); }
.console-summary-item.is-warn dd { color: var(--discard); }
@media (max-width: 640px) {
  .console-summary { grid-template-columns: repeat(2, 1fr); }
  .console-summary-item { border-bottom: 1px solid var(--line); }
  .console-summary-item:nth-child(2n) { border-right: 0; }
}

/* ---- Toolbar: tabs (or pills) on the left, search on the right. Every control here is unlabelled
   on screen (sr-only labels), so nothing sits beside a labelled one. ---- */
.console-toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.console-toolbar .app-pills { margin-top: 0; }
.console-toolbar-end { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.console-search { position: relative; width: 18rem; max-width: 100%; }
.console-search input { margin-top: 0; padding-left: 2.25rem; min-height: 2.75rem; width: 100%; }
.console-search svg { position: absolute; left: 0.75rem; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); color: var(--ink-muted); pointer-events: none; }
.console-toolbar + .app-pills, .app-pills + .console-toolbar { margin-top: 0.75rem; }
@media (max-width: 640px) {
  .console-toolbar-end { margin-left: 0; width: 100%; }
  .console-search { width: 100%; }
}

/* Status tabs with a sliding highlight (wireTabs). */
.seg { position: relative; display: inline-flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 0.125rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper-deep); max-width: 100%; }
.seg-thumb { position: absolute; left: 0; top: 0.25rem; height: calc(100% - 0.5rem); width: 0; border-radius: var(--radius-pill); background: var(--paper-raised); box-shadow: var(--shadow-card); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); pointer-events: none; }
.seg-still .seg-thumb { transition: none; }
.seg-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 0.375rem; min-height: 2.25rem; padding: 0 0.875rem; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font: inherit; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: color 0.15s ease; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.seg-btn:focus-visible { outline: 2px solid var(--spark); outline-offset: 1px; }
.seg-count { color: var(--ink-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.seg-btn[aria-pressed="true"] .seg-count { color: var(--spark); }
@media (max-width: 640px) {
  .seg-btn { min-height: 2.5rem; padding: 0 0.75rem; }
  .console-toolbar > div:first-child { max-width: 100%; }
  /* App pills scroll sideways on a phone instead of stacking five rows deep. */
  .app-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; margin-left: -2px; margin-right: -2px; }
  .app-pill { flex-shrink: 0; }
}

/* ---- Tables ---- */
.console-table { margin-top: 1rem; }
.console-table:has(td.row-actions) th:last-child, .console-table td.row-actions { text-align: right; }
.row-actions-inner { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
@media (min-width: 1024px) { .row-actions-inner { flex-wrap: nowrap; } }
.row-actions-inner :is(.btn-outline, .btn-primary, .btn-danger) { font-size: 0.75rem; }
.cell-sub { display: block; margin-top: 0.125rem; font-size: 0.8125rem; color: var(--ink-muted); font-weight: 400; }
.cell-strong { font-weight: 600; }
.cust-status { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.1875rem 0.625rem; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.cust-status::before { content: ""; width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: currentColor; }
.cust-status--on { background: var(--spark-soft); color: var(--spark); }
.cust-status--trial { background: transparent; color: var(--spark); border-color: color-mix(in srgb, var(--spark) 45%, var(--line)); }
.cust-status--off { background: var(--paper-deep); color: var(--ink-muted); border-color: var(--line); }
@media (max-width: 640px) {
  .table-wrap.mobile-cards td.row-actions { justify-content: flex-end; }
  .table-wrap.mobile-cards td.row-actions::before { content: none; }
  .table-wrap.mobile-cards td.cell-title { justify-content: flex-start; text-align: left; padding-top: 0.75rem; }
  .table-wrap.mobile-cards td.cell-title::before { content: none; }
  .table-wrap.mobile-cards .console-empty-row { border: 0; box-shadow: none; background: none; padding: 0; }
  .table-wrap.mobile-cards .console-empty-row td { display: block; border: 0; text-align: left; }
  .table-wrap.mobile-cards .console-empty-row td::before, .table-wrap.mobile-cards .skeleton-row td::before { content: none; }
  .table-wrap.mobile-cards .skeleton-row td { display: block; }
}

/* Loading shimmer. */
.skeleton { display: inline-block; height: 0.75rem; width: 60%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--paper-deep) 0%, var(--hover) 45%, var(--paper-deep) 90%); background-size: 200% 100%; animation: console-shimmer 1.3s ease-in-out infinite; }
.skeleton-block { display: block; width: 100%; border-radius: var(--radius-md); }
.skeleton-row td { padding-top: 1rem; padding-bottom: 1rem; }
@keyframes console-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Empty states. */
.console-empty { display: flex; align-items: center; gap: 0.875rem; padding: 1.5rem 0.5rem; color: var(--ink-muted); font-size: 0.875rem; }
.console-empty p { margin: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.console-empty b { color: var(--ink); font-weight: 600; }
.console-empty-icon { flex-shrink: 0; width: 2.75rem; height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--spark-soft); color: var(--spark); }
.console-empty-icon svg { width: 1.25rem; height: 1.25rem; }
.console-empty-row:hover { background: none; }

/* Rows and tiles arrive one after another (stagger). */
.is-staggered > * { animation: console-rise 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 32ms); }
@keyframes console-rise { from { opacity: 0; transform: translateY(6px); } }

/* ---- Overview page ---- */
.ov-section { margin-top: 1.5rem; }
.ov-stats { margin-top: 1.25rem; }
@media (min-width: 1100px) { .ov-stats { grid-template-columns: repeat(5, 1fr); } }
.ov-stats .dash-stat-value, .ov-stats .dash-stat-label { display: block; }
.dash-stat-sub { display: block; margin-top: 0.25rem; font-size: 0.8125rem; color: var(--spark); }
.dash-stat--brand .dash-stat-sub { color: var(--on-spark); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
@media (min-width: 1100px) { .ov-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ov-grid--wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.ov-panel { min-width: 0; padding: 1.25rem 1.25rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-raised); box-shadow: var(--shadow-card); }
.ov-stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.ov-panel .table-wrap { margin: 0; border: 0; box-shadow: none; background: none; }
.ov-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.ov-panel-head h2 { margin: 0; font-size: 1rem; }
.ov-panel-link { display: inline-flex; align-items: center; gap: 0.125rem; min-height: 2.25rem; font-size: 0.8125rem; font-weight: 600; color: var(--spark); text-decoration: none; white-space: nowrap; }
.ov-panel-link:hover { text-decoration: underline; }
.ov-panel-link svg { width: 0.875rem; height: 0.875rem; }
.ov-kicker { margin: 0 0 0.5rem; font-size: 0.875rem; color: var(--ink-muted); }
.ov-kicker b { color: var(--spark); font-size: 1.125rem; }
.ov-more { margin: 0.5rem 0 0; font-size: 0.8125rem; color: var(--ink-muted); }

/* What needs someone. */
.needs-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.5rem; }
.needs-item { display: flex; align-items: center; gap: 0.75rem; min-height: 3.25rem; padding: 0.5rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: 0.875rem; }
a.needs-item { transition: border-color 0.15s ease, background-color 0.15s ease; }
a.needs-item:hover { border-color: var(--spark); background: var(--hover); }
.needs-item > svg { margin-left: auto; width: 1rem; height: 1rem; flex-shrink: 0; color: var(--ink-muted); }
.needs-count { flex-shrink: 0; min-width: 2rem; height: 2rem; padding: 0 0.5rem; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: var(--zest); color: var(--on-zest); font-weight: 700; font-variant-numeric: tabular-nums; }
.needs-text { min-width: 0; }

/* Customers by app. */
.ov-apps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ov-app { display: grid; grid-template-columns: 2rem 7.75rem minmax(4rem, 1fr) 13.5rem; align-items: center; gap: 0.75rem; min-height: 3rem; padding: 0.375rem 0.5rem; margin: 0 -0.5rem; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.ov-app:hover { background: var(--hover); }
.ov-app-icon { width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--spark-soft); color: var(--spark); }
.ov-app.is-off .ov-app-icon { background: var(--paper-deep); color: var(--ink-muted); }
.ov-app-icon svg { width: 1rem; height: 1rem; }
.ov-app-name { display: flex; flex-direction: column; font-weight: 600; font-size: 0.875rem; min-width: 0; }
.ov-app-managed { white-space: nowrap; font-size: 0.6875rem; font-weight: 500; color: var(--ink-muted); }
.ov-app-bar { display: flex; height: 0.625rem; border-radius: var(--radius-pill); background: var(--paper-deep); overflow: hidden; }
.ov-app-bar i, .ov-legend i { display: block; height: 100%; transform-origin: left; animation: ov-grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
:is(.ov-app-bar, .ov-legend) .is-active { background: var(--spark); }
:is(.ov-app-bar, .ov-legend) .is-trial { background: color-mix(in srgb, var(--spark) 55%, var(--paper-raised)); }
:is(.ov-app-bar, .ov-legend) .is-early { background: var(--zest); }
@keyframes ov-grow { from { transform: scaleX(0); } }
.ov-app-count { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.8125rem; color: var(--ink-muted); min-width: 0; }
.ov-app-count b { font-size: 1rem; color: var(--ink); min-width: 1.5rem; text-align: right; }
.ov-app-count span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0.75rem 0 0; font-size: 0.75rem; color: var(--ink-muted); }
.ov-legend span { display: inline-flex; align-items: center; gap: 0.375rem; }
.ov-legend i { width: 0.625rem; height: 0.625rem; border-radius: 3px; animation: none; }
@media (max-width: 640px) {
  .ov-app { grid-template-columns: 2rem minmax(0, 1fr) auto; grid-template-areas: "icon name count" "icon bar bar"; row-gap: 0.375rem; padding: 0.5rem; }
  .ov-app-icon { grid-area: icon; align-self: start; }
  .ov-app-name { grid-area: name; }
  .ov-app-bar { grid-area: bar; }
  .ov-app-count { grid-area: count; }
  .ov-app-count span { display: none; }
}

/* Lists of customers, payments and requests. */
.ov-list { list-style: none; margin: 0; padding: 0; }
.ov-list li + li { border-top: 1px solid var(--line); }
.ov-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 3.25rem; padding: 0.5rem; margin: 0 -0.5rem; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
a.ov-row:hover { background: var(--hover); }
.ov-row-main { display: flex; flex-direction: column; min-width: 0; }
.ov-row-main b { font-weight: 600; font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-row-main span { font-size: 0.8125rem; color: var(--ink-muted); }
.ov-row .pay-chip, .ov-row .cust-status { flex-shrink: 0; }
.ov-when { flex-shrink: 0; font-size: 0.8125rem; color: var(--ink-muted); }

/* Activity feed. */
.ov-feed { list-style: none; margin: 0; padding: 0; position: relative; }
.ov-feed li { position: relative; display: flex; gap: 0.75rem; padding: 0.5rem 0; font-size: 0.875rem; }
.ov-feed li + li::before { content: ""; position: absolute; left: 0.28rem; top: -0.5rem; height: 1.125rem; border-left: 1px solid var(--line); }
.ov-feed-dot { flex-shrink: 0; width: 0.625rem; height: 0.625rem; margin-top: 0.4rem; border-radius: 50%; background: var(--spark); box-shadow: 0 0 0 3px var(--spark-soft); }
.ov-feed-text { min-width: 0; }
.ov-feed-text > span:not(.ov-feed-meta) { color: var(--ink-muted); }
.ov-feed-meta { display: block; font-size: 0.75rem; color: var(--ink-muted); }

/* Partners on the platform overview. */
.ov-table { width: 100%; }
.ov-table td, .ov-table th { white-space: nowrap; }
.ov-table td:first-child { white-space: normal; min-width: 10rem; }
.ov-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.ov-skeleton .skeleton { animation-duration: 1.5s; }

@media (prefers-reduced-motion: reduce) {
  .seg-thumb, .seg-btn, a.needs-item { transition: none; }
  .is-staggered > *, .ov-app-bar i { animation: none; }
  .skeleton { animation: none; background: var(--paper-deep); }
}
