/* Model plaza shares the site's light/dark tokens and keeps its own scroll area. */

/* Keep offscreen cards searchable and focusable without laying out every child.
   Older browsers simply use the normal card layout. */
@supports (content-visibility: auto) {
  .plaza-card { content-visibility:auto; contain-intrinsic-block-size:auto 450px; }
}

.model-plaza-page {
  min-width:0;color:var(--text);background:transparent
}

.plaza-container {
  padding: 0 0 20px
}

.plaza-eyebrow {
  display: block;
  margin-bottom: 10px;
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  color: #8b5cf6
}

.plaza-toolbar {
  padding: 16px 18px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px
}

.plaza-search-row {
  display: flex;
  gap: 10px;
  align-items: center
}

.plaza-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px
}

.plaza-search:focus-within {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,.1)
}

.plaza-search svg,.plaza-refresh svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted)
}

.plaza-search input::placeholder {
  color: var(--muted)
}

.plaza-sort select {
  height: 44px;
  padding: 0 30px 0 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  cursor: pointer
}

.plaza-refresh {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px
}

.plaza-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px
}

.plaza-filters button {
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 12px
}

.plaza-filters button:hover {
  color: var(--text);
  background: var(--surface-soft)
}

.plaza-filters button.active {
  background: rgba(139,92,246,.12);
  border-color: rgba(139,92,246,.22);
  color: #7c3aed;
  font-weight: 600
}

html[data-theme="dark"] .plaza-filters button.active {
  color: #c4b5fd
}

.plaza-grid {
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;align-items:stretch
}

.plaza-card {
  min-width:0;position:relative;display:flex;flex-direction:column;gap:0;padding:16px;background:var(--surface);border:1px solid var(--border);border-radius:10px;transition:border-color .16s;overflow:hidden
}

.plaza-card:hover {
  border-color: var(--control-border);
  box-shadow: var(--ui-shadow)
}

.plaza-card.is-selected {
  border-color:var(--accent);box-shadow:none
}

.plaza-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px
}

.plaza-model-icon {
  width:27px;height:27px;display:grid;place-items:center;border-radius:6px;border:1px solid var(--border);background:var(--surface-soft);color:var(--text);font-weight:600;font-size:11px
}

.plaza-type {
  padding:0;border:0;background:transparent;font-size:11px;color:var(--muted)
}

.plaza-selected-label {
  color:var(--accent-text);background:transparent;border:0
}

html[data-theme="dark"] .plaza-selected-label {
  color: #c4b5fd
}

.plaza-card h3 {
  display:block;min-height:42px;margin:0 0 4px;font-size:14px;font-weight:600;line-height:21px;overflow-wrap:anywhere;letter-spacing:-.15px
}

.plaza-id-row {
  display:flex;align-items:center;gap:7px;margin:0 0 10px;color:var(--muted);min-height:20px
}

.plaza-id-row code {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px
}

.plaza-copy {
  flex-shrink:0;display:grid;place-items:center;width:20px;height:20px;min-height:20px;padding:3px;border:0;border-radius:4px;background:transparent;color:var(--muted)
}

.plaza-copy svg {
  width: 14px;
  height: 14px
}

.plaza-tags {
  display:flex;flex-wrap:wrap;gap:5px;min-height:20px;margin-bottom:12px
}

.plaza-tag {
  font-size:10px;line-height:17px;padding:0 4px;border-radius:3px;color:var(--muted);background:var(--surface-soft);border:1px solid var(--border)
}

.plaza-tag.media-required {
  color: #a16207;
  background: rgba(234,179,8,.08);
  border-color: rgba(234,179,8,.18)
}

html[data-theme="dark"] .plaza-tag.media-required {
  color: #fcd34d
}

.plaza-specs {
  display:grid;grid-template-columns:28px minmax(0,1fr);gap:4px 8px;margin:0 0 13px;min-height:62px;font-size:11px;line-height:18px
}

.plaza-specs dt {
  color: var(--muted)
}

.plaza-specs dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere
}

.plaza-card-bottom {
  padding-top:14px
}

.plaza-health-metrics>div:last-child { text-align:right; }
.plaza-health-metrics>div:last-child>span { justify-content:flex-end; }
.plaza-health-time small:last-child { margin-right:0; }
.plaza-health-sample { padding:0 3px;min-height:16px;line-height:14px;border:1px solid var(--border);border-radius:3px;background:transparent;color:var(--muted);font-size:10px;font-weight:400;white-space:nowrap; }
.plaza-health-bar[aria-pressed="true"] span { box-shadow:0 2px 0 var(--text); }
.plaza-card h3 :is(.model-display-badge,.model-customer-price-badge,.model-pause-badge) { vertical-align:1px;margin-left:5px; }

