/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-tile { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--border); background: var(--surface); transition: border-color var(--ease), background var(--ease); }
.stat-tile:hover { border-color: var(--border-strong); background: var(--surface-2); }
.stat-tile__value { color: var(--text); font-size: 40px; font-weight: 700; letter-spacing: -0.035em; line-height: 1; }
.stat-tile__label { color: var(--text-2); font-size: 13px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-direction: column; gap: 12px; }
.toolbar__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.toolbar__search { position: relative; flex: 1 1 220px; display: flex; align-items: center; max-width: 320px; }
.toolbar__search .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.toolbar__search-input { padding-left: 36px; }

/* ---------- data table (shared by marketplace, rentals, wallet) ---------- */
.table-wrap { border: 1px solid var(--line); background: var(--bg-raised); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 12px 16px; text-align: left; font-weight: 500; font-size: 13px; color: var(--text-3); border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg-raised); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; transition: background var(--ease); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--ease); }
.table tbody tr:hover td { background: var(--surface); }
.table .num { text-align: right; white-space: nowrap; }
.table th.num { text-align: right; }
.table .col-action { text-align: right; width: 1%; white-space: nowrap; }
.table tr.is-muted .cell-name a, .table tr.is-muted .cell-name strong { color: var(--text-2); }
.cell-name { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.cell-name a, .cell-name strong { color: var(--text); font-weight: 600; font-size: 14.5px; }
.cell-name a:hover { color: var(--accent); text-decoration: none; }
.cell-sub { color: var(--text-3); font-size: 12px; font-family: var(--mono); }
.cell-muted { color: var(--text-3); font-size: 12px; }
.cell-strong { font-weight: 700; }
.table .btn { min-width: 84px; }
.empty-row td { text-align: center; padding: 40px 16px; color: var(--text-2); }

/* Fit the extra usage column without squeezing or wrapping price lines. */
@media (min-width: 860px) {
  .table--market th, .table--market td { padding-left: 10px; padding-right: 10px; }
  .table--market th.col-model { width: 252px; }
  .table--market .cell-first .cell-name { min-width: 180px; max-width: 210px; }
  .table--market .cell-name a { overflow-wrap: anywhere; }
  .table--market th.col-token-burn { width: 96px; min-width: 96px; white-space: normal; }
  .table--market th.col-token-burn, .table--market td.token-burn { text-align: center; }
  .table--market .col-action { padding-left: 20px; padding-right: 10px; }
}

/* ---------- detail ---------- */
.detail__grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
.detail__main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.detail__head { display: flex; flex-direction: column; gap: 10px; }
.detail__head h1 { font-size: clamp(28px, 5vw, 38px); letter-spacing: -0.035em; }
.detail__model { color: var(--text-3); }
.detail__meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rent-panel { display: flex; flex-direction: column; gap: 16px; }
.rent-panel__title { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.rent-block { display: flex; flex-direction: column; gap: 8px; }
.rent-block__label { font-size: 13px; font-weight: 600; color: var(--text); }
.rent-price { display: flex; flex-direction: column; gap: 6px; }
.rent-price__sub { color: var(--text-3); font-size: 12.5px; }

@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
  .toolbar { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  /* Same edge as the bundle tabs: centring the search/toggle group against a
     shorter sibling shifted the 40px search box by 1px, which reads as a broken row. */
  .toolbar__controls { flex: 1; justify-content: flex-end; align-items: flex-end; }
  .toolbar__search { align-self: flex-end; }
  /* Class tabs, bundle tabs and the search box sit in ONE desktop row, so they get
     one control height. Their natural heights were 42.25 / 39.5 / 40px. */
  .toolbar__row .seg__btn, .toolbar__controls .input, .toolbar__controls .toggle { height: 40px; box-sizing: border-box; }
  .toolbar__row .seg--tabs .seg__btn { padding-top: 0; padding-bottom: 0; }
  .toolbar__controls .toggle { display: inline-flex; align-items: center; }
  .detail__grid { grid-template-columns: minmax(0, 1fr) 380px; }
  .detail__side { position: sticky; top: calc(var(--header-h) + 20px); }
}

/* ---------- phones: each table row becomes a labelled block ---------- */
@media (max-width: 859px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table--stack tbody tr:last-child { border-bottom: 0; }
  .table--stack td { padding: 5px 0; border: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .table--stack td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; text-align: left; flex: none; }
  .table--stack td.cell-first { display: block; text-align: left; padding-bottom: 8px; }
  .table--stack td.cell-first::before { content: none; }
  .table--stack td.col-action { width: 100%; padding-top: 10px; }
  .table--stack td.col-action::before { content: none; }
  .table--stack td.col-action .btn { width: 100%; }
  .table--stack tbody tr:hover td { background: transparent; }
  .table--stack tbody tr:hover { background: var(--surface); }
  .table--stack .price--stack { align-items: flex-end; }
}

/* ---------- calculator panel (detail) ---------- */
.calc { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
.calc__in, .calc__out { display: flex; flex-direction: column; gap: 14px; }
.calc__out .btn--lg { align-self: flex-start; }
.calc__in .input { max-width: 100%; }
@media (min-width: 860px) { .calc { grid-template-columns: 1fr 1.4fr; } }

/* ---------- model directory (hairline grid) ---------- */
.directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.directory__tile { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 16px; text-align: left; background: var(--bg-raised); border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); transition: background var(--ease), box-shadow var(--ease); }
.directory__tile:hover { background: var(--surface); }
.directory__tile:hover .logo { border-color: var(--accent); }
.directory__tile.is-active { background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.directory__text { display: flex; flex-direction: column; min-width: 0; }
.directory__text strong { font-size: 15px; }
.directory__text span { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 640px) { .directory { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .directory { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- toolbar extras ---------- */
.toolbar__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.toolbar__bundle-wrap { display: flex; align-items: center; gap: 10px; }
.toolbar__label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
@media (max-width: 420px) {
  .toolbar__bundle-wrap { flex-wrap: wrap; }
  .toolbar__bundle .seg--boxes .seg__btn { min-width: 44px; padding-left: 10px; padding-right: 10px; }
}

/* ---------- detail (spec-sheet layout) ---------- */
.detail__head { flex-direction: row; align-items: flex-start; gap: 16px; }
.detail__head h1 { font-size: clamp(26px, 4vw, 36px); }
.detail__model { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-top: 4px; word-break: break-all; }
.detail__meta { margin-top: 10px; }
.rate-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 24px; padding: 6px 0; }
.rate-big { display: flex; flex-direction: column; gap: 8px; }
.rate-big__label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.bid-card { display: flex; flex-direction: column; gap: 16px; }
.bid-card__title { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.bid-card .specs dd { min-width: 0; overflow-wrap: anywhere; }
.available-clouds { display: flex; flex-direction: column; }
.available-clouds__row { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.available-clouds__model { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.available-clouds__title { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.available-clouds__bundles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.available-clouds__bundles .btn { min-width: 36px; padding: 0 8px; border-color: var(--border); }
.available-clouds__bundles .btn[aria-expanded="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
.available-clouds__panel { display: flex; flex-direction: column; gap: 10px; border-left: 2px solid var(--accent); padding: 4px 0 4px 14px; }
.available-clouds__panel[hidden] { display: none; }
.available-clouds__names { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--text); }
.available-clouds__name { border: 1px solid var(--border); padding: 8px 12px; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; }
.available-clouds__hours { font-size: 12px; color: var(--text-3); }
.hours-group { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.hours-group:first-child { border-top: 0; padding-top: 0; }
.hours-group__clouds { font-weight: 600; overflow-wrap: anywhere; margin: 0; }
.hours-batches { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }
