/* ==========================================================================
   Tokens. Light is the base; dark gets its own steps (not an inversion).
   ========================================================================== */

:root {
  color-scheme: light;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;

  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --surface-3: #e7e6e0;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.085);
  --border-strong: rgba(11, 11, 11, 0.15);
  --topbar: rgba(244, 244, 241, 0.78);

  --series-0: #2a78d6;
  --series-1: #eb6834;
  --series-2: #1baf7a;
  --series-3: #eda100;
  --series-4: #e87ba4;
  --series-5: #008300;
  --series-6: #6250d6;
  --series-7: #e34948;

  /* Income sources (Overview only), kept apart from the machine colors above. */
  --src-salad: #1baf7a;
  --src-earnapp: #6250d6;

  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --warning-text: #8a5a00;
  --critical: #d03b3b;
  --critical-text: #b42a2a;

  --primary: #0b0b0b;
  --primary-ink: #fcfcfb;
  --focus: #2a78d6;

  --shadow-sm: 0 1px 2px rgba(20, 20, 14, 0.04), 0 1px 1px rgba(20, 20, 14, 0.025);
  --shadow-md: 0 14px 34px -16px rgba(20, 20, 14, 0.22), 0 3px 8px -3px rgba(20, 20, 14, 0.06);
  --shadow-lg: 0 30px 70px -20px rgba(20, 20, 14, 0.35), 0 8px 20px -8px rgba(20, 20, 14, 0.12);

  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --gutter: 24px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222220;
    --surface-3: #2c2c2a;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.075);
    --border-strong: rgba(255, 255, 255, 0.14);
    --topbar: rgba(13, 13, 13, 0.72);
    --series-0: #3987e5;
    --series-1: #d95926;
    --series-2: #199e70;
    --series-3: #c98500;
    --series-4: #d55181;
    --series-5: #008300;
    --series-6: #9085e9;
    --series-7: #e66767;
    --src-salad: #199e70;
    --src-earnapp: #9085e9;
    --good-text: #2fbf2f;
    --warning-text: #fab219;
    --critical-text: #ef6b6b;
    --primary: #f0efec;
    --primary-ink: #111110;
    --focus: #5598e7;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 16px 36px -16px rgba(0, 0, 0, 0.7), 0 3px 8px -3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 34px 80px -20px rgba(0, 0, 0, 0.85), 0 10px 24px -10px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222220;
  --surface-3: #2c2c2a;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.14);
  --topbar: rgba(13, 13, 13, 0.72);
  --series-0: #3987e5;
  --series-1: #d95926;
  --series-2: #199e70;
  --series-3: #c98500;
  --series-4: #d55181;
  --series-5: #008300;
  --series-6: #9085e9;
  --series-7: #e66767;
  --src-salad: #199e70;
  --src-earnapp: #9085e9;
  --good-text: #2fbf2f;
  --warning-text: #fab219;
  --critical-text: #ef6b6b;
  --primary: #f0efec;
  --primary-ink: #111110;
  --focus: #5598e7;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 16px 36px -16px rgba(0, 0, 0, 0.7), 0 3px 8px -3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 34px 80px -20px rgba(0, 0, 0, 0.85), 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.no-scroll {
  overflow: hidden;
}

.theme-anim,
.theme-anim *,
.theme-anim *::before,
.theme-anim *::after {
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease), color 0.35s var(--ease), fill 0.35s var(--ease) !important;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

code,
kbd,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

code,
kbd {
  padding: 0.08em 0.38em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

kbd {
  border-bottom-width: 2px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ==========================================================================
   Motion
   ========================================================================== */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  70%,
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

.reveal {
  animation: rise 0.75s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 55ms + 40ms);
}

.reveal-soft {
  animation: fade 0.5s var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.is-scrolled .topbar {
  border-bottom-color: var(--border);
  box-shadow: 0 8px 24px -20px rgba(0, 0, 0, 0.35);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: var(--shadow-sm);
  flex: none;
}

.brand-mark .icon {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-name {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.icon-btn:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.is-spinning .icon {
  animation: spin 0.9s linear infinite;
}

#theme-btn .icon-moon,
:root[data-theme="dark"] #theme-btn .icon-sun {
  display: none;
}

:root[data-theme="dark"] #theme-btn .icon-moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-btn .icon-sun {
    display: none;
  }
  :root:not([data-theme="light"]) #theme-btn .icon-moon {
    display: block;
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px 0 12px;
  margin-right: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.status-pill:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}

.status-icon:empty {
  display: none;
}

.status-icon .icon {
  width: 15px;
  height: 15px;
  display: block;
}

.status-pill[data-kind="live"] .status-dot {
  background: var(--good);
}

.status-pill[data-kind="live"] .status-dot::after,
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: pulse 2.4s var(--ease) infinite;
}

.status-pill[data-kind="demo"] .status-dot {
  background: var(--series-6);
}

.status-pill[data-kind="syncing"] .status-dot,
.status-pill[data-kind="critical"] .status-dot,
.status-pill[data-kind="warning"] .status-dot {
  display: none;
}

.status-pill[data-kind="syncing"] .status-icon .icon {
  animation: spin 0.9s linear infinite;
}

.status-pill[data-kind="critical"] {
  color: var(--critical-text);
  border-color: color-mix(in srgb, var(--critical) 35%, transparent);
}

.status-pill[data-kind="warning"] .status-icon {
  color: var(--warning);
}

/* ==========================================================================
   Page tabs
   ========================================================================== */

.pagenav {
  position: relative;
  display: flex;
  gap: 4px;
  margin: 22px 0 0;
  border-bottom: 1px solid var(--grid);
  overflow-x: auto;
  scrollbar-width: none;
}

.pagenav::-webkit-scrollbar {
  display: none;
}