/* Reliability is local to the plaza; generation selectors stay unchanged. */
.model-plaza-page { --health-good:#2e9278; --health-warn:#ba883b; --health-low:#bd766c; --health-empty:rgba(94,102,122,.12); }
html[data-theme="dark"] .model-plaza-page { --health-good:#58b49b; --health-warn:#cba05b; --health-low:#c37f75; --health-empty:rgba(180,185,205,.09); }
.plaza-health {
  margin-top:auto;border-top:1px solid var(--border);padding:13px 0 0
}
.plaza-health-metrics {
  display:grid;grid-template-columns:1fr 1fr;gap:8px
}
.plaza-health-metrics>div>span {
  display:flex;align-items:center;gap:5px;min-height:18px;font-size:11px;color:var(--muted);margin-bottom:3px;white-space:nowrap
}
.plaza-health-metrics strong {
  display:block;font-size:23px;line-height:30px;font-weight:600;letter-spacing:-.6px;font-variant-numeric:tabular-nums
}
.plaza-health-metrics .plaza-health-time {
  font-size:21px;letter-spacing:-.3px
}
.plaza-health-time small {
  font-size:11px;font-weight:400;color:var(--muted);margin:0 4px
}
.plaza-health-bars {
  display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:3px;margin-top:5px
}
.plaza-health-bar {
  border:0;background:transparent;padding:7px 0;min-width:0;min-height:19px;border-radius:3px
}
.plaza-health-bar:hover { background:transparent; }
.plaza-health-bar span {
  display:block;width:100%;flex:1;height:5px;border-radius:2px;background:var(--health-empty)
}
.plaza-health-bar[data-tone="good"] span,.plaza-health-legend [data-tone="good"] { background:var(--health-good); }
.plaza-health-bar[data-tone="warn"] span,.plaza-health-legend [data-tone="warn"] { background:var(--health-warn); }
.plaza-health-bar[data-tone="low"] span,.plaza-health-legend [data-tone="low"] { background:var(--health-low); }
.plaza-health-bar[aria-pressed="true"] {
  box-shadow:none
}
.plaza-health-detail {
  display:flex;justify-content:space-between;gap:8px;min-height:16px;line-height:16px;font-size:10px;color:var(--muted);overflow-wrap:anywhere
}
.plaza-health-legend { display:flex;gap:15px;align-items:flex-start;flex-wrap:wrap;color:var(--muted);font-size:11px;margin:14px 0; }
.plaza-health-legend i { display:inline-block;width:7px;height:7px;margin-right:5px;border-radius:2px;background:var(--surface-soft); }
.plaza-health-legend details { margin-left:auto;max-width:480px; }
.plaza-health-legend summary { cursor:pointer;text-align:right; }
.plaza-health-legend p { line-height:1.7;margin:8px 0 0; }
@media(pointer:coarse) { .plaza-health-bar { min-height:44px; } }

.plaza-price-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px
}

.plaza-price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0
}

.plaza-price strong {
  font-size:19px;line-height:1.3;font-weight:600;letter-spacing:-.3px;font-variant-numeric:tabular-nums
}

.plaza-price span {
  font-size: 11px;
  color: var(--muted)
}

.plaza-price-link {
  border: 0;
  min-height: 30px;
  padding: 5px 0;
  background: transparent;
  color: #8b5cf6;
  font-size: 11px;
  white-space: nowrap
}

html[data-theme="dark"] .plaza-price-link {
  color: #c4b5fd
}

.plaza-price-link:hover {
  text-decoration: underline;
  background: transparent
}

.plaza-use {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border-radius: 6px;
  border: 1px solid var(--control-border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 600
}

.plaza-use:hover,.plaza-card.is-selected .plaza-use,.plaza-dialog .plaza-use {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: white
}

.plaza-use span {
  font-size: 16px;
  font-weight: 400
}

.plaza-footnote {
  margin: 23px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
  text-align: center
}

.plaza-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid rgba(234,179,8,.3);
  border-radius: 10px;
  margin-bottom: 16px;
  color: var(--text);
  font-size: 12px;
  background: rgba(234,179,8,.06)
}

