/* Same design tokens as tai.artfical.com (frontend/css/styles.css) --
   the console is a separate app but should read as the same product family,
   not a visually unrelated tool that happens to share a login. */

:root,
[data-theme="light"] {
  --bg: #ffffff;
  --sidebar: #f9f9f9;
  --text: #0d0d0d;
  --muted: #6e6e80;
  --hover: #ececec;
  --active: #e8e8e8;
  --border: #e5e5e5;
  --pill-bg: #f0f0f0;
  --accent: #0d0d0d;
  --accent-contrast: #ffffff;
  --card-bg: #ffffff;
  --danger: #d1293d;
  --danger-bg: #fdecee;
  --success: #1a7f3c;
  --success-bg: #e9f7ee;
  --code-font: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #212121;
  --sidebar: #171717;
  --text: #ececec;
  --muted: #9b9b9b;
  --hover: #2a2a2a;
  --active: #333333;
  --border: #3a3a3a;
  --pill-bg: #2a2a2a;
  --accent: #e9e9e9;
  --accent-contrast: #171717;
  --card-bg: #262626;
  --danger: #e5484d;
  --danger-bg: #3a1f21;
  --success: #4cc38a;
  --success-bg: #1c2e22;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--text);
}

h2 {
  font-size: 20px;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

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

a:hover {
  text-decoration: underline;
}

.page-lede {
  margin-top: -2px;
  margin-bottom: 24px;
}

/* ─── App shell: fixed sidebar + content, no separate top bar ──────────── */

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

.side-nav {
  width: 232px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 16px;
  font-size: 14px;
  font-weight: 600;
}

.side-brand img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* ─── Workspace switcher ────────────────────────────────────────────────── */

.workspace-switcher {
  position: relative;
  margin-bottom: 10px;
}

.workspace-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.workspace-trigger:hover {
  background: var(--hover);
}

.workspace-trigger-icon img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: block;
}

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

.workspace-trigger-chevron {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.workspace-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  padding: 6px;
  z-index: 40;
}

.workspace-menu-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 6px 8px 4px;
}

.workspace-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.workspace-menu-item:hover {
  background: var(--hover);
}

.workspace-menu-item.active {
  font-weight: 600;
}

.workspace-menu-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted);
}

.workspace-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

/* ─── Modal ─────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

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

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 13px;
  margin-bottom: 18px;
}

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

.side-nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 4px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

.side-nav a:hover {
  background: var(--hover);
  color: var(--text);
  text-decoration: none;
}

.side-nav a.active {
  background: var(--active);
  color: var(--text);
}

.side-nav a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.side-nav-spacer {
  flex: 1;
}

.side-account {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

.side-account-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}

.side-account-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--pill-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.side-account-info {
  min-width: 0;
  flex: 1;
}

.side-account-email {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-account-balance {
  font-size: 11.5px;
  color: var(--muted);
}

.side-account-actions {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}

.side-account-actions a,
.side-account-actions button {
  font-size: 12px;
  padding: 5px 10px;
}

/* ─── Top strip inside content: theme toggle only, page title lives in h2 ── */

.content-top {
  display: flex;
  justify-content: flex-end;
  padding: 12px 32px 0;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-inner {
  padding: 12px 32px 48px;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}

.menu-toggle {
  display: none;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.hamburger-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}

.hamburger-bars span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-filled {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-filled:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-outlined {
  background: var(--card-bg);
  color: var(--text);
  border-color: var(--border);
}

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

.btn-text {
  background: transparent;
  color: var(--text);
  padding: 0 8px;
  height: 28px;
}

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

.btn-error {
  background: transparent;
  color: var(--danger);
}

.btn-error:hover:not(:disabled) {
  background: var(--danger-bg);
}

.btn-small {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
}

.btn-full {
  width: 100%;
}

/* ─── Form fields ────────────────────────────────────────────────────────── */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"],
.field select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.12s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--text);
}