.pagenav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
  border-radius: 10px 10px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 580;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.pagenav-tab .icon {
  width: 17px;
  height: 17px;
}

.pagenav-tab:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.pagenav-tab.is-active {
  color: var(--ink);
}

.pagenav-value {
  font-size: 12px;
  font-weight: 560;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.pagenav-value:empty {
  display: none;
}

.pagenav-tab.is-active .pagenav-value {
  color: var(--ink-2);
}

.pagenav-ink {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.45s var(--ease), width 0.45s var(--ease);
}

.page-enter {
  animation: page-in 0.5s var(--ease) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Filters
   ========================================================================== */

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin: 26px 0 20px;
}

.filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-label {
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-2);
}

.filters-meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.seg {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  isolation: isolate;
}

.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.1), inset 0 0 0 1px var(--border);
  transition: transform 0.42s var(--ease), width 0.42s var(--ease), opacity 0.2s;
  z-index: -1;
}

.seg-btn {
  position: relative;
  border: 0;
  background: transparent;
  padding: 6px 13px;
  min-width: 46px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
  transition: color 0.2s var(--ease);
}

.seg-btn:hover:not(:disabled) {
  color: var(--ink);
}

.seg-btn[aria-checked="true"] {
  color: var(--ink);
}

.seg-btn:disabled {
  color: var(--ink-3);
  opacity: 0.55;
}

/* ==========================================================================
   Cards & layout
   ========================================================================== */

.dash {
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity 0.3s var(--ease);
}

.dash.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.card-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.kpis {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 152px;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
}

.kpi-value {
  font-size: 27px;
  font-weight: 640;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-top: 6px;
  white-space: nowrap;
}

.kpi-sub {
  font-size: 12.5px;
  color: var(--ink-2);
}

.kpi-spark {
  margin-top: auto;
  padding-top: 10px;
  height: 44px;
}

.spark {
  display: block;
  width: 100%;
  max-width: 132px;
  height: 34px;
  overflow: visible;
}

.kpi-hero {
  gap: 6px;
}

.hero-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 2px;
}

.hero-value {
  font-size: clamp(42px, 4.6vw, 56px);
  font-weight: 680;
  letter-spacing: -0.04em;
  line-height: 1.04;
  white-space: nowrap;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.delta .icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.delta-up {
  color: var(--good-text);
}

.delta-down {
  color: var(--critical-text);
}

.delta-flat {
  color: var(--ink-2);
  font-weight: 560;
}

.delta-none {
  color: var(--ink-3);
  font-weight: 500;
  font-size: 12.5px;
}

.delta-vs {
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 2px;
}

.delta-sm {
  font-size: 12px;
}

.delta-sm .icon {
  width: 13px;
  height: 13px;
}

.share {
  margin-top: auto;
  padding-top: 14px;
}

.share-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface);
}

.share-seg {
  flex: 1 1 0;
  min-width: 3px;
  transition: flex-grow 0.9s var(--ease), background-color 0.3s;
}

.share-seg:first-child {
  border-radius: 5px 0 0 5px;
}

.share-seg:last-child {
  border-radius: 0 5px 5px 0;
}

.share-seg:only-child {
  border-radius: 5px;
}

.share-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.share-legend li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  min-width: 0;
}

.share-name {
  color: var(--ink-2);
}

.share-val {
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.share-pct {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.key {
  display: inline-block;
  flex: none;
}

.key-rect {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.key-line {
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

/* ==========================================================================
   Charts
   ========================================================================== */

.chart {
  width: 100%;
  position: relative;
}

.chart-main {
  height: 340px;
}

.chart-mini {
  height: 156px;
  margin-top: 4px;
}

.chart-race {
  height: 300px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink);
  transition: background-color 0.18s var(--ease), opacity 0.2s var(--ease), border-color 0.18s;
}

.legend-item:hover {
  background: var(--surface-2);
}

.legend-item[aria-pressed="false"] {
  opacity: 0.45;
}

.legend-item[aria-pressed="false"] .legend-name {
  text-decoration: line-through;
  text-decoration-color: var(--ink-3);
}

/* Tooltip content (ECharts draws the frame). */
.tt {
  min-width: 170px;
  font-family: var(--font);
}

.tt-title {
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 7px;
  white-space: nowrap;
}

.tt-row {
  display: flex;
  align-items: center;
  gap: 9px;
  line-height: 1.35;
  padding: 2px 0;
}

.tt-key {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  flex: none;
}

.tt-key-none {
  background: transparent;
}

.tt-val {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 64px;
}

.tt-name {
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.tt-total {
  margin-top: 5px;
  padding-top: 6px;
  border-top: 1px solid var(--grid);
}

/* ==========================================================================
   Machine cards
   ========================================================================== */

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

.machines[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.machines[data-count="3"],
.machines[data-count="5"],
.machines[data-count="6"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.machine {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  container-type: inline-size;
}

/* A narrow card (three across, or a phone) folds its four stats into two rows. */
@container (max-width: 470px) {
  .stats:not(.stats-2) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats:not(.stats-2) .stat:nth-child(3) {
    border-left: 0;
  }
  .stats:not(.stats-2) .stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
}

.machine::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--mc);
  opacity: 0.95;
}

.machine-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.machine-key {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 4px;
  background: var(--mc);
  flex: none;
}

/* Device and source icons in place of the color key */
.machine-head.has-icon {
  align-items: center;
}

.device-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex: none;
  color: var(--mc);
  background: color-mix(in srgb, var(--mc) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--mc) 28%, transparent);
}

.device-icon .icon {
  width: 20px;
  height: 20px;
}

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

.badge-banned,
.badge-conn-critical {
  color: var(--critical-text);
}

.badge-banned .icon,
.badge-conn-critical .icon {
  color: var(--critical);
}

.badge-conn-warning .icon {
  color: var(--warning);
}

.badge-bonus .icon {
  color: var(--ink-3);
}

.badge-conn-live {
  color: var(--ink);
}

.demo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--series-6);
}

