:root {
  --bg-deep: #071128;
  --bg-mid: #0a1630;
  --surface: rgba(17, 24, 39, 0.68);
  --surface-strong: rgba(15, 23, 42, 0.92);
  --surface-soft: rgba(30, 41, 59, 0.74);
  --border: #22324a;
  --border-strong: #2b4467;
  --text: #e5eefb;
  --muted: #bfd0e6;
  --muted-strong: #dbeafe;
  --bright: #38bdf8;
  --primary: #2563eb;
  --success: #22c55e;
  --governance-accent: #10b981;
  --governance-accent-hover: #0d9c6b;
  --governance-accent-focus: #34d399;
  --governance-accent-soft: rgba(16, 185, 129, 0.12);
  --governance-border: rgba(16, 185, 129, 0.42);
  --danger: #f87171;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(60rem 30rem at 12% 0%, rgba(56, 189, 248, 0.18) 0%, transparent 62%),
    radial-gradient(50rem 28rem at 100% 8%, rgba(37, 99, 235, 0.18) 0%, transparent 66%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 100%);
  color: var(--text);
  line-height: 1.5;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  background: rgba(7, 17, 40, 0.82);
  padding: 24px;
  box-sizing: border-box;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
}

.brand {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
}

.tagline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

.sidebar nav a {
  display: block;
  color: var(--muted-strong);
  text-decoration: none;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(56, 189, 248, 0.13);
  border-color: rgba(56, 189, 248, 0.32);
  color: #ffffff;
}

.auth-section {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-status {
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
}

.logout-button {
  width: 100%;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  margin: 0;
  font-weight: 700;
}

.logout-button:hover {
  background: rgba(37, 99, 235, 0.22);
  border-color: var(--bright);
}

.content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1280px;
  overflow-x: auto;
}

.section {
  margin-bottom: 48px;
}

.section h1,
.section h2 {
  margin: 0 0 8px;
  color: var(--text);
}

.section-subtitle {
  margin-top: -4px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card,
.status-box,
.response-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.card strong {
  font-size: 24px;
  color: var(--text);
}

.status-box h3,
.response-box h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 1rem;
}

.status-box ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.status-box li {
  padding: 6px 0;
  color: var(--muted);
  font-size: 14px;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: rgba(15, 23, 42, 0.95);
  color: var(--muted-strong);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: rgba(56, 189, 248, 0.06);
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--bright);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

button {
  cursor: pointer;
  background: linear-gradient(180deg, var(--bright) 0%, var(--primary) 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  transition: filter 0.2s, transform 0.1s;
}

button:hover {
  filter: brightness(1.08);
}

button:active {
  transform: scale(0.98);
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.inline-form input {
  margin: 0;
  flex: 1;
  max-width: 320px;
}

.inline-form button {
  width: auto;
  margin: 0;
}

.playground-form label {
  display: block;
  font-weight: 700;
  color: var(--muted-strong);
  margin: 16px 0 8px;
  font-size: 14px;
}

.playground-form select,
.playground-form textarea {
  margin: 0 0 16px;
}

.playground-form button {
  width: auto;
  min-width: 140px;
}

.response-box {
  margin-top: 24px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(7, 17, 40, 0.92);
  color: var(--text);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

.status-message {
  margin: 8px 0 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 14px;
}

.ok {
  color: var(--success);
  font-weight: 700;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.muted-cell {
  color: var(--muted);
}

.nowrap-cell {
  white-space: nowrap;
}

.model-catalog-heading {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 1fr) minmax(150px, 0.6fr) minmax(110px, 0.4fr);
  gap: 20px;
  margin: 22px 0 10px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.model-card-list {
  display: grid;
  gap: 16px;
}

.model-card {
  border: 1px solid var(--governance-border);
  border-radius: 6px;
  background: rgba(31, 41, 48, 0.86);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.model-card-header {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 1fr) minmax(150px, 0.6fr) minmax(110px, 0.4fr);
  gap: 20px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.26);
}

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

.model-expand-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.62);
  background: rgba(15, 23, 42, 0.92);
  color: var(--muted-strong);
  font-weight: 900;
}

.model-title-wrap {
  min-width: 0;
}

.model-title {
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--text);
}

.model-subtitle {
  display: block;
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.model-task-chips,
.model-use-cases {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border: 1px solid rgba(148, 163, 184, 0.44);
  border-radius: 5px;
  color: var(--muted-strong);
  background: rgba(15, 23, 42, 0.42);
  font-size: 12px;
}

.status-chip {
  border-color: var(--governance-border);
  color: var(--governance-accent-focus);
  background: var(--governance-accent-soft);
}

.model-availability {
  display: grid;
  gap: 3px;
}

.model-actions {
  display: flex;
  justify-content: flex-end;
}

.secondary-action,
.code-tab,
.copy-code-button,
.code-modal-close {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--governance-border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
}

.secondary-action:hover,
.copy-code-button:hover,
.code-modal-close:hover,
.model-expand-button:hover {
  border-color: var(--governance-accent);
  background: var(--governance-accent-soft);
}

.secondary-action:focus-visible,
.copy-code-button:focus-visible,
.code-modal-close:focus-visible,
.model-expand-button:focus-visible,
.code-tab:focus-visible {
  outline: 2px solid var(--governance-accent-focus);
  outline-offset: 2px;
}

.model-card-details {
  padding: 18px 16px 20px;
}

.model-description {
  margin: 6px 0 18px;
  color: var(--muted-strong);
}

.model-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-strong);
}

.model-detail-item {
  display: grid;
  gap: 5px;
}

.model-detail-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.model-detail-value {
  color: var(--text);
  font-size: 15px;
}

.model-card.collapsed .model-card-details {
  display: none;
}

.code-modal[hidden] {
  display: none;
}

.code-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.code-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(10px);
}

.code-modal-panel {
  position: relative;
  width: min(860px, 96vw);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  border-radius: 14px;
  border: 1px solid var(--governance-border);
  background: #202831;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.code-modal-panel h2 {
  margin: 0 0 22px;
}

.code-modal-panel p {
  color: var(--muted-strong);
}

.code-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  color: var(--muted-strong);
  font-size: 20px;
  padding: 4px 10px;
}

.code-modal-kicker {
  margin-top: 24px;
  font-weight: 800;
}

.code-modal-model {
  margin-top: -8px;
  color: var(--muted);
  font-size: 13px;
}

.code-tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.36);
  margin: 24px 0;
}

.code-tab {
  border: none;
  border-radius: 0;
  padding: 0 0 12px;
  color: var(--muted);
  background: transparent;
}

.code-tab.active {
  color: var(--governance-accent-focus);
  border-bottom: 2px solid var(--governance-accent);
}

.code-block-wrap {
  position: relative;
}

.code-block-wrap pre {
  max-height: 460px;
  overflow: auto;
  padding-top: 44px;
  background: rgba(15, 23, 42, 0.7);
}

.copy-code-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
}

.code-copy-status {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .content {
    padding: 24px;
  }

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

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form input {
    max-width: none;
  }
}