.field .hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ─── Card ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

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

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── Profile / field-list (Settings page) ─────────────────────────────── */

.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--pill-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.profile-name {
  font-size: 15px;
  font-weight: 600;
}

.profile-email {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.field-list {
  border-top: 1px solid var(--border);
}

.field-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.field-list-row:last-child {
  border-bottom: none;
}

.field-list-label {
  font-size: 13px;
  color: var(--muted);
}

.field-list-value {
  font-size: 13.5px;
  font-weight: 500;
}

/* ─── Dashboard: header, models, resources ─────────────────────────────── */

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.dash-header h2 {
  margin: 0;
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dash-header-actions .pg-icon-btn {
  width: 34px;
  height: 34px;
}

.dash-section-title {
  font-size: 14.5px;
  font-weight: 600;
  margin: 28px 0 12px;
}

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

.model-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.model-card:hover {
  border-color: var(--muted);
}

.model-card-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 84px;
  font-size: 30px;
  color: rgba(255, 255, 255, 0.92);
}

.model-card-thumb.has-photo {
  background-size: cover;
  background-position: center 30%;
}

.model-card-thumb img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.model-thumb-0 { background: linear-gradient(135deg, #5b8def, #2f5fc4); }
.model-thumb-1 { background: linear-gradient(135deg, #e08a5b, #c85a2e); }
.model-thumb-2 { background: linear-gradient(135deg, #6bbf8f, #2f8a5c); }
.model-thumb-3 { background: linear-gradient(135deg, #b585e0, #7a3fc4); }
.model-thumb-4 { background: linear-gradient(135deg, #e0c15b, #c48a2e); }

.model-card-body {
  padding: 12px 14px 14px;
}

.model-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.model-card-name {
  font-size: 13.5px;
  font-weight: 600;
}

.model-tier-free { background: var(--pill-bg); color: var(--text); }
.model-tier-pro { background: var(--success-bg); color: var(--success); }
.model-tier-enterprise { background: var(--danger-bg); color: var(--danger); }

.model-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

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

.resource-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resource-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
}

.resource-card-head svg {
  color: var(--muted);
  flex-shrink: 0;
}

.resource-card p {
  font-size: 12px;
  margin: 0;
  flex: 1;
}

.resource-card .btn {
  align-self: flex-start;
}

/* ─── Auth (sign-in) shell ──────────────────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: var(--sidebar);
}

.auth-led-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
}

.auth-card .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  text-align: center;
}

.auth-card .brand img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
}

.auth-card .subtitle {
  text-align: center;
  margin-bottom: 24px;
}

.auth-card .switch-link {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.theme-toggle-floating {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
}

/* ─── Alerts ────────────────────────────────────────────────────────────── */

.alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid transparent;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.alert button {
  background: none;
  border: none;
  color: inherit;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}

.alert button:hover {
  opacity: 1;
}

/* ─── Chip / badge ──────────────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
}

.chip-active {
  background: var(--success-bg);
  color: var(--success);
}

.chip-revoked {
  background: var(--danger-bg);
  color: var(--danger);
}

.key-code {
  font-family: var(--code-font);
  font-size: 13px;
  background: var(--pill-bg);
  padding: 3px 8px;
  border-radius: 5px;
}

.code-block-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 14px 0 6px;
}

.code-block-label:first-child {
  margin-top: 0;
}

.code-block {
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--code-font);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  margin: 0;
}

/* ─── Table ─────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--sidebar);
}

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

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}

/* ─── Filter bar ────────────────────────────────────────────────────────── */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.filter-bar .field {
  margin-bottom: 0;
  min-width: 150px;
}

/* ─── API keys page ─────────────────────────────────────────────────────── */

.dash-header-titlerow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-header-titlerow h2 {
  margin: 0;
}

.keys-count-badge {
  background: var(--pill-bg);
  color: var(--text);
}

.keys-add-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.keys-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}

.keys-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--pill-bg);
  color: var(--muted);
  min-width: 180px;
}

.keys-search-wrap input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 100%;
}

.keys-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--pill-bg);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.keys-filter-pill strong {
  color: var(--text);
  font-weight: 500;
}

.keys-filter-select {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.keys-cell-name {
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
}

.keys-cell-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
}

.keys-cell-actions {
  text-align: right;
}

/* ─── Create-key modal ──────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

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

.modal-dialog {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px 22px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h3 {
  margin: 0;
  font-size: 19px;
}

.modal-field {
  margin-bottom: 16px;
}

.modal-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-field input[type="text"],
.modal-field select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
}

.modal-field input[type="text"]:focus,
.modal-field select:focus {
  outline: none;
  border-color: var(--text);
}

.modal-static-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  background: var(--pill-bg);
  font-size: 13.5px;
}

.modal-scope-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #7a5fd9;
  flex-shrink: 0;
}

.modal-field-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.4;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Playground / chat interface ──────────────────────────────────────── */

.model-info {
  font-size: 12.5px;
  color: var(--muted);
}

/* ─── Playground ────────────────────────────────────────────────────────── */

.pg-topbar {
  margin-bottom: 16px;
}

.pg-topbar-titlerow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pg-topbar-titlerow h2 {
  margin: 0;
}

.pg-topbar-sub {
  margin: 4px 0 0;
}

.pg-beta-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-contrast);
  background: var(--accent);
  border-radius: 20px;
  padding: 2px 9px;
}

.pg-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  overflow: hidden;
  min-height: 620px;
}

@media (max-width: 900px) {
  .pg-layout {
    grid-template-columns: 1fr;
  }
}

.pg-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pg-request {
  border-right: 1px solid var(--border);
}

@media (max-width: 900px) {
  .pg-request {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.pg-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pg-pane-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
}

.pg-pane-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.pg-response-body {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.pg-tabs {
  display: flex;
  gap: 2px;
  background: var(--pill-bg);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
}

.pg-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.pg-tab.active {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Buttons that mirror Claude Console's secondary/pill controls */

.pg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.pg-btn svg {
  flex-shrink: 0;
  opacity: 0.65;
}

.pg-btn-secondary {
  background: var(--pill-bg);
  color: var(--text);
}

.pg-btn-secondary:hover {
  background: var(--hover);
}

.pg-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 18px;
}

.pg-toprow .pg-add-menu {
  left: auto;
  right: 0;
}

.pg-model-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.pg-model-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--pill-bg);
  color: var(--text);
  border: none;
  border-radius: 7px;
  height: 32px;
  padding: 0 28px 0 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  max-width: 220px;
}

.pg-model-select:hover {
  background: var(--hover);
}

.pg-select-chevron {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: var(--muted);
}

.pg-split-btn {
  display: inline-flex;
  border-radius: 7px;
  overflow: hidden;
}

.pg-split-main {
  border-radius: 0;
}

.pg-split-chevron {
  border-radius: 0;
  padding: 0 8px;
  border-left: 1px solid var(--border);
}

.pg-menu-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.2px;
  padding: 6px 10px 4px;
}

.pg-capability-menu {
  width: 220px;
  padding: 6px;
}

.pg-tool-item {
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  white-space: nowrap;
}

.pg-tool-item:disabled {
  cursor: not-allowed;
  color: var(--muted);
}

.pg-tool-item:disabled:hover {
  background: transparent;
}

.pg-tool-check {
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

.pg-soon-badge {
  display: inline-block;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--muted);
  background: var(--hover);
  border-radius: 20px;
  padding: 1px 8px;
}

.pg-enabled-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pg-enabled-tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--pill-bg);
  border-radius: 20px;
  padding: 3px 6px 3px 10px;
}