/* Overview source cards */
.sources .source-body {
  display: flex;
  flex-direction: column;
}

.source-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--grid);
}

.source-foot .btn {
  margin-right: -8px;
}

.source-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13.5px;
}

.sources .stat-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Top earners */
.top-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.top-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1.2fr) minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 13px;
}

.top-row:last-child {
  border-bottom: 0;
}

.top-rank {
  color: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.top-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-label {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-src {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.top-src .key-rect {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.top-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.top-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0 4px 4px 0;
  transition: width 1s var(--ease);
}

.top-val {
  text-align: right;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

/* Payout history */
.payouts {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.payout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 13px;
}

.payout:last-child {
  border-bottom: 0;
}

.payout-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.payout-amount {
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.payout-method,
.payout-date {
  color: var(--ink-2);
  white-space: nowrap;
}

.payout-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-self: end;
  font-size: 12px;
  font-weight: 560;
  color: var(--ink-2);
  white-space: nowrap;
}

.payout-status .icon {
  width: 14px;
  height: 14px;
}

.payout-status.is-paid .icon {
  color: var(--good);
}

.payout-status.is-pending .icon {
  color: var(--warning);
}

/* GPU illustration in place of the color key */
.machine-head.has-art {
  align-items: center;
  gap: 14px;
}

.gpu-art {
  display: block;
  /* --units is the drawing's width in mm, so every card is drawn at the same true scale. */
  width: calc(var(--units, 310) * 0.413px);
  height: auto;
  flex: none;
  overflow: visible;
}

.gpu-art * {
  vector-effect: non-scaling-stroke;
  stroke-width: 1;
}

.ga-shroud {
  fill: var(--surface-2);
  stroke: var(--ink-3);
}

.ga-metal {
  fill: var(--surface-3);
  stroke: var(--ink-3);
}

.ga-gold {
  fill: var(--axis);
}

.ga-pcb {
  fill: var(--ink-3);
  fill-opacity: 0.2;
  stroke: var(--ink-3);
  stroke-opacity: 0.6;
}

.ga-part {
  fill: var(--surface-3);
  stroke: var(--ink-3);
}

.ga-accent {
  fill: var(--mc, var(--series-0));
}

.ga-dark {
  fill: var(--ink-3);
  fill-opacity: 0.32;
}

.ga-screw {
  fill: var(--ink-3);
}

.ga-line {
  fill: none;
  stroke: var(--ink-3);
  stroke-opacity: 0.7;
}

.ga-faint {
  stroke-opacity: 0.3;
}

.ga-well {
  fill: var(--surface-3);
  stroke: var(--ink-3);
}

.ga-blades path {
  fill: var(--ink-2);
  fill-opacity: 0.55;
}

.ga-rim {
  fill: none;
  stroke: var(--ink-3);
  stroke-opacity: 0.55;
}

.ga-hub {
  fill: var(--surface);
  stroke: var(--ink-3);
}

.ga-dot {
  fill: var(--mc, var(--series-0));
}

.ga-rotor {
  transform-box: fill-box;
  transform-origin: center;
  animation: fan-spin 2.4s linear infinite;
  animation-play-state: paused;
}

.gpu-art.is-on .ga-rotor {
  animation-play-state: running;
}

@keyframes fan-spin {
  to {
    transform: rotate(360deg);
  }
}

.machine-titles {
  flex: 1;
  min-width: 0;
}

.machine-name {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.machine-sub {
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 2px 0 0 -6px;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 550;
  transition: background-color 0.15s, color 0.15s;
}

.name-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.name-btn .icon {
  width: 13px;
  height: 13px;
}

.machine-figure {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 16px 0 14px;
}

.machine-value {
  font-size: 34px;
  font-weight: 670;
  letter-spacing: -0.035em;
  line-height: 1.05;
  white-space: nowrap;
}

.machine-figure-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.machine-value-label {
  font-size: 12.5px;
  color: var(--ink-2);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  overflow: hidden;
}

.stat {
  padding: 10px 12px 11px;
  min-width: 0;
}

.stat + .stat {
  border-left: 1px solid var(--border);
}

.stat dd {
  margin: 0;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-size: 15px;
  font-weight: 640;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.stat-hint {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.machine-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--grid);
  font-size: 12px;
  color: var(--ink-2);
}

.sep {
  color: var(--ink-3);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 560;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  flex: none;
}

.badge .icon {
  width: 14px;
  height: 14px;
}

.badge .pulse {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
}

.badge .ring {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-3);
}

.badge-earning {
  color: var(--ink);
}

.badge-stale .icon,
.badge-warning .icon {
  color: var(--warning);
}

.badge-good .icon {
  color: var(--good);
}

.badge-critical {
  color: var(--critical-text);
}

.badge-critical .icon {
  color: var(--critical);
}

.badge-muted .icon {
  color: var(--ink-3);
}

/* ==========================================================================
   Internet: online time and the hours it leaves the machines
   ========================================================================== */

.net-head-side {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.net-stats {
  margin: 4px 0 18px;
}

.net-stats .stat-value {
  white-space: normal;
}

.net-timeline {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.net-row,
.net-axis {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 176px;
  align-items: center;
  gap: 12px;
}

.net-day {
  font-size: 12px;
  font-weight: 560;
  color: var(--ink-2);
  white-space: nowrap;
}

.net-row.is-today .net-day {
  color: var(--ink);
  font-weight: 650;
}

.net-track {
  position: relative;
  height: 14px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
  overflow: hidden;
}

.net-seg {
  position: absolute;
  top: 0;
  bottom: 0;
}

/* Online is the reserved "good" status color; offline and unwatched stay neutral, told apart by fill. */
.net-seg.is-o,
.net-swatch.is-o {
  background: var(--good);
}

.net-seg.is-e,
.net-swatch.is-e {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--good) 55%, transparent) 0 3px, color-mix(in srgb, var(--good) 22%, transparent) 3px 6px);
}

.net-seg.is-x,
.net-swatch.is-x {
  background: color-mix(in srgb, var(--ink) 16%, var(--surface));
}

.net-swatch.is-u {
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--border);
}

.net-now {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--ink);
}

.net-meta {
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.net-meta b {
  color: var(--ink);
  font-weight: 620;
}

.net-axis {
  margin-top: 2px;
}

.net-ticks {
  position: relative;
  height: 14px;
  font-size: 10.5px;
  color: var(--ink-3);
}

.net-ticks span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.net-ticks span:first-child {
  transform: none;
}

.net-ticks span:last-child {
  transform: translateX(-100%);
}

.net-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--ink-2);
}