.plaza-notice button {
  font-size: 12px;
  flex-shrink: 0;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text)
}

.plaza-empty {
  text-align: center;
  padding: 55px 20px;
  background: var(--surface);
  border: 1px dashed var(--control-border);
  border-radius: 14px
}

.plaza-empty-icon {
  font-size: 36px;
  color: var(--muted)
}

.plaza-empty h3 {
  font-size: 16px;
  margin: 12px 0 8px
}

.plaza-empty p {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0 0 20px
}

.plaza-empty button {
  background: var(--surface-soft);
  border-color: var(--control-border);
  color: var(--text);
  font-size: 12px
}

.plaza-skeleton {
  height: 330px;
  pointer-events: none
}

.plaza-skeleton div {
  border-radius: 7px;
  background: var(--surface-soft);
  height: 13px;
  margin-bottom: 16px
}

.plaza-skeleton div:first-child {
  width: 44px;
  height: 44px;
  margin-bottom: 25px
}

.plaza-skeleton div:nth-child(2) {
  width: 65%;
  height: 20px
}

.plaza-skeleton div:nth-child(3) {
  width: 45%
}

.plaza-skeleton div:last-child {
  height: 39px;
  margin-top: auto;
  margin-bottom: 0
}

.plaza-dialog::backdrop {
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px)
}

.plaza-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px
}

.plaza-dialog-head h2 {
  font-size: 20px;
  overflow-wrap: anywhere
}

.plaza-dialog-head button {
  border: 0;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 22px;
  flex-shrink: 0
}

.plaza-dialog-model-id {
  font-family: monospace;
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin: 10px 0 20px
}

.plaza-price-table-wrap {
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden
}

.plaza-price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

.plaza-price-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 500;
  font-size: 11px
}

.plaza-price-table th,.plaza-price-table td {
  text-align: left;
  padding: 12px 14px;
  overflow-wrap: anywhere
}

.plaza-price-table tr+tr {
  border-top: 1px solid var(--border)
}

.plaza-price-table td:last-child,.plaza-price-table th:last-child {
  text-align: right
}

#plazaPriceNote {
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
  margin: 16px 0 22px
}

.plaza-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 35px rgba(0,0,0,.2);
  font-size: 12px;
  z-index: 200
}

.plaza-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0
}

.model-plaza-page :focus-visible,.plaza-dialog :focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 3px
}

.model-plaza-page .plaza-search input:focus-visible {
  outline: none
}

/* Cards and filters share the same glass as the rest of the app. */

.plaza-card,.plaza-toolbar {
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--ui-shadow)
}

.plaza-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap
}

.plaza-count {
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px 8px;
  margin-left: auto
}

.plaza-results {
  font-size: 11px;
  color: var(--muted);
  white-space: normal
}

.plaza-dialog {
  width: min(460px,calc(100vw - 32px));
  max-height: 85vh;
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--control-border);
  border-radius: 18px;
  color: var(--text);
  box-shadow: 0 20px 80px rgba(0,0,0,.3);
  background: var(--solid-surface)
}

@media(max-width:1200px) {

  .plaza-card {
    padding: 16px
  }

  .plaza-grid {
    gap: 12px
  }

  .plaza-specs {
    gap: 4px 8px
  }

  .plaza-filters button {
    padding: 7px 9px
  }
}

@media(max-width:1050px) {

  .plaza-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
}

@media(max-width:600px) {

  .plaza-grid {
    grid-template-columns: 1fr
  }

  .plaza-toolbar {
    padding: 14px
  }

  .plaza-search-row {
    flex-wrap: wrap;
    gap: 8px
  }

  .plaza-search {
    flex-basis: 100%
  }

  .plaza-sort {
    flex: 1
  }

  .plaza-sort select {
    max-width: none;
    width: 100%
  }

  .plaza-filter-row {
    gap: 9px
  }

  .plaza-filters {
    flex-wrap: wrap;
    gap: 4px
  }

  .plaza-filters button {
    font-size: 11px;
    padding: 6px 8px
  }

  .plaza-count {
    margin-left: 0
  }

  .plaza-results {
    margin-left: auto
  }

  .plaza-card {
    padding: 16px
  }

  .plaza-toast {
    max-width: calc(100vw - 30px);
    white-space: normal;
    text-align: center
  }
}

.plaza-search input[type="search"] {
  width: 100%;
  min-width: 0;
  height: 42px;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 8px 0
}
