:root {
  --bg: #07101a;
  --bg-2: #101b2d;
  --panel: rgba(14, 22, 36, 0.86);
  --panel-strong: rgba(17, 27, 43, 0.96);
  --border: rgba(182, 77, 148, 0.2);
  --text: #f7f8fc;
  --muted: #a9b5cb;
  --accent: #e65291;
  --accent-2: #18ac83;
  --accent-3: #4db5e4;
  --danger: #ff7b82;
  --success: #74df9a;
  --warning: #ffd275;
  --shadow: 0 22px 70px rgba(4, 8, 14, 0.44);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(230, 82, 145, 0.14), transparent 25%),
    radial-gradient(circle at top right, rgba(24, 172, 131, 0.13), transparent 22%),
    linear-gradient(180deg, rgba(7, 17, 31, 0.94), rgba(13, 23, 41, 0.96));
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(7, 17, 31, 0.58), rgba(7, 17, 31, 0.78)),
    url("/static/dashboard/panel-background.jpg") center center / cover no-repeat;
  filter: saturate(0.92) brightness(0.98);
  opacity: 1;
}

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

.page-sheen {
  position: fixed;
  inset: auto;
  width: 36rem;
  height: 36rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.28;
  pointer-events: none;
}

.page-sheen-left {
  top: -10rem;
  left: -10rem;
  background: rgba(230, 82, 145, 0.16);
}

.page-sheen-right {
  top: 8rem;
  right: -12rem;
  background: rgba(24, 172, 131, 0.16);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
}