.pg-enabled-tool-pill button {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 1px 3px;
}

.pg-enabled-tool-pill button:hover {
  color: var(--danger);
}

.pg-activity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--pill-bg);
  border-radius: 7px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.pg-activity-row.is-error {
  color: var(--danger);
}

.pg-field {
  margin-bottom: 20px;
}

.pg-field:last-child {
  margin-bottom: 0;
}

.pg-section-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

.pg-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pg-field-row label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.pg-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
}

.pg-icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.pg-textarea {
  width: 100%;
  resize: vertical;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.5;
}

.pg-textarea:focus {
  outline: none;
  border-color: var(--text);
}

.pg-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.pg-message {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg);
}

.pg-message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.pg-role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.pg-role-badge.role-user {
  background: var(--pill-bg);
  color: var(--text);
}

.pg-role-badge.role-assistant {
  background: var(--success-bg);
  color: var(--success);
}

.pg-msg-delete {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.pg-msg-delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.pg-add-wrap {
  position: relative;
  display: inline-block;
}

.pg-add-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  padding: 4px;
  min-width: 200px;
  z-index: 20;
}

.pg-add-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.pg-add-menu button:hover {
  background: var(--hover);
}

.pg-pane-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.pg-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 8px 0 16px;
  border-radius: 7px;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.pg-run-btn:hover:not(:disabled) {
  opacity: 0.88;
}