.net-key-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.net-swatch {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.net-swatch.is-line {
  height: 2px;
  border-radius: 2px;
  background: var(--ink-2);
}

.net-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-hours {
  height: 260px;
}

.net-machines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--ink-2);
}

.net-machines li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.net-machines b {
  color: var(--ink);
  font-weight: 620;
}

.net-machines .net-swatch {
  background: var(--c);
}

.net-machines .net-swatch.is-line {
  background: var(--ink-2);
}

@media (max-width: 960px) {
  .net-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .net-row,
  .net-axis {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 4px 10px;
  }
  .net-meta {
    grid-column: 2;
    margin-top: -2px;
  }
  .net-axis > :last-child {
    display: none;
  }
  .net-head-side {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Running total + head to head
   ========================================================================== */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 16px;
}

.split.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.compare {
  display: flex;
  flex-direction: column;
}

.compare-headline {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
  margin: -2px 0 16px;
  text-wrap: balance;
}

.compare-headline b {
  color: var(--ink);
  font-weight: 640;
}

.compare-headline .ratio {
  font-size: 1.1em;
}

.compare-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cmp-label {
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 5px;
}

.cmp-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cmp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: center;
  gap: 10px;
}

.cmp-track {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.cmp-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0 4px 4px 0;
  transition: width 1s var(--ease);
}

.cmp-val {
  font-size: 12.5px;
  font-weight: 560;
  text-align: right;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cmp-row.is-best .cmp-val {
  color: var(--ink);
  font-weight: 680;
}

.compare-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: auto 0 0;
  padding: 18px 0 0;
  list-style: none;
  font-size: 12px;
  color: var(--ink-2);
}

.compare-key li {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ==========================================================================
   Heatmaps
   ========================================================================== */

.heatmaps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px 28px;
}

.heat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.heat-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heat-scale {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.heat-scale-label {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.heat-ramp {
  width: 56px;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 18%, var(--surface)), var(--c));
}

/* ==========================================================================
   Table
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  margin: 0 -22px;
  padding: 0 22px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.table th,
.table td {
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--grid);
}

.table thead th {
  font-size: 12px;
  font-weight: 560;
  color: var(--ink-2);
  border-bottom-color: var(--axis);
  padding-top: 4px;
}

.table tbody th {
  font-weight: 500;
  color: var(--ink-2);
}

.table .num {
  text-align: right;
}

.table td.zero {
  color: var(--ink-3);
}

.table td.lead {
  font-weight: 640;
}

.table td.total {
  font-weight: 600;
}

.table tbody tr {
  transition: background-color 0.15s;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table th:first-child,
.table td:first-child {
  padding-left: 0;
}

.table th:last-child,
.table td:last-child {
  padding-right: 0;
}

.so-far {
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 550;
  color: var(--ink-3);
}

.th-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.table-more {
  margin: 12px auto 0;
  display: flex;
}

/* ==========================================================================
   Onboarding
   ========================================================================== */

.onboarding {
  max-width: 760px;
  margin: 48px auto;
  padding: 44px 44px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.onboard-mark,
.onboard-spinner {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 16px;
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: var(--shadow-md);
}

.onboard-mark .icon,
.onboard-spinner .icon {
  width: 28px;
  height: 28px;
  stroke-width: 1.9;
}

.onboard-spinner .icon {
  animation: spin 1s linear infinite;
}

.onboard-spinner:not([hidden]) + .onboard-title {
  margin-top: 0;
}

.onboard-spinner:not([hidden]) ~ .onboard-mark,
.onboarding:has(.onboard-spinner:not([hidden])) .onboard-mark {
  display: none;
}

.onboard-title {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-wrap: balance;
}

.onboard-text {
  max-width: 560px;
  margin: 12px auto 0;
  font-size: 15px;
  color: var(--ink-2);
  text-wrap: pretty;
}

.onboard-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.onboard-steps li {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.onboard-steps b {
  display: block;
  font-size: 13.5px;
  font-weight: 620;
}

.onboard-steps span:not(.step-n) {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 2px;
}

.step-n {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 650;
  flex: none;
}

.onboard-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding: 26px 0 40px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.foot-left,
.foot-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.foot-right .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-3);
}

.foot a {
  text-decoration: none;
  color: var(--ink);
}

.foot a:hover {
  text-decoration: underline;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
}

