:root {
  --paper: #f7efe0;
  --paper-strong: #fffaf0;
  --ink: #1c1712;
  --muted: #675f55;
  --red: #d83b21;
  --green: #177a48;
  --yellow: #f0c94b;
  --blue: #93c9d7;
  --shadow: 4px 4px 0 var(--ink);
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background:
    linear-gradient(90deg, rgba(28, 23, 18, 0.065) 1px, transparent 1px),
    linear-gradient(rgba(28, 23, 18, 0.055) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(var(--max), calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 2px solid var(--ink);
  background: rgba(247, 239, 224, 0.94);
  backdrop-filter: blur(10px);
}

.nav {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  font-weight: 950;
  letter-spacing: -0.02em;
}

.nav-links,
.actions,
.filters,
.component-tags,
.component-meta,
.footer-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-links {
  justify-content: flex-end;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
}

.nav-links a,
.button,
.filter {
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper-strong);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 850;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.nav-links a {
  padding: 6px 10px;
}

.nav-links a:hover,
.button:hover,
.filter:hover,
.component-card[href]:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.hero {
  min-height: calc(88vh - 62px);
  padding-block: 70px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.65fr);
  align-items: center;
  gap: clamp(36px, 7vw, 96px);
}

.eyebrow,
.section-kicker,
.component-kicker,
.component-tags,
.component-meta,
.catalog-updated,
.principle-number,
.now-card > span,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.eyebrow,
.section-kicker {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.eyebrow {
  display: inline-block;
  padding: 5px 9px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
}

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

h1 {
  margin-bottom: 26px;
  max-width: 800px;
  font-size: clamp(54px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.065em;
}

.intro {
  max-width: 710px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 21px);
}

.actions {
  margin-top: 32px;
  gap: 14px;
}

.button {
  min-height: 46px;
  padding: 10px 16px;
}

.button.primary {
  color: var(--paper-strong);
  background: var(--red);
}

.hero-panel {
  border: 3px solid var(--ink);
  border-radius: 9px;
  background: var(--paper-strong);
  box-shadow: 10px 10px 0 var(--ink);
  transform: rotate(1.5deg);
}

.hero-panel-head {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--ink);
  background: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 900;
}

.live-dot {
  width: 11px;
  height: 11px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 2px 2px 0 var(--ink);
}

.hero-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.hero-stats div {
  min-width: 0;
  padding: 22px 12px;
  text-align: center;
  border-right: 2px solid var(--ink);
}

.hero-stats div:last-child {
  border-right: 0;
}

.hero-stats dt {
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
}

.hero-stats dd {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.catalog-updated {
  margin: 0;
  padding: 12px 16px;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 11px;
}

.principles {
  border-block: 2px solid var(--ink);
  background: rgba(255, 250, 240, 0.74);
}

.device-status {
  padding-block: 54px;
  border-block: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper-strong);
}

.device-heading-row {
  margin-bottom: 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.device-heading-row h2 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 50px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.device-heading-row .section-kicker {
  color: var(--yellow);
}

.metrics-updated {
  margin: 0 0 4px;
  color: #cfc6b7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

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

.metric-card {
  min-width: 0;
  padding: 18px;
  border: 2px solid var(--paper-strong);
  border-radius: 8px;
  background: #27211b;
  box-shadow: 4px 4px 0 var(--paper-strong);
}

.metric-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #cfc6b7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
}

.metric-card-head span:first-child {
  color: var(--paper-strong);
  font-size: 13px;
}

.metric-value {
  display: block;
  margin-block: 15px 11px;
  font-size: 34px;
  line-height: 1;
}

.metric-card progress {
  width: 100%;
  height: 12px;
  display: block;
  overflow: hidden;
  border: 2px solid var(--paper-strong);
  border-radius: 999px;
  background: transparent;
  appearance: none;
}

.metric-card progress::-webkit-progress-bar {
  background: #4a4037;
}

.metric-card progress::-webkit-progress-value {
  background: var(--metric-color, var(--yellow));
}

.metric-card progress::-moz-progress-bar {
  background: var(--metric-color, var(--yellow));
}

.metric-cpu {
  --metric-color: var(--red);
}

.metric-memory {
  --metric-color: var(--blue);
}

.metric-disk {
  --metric-color: var(--yellow);
}

.metric-gpu {
  --metric-color: #49c47a;
}

.metric-detail,
.metric-secondary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-detail {
  margin: 14px 0 4px;
  color: var(--paper-strong);
  font-size: 12px;
}

.metric-secondary {
  margin: 0;
  color: #aca397;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
}

.principle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.principle-grid article {
  min-height: 178px;
  padding: 28px;
  border-right: 2px solid var(--ink);
}

.principle-grid article:last-child {
  border-right: 0;
}

.principle-number {
  display: block;
  margin-bottom: 14px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.principle-grid strong {
  display: block;
  margin-bottom: 8px;
  font-size: 19px;
}

.principle-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.catalog-section,
.now-section {
  padding-block: 88px;
  scroll-margin-top: 62px;
}

.infrastructure-section {
  width: 100%;
  border-block: 2px solid var(--ink);
  background: rgba(147, 201, 215, 0.16);
}

.section-heading {
  margin-bottom: 28px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.section-heading > p {
  max-width: 510px;
  margin-bottom: 4px;
  color: var(--muted);
}

.filters {
  margin-bottom: 32px;
}

.filter {
  cursor: pointer;
  padding: 8px 12px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.filter.active {
  background: var(--yellow);
}

.catalog {
  min-width: 0;
  display: grid;
  gap: 34px;
}

.category-group {
  min-width: 0;
  display: grid;
  gap: 15px;
}

.category-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.category-title::after {
  content: "";
  height: 2px;
  flex: 1;
  background: var(--ink);
  opacity: 0.2;
}

.component-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.component-card,
.loading-card,
.empty-state,
.error-state {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.component-card {
  min-width: 0;
  min-height: 250px;
  padding: 19px;
  display: flex;
  flex-direction: column;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.component-card.return-focus {
  animation: return-focus 1.8s ease;
}

@keyframes return-focus {
  0%, 100% { outline: 0 solid transparent; }
  20%, 70% { outline: 7px solid rgba(240, 201, 75, 0.7); outline-offset: 5px; }
}

.component-card.accent-red {
  border-top: 10px solid var(--red);
}

.component-card.accent-green {
  border-top: 10px solid var(--green);
}

.component-card.accent-yellow {
  border-top: 10px solid var(--yellow);
}

.component-card.accent-blue {
  border-top: 10px solid var(--blue);
}

.component-card.accent-ink {
  border-top: 10px solid var(--ink);
}

.component-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.component-state-stack {
  min-width: 0;
  max-width: calc(100% - 64px);
  display: grid;
  justify-items: end;
  gap: 6px;
}

.component-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 950;
}

.component-icon img {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
}

.component-icon.has-image {
  background: #fff;
}

.component-icon.has-image .component-icon-fallback {
  display: none;
}

.component-status {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.component-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--muted);
}

.component-status.status-running::before {
  background: #49c47a;
}

.component-status.status-restarting::before,
.component-status.status-degraded::before {
  background: var(--yellow);
}

.component-status.status-unhealthy::before,
.component-status.status-exited::before,
.component-status.status-dead::before,
.component-status.status-missing::before,
.component-monitor-status.monitor-down::before {
  background: var(--red);
}

.component-monitor-status.monitor-up::before {
  background: #49c47a;
}

.component-monitor-status.monitor-degraded::before,
.component-monitor-status.monitor-pending::before {
  background: var(--yellow);
}

.component-monitor-status.monitor-paused::before {
  background: var(--blue);
}

.component-monitor-status {
  background: var(--ink);
  color: var(--paper-strong);
}

.admin-main {
  padding-block: 64px 100px;
}

.admin-heading {
  max-width: 850px;
  margin-bottom: 40px;
}

.admin-heading h1 {
  margin-bottom: 22px;
}

.admin-heading > p:last-child {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
}

.admin-summary {
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.admin-summary div {
  padding: 22px;
  display: grid;
  gap: 5px;
  border-right: 2px solid var(--ink);
}

.admin-summary div:last-child {
  border-right: 0;
}

.admin-summary strong {
  font-size: 34px;
  line-height: 1;
}

.admin-summary span,
.admin-toolbar,
.admin-pill,
.admin-details,
.admin-action {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.admin-summary span {
  color: var(--muted);
  font-size: 11px;
}

.admin-toolbar {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.admin-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-components {
  display: grid;
  gap: 14px;
}

.admin-component {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(150px, auto) minmax(360px, 1.6fr) auto;
  align-items: center;
  gap: 20px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-strong);
  box-shadow: 3px 3px 0 var(--ink);
}

.admin-component-identity {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
}

.admin-component-identity h2 {
  margin: 0 0 3px;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-component-identity code {
  color: var(--muted);
  font-size: 10px;
}

.admin-component-status {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.admin-pill {
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-size: 10px;
  font-weight: 900;
}

.admin-pill.lifecycle-missing,
.admin-pill.monitor-down {
  background: #ffd8d1;
}

.admin-pill.lifecycle-archived,
.admin-pill.monitor-paused {
  background: #d7ebf0;
}

.admin-pill.monitor-up {
  background: #d7f3e3;
}

.admin-pill.monitor-degraded,
.admin-pill.monitor-pending {
  background: #fff0b5;
}

.admin-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-details div {
  min-width: 0;
}

.admin-details dt {
  color: var(--muted);
  font-size: 9px;
}

.admin-details dd {
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-error {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--red);
  font-size: 10px;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-action {
  cursor: pointer;
  padding: 6px 8px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 10px;
  font-weight: 900;
}

.admin-action.dangerous {
  color: #fff;
  background: var(--red);
}

.admin-action:disabled {
  cursor: wait;
  opacity: 0.45;
}

.admin-session {
  margin: 20px 0 0;
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.admin-panel {
  min-width: 0;
  margin-top: 34px;
  padding: clamp(18px, 3vw, 30px);
  border: 3px solid var(--ink);
  border-radius: 9px;
  background: rgba(255, 250, 240, 0.88);
  box-shadow: var(--shadow);
}

.admin-panel-heading,
.admin-record-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.admin-panel-heading {
  margin-bottom: 20px;
}

.admin-panel-heading .section-kicker {
  margin-bottom: 7px;
}

.admin-panel-heading h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.account-profile-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(280px, 1.3fr);
  gap: 18px;
}

.account-avatar-card,
.account-security-card {
  min-width: 0;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--paper);
}

.account-avatar-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.account-avatar {
  width: 128px;
  height: 128px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--paper-strong);
  object-fit: cover;
  box-shadow: 4px 4px 0 var(--ink);
}

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

.account-security-card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.account-security-card h3 {
  margin: 0;
}

.account-security-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-sessions-card {
  grid-column: 1 / -1;
}

.account-security-record .admin-help {
  margin: 0;
}

.admin-notice {
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #d7ebf0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.admin-notice.success {
  background: #d7f3e3;
}

.admin-notice.warning {
  background: #fff0b5;
}

.admin-form-grid {
  margin-block: 20px 30px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-form {
  min-width: 0;
  padding: 16px;
  display: grid;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--paper);
}

.admin-form h3 {
  margin: 0;
}

.admin-form label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 850;
}

.admin-form input,
.admin-form select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 9px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  color: var(--ink);
  background: var(--paper-strong);
  font: inherit;
  font-size: 12px;
}

.admin-form p,
.admin-help {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.admin-form-inline {
  margin-bottom: 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

.admin-form-inline.compact {
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
}

.provider-editor-form {
  margin-bottom: 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.provider-probe-fields {
  min-width: 0;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.provider-advanced {
  min-width: 0;
  grid-column: 1 / -1;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--paper-strong);
}

.provider-advanced > summary {
  padding: 12px 14px;
  font-weight: 850;
  cursor: pointer;
}

.provider-advanced-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.provider-advanced-grid > label {
  min-width: 0;
}

.provider-credential-fields {
  min-width: 0;
  margin: 4px 0 0;
  padding: 14px;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 2px dashed var(--ink);
  border-radius: 7px;
}

.provider-credential-fields legend {
  padding-inline: 7px;
  font-weight: 850;
}

.provider-editor-actions {
  grid-column: 1 / -1;
}

.provider-test-result {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  grid-column: 1 / -1;
}

.provider-test-result:empty {
  display: none;
}

.provider-test-result.success {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--paper-strong);
}

.provider-test-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.provider-test-heading code {
  color: var(--muted);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.provider-test-section {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 8px;
}

.provider-test-section h4 {
  margin: 0;
  font-size: 15px;
}

.provider-test-models {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.provider-test-model {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--ink);
  border-radius: 6px;
}

.provider-test-model > div {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.provider-test-model strong,
.provider-test-model code,
.provider-test-model small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.provider-test-model code,
.provider-test-model small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.provider-test-model .admin-action {
  flex: 0 0 auto;
}

.provider-test-more {
  min-width: 0;
  max-width: 100%;
}

.provider-test-more > summary {
  display: inline-flex;
  cursor: pointer;
  list-style: none;
}

.provider-test-more > summary::-webkit-details-marker {
  display: none;
}

.provider-test-more > .provider-test-models {
  margin-top: 8px;
}

.provider-test-more:not([open]) > .provider-test-models {
  display: none;
}

.provider-test-metadata pre {
  max-height: 220px;
  overflow: auto;
  margin: 5px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: var(--paper);
  font-size: 10px;
  white-space: pre-wrap;
}

.provider-credentials-heading {
  margin-top: 28px;
}

.provider-credentials-heading h3 {
  margin: 0;
  font-size: 22px;
}

.admin-subsection {
  min-width: 0;
  margin-top: 30px;
}

.admin-subsection > h3 {
  margin-bottom: 10px;
  font-size: 21px;
}

.admin-subsection > .admin-help {
  margin: -5px 0 13px;
}

.admin-list {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.provider-group {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.provider-group + .provider-group,
.provider-more {
  margin-top: 18px;
}

.provider-group-title {
  margin: 0;
  font-size: 18px;
}

.provider-more > summary {
  width: fit-content;
  list-style: none;
  cursor: pointer;
}

.provider-more > summary::-webkit-details-marker {
  display: none;
}

.provider-more[open] > summary {
  margin-bottom: 12px;
}

.provider-more-list {
  padding-top: 2px;
}

.admin-record {
  min-width: 0;
  padding: 15px;
  display: grid;
  gap: 13px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--paper-strong);
  box-shadow: 2px 2px 0 var(--ink);
}

.admin-record-heading > div:first-child,
.admin-record-heading h3 {
  min-width: 0;
}

.admin-record h3 {
  margin: 0 0 2px;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.admin-record code {
  display: block;
  max-width: 100%;
  color: var(--muted);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.admin-record.compact-record {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.admin-checks {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-checks label {
  padding: 3px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
}

.admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 850;
}

.admin-wrap {
  overflow-wrap: anywhere;
}

.vault-details {
  grid-template-columns: 1.1fr 1.5fr 0.7fr 0.7fr;
}

.admin-audit {
  min-width: 0;
  display: grid;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--paper-strong);
}

.audit-row {
  min-width: 0;
  padding: 9px 11px;
  display: grid;
  grid-template-columns: 120px 90px minmax(120px, 0.8fr) minmax(160px, 1.5fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(28, 23, 18, 0.3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
}

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

.audit-row span:not(.admin-pill),
.audit-row code,
.audit-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-kicker {
  margin: 22px 0 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.component-card h3 {
  margin-bottom: 8px;
  font-size: 23px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.component-description {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.component-foot {
  min-width: 0;
  margin-top: auto;
}

.component-tags {
  min-width: 0;
  margin-bottom: 13px;
  align-items: stretch;
}

.tag {
  max-width: 100%;
  padding: 4px 7px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  font-size: 10px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.tag.access-public {
  background: #d9f4df;
}

.tag.access-restricted {
  background: #ffe2a8;
}

.component-meta {
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: nowrap;
  color: var(--muted);
  font-size: 10px;
}

.component-meta span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-open {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 900;
}

.loading-card,
.empty-state,
.error-state {
  padding: 28px;
  color: var(--muted);
}

.error-state {
  border-color: var(--red);
  background: #fff0eb;
  color: #7e2113;
}

.now-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.now-card {
  min-height: 210px;
  padding: 24px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.now-card.accent-yellow {
  background: var(--yellow);
}

.now-card.accent-blue {
  background: var(--blue);
}

.now-card.accent-green {
  color: #fff;
  background: var(--green);
}

.now-card > span {
  font-size: 11px;
  font-weight: 900;
}

.now-card h3 {
  margin: 28px 0 8px;
  font-size: 25px;
}

.now-card p {
  margin-bottom: 0;
}

code {
  padding: 1px 4px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 0.86em;
}

footer {
  padding-block: 24px;
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.footer-inner {
  justify-content: space-between;
}

@media (max-width: 940px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-panel {
    max-width: 560px;
    transform: none;
  }

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

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

  .principle-grid {
    grid-template-columns: 1fr;
  }

  .principle-grid article {
    min-height: auto;
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }

  .principle-grid article:last-child {
    border-bottom: 0;
  }

  .admin-component {
    grid-template-columns: 1fr 1fr;
  }

  .admin-details {
    grid-column: 1 / -1;
  }

  .admin-form-inline,
  .admin-form-inline.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .provider-editor-form,
  .provider-advanced-grid,
  .provider-credential-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .provider-probe-fields {
    grid-template-columns: 1fr 1fr;
  }

  .provider-probe-fields .admin-action {
    grid-column: 1 / -1;
  }

  .audit-row {
    grid-template-columns: 105px 80px minmax(110px, 1fr) auto;
  }

  .audit-row span:not(.admin-pill) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .provider-test-models { grid-template-columns: minmax(0, 1fr); }
  .provider-test-heading { min-width: 0; flex-direction: column; }
  .provider-test-heading code { width: 100%; word-break: break-all; }
  .provider-test-model { align-items: stretch; flex-direction: column; }
  .provider-test-model .admin-action { width: 100%; justify-content: center; }
  .provider-test-metadata { min-width: 0; }
  .provider-test-metadata pre { max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; word-break: break-word; }
  .shell {
    width: min(100% - 24px, var(--max));
  }

  .nav {
    padding-block: 10px;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-links a {
    padding: 5px 8px;
  }

  .hero {
    padding-block: 50px;
  }

  h1 {
    font-size: clamp(48px, 17vw, 68px);
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .device-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .component-grid,
  .now-grid {
    grid-template-columns: 1fr;
  }

  .component-card {
    min-height: 230px;
  }

  .catalog-section,
  .now-section {
    padding-block: 64px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .admin-summary div:nth-child(2) {
    border-right: 0;
  }

  .admin-summary div:nth-child(-n + 2) {
    border-bottom: 2px solid var(--ink);
  }

  .admin-component {
    grid-template-columns: 1fr;
  }

  .admin-details {
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-actions {
    justify-content: flex-start;
  }

  .admin-panel-heading,
  .admin-record-heading {
    flex-direction: column;
  }

  .admin-panel-heading .admin-actions,
  .admin-record-heading .admin-component-status {
    width: 100%;
  }

  .admin-form-grid,
  .admin-form-inline,
  .admin-form-inline.compact,
  .vault-details {
    grid-template-columns: 1fr;
  }

  .provider-editor-form,
  .provider-probe-fields,
  .provider-advanced-grid,
  .provider-credential-fields {
    grid-template-columns: 1fr;
  }

  .provider-probe-fields .admin-action {
    grid-column: auto;
  }

  .account-profile-layout,
  .account-security-grid {
    grid-template-columns: 1fr;
  }

  .account-sessions-card {
    grid-column: auto;
  }

  .account-security-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-record.compact-record {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .audit-row {
    grid-template-columns: 1fr auto;
  }

  .audit-row code,
  .audit-row strong,
  .audit-row span:not(.admin-pill) {
    grid-column: 1 / -1;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
