:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #111827;
  --text-muted: #4b5563;
  --border: #d1d5db;
  --border-strong: #9ca3af;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warning-soft: #fff7ed;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
code, pre { font-family: "SFMono-Regular", SFMono-Regular, ui-monospace, Menlo, monospace; }

.shell-grid { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 48px); }
.shell-sidebar { background: #111827; color: #f9fafb; padding: 28px 20px; display: flex; flex-direction: column; gap: 24px; }
.brand-block { display: flex; flex-direction: column; gap: 4px; }
.brand-block.centered { align-items: center; text-align: center; }
.brand-title { font-size: 1.05rem; font-weight: 700; }
.brand-subtitle { color: #cbd5e1; font-size: 0.92rem; }
.shell-nav { display: flex; flex-direction: column; gap: 8px; }
.nav-link { padding: 10px 12px; border-radius: 8px; color: #cbd5e1; font-weight: 600; }
.nav-link.is-active, .nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.shell-meta { margin-top: auto; }
.shell-auth { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.user-chip { border: 1px solid rgba(255,255,255,0.18); border-radius: 999px; padding: 6px 10px; font-size: 0.82rem; color: #e2e8f0; }

.shell-main { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.page-band { background: transparent; }
.hero-band { padding-top: 8px; }
.section-band { padding-top: 4px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.page-header h1 { margin: 0 0 8px; font-size: 1.9rem; }
.page-header p { margin: 0; max-width: 760px; color: var(--text-muted); line-height: 1.55; }
.header-actions { display: flex; gap: 12px; }

.section-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.section-column { grid-column: span 6; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px; box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04); }
.section-span-wide { grid-column: span 12; }
.section-column h2, .table-shell h2 { margin: 0 0 10px; font-size: 1.1rem; }
.section-column p, .table-toolbar p { margin: 0; color: var(--text-muted); line-height: 1.55; }

.status-card, .note-card, .table-shell, .secret-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04); }
.status-card.compact { min-width: 260px; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.eyebrow { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.02em; }
.status-value { font-size: 1rem; font-weight: 700; margin-top: 8px; }
.status-detail { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; color: var(--text-muted); font-size: 0.9rem; }

.status-pill { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; border: 1px solid transparent; }
.status-live, .status-active { background: var(--accent-soft); color: var(--accent); border-color: rgba(15,118,110,0.18); }
.status-revoked, .status-failed { background: var(--danger-soft); color: var(--danger); border-color: rgba(185,28,28,0.18); }
.status-disabled, .status-expired { background: #fef3c7; color: #92400e; border-color: rgba(146,64,14,0.2); }
.status-provisioning { background: #dbeafe; color: #1d4ed8; border-color: rgba(29,78,216,0.2); }

.primary-button, .ghost-button, .danger-button, .icon-button { height: 40px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; }
.primary-button { background: var(--accent); color: white; padding: 0 16px; }
.ghost-button { background: transparent; color: inherit; border-color: var(--border); padding: 0 14px; }
.danger-button { background: var(--danger); color: white; padding: 0 14px; }
.icon-button { background: transparent; border-color: var(--border); color: var(--text-muted); padding: 0 12px; }
.compact-button { height: 34px; padding: 0 12px; font-size: 0.86rem; }
.primary-button:disabled, .ghost-button:disabled, .danger-button:disabled { opacity: 0.55; cursor: not-allowed; }

.code-panel { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #0f172a; color: #e5e7eb; }
.code-panel.emphasis { border-color: rgba(15,118,110,0.25); }
.code-panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: rgba(255,255,255,0.03); color: #94a3b8; font-size: 0.84rem; }
.code-panel pre { margin: 0; padding: 16px; overflow-x: auto; font-size: 0.9rem; line-height: 1.6; }

.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.plain-list li { display: grid; gap: 4px; }
.plain-list strong { font-size: 0.9rem; }
.plain-list span { color: var(--text-muted); line-height: 1.45; }

.model-list { display: grid; gap: 14px; }
.model-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-muted); }
.model-card h3 { margin: 0 0 6px; font-size: 1rem; }
.model-card p { margin: 0; color: var(--text-muted); }

.table-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.table-content { min-height: 140px; }
.table-frame { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.02em; }
.cell-title { font-weight: 700; }
.cell-subtitle { margin-top: 4px; font-size: 0.78rem; color: var(--text-muted); word-break: break-all; }

.feedback-stack { display: flex; flex-direction: column; gap: 12px; }
.warning-card { background: var(--warning-soft); border-color: #fdba74; }
.neutral-card { background: var(--surface-muted); }
.error-text, .error-state { color: var(--danger); }
.loading-state, .empty-state, .error-state { padding: 18px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface-muted); }

.secret-panel { display: grid; gap: 14px; }
.secret-panel-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }

.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal.hidden, .hidden { display: none !important; }
.modal-scrim { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); }
.modal-panel { position: relative; width: min(680px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.compact-panel { width: min(520px, 100%); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-header h2 { margin: 0 0 8px; }
.modal-header p { margin: 0; color: var(--text-muted); line-height: 1.5; }

.form-grid { display: grid; gap: 14px; }
.form-grid label { display: grid; gap: 6px; font-weight: 600; }
.form-grid input { width: 100%; height: 42px; border-radius: 8px; border: 1px solid var(--border); padding: 0 12px; font: inherit; }
.checkbox-row { grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 10px; font-weight: 500; color: var(--text-muted); }
.checkbox-row input { margin-top: 4px; width: 16px; height: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.provision-status { display: grid; gap: 8px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-muted); }
.provision-step { color: var(--text-muted); font-size: 0.92rem; }
.provision-step.is-active { color: var(--accent); font-weight: 700; }
.provision-step.is-done { color: var(--text); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-panel { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.login-panel h1 { margin: 0; font-size: 1.6rem; }
.login-panel p { margin: 0; color: var(--text-muted); line-height: 1.55; }

.site-footer { display: flex; justify-content: center; gap: 10px; padding: 14px 20px 20px; color: var(--text-muted); font-size: 0.88rem; }

@media (max-width: 960px) {
  .shell-grid { grid-template-columns: 1fr; }
  .shell-sidebar { gap: 16px; }
  .shell-nav { flex-direction: row; flex-wrap: wrap; }
  .shell-meta { margin-top: 0; }
  .shell-auth { justify-content: flex-start; }
  .page-header, .table-toolbar, .secret-panel-header { flex-direction: column; }
  .section-column, .section-span-wide { grid-column: span 12; }
}

@media (max-width: 640px) {
  .shell-main { padding: 18px; }
  .modal { padding: 16px; }
  .modal-panel, .login-panel { padding: 20px; }
  th:nth-child(7), td:nth-child(7), th:nth-child(8), td:nth-child(8), th:nth-child(9), td:nth-child(9) { display: none; }
}