.pg-run-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.pg-kbd-hint {
  display: inline-flex;
  gap: 3px;
}

.pg-kbd-hint kbd {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  color: inherit;
  opacity: 0.7;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 3px 5px;
}

[data-theme="dark"] .pg-kbd-hint kbd {
  background: rgba(255, 255, 255, 0.14);
}

.pg-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
}

.pg-idle[hidden],
.pg-response-content[hidden] {
  display: none;
}

.pg-idle-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--pill-bg);
  color: var(--text);
}

.pg-idle-icon-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.pg-idle-title {
  font-size: 14px;
  font-weight: 600;
}

.pg-idle-sub {
  font-size: 12.5px;
  color: var(--muted);
  max-width: 320px;
}

.pg-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--text);
  animation: pg-spin 0.7s linear infinite;
}

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

.pg-response-content {
  width: 100%;
  align-self: flex-start;
  text-align: left;
  padding: 4px;
}

.pg-response-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-bg);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.pg-response-text {
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}

.pg-response-text > *:first-child { margin-top: 0; }
.pg-response-text > *:last-child { margin-bottom: 0; }

.pg-response-text p {
  margin: 0 0 12px;
  line-height: 1.6;
}

.pg-response-text strong { font-weight: 700; }
.pg-response-text em { font-style: italic; }

.pg-response-text ul,
.pg-response-text ol {
  margin: 0 0 12px;
  padding-left: 22px;
  line-height: 1.55;
}

.pg-response-text li { margin-bottom: 4px; }

.pg-response-text h1,
.pg-response-text h2,
.pg-response-text h3,
.pg-response-text h4 {
  margin: 16px 0 8px;
  font-weight: 700;
  line-height: 1.3;
}

.pg-response-text h1 { font-size: 18px; }
.pg-response-text h2 { font-size: 16px; }
.pg-response-text h3 { font-size: 14.5px; }
.pg-response-text h4 { font-size: 13.5px; }

.pg-response-text a {
  color: var(--text);
  text-decoration: underline;
}

.pg-response-text code {
  background: var(--pill-bg);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 12.5px;
  font-family: var(--code-font);
}

.pg-response-text pre {
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 12px;
  overflow-x: auto;
}

.pg-response-text pre code {
  background: none;
  border-radius: 0;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre;
}

.pg-response-usage {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* ─── Utility ───────────────────────────────────────────────────────────── */

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

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

.mt-24 {
  margin-top: 24px;
}

.text-muted {
  color: var(--muted);
  font-size: 12.5px;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .side-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
    box-shadow: 0 0 0 1px var(--border);
  }

  .side-nav.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: flex;
  }

  .content-top {
    padding: 10px 16px 0;
    justify-content: space-between;
  }

  .content-inner {
    padding: 12px 16px 40px;
  }
}

@media (max-width: 600px) {
  .auth-card {
    padding: 28px 20px;
  }

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