/* ==========================================================================
   Buttons & inputs
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 580;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.15s var(--ease), box-shadow 0.18s, opacity 0.2s;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.btn:disabled {
  opacity: 0.55;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary) 86%, var(--page));
}

.btn-danger {
  background: var(--critical);
  border-color: var(--critical);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--critical) 88%, #000);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn-lg {
  height: 44px;
  padding: 0 20px;
  font-size: 14px;
  border-radius: 12px;
}

.btn.is-loading {
  position: relative;
  color: transparent !important;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

.btn-primary.is-loading::after {
  border-color: var(--primary-ink);
  border-top-color: transparent;
}

.danger-text {
  color: var(--critical-text);
}

.link-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  transition: background-color 0.15s, color 0.15s;
}

.link-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.link-btn .icon {
  width: 15px;
  height: 15px;
}

.input {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: var(--ink-3);
}

.input:hover {
  border-color: color-mix(in srgb, var(--ink) 25%, transparent);
}

.input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}

.input:disabled {
  opacity: 0.6;
}

textarea.input {
  resize: vertical;
  line-height: 1.45;
}

.cookie-input {
  font-size: 12px;
  min-height: 86px;
  word-break: break-all;
}

.select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 580;
  color: var(--ink);
}

.optional {
  color: var(--ink-3);
  font-weight: 450;
}

/* Switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  width: 32px;
  height: 19px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background-color 0.2s var(--ease), border-color 0.2s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s var(--ease);
}

.switch-input:checked + .switch-track {
  background: var(--primary);
  border-color: var(--primary);
}

.switch-input:checked + .switch-track::after {
  transform: translateX(13px);
  background: var(--primary-ink);
}

.switch-input:focus-visible + .switch-track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Layout helpers */
.row {
  display: flex;
  align-items: center;
}

.row-wrap {
  flex-wrap: wrap;
}

.gap-8 {
  gap: 8px;
}

.stack-6,
.stack-8,
.stack-12 {
  display: flex;
  flex-direction: column;
}

.stack-6 {
  gap: 6px;
}

.stack-8 {
  gap: 8px;
}

.stack-12 {
  gap: 12px;
}

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

.pad-top {
  padding-top: 12px;
}

/* ==========================================================================
   Drawer
   ========================================================================== */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 0.45s;
}

.drawer.is-open {
  pointer-events: auto;
  visibility: visible;
  transition: visibility 0s;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 8, 0.32);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: min(480px, calc(100vw - 20px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  transform: translateX(calc(100% + 24px));
  transition: transform 0.48s var(--ease);
  overflow: hidden;
  overflow: clip; /* unlike hidden, focus can't scroll it */
}

.drawer.is-open .drawer-panel {
  transform: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 14px 24px;
  border-bottom: 1px solid var(--grid);
}

.drawer-head h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 24px 28px;
}

.sec {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 0;
  scroll-margin-top: 8px;
}

.sec + .sec {
  border-top: 1px solid var(--grid);
}

.sec-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.005em;
}

.sec-sub {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: -6px;
  text-wrap: pretty;
}

.conn {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.conn-expired {
  border-color: color-mix(in srgb, var(--critical) 40%, transparent);
}

.conn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.conn-meta {
  font-size: 12px;
  color: var(--ink-2);
}

.conn-name {
  font-size: 15px;
  font-weight: 620;
}

.conn-msg {
  font-size: 12.5px;
  color: var(--ink-2);
}

.conn-hint {
  font-size: 12px;
  color: var(--ink-3);
}

.conn-update {
  padding: 12px 0 4px;
}

.help {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 0 14px;
}

.help summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  font-size: 12.5px;
  font-weight: 580;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
}

.help summary::-webkit-details-marker {
  display: none;
}

.help summary .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-2);
}

.help summary::after {
  content: "";
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--ink-3);
  border-bottom: 1.6px solid var(--ink-3);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.25s var(--ease);
}

.help[open] summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.help[open] > :not(summary) {
  animation: fade 0.3s var(--ease);
}

.steps {
  margin: 0 0 14px;
  padding-left: 20px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.steps b {
  color: var(--ink);
  font-weight: 600;
}

.steps a {
  color: var(--ink);
  font-weight: 560;
}

.fine {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
}

.fine-icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
}

.empty-line {
  font-size: 12.5px;
  color: var(--ink-3);
}

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-2);
}

.callout b {
  color: var(--ink);
}

.callout .icon {
  color: var(--ink-2);
  margin-top: 1px;
}

/* Machine editor */
.machine-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: opacity 0.2s;
}

.machine-edit.is-hidden .machine-edit-top,
.machine-edit.is-hidden .machine-edit-meta {
  opacity: 0.55;
}

.machine-edit-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.machine-edit-fields {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.machine-edit-fields.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.sec-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 -4px;
  font-size: 13px;
  font-weight: 640;
}

.sec-group .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-2);
}

.swatch-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
}

.swatch-btn::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: var(--sw);
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 2px 48px;
  animation: fade 0.25s var(--ease);
}

.palette-dot {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--surface-2);
  background: var(--sw);
  box-shadow: 0 0 0 1px var(--border-strong);
  padding: 0;
  transition: transform 0.15s var(--ease);
}

.palette-dot:hover {
  transform: scale(1.1);
}

.palette-dot.is-current {
  box-shadow: 0 0 0 2px var(--ink);
}

.machine-edit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding-left: 48px;
  font-size: 12px;
  color: var(--ink-2);
}

.machine-edit-meta .link-btn {
  margin-left: -10px;
  width: 22px;
  height: 22px;
}

.machine-edit-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 48px;
}

.machine-edit-foot .btn {
  margin-left: auto;
}

.saved {
  font-size: 12px;
  color: var(--good-text);
  opacity: 0;
}

.saved.is-on {
  animation: saved 1.8s var(--ease);
}

@keyframes saved {
  0% {
    opacity: 0;
    transform: translateY(3px);
  }
  15%,
  70% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
  }
}

.log,
.entries,
.urls {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.log li {
  display: grid;
  grid-template-columns: 18px 84px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--grid);
}

.log li:last-child {
  border-bottom: 0;
}

.log .icon {
  width: 15px;
  height: 15px;
}