.topbar,
.page-header,
.hero,
.grid,
.messages {
  margin-bottom: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(230, 82, 145, 0.08), rgba(24, 172, 131, 0.04)),
    rgba(8, 16, 29, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.topbar-actions,
.header-actions,
.actions-cell,
.form-actions,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-actions {
  align-items: center;
}

.topbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-group-left {
  align-items: center;
}

.topbar-group-right {
  align-items: center;
}

.topbar-divider {
  width: 1px;
  align-self: stretch;
  min-height: 34px;
  margin: 0 2px;
  background: linear-gradient(
    180deg,
    rgba(157, 180, 211, 0.05),
    rgba(157, 180, 211, 0.35),
    rgba(157, 180, 211, 0.05)
  );
}

.content {
  padding-bottom: 32px;
}

.hero,
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.hero h1,
.page-header h1 {
  margin: 10px 0 12px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.lead {
  max-width: 66ch;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.hero-card {
  display: grid;
  gap: 12px;
  min-width: 250px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(20, 31, 52, 0.95), rgba(12, 20, 36, 0.95));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.hero-stat span {
  font-size: 2rem;
  font-weight: 700;
}

.hero-stat small,
.muted {
  color: var(--muted);
}

.chip-row,
.stack-list,
.detail-grid {
  display: grid;
  gap: 12px;
}

.chip-row {
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.chip-active {
  color: var(--text);
  border-color: rgba(24, 172, 131, 0.48);
  background: rgba(24, 172, 131, 0.14);
}

.compact-list .list-row,
.stack-list .list-row,
.request-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.detail-grid > div {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.callout {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
}

.secret-preview {
  margin: 12px 0 0;
  padding: 14px;
  border-radius: 16px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(7, 16, 26, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.matrix-select {
  width: 100%;
}

.role-chip-col {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sticky-roles-wrap {
  overflow: auto;
}

.sticky-role-table {
  min-width: 920px;
}

.sticky-role-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(12, 20, 36, 0.98);
}

.sticky-name-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 220px;
  background: rgba(12, 20, 36, 0.98);
}

.sticky-role-table thead .sticky-name-cell,
.sticky-role-table thead th:first-child {
  z-index: 3;
}

.checkbox-cell {
  text-align: center;
  vertical-align: middle;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}

.password-dialog {
  width: min(760px, calc(100vw - 32px));
}

.password-dialog .rename-dialog-panel {
  width: 100%;
}

.password-form-grid {
  margin-bottom: 8px;
}

.password-dialog .stacked-form textarea[name="notes"] {
  min-height: 96px;
}

.password-dialog .stacked-form textarea[name="value"] {
  min-height: 110px;
}

.password-dialog .stacked-form textarea[name="rotation_notes"] {
  min-height: 84px;
}

.grid {
  display: grid;
  gap: 20px;
}

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

.card {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.card h2 {
  margin: 8px 0 0;
  font-size: 1.35rem;
}

.notice,
.empty-state {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.notice-warning {
  border-color: rgba(255, 210, 117, 0.35);
  background: rgba(255, 210, 117, 0.08);
}

.notice-success {
  border-color: rgba(116, 223, 154, 0.35);
  background: rgba(116, 223, 154, 0.08);
}

.messages {
  display: grid;
  gap: 12px;
}

.message {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.message-success {
  border-color: rgba(116, 223, 154, 0.3);
  background: rgba(116, 223, 154, 0.08);
}

.message-warning {
  border-color: rgba(255, 210, 117, 0.3);
  background: rgba(255, 210, 117, 0.08);
}

.message-error {
  border-color: rgba(255, 123, 130, 0.3);
  background: rgba(255, 123, 130, 0.08);
}

.stacked-form p {
  margin: 0 0 14px;
}

.stacked-form .field-group {
  margin: 0 0 14px;
}

.stacked-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.stacked-form input,
.stacked-form textarea,
.stacked-form select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(182, 77, 148, 0.22);
  background: rgba(4, 10, 18, 0.72);
  color: var(--text);
  outline: none;
}

.stacked-form input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin-right: 8px;
}

.stacked-form textarea {
  min-height: 120px;
  resize: vertical;
}

.stacked-form input:focus,
.stacked-form textarea:focus,
.stacked-form select:focus {
  border-color: rgba(230, 82, 145, 0.75);
  box-shadow: 0 0 0 3px rgba(230, 82, 145, 0.18);
}

.stacked-form .helptext,
.stacked-form .errorlist {
  margin-top: 8px;
  color: var(--muted);
}

.scenario-document-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.scenario-document-editor,
.scenario-document-preview {
  display: grid;
  gap: 22px;
}

.scenario-document-preview {
  font-size: 8px;
  line-height: 1.45;
}

.scenario-document-preview .card-head {
  margin-bottom: 14px;
}

.scenario-document-preview .card-head h2 {
  margin-top: 6px;
  font-size: 1.7em;
  line-height: 1.12;
}

.scenario-document-preview .eyebrow {
  font-size: 1em;
  letter-spacing: 0.18em;
}

.scenario-document-form {
  display: grid;
  gap: 22px;
}

.scenario-section {
  display: grid;
  gap: 14px;
}

.scenario-section-note {
  max-width: 34ch;
  line-height: 1.5;
  text-align: right;
}

.scenario-document-header .scenario-header-action {
  background: linear-gradient(180deg, rgba(245, 248, 252, 0.96), rgba(226, 233, 244, 0.9));
  border-color: rgba(245, 248, 252, 0.86);
  color: #0c1424;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.scenario-document-header .scenario-header-action:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(234, 239, 247, 0.95));
  border-color: rgba(255, 255, 255, 0.96);
  color: #081120;
}

.scenario-field {
  display: grid;
  gap: 8px;
}

.scenario-field label {
  display: block;
  font-weight: 700;
  color: var(--text);
}

.scenario-field input,
.scenario-field textarea,
.scenario-field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(157, 180, 211, 0.22);
  background: rgba(4, 10, 18, 0.72);
  color: var(--text);
  outline: none;
}

.scenario-field textarea {
  min-height: 120px;
  resize: vertical;
}

.scenario-field input:focus,
.scenario-field textarea:focus,
.scenario-field select:focus {
  border-color: rgba(230, 82, 145, 0.75);
  box-shadow: 0 0 0 3px rgba(230, 82, 145, 0.18);
}

.scenario-field .helptext {
  margin: 0;
  color: var(--muted);
}

.scenario-field .errorlist {
  margin: 0;
}

.scenario-field select:disabled,
.scenario-field input:disabled,
.scenario-field textarea:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.scenario-field-body textarea {
  min-height: 360px;
}

.scenario-io-grid,
.scenario-meta-grid-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.scenario-field-span-2 {
  grid-column: 1 / -1;
}

.scenario-editor-actions {
  justify-content: flex-start;
  padding-top: 4px;
}

.scenario-preview-meta {
  margin-top: 0;
}

.scenario-document-preview .meta-grid {
  margin-top: 0;
  gap: 10px;
}

.scenario-document-preview .meta-item {
  padding: 10px 12px;
  border-radius: 12px;
}

.scenario-document-preview .meta-item span {
  margin-bottom: 3px;
  font-size: 0.95em;
}

.scenario-document-preview .meta-item strong {
  font-size: 1.15em;
  line-height: 1.3;
}

.scenario-original-preview {
  min-height: 320px;
}

.scenario-document-preview .summary-block {
  margin-top: 14px;
  padding-top: 14px;
}

.scenario-document-preview .summary-block h3 {
  margin-bottom: 6px;
  font-size: 1.3em;
}

.scenario-document-preview .prompt-preview {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 1em;
  line-height: 1.45;
}

.scenario-original-empty {
  color: var(--muted);
}

.rename-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(157, 180, 211, 0.2);
  border-radius: 24px;
  padding: 0;
  background: rgba(8, 16, 29, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
}

.rename-dialog::backdrop {
  background: rgba(2, 6, 12, 0.7);
  backdrop-filter: blur(6px);
}

.rename-dialog-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.dialog-head {
  display: grid;
  gap: 6px;
}

.dialog-head h3 {
  margin: 0;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.chat-thread {
  display: grid;
  gap: 14px;
}

.chat-thread-main {
  max-height: min(66vh, 900px);
  overflow: auto;
  padding-right: 6px;
}

.chat-card {
  display: grid;
  gap: 22px;
  padding: 28px;
}

.chat-sidebar {
  display: grid;
  gap: 12px;
  max-width: 320px;
  justify-self: end;
}

.chat-workspace {
  align-items: start;
  grid-template-columns: minmax(0, 2.5fr) minmax(240px, 0.7fr);
  gap: 18px;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
}

.chat-banner {
  margin: 0;
}

.chat-turn {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(157, 180, 211, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.chat-turn-assistant {
  margin-right: 18%;
}

.chat-turn-user {
  margin-left: 18%;
  border-color: rgba(230, 82, 145, 0.24);
  background: rgba(230, 82, 145, 0.08);
}

.chat-turn-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.chat-turn-body {
  white-space: pre-wrap;
  line-height: 1.7;
}

.chat-composer {
  display: grid;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(157, 180, 211, 0.12);
}

.chat-composer-help {
  line-height: 1.5;
}

.chat-actions {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 16px;
}

.chat-actions .muted {
  flex: 1;
  text-align: left;
  line-height: 1.45;
  padding-top: 2px;
}

.chat-attachments {
  display: grid;
  gap: 10px;
}

.chat-attachments > label {
  display: block;
  font-weight: 700;
  color: var(--text);
}

.chat-attachments input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.chat-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-dropzone {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(182, 77, 148, 0.3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.chat-dropzone.is-dragover {
  border-color: rgba(24, 172, 131, 0.85);
  background:
    linear-gradient(180deg, rgba(24, 172, 131, 0.12), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  transform: translateY(-1px);
}

.chat-dropzone-copy {
  display: grid;
  gap: 4px;
}

.chat-dropzone-copy strong {
  font-size: 0.98rem;
}

.chat-dropzone-copy span {
  color: var(--muted);
}

.chat-dropzone-actions {
  display: flex;
  justify-content: flex-start;
}

.chat-pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.materials-list {
  display: grid;
  gap: 10px;
}

.material-item {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(157, 180, 211, 0.14);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.material-item:hover {
  transform: translateY(-1px);
  border-color: rgba(230, 82, 145, 0.35);
  background: rgba(230, 82, 145, 0.05);
}

.material-item strong {
  font-size: 0.95rem;
}

.material-item span {
  color: var(--muted);
  font-size: 0.85rem;
}

.chat-form .chat-input textarea,
.chat-form .chat-input input {
  min-height: 58px;
  margin-top: 0;
}

.chat-input textarea,
.chat-input input {
  margin-top: 8px;
}

.errorlist {
  color: var(--danger);
  margin: 0 0 10px;
  padding-left: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #041018;
}

.button.secondary,
.button.ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(182, 77, 148, 0.22);
  color: var(--text);
}

.button.danger {
  background: rgba(255, 123, 130, 0.12);
  border-color: rgba(255, 123, 130, 0.28);
  color: #ffd7d9;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 14px 12px;
  vertical-align: top;
  border-bottom: 1px solid rgba(157, 180, 211, 0.12);
}

.table th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
}

.actions-cell {
  justify-content: flex-end;
}

.inline-form {
  display: inline-flex;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(157, 180, 211, 0.2);
  font-size: 0.84rem;
  line-height: 1;
  white-space: nowrap;
}

.pill-neutral {
  background: rgba(255, 255, 255, 0.04);
}

.pill-success {
  color: #c8ffe2;
  border-color: rgba(24, 172, 131, 0.28);
  background: rgba(24, 172, 131, 0.12);
}

.pill-warning {
  color: #ffe4ab;
  border-color: rgba(245, 168, 110, 0.28);
  background: rgba(245, 168, 110, 0.12);
}

.pill-danger {
  color: #ffd0d3;
  border-color: rgba(255, 123, 130, 0.25);
  background: rgba(255, 123, 130, 0.12);
}

.footer-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  margin-top: 4px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(230, 82, 145, 0.08), rgba(24, 172, 131, 0.05)),
    rgba(8, 16, 29, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.footer-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

.footer-brand strong,
.footer-brand small {
  display: block;
}

.footer-brand strong {
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-brand small {
  margin-top: 2px;
  color: var(--muted);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.meta-item {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(157, 180, 211, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.meta-item span {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
  font-size: 0.84rem;
}

.meta-item strong {
  display: block;
  font-weight: 700;
  word-break: break-word;
}

.summary-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(157, 180, 211, 0.12);
}

.summary-block h3 {
  margin: 0 0 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-row {
  display: grid;
  gap: 10px;
}

.preset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stacked-list {
  display: grid;
  gap: 12px;
}

.prompt-preview {
  display: block;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(157, 180, 211, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.rich-preview {
  white-space: normal;
}

.rich-preview > *:first-child {
  margin-top: 0;
}

.rich-preview > *:last-child {
  margin-bottom: 0;
}

.rich-preview h1,
.rich-preview h2,
.rich-preview h3,
.rich-preview h4,
.rich-preview h5,
.rich-preview h6 {
  margin: 1.1em 0 0.55em;
  line-height: 1.2;
}

.scenario-document-preview .rich-preview h1 {
  font-size: 1.9em;
}

.scenario-document-preview .rich-preview h2 {
  font-size: 1.6em;
}

.scenario-document-preview .rich-preview h3 {
  font-size: 1.35em;
}

.scenario-document-preview .rich-preview h4 {
  font-size: 1.2em;
}

.scenario-document-preview .rich-preview h5,
.scenario-document-preview .rich-preview h6 {
  font-size: 1.05em;
}

.rich-preview p {
  margin: 0 0 0.9em;
  font-size: 1em;
}

.rich-preview ul,
.rich-preview ol {
  margin: 0 0 0.95em 1.4em;
  padding: 0;
  font-size: 1em;
}

.rich-preview li + li {
  margin-top: 0.35em;
}

.rich-preview blockquote {
  margin: 0 0 1em;
  padding: 0.75em 1em;
  border-left: 3px solid rgba(230, 82, 145, 0.35);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 14px 14px 0;
  font-size: 0.98em;
}

.rich-preview blockquote p {
  margin: 0;
}

.rich-preview pre {
  overflow-x: auto;
  margin: 0 0 1em;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(157, 180, 211, 0.14);
  background: rgba(4, 10, 18, 0.82);
  font-size: 0.95em;
}

.rich-preview pre code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: pre;
}

.rich-preview code {
  padding: 1px 5px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(157, 180, 211, 0.14);
  font-size: 0.95em;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(157, 180, 211, 0.14);
}

@media (max-width: 1160px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .scenario-document-layout {
    grid-template-columns: 1fr;
  }

  .hero,
  .page-header {
    flex-direction: column;
  }

  .chat-card {
    padding: 22px;
  }

  .scenario-section-note {
    text-align: left;
    max-width: none;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 16px;
  }

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

  .topbar-actions,
  .header-actions,
  .actions-cell,
  .form-actions {
    width: 100%;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-group {
    width: 100%;
  }

  .topbar-divider {
    width: 100%;
    height: 1px;
    min-height: 1px;
    margin: 4px 0;
  }

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

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

  .table th,
  .table td {
    padding: 12px 10px;
  }

  .chat-card {
    padding: 18px;
  }

  .chat-turn-assistant,
  .chat-turn-user {
    margin-left: 0;
    margin-right: 0;
  }

  .chat-header,
  .chat-actions {
    flex-direction: column;
  }

  .chat-actions .muted {
    padding-top: 0;
  }
}