.log .ok .icon {
  color: var(--good);
}

.log .fail .icon {
  color: var(--critical);
}

.log-time {
  color: var(--ink-3);
  white-space: nowrap;
}

.log-msg {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entries li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 12.5px;
}

.entries .dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex: none;
}

.entry-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.entry-main b {
  color: var(--ink);
}

.entry-when {
  color: var(--ink-3);
  white-space: nowrap;
}

.urls li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
}

.urls li + li {
  margin-top: 6px;
}

.urls .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-3);
}

.urls a {
  flex: 1;
  text-decoration: none;
  color: var(--ink);
}

.urls a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Toasts & dialogs
   ========================================================================== */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: 100%;
  padding: 10px 8px 10px 14px;
  border-radius: 13px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 13px;
  font-weight: 520;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition: opacity 0.32s var(--ease), transform 0.42s var(--ease);
}

.toast.is-in {
  opacity: 1;
  transform: none;
}

.toast.is-out {
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition-duration: 0.22s;
}

.toast-icon {
  width: 17px;
  height: 17px;
}

.toast-success .toast-icon {
  color: var(--good);
}

.toast-error .toast-icon {
  color: #ff7a7a;
}

:root[data-theme="dark"] .toast-error .toast-icon {
  color: var(--critical);
}

.toast-msg {
  flex: 1;
  min-width: 0;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  opacity: 0.6;
}

.toast-close:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--primary-ink) 12%, transparent);
}

.toast-close .icon {
  width: 14px;
  height: 14px;
}

.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  animation: rise 0.32s var(--ease);
}

.dialog.is-out {
  opacity: 0;
  transition: opacity 0.18s;
}

.dialog::backdrop {
  background: rgba(10, 10, 8, 0.4);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade 0.25s var(--ease);
}

.dialog-body {
  padding: 22px 22px 18px;
}

.dialog-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.dialog-text {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ==========================================================================
   Portfolio
   ========================================================================== */

.pf-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 18px;
}

.pf-strip-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--ink-2);
}

.pf-strip-actions {
  display: flex;
  gap: 8px;
}

.btn.is-spinning .icon {
  animation: spin 0.9s linear infinite;
}

.kpi-value.is-up,
.pf-change.is-up {
  color: var(--good-text);
}

.kpi-value.is-down,
.pf-change.is-down {
  color: var(--critical-text);
}

.pf-change {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pf-est {
  color: var(--ink-3);
}

.chart.is-loading {
  opacity: 0.55;
  transition: opacity 0.25s var(--ease);
}

/* Symbol badge: a tinted chip in the security type's color. */
.pf-sym {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: color-mix(in srgb, var(--c, var(--series-0)) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c, var(--series-0)) 30%, transparent);
  flex: none;
}

.pf-sym-lg {
  min-width: 64px;
  height: 36px;
  font-size: 13px;
  border-radius: 10px;
}

.pf-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.pf-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0 4px 4px 0;
  background: var(--series-0);
  transition: width 1s var(--ease);
}

.pf-alloc,
.pf-accounts,
.pf-imports {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pf-alloc-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(70px, 0.8fr) 52px;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 13px;
}

.pf-alloc-row:last-child,
.pf-account:last-child,
.pf-import:last-child {
  border-bottom: 0;
}

.pf-alloc-row .pf-sym {
  --c: var(--ink-3);
}

.pf-alloc-name {
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-alloc-pct {
  text-align: right;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.pf-account {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--grid);
}

.pf-account-top,
.pf-account-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pf-account-name {
  font-size: 13.5px;
  font-weight: 600;
}

.pf-account-value {
  font-size: 15px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
}

.pf-account-meta {
  font-size: 12px;
  color: var(--ink-2);
}

/* Holdings table */
.pf-table th,
.pf-table td {
  vertical-align: middle;
}

.pf-row {
  cursor: pointer;
}

.pf-row:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.pf-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
}

.pf-sort:hover,
.pf-sort.is-active {
  color: var(--ink);
}

.pf-sort-arrow {
  display: inline-block;
  width: 10px;
}

.pf-holding {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pf-holding-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.pf-holding-name {
  max-width: 260px;
  color: var(--ink);
  font-weight: 560;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-holding-type {
  font-size: 11.5px;
  color: var(--ink-3);
}

.pf-strong {
  font-weight: 640;
}

.pf-weight {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 96px;
}

.pf-weight-bar {
  height: 6px;
  max-width: 44px;
  border-radius: 3px;
  background: var(--series-0);
  opacity: 0.85;
}

.pf-gain {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}

.pf-gain small {
  font-size: 11.5px;
  font-weight: 520;
  opacity: 0.85;
}

.pf-spark-col .spark {
  display: inline-block;
  vertical-align: middle;
}

/* Holding detail */
.dialog.pf-detail {
  width: min(720px, calc(100vw - 24px));
}

.pf-detail-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
}

.pf-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pf-detail-titles {
  flex: 1;
  min-width: 0;
}

.pf-detail-titles .dialog-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-detail-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.pf-detail-big {
  font-size: 34px;
  font-weight: 680;
  letter-spacing: -0.03em;
}

.pf-detail-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.pf-detail-chart {
  height: 260px;
}

.pf-detail-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pf-detail-stats .stat:nth-child(5) {
  border-left: 0;
}

.pf-detail-stats .stat:nth-child(n + 5) {
  border-top: 1px solid var(--border);
}

/* Imports */
.pf-import {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 13px;
}

.pf-import-icon {
  --mc: var(--ink-2);
  width: 36px;
  height: 36px;
}

.pf-import-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pf-import-text span {
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-import-total {
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

/* Drop a CSV anywhere */
.pf-drop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--page) 70%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}

.pf-drop.is-on {
  opacity: 1;
}

.pf-drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 48px;
  border-radius: 22px;
  border: 2px dashed var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: scale(0.96);
  transition: transform 0.3s var(--ease);
}

.pf-drop.is-on .pf-drop-card {
  transform: none;
}

.pf-drop-card .icon {
  width: 34px;
  height: 34px;
  color: var(--ink-2);
}

.pf-drop-card b {
  font-size: 16px;
}

.pf-drop-card span {
  font-size: 13px;
  color: var(--ink-2);
}

/* Value chart key: portfolio value vs money put in */
.pf-chart-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-2);
}

.pf-chart-key-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--ink);
}

.pf-key-line {
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--series-0);
}

.pf-key-line.pf-key-putin {
  height: 1.5px;
  background: color-mix(in srgb, var(--ink-2) 75%, transparent);
}

.pf-chart-key-hint {
  color: var(--ink-3);
}

/* Trades on a holding's chart */
.trade-icon {
  flex: none;
  display: block;
}

.tt-row .trade-icon {
  margin: 0 1px;
}

.pf-trade-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: -6px 0 0;
  font-size: 12px;
  color: var(--ink-2);
}

.pf-trade-key-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--ink);
}

.pf-trade-key-hint {
  color: var(--ink-3);
}

.pf-trades {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pf-trades-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.pf-trades-title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.pf-trades-empty {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.pf-trades .btn {
  align-self: flex-start;
}

.pf-trade-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 252px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.pf-trade {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto 96px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s;
}

.pf-trade:first-child {
  border-top: 0;
}

.pf-trade:hover,
.pf-trade:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.pf-trade-icon {
  display: grid;
  place-items: center;
}

.pf-trade-what {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pf-trade-what b {
  font-size: 13.5px;
  font-weight: 620;
}

.pf-trade-what span {
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-trade-price,
.pf-trade-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 13.5px;
  font-weight: 600;
}

.pf-trade-price small,
.pf-trade-amount small {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
}

@media (max-width: 720px) {
  .pf-spark-col,
  .pf-table th:nth-child(6),
  .pf-table td:nth-child(6) {
    display: none;
  }
  .pf-holding-name {
    max-width: 112px;
  }
  /* The holding stays put while the numbers scroll sideways. */
  .pf-table tbody th,
  .pf-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--border);
    transition: background-color 0.15s;
  }
  .pf-table tbody tr:hover th {
    background: var(--surface-2);
  }
  .pf-detail-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pf-trade {
    grid-template-columns: 14px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 12px;
  }
  .pf-trade-price {
    display: none;
  }
  .pf-trade-key-hint {
    display: none;
  }
  .pf-detail-stats .stat:nth-child(odd) {
    border-left: 0;
  }
  .pf-detail-stats .stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
  .pf-alloc-row {
    grid-template-columns: auto minmax(0, 1fr) 48px;
  }
  .pf-alloc-row .pf-bar {
    display: none;
  }
}

/* ==========================================================================
   Lock screen
   ========================================================================== */

.lock-page {
  /* A faint dot grid, fading out toward the edges. */
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1.6px) 0 0 / 22px 22px,
    var(--page);
}

.lock-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 60% 55% at 50% 45%, transparent 30%, var(--page) 78%);
  pointer-events: none;
}

.lock {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 48px 20px 88px;
  text-align: center;
}

/* --- the two cards on their slot */
.lock-stage {
  position: relative;
  margin-bottom: 40px;
  animation: rise 0.9s var(--ease) both;
}

.lock-rig {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 34px;
}

.lock-gpu {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  --mc: var(--src-salad);
  animation: rise 0.9s var(--ease) both;
}

.lock-gpu:nth-child(2) {
  animation-delay: 0.12s;
}

.lock-gpu .gpu-art {
  width: calc(var(--units) * 0.78px);
}

.lock-gpu figcaption {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}

.lock-slot {
  height: 1px;
  margin: 14px -40px 0;
  background: linear-gradient(90deg, transparent, var(--axis) 18%, var(--axis) 82%, transparent);
  transform-origin: center;
  animation: lock-slot 1.1s var(--ease) 0.2s both;
}

@keyframes lock-slot {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* --- greeting */
.lock-title {
  font-size: clamp(42px, 8.5vw, 76px);
  font-weight: 760;
  letter-spacing: -0.048em;
  line-height: 1;
  animation: rise 0.9s var(--ease) 0.18s both;
}

.lock-sub {
  max-width: 400px;
  margin-top: 14px;
  font-size: 15px;
  color: var(--ink-2);
  text-wrap: balance;
  animation: rise 0.9s var(--ease) 0.26s both;
}

/* --- password */
.lock-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(380px, 100%);
  margin-top: 30px;
  animation: rise 0.9s var(--ease) 0.34s both;
}

.lock-pill {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 56px;
  padding: 0 6px 0 20px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.lock-pill:focus-within {
  border-color: var(--focus);
  box-shadow: var(--shadow-md), 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent);
}

.lock.has-error .lock-pill {
  border-color: color-mix(in srgb, var(--critical) 60%, transparent);
}

.lock-pill.is-shaking {
  animation: shake 0.45s var(--ease-io);
}

.lock-pill input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.lock-pill input::placeholder {
  color: var(--ink-3);
  letter-spacing: 0;
}

.lock-pill-confirm {
  padding-right: 20px;
}

.lock-icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-3);
  transition: color 0.15s, background-color 0.15s;
}

.lock-icon-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.lock-icon-btn .icon-hide,
.lock-icon-btn[aria-pressed="true"] .icon-show {
  display: none;
}

.lock-icon-btn[aria-pressed="true"] .icon-hide {
  display: block;
}

.lock-go {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: 4px;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: var(--primary);
  color: var(--primary-ink);
  transition: transform 0.2s var(--ease), background-color 0.3s var(--ease);
}

.lock-go:hover {
  transform: translateX(2px);
}

.lock-go:active {
  transform: scale(0.94);
}

.lock-go .icon {
  width: 19px;
  height: 19px;
  stroke-width: 2.2;
  transition: opacity 0.2s, transform 0.3s var(--ease);
}

.lock-go .icon-done {
  position: absolute;
  opacity: 0;
  transform: scale(0.6);
}

.lock.is-busy .lock-go .icon-arrow {
  opacity: 0;
}

.lock.is-busy .lock-go::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--primary-ink);
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

.lock.is-unlocked .lock-go {
  background: var(--good);
}

.lock.is-unlocked .lock-go .icon-arrow {
  opacity: 0;
}

.lock.is-unlocked .lock-go .icon-done {
  opacity: 1;
  transform: none;
}

.lock-error {
  min-height: 18px;
  font-size: 13px;
  color: var(--critical-text);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease);
}

.lock.has-error .lock-error {
  opacity: 1;
  transform: none;
}

.lock-remember {
  font-size: 12.5px;
}

.lock-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  padding: 0 20px;
  font-size: 12px;
  color: var(--ink-3);
  animation: fade 1s var(--ease) 0.8s both;
}

/* --- unlocking: fans race, everything lifts away */
.lock.is-unlocked .ga-rotor {
  animation-duration: 0.45s;
}

.lock.is-unlocked .lock-stage,
.lock.is-unlocked .lock-title,
.lock.is-unlocked .lock-sub,
.lock.is-unlocked .lock-form {
  transition: opacity 0.45s var(--ease) 0.35s, transform 0.55s var(--ease) 0.35s;
  opacity: 0;
  transform: translateY(-14px);
}

@media (max-width: 520px) {
  .lock-rig {
    gap: 20px;
  }
  .lock-gpu .gpu-art {
    width: calc(var(--units) * 0.52px);
  }
  .lock-stage {
    margin-bottom: 30px;
  }
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* ==========================================================================
   Account menu
   ========================================================================== */

.account {
  position: relative;
}

.account-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: 2px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s var(--ease);
}

.account-btn:hover {
  border-color: var(--ink-3);
}

.account-btn:active {
  transform: scale(0.95);
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 232px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: menu-in 0.2s var(--ease);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.account-who {
  padding: 10px 10px 10px;
  border-bottom: 1px solid var(--grid);
  margin-bottom: 4px;
}

.account-who small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
}

.account-who b {
  display: block;
  font-size: 14px;
  font-weight: 640;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
  text-align: left;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-2);
}

.menu-item .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-2);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi-hero {
    grid-column: 1 / -1;
    min-height: 0;
  }
  .machines[data-count="3"],
  .machines[data-count="5"],
  .machines[data-count="6"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .machines,
  .machines[data-count] {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
  }
  .topbar-inner {
    height: 58px;
  }
  .status-pill {
    width: 34px;
    padding: 0;
    justify-content: center;
    margin-right: 0;
  }
  .status-pill .status-text {
    display: none;
  }
  .brand-sub {
    max-width: 44vw;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  .pagenav {
    margin: 12px calc(var(--gutter) * -1) 0;
    padding: 0 var(--gutter);
  }
  .pagenav-tab {
    padding: 9px 11px 11px;
    font-size: 13.5px;
  }
  .pagenav-value {
    display: none;
  }
  .top-row {
    grid-template-columns: 16px minmax(0, 1fr) 64px;
  }
  .top-bar {
    display: none;
  }
  .payout {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .payout-date {
    grid-column: 1;
    grid-row: 2;
    margin-top: -6px;
    font-size: 12px;
  }
  .payout-status {
    grid-row: 1 / span 2;
    grid-column: 2;
  }
  .filters {
    margin: 18px 0 14px;
    gap: 10px 14px;
  }
  .filter {
    width: 100%;
    justify-content: space-between;
  }
  .filter .seg {
    flex: 1;
    max-width: 360px;
  }
  .seg-btn {
    flex: 1;
    min-width: 0;
    padding: 6px 6px;
  }
  .filters-meta {
    margin-left: 0;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .kpis .kpi:last-child {
    grid-column: 1 / -1;
    min-height: 0;
  }
  .kpi {
    min-height: 0;
  }
  .kpi-value {
    font-size: 22px;
  }
  .card {
    padding: 16px;
    border-radius: 14px;
  }
  .table-wrap {
    margin: 0 -16px;
    padding: 0 16px;
  }
  .dash {
    gap: 12px;
  }
  .chart-main {
    height: 270px;
  }
  .chart-race {
    height: 240px;
  }
  .card-head {
    flex-direction: column;
    gap: 8px;
  }
  .legend {
    justify-content: flex-start;
    margin-left: -11px;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat:nth-child(3) {
    border-left: 0;
  }
  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
  .machine-value {
    font-size: 30px;
  }
  .gpu-art {
    width: calc(var(--units, 310) * 0.3226px);
  }
  .heatmaps {
    grid-template-columns: minmax(0, 1fr);
  }
  .onboarding {
    margin: 20px auto;
    padding: 30px 20px 26px;
  }
  .onboard-steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-2,
  .machine-edit-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .drawer-panel {
    top: 6px;
    right: 6px;
    bottom: 6px;
    width: calc(100vw - 12px);
    border-radius: 18px;
  }
  .drawer-body {
    padding: 4px 18px 24px;
  }
  .palette,
  .machine-edit-meta,
  .machine-edit-foot {
    padding-left: 0;
  }
  .foot {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 400px) {
  .brand-sub {
    display: none;
  }
  .hero-value {
    font-size: 38px;
  }
}

@media (forced-colors: active) {
  .share-seg,
  .cmp-fill,
  .key {
    forced-color-adjust: none;
  }
}
