:root {
  color-scheme: dark;
  --bg: #0f1116;
  --panel: #171a21;
  --panel-alt: #1f2430;
  --panel-hover: #262d3d;
  --border: #2e3545;
  --text: #eef2ff;
  --text-muted: #a4adbf;
  --text-dim: #7d8698;
  --accent: #7c9cff;
  --accent-strong: #5f85ff;
  --success: #2dbf7f;
  --warning: #f0b429;
  --danger: #f97066;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  --radius: 18px;
  --sidebar-width: 360px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at top, #1a2235, #0f1116 38%);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body {
  height: 100vh;
  min-height: 100vh;
}

button,
input,
textarea,
summary {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  min-width: 0;
  overflow: hidden;
}

.app-shell.is-unauthenticated {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.app-shell.is-unauthenticated .auth-required {
  display: none !important;
}

.app-shell.is-unauthenticated .sidebar {
  position: relative;
  width: min(100%, 480px);
  max-height: calc(100vh - 48px);
  flex: none;
  border: 1px solid rgba(124, 156, 255, 0.18);
  border-radius: 24px;
  box-shadow: var(--shadow);
  transform: none;
  transition: none;
  z-index: auto;
}

.app-shell.is-unauthenticated .brand {
  justify-content: center;
  text-align: left;
}

.app-shell.is-unauthenticated .panel:last-child {
  margin-bottom: 0;
}

.app-shell.is-unauthenticated .panel-settings {
  margin-bottom: 0;
}

.auth-bootstrap-status {
  display: none;
}

.app-shell.is-bootstrapping .auth-bootstrap-status {
  display: block;
}

.app-shell.is-bootstrapping #authStateBadge,
.app-shell.is-bootstrapping #userSummary,
.app-shell.is-bootstrapping #authChallengeBanner,
.app-shell.is-bootstrapping #authForm {
  display: none !important;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  height: 100vh;
  min-height: 0;
  padding: 20px;
  border-right: 1px solid rgba(124, 156, 255, 0.12);
  background: rgba(15, 17, 22, 0.84);
  backdrop-filter: blur(18px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-stage {
  flex: 1;
  height: 100vh;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 70%) minmax(240px, 25%);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  justify-content: space-between;
  padding: 24px 32px 32px;
  gap: 18px 24px;
  overflow: hidden;
}

.brand,
.chat-header,
.section-header,
.button-row,
.composer-footer,
.header-actions,
.message-meta,
.empty-state-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0;
  justify-content: stretch;
  margin-bottom: 20px;
  width: 100%;
}

.brand h1,
.chat-header h2,
.panel h2 {
  margin: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #62d3ff);
  color: #06101f;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  object-fit: contain;
  object-position: left center;
  border-radius: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.panel {
  background: rgba(23, 26, 33, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.panel-session.is-auth-challenge {
  border-color: rgba(240, 180, 41, 0.42);
  background:
    linear-gradient(
      135deg,
      rgba(240, 180, 41, 0.13),
      rgba(23, 26, 33, 0.9) 34%
    ),
    rgba(23, 26, 33, 0.88);
}

.panel-session.is-mfa-challenge {
  border-color: rgba(124, 156, 255, 0.46);
  background:
    linear-gradient(
      135deg,
      rgba(124, 156, 255, 0.16),
      rgba(23, 26, 33, 0.9) 34%
    ),
    rgba(23, 26, 33, 0.88);
}

.challenge-banner {
  display: grid;
  gap: 6px;
  margin: 14px 0 16px;
  padding: 14px;
  border: 1px solid rgba(240, 180, 41, 0.28);
  border-radius: 16px;
  background: rgba(240, 180, 41, 0.09);
}

.panel-session.is-mfa-challenge .challenge-banner {
  border-color: rgba(124, 156, 255, 0.32);
  background: rgba(124, 156, 255, 0.1);
}

.challenge-banner h3,
.challenge-banner p {
  margin: 0;
}

.challenge-banner h3 {
  font-size: 1.05rem;
}

.challenge-banner p:not(.eyebrow) {
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar > .notice {
  margin-bottom: 16px;
}

.panel summary {
  list-style: none;
  font-weight: 600;
}

.panel summary::-webkit-details-marker {
  display: none;
}

.panel-copy,
.helper {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.helper {
  font-size: 0.86rem;
}

/* SRE-4003: emphasized helper for the "reconnect to enable editing" prompt. */
.helper.helper-warning {
  color: var(--warning);
  font-weight: 600;
}

.section-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.badge {
  border-radius: 999px;
  border: 1px solid rgba(124, 156, 255, 0.18);
  background: rgba(124, 156, 255, 0.12);
  color: var(--text);
  font-size: 0.8rem;
}

.badge {
  padding: 6px 10px;
}

.header-actions {
  gap: 10px;
  margin-left: auto;
}

.admin-gear-button,
.experience-button,
.system-toggle-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(124, 156, 255, 0.22);
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.12);
  color: var(--text);
  font-size: 1.2rem;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.admin-gear-button:hover,
.experience-button:hover,
.system-toggle-button:hover {
  border-color: rgba(124, 156, 255, 0.44);
  background: rgba(124, 156, 255, 0.2);
  transform: translateY(-1px);
}

.system-toggle-icon {
  display: block;
}

/* When pressed, the column is hidden — reflect that in the icon. */
.system-toggle-button[aria-pressed="true"] {
  background: rgba(124, 156, 255, 0.04);
  border-color: rgba(124, 156, 255, 0.16);
  color: var(--text-muted);
}

.system-toggle-button[aria-pressed="true"] .system-toggle-icon-panel {
  opacity: 0;
}

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

.mfa-qr-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.mfa-qr-code {
  width: min(100%, 260px);
  padding: 10px;
  border-radius: 16px;
  background: #ffffff;
}

.mfa-qr-svg {
  display: block;
  width: 100%;
  height: auto;
  shape-rendering: crispEdges;
}

.stack label {
  display: grid;
  gap: 8px;
}

.stack span {
  color: var(--text-muted);
  font-size: 0.84rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(12, 15, 21, 0.88);
  color: var(--text);
  padding: 12px 14px;
  transition: border-color 120ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  min-height: 56px;
  max-height: 220px;
  resize: vertical;
}

.is-hidden {
  display: none !important;
}

.auth-form.is-signed-in .sign-in-control {
  display: none !important;
}

.auth-form:not(.is-signed-in) .sign-out-control {
  display: none !important;
}

.button-row {
  gap: 10px;
  flex-wrap: wrap;
}

.button,
.conversation-item,
.memory-pack-button,
.text-button,
.suggestion-chip,
.menu-button,
.icon-button,
.vera-status-button {
  border: 0;
}

.button {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 600;
  transition:
    transform 120ms ease,
    background 120ms ease,
    opacity 120ms ease;
}

.button:hover,
.text-button:hover,
.conversation-item:hover,
.memory-pack-button:hover,
.suggestion-chip:hover,
.menu-button:hover {
  transform: translateY(-1px);
}

.button:disabled,
.text-button:disabled,
.conversation-item:disabled,
.suggestion-chip:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

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

.button-danger {
  background: rgba(249, 112, 102, 0.14);
  color: #ffd8d4;
  border-color: rgba(249, 112, 102, 0.36);
}

.button-secondary,
.conversation-item,
.memory-pack-button,
.menu-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.durable-approval-review {
  min-width: 0;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--warning);
  border-radius: 12px;
  background: var(--panel-alt);
}

.durable-approval-title {
  margin: 0 0 8px;
}

.durable-approval-guidance,
.durable-approval-args-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.durable-approval-operations {
  margin: 16px 0;
  padding-left: 24px;
}

.durable-approval-operation + .durable-approval-operation {
  margin-top: 16px;
}

.durable-approval-tool,
.durable-approval-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.durable-approval-tool-name {
  overflow-wrap: anywhere;
}

.durable-approval-kind {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.durable-approval-kind[data-grants-external-write="true"] {
  border-color: var(--warning);
  color: var(--warning);
}

.durable-approval-args-label {
  margin-top: 10px;
}

.durable-approval-args {
  max-height: 24rem;
  margin: 6px 0 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.8125rem;
}

/* SRE-4003: plain-language explanation leads each approval operation; the raw JSON
   moves behind the ⓘ control. */
.durable-approval-explanation {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.5;
}

.durable-approval-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.durable-approval-info-button:hover,
.durable-approval-info-button:focus-visible {
  border-color: var(--accent, #7c9cff);
  color: var(--text);
}

.approval-json-dialog {
  width: min(92vw, 720px);
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 20px;
  background: rgba(18, 20, 27, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
}

.approval-json-dialog::backdrop {
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(6px);
}

.approval-json-dialog-shell {
  max-height: calc(100vh - 52px);
  overflow-y: auto;
  padding: 20px;
}

.approval-json-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.approval-json-dialog-header h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.approval-json-dialog-body {
  max-height: 60vh;
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.8125rem;
}

.memory-pack-card {
  padding: 0;
}

.vera-status-card {
  padding: 0;
  overflow: hidden;
}

.vera-status-overview {
  display: grid;
  gap: 10px;
  padding: 16px 16px 12px;
}

.vera-status-overview .section-header {
  margin: 0;
}

.system-load {
  display: grid;
  gap: 7px;
}

.system-load-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.system-load-label {
  font-weight: 700;
}

.system-load-counts {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.system-load-counts {
  text-align: right;
}

.system-load-meter {
  position: relative;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(182, 195, 225, 0.24);
  border-radius: 999px;
  background: rgba(182, 195, 225, 0.12);
}

.system-load-fill {
  display: block;
  width: var(--system-load-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: #7f8ba3;
  transition: width 220ms ease, background-color 160ms ease;
}

.system-load-meter[data-state="GREEN"] .system-load-fill {
  background: #48c78e;
}

.system-load-meter[data-state="GREEN"] {
  border-color: rgba(72, 199, 142, 0.68);
  background: rgba(72, 199, 142, 0.2);
  box-shadow: inset 0 0 0 1px rgba(72, 199, 142, 0.12);
}

.system-load-meter[data-state="YELLOW"] .system-load-fill {
  background: #f4c95d;
}

.system-load-meter[data-state="RED"] .system-load-fill {
  background: #f97066;
}

.system-load-meter[data-state="UNKNOWN"] {
  background: repeating-linear-gradient(
    135deg,
    rgba(182, 195, 225, 0.08) 0,
    rgba(182, 195, 225, 0.08) 8px,
    rgba(182, 195, 225, 0.16) 8px,
    rgba(182, 195, 225, 0.16) 16px
  );
}

.system-load-meter[data-state="UNKNOWN"] .system-load-fill {
  width: 0;
}

.connection-state-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
}

.connection-state-value {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.connection-state-value[data-state="connected"] {
  color: #8ce5b9;
}

.connection-state-value[data-state="connecting"] {
  color: #ffe099;
}

.connection-state-value[data-state="disconnected"] {
  color: #ffaaa4;
}

.vera-status-button {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(124, 156, 255, 0.12);
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(255, 255, 255, 0.015);
  color: var(--text);
  text-align: left;
}

.vera-status-button:hover {
  background: rgba(124, 156, 255, 0.08);
}

.vera-status-button .section-header {
  width: 100%;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .system-load-fill {
    transition: none;
  }
}

.conversation-create-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  min-width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(124, 156, 255, 0.22);
  border-radius: 10px;
  background: rgba(124, 156, 255, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.icon-button:hover {
  border-color: rgba(124, 156, 255, 0.48);
  color: var(--text);
}

.onboarding-launch-button {
  width: 42px;
  padding: 0;
  font-size: 1.05rem;
}

.memory-pack-button {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 700;
  text-align: left;
  transition:
    background 120ms ease,
    transform 120ms ease;
}

.memory-pack-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.text-button {
  background: transparent;
  color: var(--accent);
  padding: 0;
}

.progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(135deg, var(--accent), #58d5ff);
  transition: width 220ms ease;
}

.memory-pack-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
}

.report-button {
  min-width: 104px;
}

.memory-pack-dialog,
.error-dialog {
  width: min(92vw, 780px);
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 24px;
  background: rgba(18, 20, 27, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
}

.memory-pack-dialog::backdrop,
.error-dialog::backdrop {
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(6px);
}

.memory-pack-dialog-shell,
.error-dialog-shell {
  max-height: calc(100vh - 52px);
  overflow-y: auto;
  padding: 22px;
}

.error-dialog {
  width: min(92vw, 640px);
  border-color: rgba(249, 112, 102, 0.34);
}

.error-dialog-text {
  margin-bottom: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid rgba(249, 112, 102, 0.24);
  border-radius: 16px;
  background: rgba(249, 112, 102, 0.08);
  color: var(--text);
  line-height: 1.5;
  padding: 14px;
}

.dialog-header,
.dialog-status,
.dialog-section {
  margin-bottom: 18px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2,
.dialog-section h3 {
  margin: 0;
}

.dialog-close-button {
  min-height: 36px;
}

.dialog-status {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.14);
  border-radius: 18px;
  background: rgba(124, 156, 255, 0.08);
}

.dialog-status .progress {
  margin-bottom: 0;
}

.dialog-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.credential-save-status,
.dialog-action-status {
  min-height: 1.3em;
}

.credential-saved-state {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
}

.credential-saved-state {
  border: 1px solid rgba(249, 112, 102, 0.22);
  background: rgba(249, 112, 102, 0.08);
}

.credential-save-status[data-tone="success"],
.dialog-action-status[data-tone="success"] {
  color: var(--success);
}

.credential-save-status[data-tone="warning"],
.dialog-action-status[data-tone="warning"] {
  color: var(--warning);
}

.credential-save-status[data-tone="error"],
.dialog-action-status[data-tone="error"] {
  color: var(--danger);
}

.credential-warning {
  color: var(--warning);
}

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

.memory-pack-options label:has(textarea) {
  grid-column: 1 / -1;
}

.connections-dialog {
  width: min(92vw, 860px);
}

.connections-dialog[open] {
  position: fixed;
  inset: 20vh 0 auto;
  max-height: calc(80vh - 24px);
  margin: 0 auto;
}

.connections-dialog .memory-pack-dialog-shell {
  max-height: calc(80vh - 26px);
}

.mcp-api-keys-dialog {
  width: min(92vw, 720px);
}

.experience-dialog {
  width: min(94vw, 880px);
}

.experience-dialog .memory-pack-dialog-shell {
  max-height: calc(90vh - 32px);
  overflow-y: auto;
}

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

.experience-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.14);
  border-radius: 16px;
  background: rgba(124, 156, 255, 0.06);
}

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

.experience-card p {
  margin: 0;
}

.experience-card-metadata {
  color: var(--muted);
  font-size: 0.82rem;
}

.mcp-created-key textarea {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.mcp-api-key-expiry-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
}

.mcp-api-key-list {
  display: grid;
  gap: 12px;
}

.mcp-api-key-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.14);
  border-radius: 16px;
  background: rgba(124, 156, 255, 0.06);
}

.mcp-api-key-card.is-disabled {
  opacity: 0.75;
}

.mcp-api-key-details {
  min-width: 0;
}

.mcp-api-key-details .helper {
  margin-bottom: 0;
}

.mcp-api-key-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.admin-dialog {
  width: min(96vw, 1280px);
  height: min(92vh, 920px);
  max-height: calc(100vh - 32px);
}

.admin-dialog-shell {
  height: 100%;
  max-height: calc(92vh - 4px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-dialog .admin-tab-panel {
  min-height: 0;
  overflow-y: auto;
}

.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.admin-metric-grid > div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.14);
  border-radius: 16px;
  background: rgba(124, 156, 255, 0.08);
}

.admin-metric-grid dt {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.admin-metric-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.admin-utilization-table-scroll {
  overflow-x: auto;
}

.admin-utilization-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid rgba(124, 156, 255, 0.18);
}

.admin-utilization-table th,
.admin-utilization-table td {
  padding: 12px 14px;
  border: 1px solid rgba(124, 156, 255, 0.14);
  text-align: right;
  white-space: nowrap;
}

.admin-utilization-table th:first-child {
  text-align: left;
}

.admin-utilization-table thead th {
  color: var(--text-muted);
  font-size: 0.78rem;
}

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

.admin-list-heading h4 {
  margin: 0;
}

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

/* "Acting as machine identity" banner shown atop the three reused dialogs. */
.acting-identity-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid rgba(124, 156, 255, 0.45);
  border-radius: 12px;
  background: rgba(124, 156, 255, 0.16);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Empty/loading-state line for admin directory-style lists (machine identities). */
.admin-directory-empty {
  padding: 10px 11px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.admin-entry {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
}

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

.admin-entry-title {
  margin: 0;
  font-weight: 700;
}

.admin-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-entry-grid label {
  display: grid;
  gap: 8px;
}

.admin-entry-grid label.admin-wide-field {
  grid-column: 1 / -1;
}

.admin-entry-grid span {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.admin-entry-grid select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(12, 15, 21, 0.88);
  color: var(--text);
  padding: 12px 14px;
}

.admin-entry-grid textarea {
  min-height: 180px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.connection-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.connection-tab {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
}

.connection-tab.is-active {
  background: rgba(124, 156, 255, 0.18);
  color: var(--text);
}

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

.connection-options label:has(input[type="password"]),
.connection-options-aws label,
.connection-options-json label {
  grid-column: 1 / -1;
}

.connection-options-aws textarea,
.connection-options-json textarea {
  min-height: 220px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.connection-panel-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.credential-default-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid rgba(124, 156, 255, 0.28);
  border-radius: 9px;
  background: rgba(124, 156, 255, 0.12);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.connection-panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.credential-delete-button {
  color: var(--danger);
}

.credential-help-dialog {
  width: min(92vw, 680px);
}

.aws-bootstrap-dialog {
  width: min(94vw, 900px);
}

.aws-bootstrap-dialog .memory-pack-dialog-shell {
  max-height: calc(90vh - 32px);
  overflow-y: auto;
}

.aws-bootstrap-summary,
.aws-bootstrap-policy-section,
.aws-bootstrap-provision,
.aws-bootstrap-portal,
.aws-bootstrap-result {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.18);
  border-radius: 14px;
  background: rgba(124, 156, 255, 0.05);
}

.aws-bootstrap-metadata {
  display: grid;
  gap: 8px;
  margin: 0;
}

.aws-bootstrap-metadata > div {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
  gap: 8px 14px;
}

.aws-bootstrap-summary dt {
  color: var(--muted);
}

.aws-bootstrap-summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.aws-bootstrap-policy-section summary {
  cursor: pointer;
  font-weight: 700;
}

.aws-bootstrap-policy,
.aws-bootstrap-copy-field pre,
.aws-bootstrap-result pre {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(124, 156, 255, 0.18);
  border-radius: 10px;
  background: rgba(5, 9, 20, 0.72);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.aws-bootstrap-copy-fields {
  display: grid;
  gap: 10px;
}

.aws-bootstrap-copy-field {
  display: grid;
  gap: 8px;
}

.aws-bootstrap-copy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.aws-bootstrap-blockers {
  color: var(--warning);
}

.aws-bootstrap-blockers:empty {
  display: none;
}

.aws-bootstrap-result {
  border-color: rgba(89, 214, 145, 0.32);
  background: rgba(89, 214, 145, 0.06);
}

.credential-help-body p,
.credential-help-body li {
  line-height: 1.6;
}

.credential-help-body ol {
  margin: 12px 0 0;
  padding-left: 1.4rem;
}

.credential-help-example {
  margin-top: 18px;
}

.credential-help-example .helper {
  margin-bottom: 8px;
}

.credential-help-example pre {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.2);
  border-radius: 14px;
  background: rgba(5, 9, 20, 0.72);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
}

.credential-help-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.credential-help-links a {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(124, 156, 255, 0.08);
}

.credential-help-links a:hover {
  color: var(--text);
  border-color: rgba(124, 156, 255, 0.48);
}

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

.onboarding-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 8, 16, 0.76);
  backdrop-filter: blur(3px);
}

.onboarding-dialog-card {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1002;
  display: flex;
  width: min(92vw, 620px);
  max-height: min(90vh, 860px);
  flex-direction: column;
  padding: 24px;
  border: 1px solid rgba(124, 156, 255, 0.38);
  border-radius: 24px;
  background: rgba(18, 20, 27, 0.99);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.56);
  transform: translate(-50%, -50%);
}

.onboarding-dialog-card:focus {
  outline: none;
}

.onboarding-dialog-card.onboarding-dialog-anchored {
  transform: none;
}

.onboarding-header,
.onboarding-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

.onboarding-header {
  justify-content: space-between;
  margin-bottom: 18px;
}

.onboarding-header h2 {
  margin: 0;
}

.onboarding-close-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.1);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
}

.onboarding-close-button:hover {
  border-color: rgba(124, 156, 255, 0.5);
  background: rgba(124, 156, 255, 0.2);
}

.onboarding-slides {
  min-height: 0;
  overflow-y: auto;
}

.onboarding-slide {
  line-height: 1.6;
}

.onboarding-slide > :first-child {
  margin-top: 0;
}

.onboarding-slide > :last-child {
  margin-bottom: 0;
}

.onboarding-slide li + li {
  margin-top: 8px;
}

.onboarding-slide a {
  color: var(--accent);
}

.onboarding-skill-list {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}

.onboarding-skill-list li {
  padding-left: 4px;
}

.onboarding-skill-list code {
  display: inline-block;
  margin-right: 8px;
}

.onboarding-workspace-preview {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 10px;
  border-radius: inherit;
  background: rgba(13, 16, 24, 0.97);
  box-shadow: inset 0 0 0 1px rgba(124, 156, 255, 0.28);
}

.onboarding-workspace-preview .message {
  margin: 0;
}

.onboarding-workspace-preview-label {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.onboarding-workspace-preview .message--assistant {
  cursor: default;
}

.onboarding-workspace-preview .message--system:last-child {
  border-color: rgba(45, 191, 127, 0.3);
}

.onboarding-credential-form {
  margin-top: 18px;
}

.onboarding-credential-form textarea {
  min-height: 150px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.onboarding-save-button {
  justify-self: start;
}

.onboarding-status {
  min-height: 1.5em;
  margin: 14px 0 0;
}

.onboarding-status[data-tone="success"] {
  color: var(--success);
}

.onboarding-status[data-tone="error"] {
  color: var(--danger);
}

.onboarding-footer {
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(124, 156, 255, 0.16);
}

.is-onboarding-target {
  position: relative;
  z-index: 1001 !important;
  pointer-events: none;
  outline: 3px solid var(--accent);
  outline-offset: 5px;
  box-shadow:
    0 0 0 10px rgba(124, 156, 255, 0.18),
    0 0 42px rgba(124, 156, 255, 0.72) !important;
}

.app-shell.is-onboarding .sidebar:has(.is-onboarding-target) {
  position: relative;
  z-index: 1001;
}

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

.conversation-folder {
  display: grid;
  gap: 8px;
}

.conversation-folder-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 10px;
  color: var(--text);
}

.conversation-folder-header.is-drop-target,
.conversation-folder.is-drop-target,
.conversation-list.is-drop-target {
  background: rgba(124, 156, 255, 0.16);
  outline: 1px dashed rgba(124, 156, 255, 0.58);
}

.folder-disclosure {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
}

.folder-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.folder-new-chat,
.folder-delete {
  min-width: 26px;
  min-height: 26px;
  border-radius: 8px;
}

.folder-delete {
  color: var(--danger);
  font-size: 0.86rem;
  line-height: 1;
}

.folder-context-menu {
  position: fixed;
  z-index: 30;
  display: grid;
  min-width: 136px;
  padding: 6px;
  border: 1px solid rgba(124, 156, 255, 0.22);
  border-radius: 12px;
  background: rgba(18, 20, 27, 0.98);
  box-shadow: var(--shadow);
}

.folder-context-menu button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 9px 10px;
  text-align: left;
}

.folder-context-menu button:hover:not(:disabled) {
  background: rgba(124, 156, 255, 0.14);
}

.folder-context-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.conversation-folder-items {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.conversation-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.conversation-card[draggable="true"] {
  cursor: grab;
}

.conversation-card.is-dragging {
  opacity: 0.48;
}

.conversation-item {
  width: 100%;
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.conversation-card.is-running .conversation-item {
  border-color: rgba(124, 156, 255, 0.32);
}

/* Run not found (404) or retired (410): grey the whole card out in the list. */
.conversation-card.is-unavailable {
  opacity: 0.45;
  filter: grayscale(0.6);
}
.conversation-card.is-unavailable.is-active {
  opacity: 0.7;
}

.conversation-item.is-active {
  background: rgba(124, 156, 255, 0.18);
  border-color: rgba(124, 156, 255, 0.38);
}

.conversation-menu-toggle {
  align-self: stretch;
  min-width: 38px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.conversation-menu-toggle:hover {
  color: var(--text);
  border-color: rgba(124, 156, 255, 0.34);
}

.conversation-menu {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 8;
  display: grid;
  min-width: 120px;
  padding: 6px;
  border: 1px solid rgba(124, 156, 255, 0.22);
  border-radius: 14px;
  background: rgba(18, 20, 27, 0.98);
  box-shadow: var(--shadow);
}

.conversation-menu button {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 9px 10px;
  text-align: left;
}

.conversation-menu button:hover {
  background: rgba(124, 156, 255, 0.14);
}

.conversation-item-title {
  font-weight: 600;
}

.conversation-item-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.conversation-activity {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(124, 156, 255, 0.3);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

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

.chat-header {
  gap: 14px;
  padding-bottom: 12px;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.notice {
  min-height: 0;
  padding: 0;
  color: var(--text-muted);
}

.notice:not(:empty) {
  padding: 14px 16px;
  border: 1px solid rgba(124, 156, 255, 0.16);
  border-radius: 16px;
  background: rgba(124, 156, 255, 0.1);
}

.notice[data-tone="error"]:not(:empty) {
  border-color: rgba(249, 112, 102, 0.26);
  background: rgba(249, 112, 102, 0.12);
  color: #ffd5cf;
}

.notice[data-tone="success"]:not(:empty) {
  border-color: rgba(45, 191, 127, 0.24);
  background: rgba(45, 191, 127, 0.12);
  color: #c8f5df;
}

.message-workspace {
  display: contents;
}

.messages {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-right: 4px;
}

.chat-messages,
.system-messages {
  scrollbar-gutter: stable;
}

.system-messages {
  grid-column: 2;
  grid-row: 3;
  gap: 12px;
  padding: 2px 4px 2px 0;
  overscroll-behavior: contain;
  scroll-behavior: auto;
}

/* SRE-3827: collapse the System Messages column to free screen real estate.
   The conversation thread (user prompts + Vera responses) expands
   horizontally to consume the vacated column; the composer and the Notes
   panel keep their positions in the bottom row. */
.app-shell.is-system-collapsed:not(.is-shared-viewer) .system-messages {
  display: none;
}

.app-shell.is-system-collapsed:not(.is-shared-viewer) .chat-messages {
  grid-column: 1 / -1;
}

.notes-panel {
  grid-column: 2;
  grid-row: 4;
  min-height: 250px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.14);
  border-radius: 18px;
  background: rgba(18, 20, 27, 0.9);
  box-shadow: var(--shadow);
}

.notes-panel .section-header {
  margin: 0;
}

.notes-panel h3 {
  margin: 0;
}

.notes-panel textarea {
  min-height: 0;
  max-height: none;
  resize: none;
}

.chat-header,
.notice {
  grid-column: 1 / -1;
}

.app-shell.is-shared-viewer {
  display: block;
  height: 100vh;
  overflow: hidden;
}

.app-shell.is-shared-viewer .sidebar,
.app-shell.is-shared-viewer .composer,
.app-shell.is-shared-viewer .notes-panel,
.app-shell.is-shared-viewer .menu-button {
  display: none;
}

.app-shell.is-shared-viewer .chat-stage {
  min-height: 100vh;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 32px;
}

.app-shell.is-shared-viewer .message-workspace {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 2;
  grid-template-columns: minmax(0, 70%) minmax(240px, 25%);
  gap: 18px 24px;
  min-height: 0;
}

.app-shell.is-shared-viewer .chat-messages,
.app-shell.is-shared-viewer .system-messages {
  grid-row: 1;
}

.chat-messages {
  grid-column: 1;
  grid-row: 3;
}

.system-messages > :first-child {
  margin-top: auto;
}

.message,
.empty-state {
  max-width: none;
  width: 100%;
  align-self: stretch;
}

.message {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(23, 26, 33, 0.86);
  box-shadow: var(--shadow);
}

.system-detail-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.system-detail-button:hover {
  background: rgba(124, 156, 255, 0.24);
  color: var(--text);
}

.detail-content {
  max-height: 62vh;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(124, 156, 255, 0.18);
  border-radius: 14px;
  background: rgba(5, 9, 20, 0.72);
  color: var(--text);
  display: grid;
  gap: 18px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.system-detail-section {
  display: grid;
  gap: 8px;
}

.system-detail-section h3,
.system-detail-tool h4 {
  margin: 0;
}

.system-detail-section p {
  margin: 0;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.system-detail-reasoning {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.system-detail-reasoning strong {
  display: block;
  color: var(--text);
}

.system-detail-tool,
.system-detail-verification {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.18);
  border-radius: 12px;
  background: rgba(23, 26, 33, 0.72);
}

.system-detail-verification h4,
.system-detail-verification pre {
  margin: 0;
}

.system-detail-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.system-detail-tool-status {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: capitalize;
}

.system-detail-tool pre,
.system-detail-verification pre,
.system-detail-raw pre {
  overflow: auto;
  max-height: 28vh;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.system-detail-fields {
  display: grid;
  grid-template-columns: minmax(84px, max-content) 1fr;
  gap: 6px 14px;
  margin: 0;
}

.system-detail-fields dt {
  color: var(--text-muted);
  font-weight: 600;
}

.system-detail-fields dd {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.system-detail-raw {
  border: 1px solid rgba(124, 156, 255, 0.18);
  border-radius: 12px;
  background: rgba(23, 26, 33, 0.72);
  padding: 10px 14px;
}

.system-detail-raw summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.system-detail-raw pre {
  margin-top: 10px;
}

.system-detail-summary-text {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.system-detail-summary-text.system-detail-summary-error {
  color: var(--text-muted);
}

.system-detail-summary-retry {
  margin-top: 8px;
  align-self: flex-start;
}

.report-content {
  display: grid;
  gap: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.report-content p {
  margin: 0;
}

.report-content h3 {
  margin: 8px 0 -6px;
  color: var(--text);
  font-size: 0.95rem;
}

.report-content ul {
  margin: -4px 0 0;
  padding-left: 22px;
}

.report-content li + li {
  margin-top: 6px;
}

.status-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-detail-item {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(124, 156, 255, 0.16);
  border-radius: 14px;
  background: rgba(124, 156, 255, 0.06);
}

.status-detail-item strong {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.status-detail-item span {
  overflow-wrap: anywhere;
}

.status-detail-item.is-wide {
  grid-column: 1 / -1;
}

.compact-dialog {
  width: min(92vw, 460px);
}

.message--user {
  background: rgba(124, 156, 255, 0.14);
}

.message--assistant {
  background: rgba(255, 255, 255, 0.04);
}

.message--system {
  background: rgba(124, 156, 255, 0.08);
}

.message--compact {
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  box-shadow: none;
}

.message--selected {
  border-color: rgba(124, 156, 255, 0.58);
  box-shadow:
    0 0 0 1px rgba(124, 156, 255, 0.18),
    var(--shadow);
}

.message--dimmed {
  opacity: 0.42;
  filter: saturate(0.72);
  transition:
    opacity 160ms ease,
    filter 160ms ease;
}

.message--error {
  border-color: rgba(249, 112, 102, 0.28);
}

.message-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.message-meta {
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.message-action-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(124, 156, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  opacity: 0.72;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.message-action-button:hover,
.message-action-button:focus-visible {
  border-color: rgba(124, 156, 255, 0.38);
  background: rgba(124, 156, 255, 0.14);
  color: var(--text);
  opacity: 1;
  outline: none;
}

.message-action-button svg {
  width: 16px;
  height: 16px;
}

.pdf-print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.message-role {
  color: var(--text);
  font-weight: 700;
}

.durable-run-status {
  padding: 2px 7px;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.72rem;
}

.durable-run-status[data-status="WAITING_CAPACITY"],
.durable-run-status[data-status="AWAITING_CONFIRMATION"] {
  border-color: rgba(244, 201, 93, 0.38);
  background: rgba(244, 201, 93, 0.12);
  color: #ffe099;
}

.durable-run-status[data-status="FAILED"],
.durable-run-status[data-status="TIMED_OUT"],
.durable-run-status[data-status="OUTCOME_UNKNOWN"] {
  border-color: rgba(249, 112, 102, 0.38);
  background: rgba(249, 112, 102, 0.12);
  color: #ffaaa4;
}

.message-content {
  /* Grid items default to min-width:auto, so one long unbreakable line (a code
     block, a chart-spec fallback) would widen the whole message — and every
     chart canvas sized from it. Keep content within the message column. */
  min-width: 0;
  max-width: 100%;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
}

.message-content--markdown {
  white-space: normal;
}

.message-content--markdown > :first-child {
  margin-top: 0;
}

.message-content--markdown > :last-child {
  margin-bottom: 0;
}

.message-content--markdown p,
.message-content--markdown ul,
.message-content--markdown ol,
.message-content--markdown blockquote,
.message-content--markdown pre,
.message-content--markdown .markdown-table-scroll {
  margin: 0 0 0.9rem;
}

.message-content--markdown h3,
.message-content--markdown h4,
.message-content--markdown h5,
.message-content--markdown h6 {
  margin: 0 0 0.7rem;
  line-height: 1.3;
}

.message-content--markdown ul,
.message-content--markdown ol {
  padding-left: 1.3rem;
}

.message-content--markdown li + li {
  margin-top: 0.35rem;
}

/* SRE-4016: nested lists sit directly beneath their parent item. */
.message-content--markdown li > ul,
.message-content--markdown li > ol {
  margin: 0.35rem 0 0;
}

.message-content--markdown code {
  border: 1px solid rgba(124, 156, 255, 0.16);
  border-radius: 8px;
  padding: 0.12rem 0.32rem;
  background: rgba(8, 12, 20, 0.62);
  color: #d9e4ff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.message-content--markdown pre {
  overflow-x: auto;
  border: 1px solid rgba(124, 156, 255, 0.16);
  border-radius: 14px;
  padding: 14px;
  background: rgba(8, 12, 20, 0.76);
}

.message-content--markdown pre code {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  white-space: pre;
}

/* SRE-4010: inline charts (frontend/charts.mjs). The canvas background stays
   transparent; the Download/Copy toolbar appears in the upper-right corner on
   hover or keyboard focus (always visible on touch devices). */
.message-content--markdown .chart-figure {
  position: relative;
  min-width: 0;
  max-width: 100%;
  margin: 0 0 0.9rem;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(124, 156, 255, 0.16);
  border-radius: 14px;
}

.chart-canvas {
  display: block;
  width: 100%;
}

.chart-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.chart-figure:hover .chart-actions,
.chart-figure:focus-within .chart-actions {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .chart-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

.chart-action-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(124, 156, 255, 0.28);
  border-radius: 10px;
  background: rgba(15, 17, 22, 0.86);
  color: var(--text-muted);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.chart-action-button:hover,
.chart-action-button:focus-visible {
  border-color: rgba(124, 156, 255, 0.5);
  background: rgba(38, 45, 61, 0.95);
  color: var(--text);
  outline: none;
}

.chart-action-button svg {
  width: 16px;
  height: 16px;
}

.message-content--markdown .chart-placeholder {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 0 0 0.9rem;
  border: 1px dashed rgba(124, 156, 255, 0.24);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.message-content--markdown .chart-error {
  margin: 0 0 0.9rem;
}

.message-content--markdown .chart-error-notice {
  margin: 0 0 0.5rem;
  color: var(--warning);
  font-size: 0.9rem;
}

.message-content--markdown a {
  color: #9cb4ff;
  text-decoration-color: rgba(156, 180, 255, 0.58);
}

.message-content--markdown .markdown-table-scroll {
  overflow-x: auto;
}

.message-content--markdown table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid rgba(124, 156, 255, 0.18);
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.46);
  font-size: 0.94rem;
}

.message-content--markdown th,
.message-content--markdown td {
  padding: 0.62rem 0.75rem;
  border: 1px solid rgba(124, 156, 255, 0.16);
  text-align: left;
  vertical-align: top;
}

.message-content--markdown th {
  background: rgba(124, 156, 255, 0.12);
  color: var(--text);
  font-weight: 700;
}

.message-content--markdown td {
  color: var(--text-muted);
}

.message-content--markdown blockquote {
  border-left: 3px solid rgba(124, 156, 255, 0.42);
  padding-left: 1rem;
  color: var(--text-muted);
}

.message-content--markdown hr {
  border: 0;
  border-top: 1px solid rgba(124, 156, 255, 0.18);
  margin: 1rem 0;
}

.message-content.is-pending::after {
  content: "|";
  margin-left: 2px;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

.system-message-group {
  display: grid;
  gap: 10px;
  transition:
    opacity 160ms ease,
    filter 160ms ease;
}

.system-empty-state {
  margin-top: auto;
  padding: 16px;
  border: 1px dashed rgba(124, 156, 255, 0.2);
  border-radius: 16px;
  color: var(--text-muted);
  line-height: 1.5;
  background: rgba(19, 22, 29, 0.54);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.empty-state {
  margin: auto auto 24px;
  padding: 28px;
  border-radius: 22px;
  border: 1px dashed rgba(124, 156, 255, 0.22);
  background: rgba(19, 22, 29, 0.72);
}

.empty-state h3 {
  margin: 0 0 10px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--text-muted);
  line-height: 1.6;
}

.empty-state-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.suggestion-chip {
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.composer {
  grid-column: 1;
  grid-row: 4;
  width: 100%;
  align-self: end;
  display: grid;
  gap: 12px;
  position: relative;
  padding: 18px;
  border-radius: 22px;
  background: rgba(18, 20, 27, 0.9);
  border: 1px solid rgba(124, 156, 255, 0.14);
  box-shadow: var(--shadow);
}

.slash-skill-autocomplete {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(124, 156, 255, 0.18);
  border-radius: 14px;
  background: rgba(10, 14, 24, 0.96);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.slash-skill-autocomplete[hidden] {
  display: none;
}

.slash-skill-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
}

.slash-skill-option strong {
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
}

.slash-skill-option span {
  font-size: 0.84rem;
}

.slash-skill-option:hover,
.slash-skill-option[aria-selected="true"] {
  background: rgba(124, 156, 255, 0.13);
  color: var(--text);
}

.composer-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: auto;
}

.composer-skills:empty {
  display: none;
}

.composer-skill {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.08);
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.composer-skill:hover:not(:disabled) {
  background: rgba(124, 156, 255, 0.16);
  color: var(--text);
}

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

.composer-footer {
  justify-content: space-between;
  gap: 16px;
}

.composer-footer .helper {
  flex: 1;
}

.status-online {
  background: rgba(45, 191, 127, 0.14);
  border-color: rgba(45, 191, 127, 0.28);
}

.status-warning {
  background: rgba(240, 180, 41, 0.12);
  border-color: rgba(240, 180, 41, 0.28);
}

.status-error {
  background: rgba(249, 112, 102, 0.12);
  border-color: rgba(249, 112, 102, 0.3);
}

@media (max-width: 1080px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .chat-stage {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .message-workspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .chat-messages,
  .system-messages,
  .composer,
  .notes-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .system-messages {
    min-height: 160px;
    max-height: 34vh;
  }

  .notes-panel {
    min-height: 190px;
  }

  .composer {
    width: 100%;
  }

  .menu-button {
    display: inline-grid;
    place-items: center;
  }
}

@media (max-width: 720px) {
  .chat-stage {
    padding: 16px;
  }

  .chat-header,
  .composer-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer,
  .message,
  .empty-state {
    width: 100%;
  }

  .memory-pack-dialog-shell {
    padding: 18px;
  }

  .onboarding-dialog-card,
  .onboarding-dialog-card.onboarding-dialog-anchored {
    inset: auto 12px 12px;
    width: auto;
    max-height: calc(100vh - 24px);
    padding: 18px;
    transform: none;
  }

  .onboarding-header {
    align-items: flex-start;
  }

  .onboarding-footer {
    flex-wrap: wrap;
  }

  .dialog-header,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .memory-pack-options {
    grid-template-columns: 1fr;
  }

  .aws-bootstrap-metadata > div {
    grid-template-columns: 1fr;
  }

  .aws-bootstrap-summary dd {
    margin-bottom: 6px;
  }

  .memory-pack-status-row,
  .status-detail-grid {
    grid-template-columns: 1fr;
  }

  .system-load-heading,
  .connection-state-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .system-load-counts {
    text-align: left;
  }
}

/* User-defined skills (SRE-3848) */
.skills-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(124, 156, 255, 0.22);
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.12);
  color: var(--text);
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.skills-button:hover {
  border-color: rgba(124, 156, 255, 0.44);
  background: rgba(124, 156, 255, 0.2);
  transform: translateY(-1px);
}

.skills-icon {
  display: block;
}

.skills-dialog,
.shared-skill-dialog {
  width: min(94vw, 960px);
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 24px;
  background: rgba(18, 20, 27, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
}

.shared-skill-dialog {
  width: min(92vw, 640px);
}

.skills-dialog::backdrop,
.shared-skill-dialog::backdrop {
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(6px);
}

.skills-dialog-shell,
.shared-skill-dialog-shell {
  max-height: calc(100vh - 52px);
  overflow-y: auto;
  padding: 22px;
}

/* User preference prose (SRE-3855) */
.preferences-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(124, 156, 255, 0.22);
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.12);
  color: var(--text);
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.preferences-button:hover {
  border-color: rgba(124, 156, 255, 0.44);
  background: rgba(124, 156, 255, 0.2);
  transform: translateY(-1px);
}

.preferences-icon {
  display: block;
}

.preferences-dialog {
  width: min(92vw, 680px);
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 24px;
  background: rgba(18, 20, 27, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
}

.preferences-dialog::backdrop {
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(6px);
}

.preferences-dialog-shell {
  max-height: calc(100vh - 52px);
  overflow-y: auto;
  padding: 22px;
}

.preferences-editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.preferences-editor textarea {
  resize: vertical;
  min-height: 160px;
}

.preferences-editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.skills-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 18px;
  margin-top: 16px;
}

.skills-list-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.skills-new-button {
  width: 100%;
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skill-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.skill-row.is-selected {
  border-color: var(--accent);
  background: var(--panel-alt);
}

.skill-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.skill-row-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.skill-row-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.skill-pill {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(124, 156, 255, 0.08);
}

.skill-pill-linked {
  color: var(--accent);
  border-color: rgba(124, 156, 255, 0.4);
}

.skill-pill-copied {
  color: var(--success);
  border-color: rgba(45, 191, 127, 0.4);
}

.skill-pill-unavailable {
  color: var(--danger);
  border-color: rgba(249, 112, 102, 0.4);
}

.skill-row-menu-wrap {
  position: relative;
  padding-right: 6px;
}

.skill-row-menu-toggle {
  font-size: 1.2rem;
  line-height: 1;
}

.skill-row-menu {
  position: absolute;
  right: 6px;
  top: 100%;
  z-index: 5;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-alt);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.skill-row-menu-item {
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
}

.skill-row-menu-item:hover {
  background: var(--panel-hover);
}

.skill-row-menu-danger {
  color: var(--danger);
}

/* Scheduled tasks (SRE-3822): rows reuse the skills dialog/layout chrome. */
.task-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.task-row.is-selected {
  border-color: var(--accent);
  background: var(--panel-alt);
}

.task-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.task-row-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.task-row-schedule {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.task-pill {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(124, 156, 255, 0.08);
  white-space: nowrap;
}

.task-pill-on {
  color: var(--success);
  border-color: rgba(45, 191, 127, 0.4);
}

.task-pill-off {
  color: var(--text-dim);
}

.task-row-menu-wrap {
  position: relative;
  padding-right: 6px;
}

.task-row-menu-toggle {
  font-size: 1.2rem;
  line-height: 1;
}

.task-row-menu {
  position: absolute;
  right: 6px;
  top: 100%;
  z-index: 5;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-alt);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.task-row-menu-item {
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
}

.task-row-menu-item:hover {
  background: var(--panel-hover);
}

.task-row-menu-danger {
  color: var(--danger);
}

.skills-editor-pane {
  min-width: 0;
}

.skills-editor-empty {
  color: var(--text-muted);
}

.skills-editor-fields {
  display: grid;
  gap: 14px;
}

.skills-linked-banner {
  border: 1px solid rgba(124, 156, 255, 0.3);
  background: rgba(124, 156, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text-muted);
}

.skills-editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

#skillInstructionsInput {
  width: 100%;
  resize: vertical;
  font-family: inherit;
}

.shared-skill-instructions {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 40vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 12px;
  margin: 12px 0;
}

.shared-skill-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

#skillsEditorStatus[data-tone="error"],
#sharedSkillStatus[data-tone="error"] {
  color: var(--danger);
}

#skillsEditorStatus[data-tone="success"],
#sharedSkillStatus[data-tone="success"] {
  color: var(--success);
}

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

/* Summary-only conversation whose messages are loading (or failed to load). */
.conversation-loading-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.conversation-loading-state.is-error {
  color: var(--warning);
}

/* Role Views (SRE-4011) ------------------------------------------------------ */
.role-views-dialog {
  width: 90vw;
  height: 90vh;
  max-width: 90vw;
  max-height: 90vh;
  padding: 0;
  border: 1px solid rgba(124, 156, 255, 0.24);
  border-radius: 20px;
  background: rgba(18, 20, 27, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.role-views-dialog[open] {
  display: flex;
}

.role-views-dialog::backdrop {
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(6px);
}

.role-views-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  padding: 18px 20px 20px;
  gap: 14px;
}

.role-views-header {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.role-views-heading h2 {
  margin: 0;
}

.role-views-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.role-views-tab {
  border: 1px solid transparent;
  border-radius: 10px 10px 0 0;
  padding: 8px 16px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
}

.role-views-tab:hover {
  color: var(--text);
  background: var(--panel-alt);
}

.role-views-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--panel-alt);
  border-color: var(--border);
  border-bottom-color: var(--accent);
}

.role-view-panel {
  flex: 1;
  min-height: 0;
}

.role-view-panel[hidden] {
  display: none;
}

.sre-role-view {
  display: grid;
  grid-template-columns: minmax(300px, 34%) minmax(0, 1fr);
  gap: 16px;
}

.sre-incidents-pane,
.sre-detail-pane {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.sre-incidents-pane {
  padding: 12px;
  gap: 10px;
}

.sre-filters {
  display: grid;
  gap: 8px;
}

.sre-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 8px;
}

/* SRE-4048: days | saved-filter card | states. */
.sre-filter-row:has(.sre-saved-filter) {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.sre-saved-filter {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px 6px;
}

.sre-saved-filter legend {
  padding: 0 4px;
}

.sre-saved-filter select,
.sre-saved-filter input[type="text"] {
  padding: 4px 6px;
  font-weight: 600;
}

.sre-saved-filter input[hidden],
.sre-saved-filter select[hidden] {
  display: none;
}

/* The selected name turns gray when the current filters differ from the save. */
.sre-saved-filter select.is-modified {
  color: var(--text-dim);
  font-weight: 400;
  font-style: italic;
}

.sre-saved-filter select option {
  color: var(--text);
  font-style: normal;
}

.sre-saved-filter-actions {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.sre-saved-filter-actions .text-button {
  padding: 2px 4px;
  font-size: 0.78rem;
}

.sre-saved-filter-actions .text-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.role-views-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-alt);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.role-views-toast[hidden] {
  display: none;
}

.role-views-toast.is-error {
  border-color: var(--danger);
}

.sre-filter {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.sre-filter input[type="text"],
.sre-filter input[type="number"],
.sre-filter select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--panel-alt);
  color: var(--text);
}

.sre-days-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sre-days-input input {
  max-width: 90px;
}

.sre-status-filter {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px 6px;
}

.sre-status-filter legend {
  padding: 0 4px;
}

.sre-status-filter label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: var(--text);
}

.sre-status-filter input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
}

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

.sre-multiselect {
  position: relative;
}

.sre-multiselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--panel-alt);
  color: var(--text);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.sre-multiselect-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sre-multiselect-trigger::after {
  content: "▾";
  flex: none;
  color: var(--text-muted);
}

.sre-multiselect.is-open .sre-multiselect-trigger::after {
  content: "▴";
}

.sre-multiselect-trigger.is-filtering {
  border-color: var(--accent, var(--border));
  font-weight: 600;
}

.sre-multiselect-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  width: max(100%, 260px);
  max-width: min(360px, 80vw);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.sre-multiselect-popover[hidden] {
  display: none;
}

.sre-multiselect:nth-child(even) .sre-multiselect-popover {
  left: auto;
  right: 0;
}

.sre-multiselect-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sre-multiselect-tools input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--panel-alt);
  color: var(--text);
}

.sre-multiselect-options {
  display: grid;
  align-content: start;
  max-height: 260px;
  overflow-y: auto;
}

.sre-multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}

.sre-multiselect-option[hidden] {
  display: none;
}

.sre-multiselect-option:hover,
.sre-multiselect-option:focus-within {
  background: var(--panel-alt);
}

.sre-multiselect-option input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
  flex: none;
}

.sre-multiselect-option span {
  overflow-wrap: anywhere;
}

.sre-multiselect-empty {
  margin: 4px 6px;
  font-size: 0.78rem;
}

.sre-filter-footer,
.sre-list-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sre-filter-footer .helper,
.sre-list-status .helper {
  margin: 0;
  font-size: 0.78rem;
}

.sre-filter-error {
  margin: 0;
  color: var(--danger);
}

.sre-incident-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 6px;
  padding-right: 2px;
}

.sre-incident-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--panel-alt);
  color: var(--text);
}

.sre-incident-tile:hover {
  background: var(--panel-hover);
}

.sre-incident-tile.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.sre-incident-tile[data-status="triggered"] {
  border-left-color: var(--danger);
}

.sre-incident-tile[data-status="acknowledged"] {
  border-left-color: var(--warning);
}

.sre-incident-tile[data-status="resolved"] {
  border-left-color: var(--success);
}

/* Blue tint once the incident has a Vera conversation. */
.sre-incident-tile.has-conversation {
  background: rgba(124, 156, 255, 0.16);
  border-color: rgba(124, 156, 255, 0.45);
}

.sre-incident-tile.has-conversation:hover {
  background: rgba(124, 156, 255, 0.24);
}

.sre-incident-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sre-incident-meta {
  grid-column: 1 / -1;
  font-size: 0.76rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.sre-incident-tile .conversation-activity {
  align-self: start;
}

.sre-detail-pane {
  overflow: hidden;
}

.sre-detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.sre-detail-empty {
  margin: auto;
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

.sre-detail-title {
  margin: 0;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.sre-detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sre-detail-actions .helper {
  margin: 0;
}

.sre-detail-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 14px;
  margin: 0;
  font-size: 0.86rem;
}

.sre-detail-fields dt {
  color: var(--text-muted);
}

.sre-detail-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.sre-detail-section h3 {
  margin: 0 0 6px;
  font-size: 0.92rem;
}

.sre-detail-section pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-alt);
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sre-note {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
}

.sre-note:last-child {
  border-bottom: none;
}

.sre-note-meta {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.sre-conversation {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.sre-conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sre-conversation-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.sre-conversation-messages {
  display: grid;
  gap: 12px;
}

@media (max-width: 900px) {
  .sre-role-view {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 45%) minmax(0, 1fr);
  }

  .sre-filter-row,
  .sre-filter-row:has(.sre-saved-filter) {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The compact dropdowns stay side by side until the dialog is phone-narrow. */
  .sre-filter-row-multi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-views-header {
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .sre-filter-row-multi {
    grid-template-columns: minmax(0, 1fr);
  }
}

.sre-list-status .is-error,
.sre-detail-actions .is-error,
.sre-detail-scroll .is-error {
  color: var(--danger);
}

/* SRE Role View alerts: every alert expanded, text rendered as HTML lines. */
.sre-alerts {
  display: grid;
  gap: 10px;
}

.sre-alert {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-alt);
}

.sre-alert-title {
  margin: 0;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.sre-alert-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.sre-alert-text {
  margin-top: 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sre-alert-indent {
  display: inline-block;
}

.sre-alert-text.is-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* SRE Role View follow-up composer (persistent; outside the re-rendered content). */
.sre-detail-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sre-followup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px 10px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.sre-followup.is-hidden {
  display: none;
}

.sre-followup-input {
  width: 100%;
  min-height: 44px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--panel-alt);
  color: var(--text);
  font: inherit;
}

.sre-followup-input:focus {
  outline: none;
  border-color: var(--accent);
}

.sre-followup-send.is-stop {
  background: var(--danger);
}

.sre-followup-status {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.76rem;
}

/* Retry action on an assistant message whose prompt never reached Vera. */
.message-retry-button {
  align-self: flex-start;
  margin-top: 10px;
  padding: 6px 14px;
  border: 1px solid rgba(124, 156, 255, 0.38);
  border-radius: 10px;
  background: rgba(124, 156, 255, 0.14);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.message-retry-button:hover,
.message-retry-button:focus-visible {
  border-color: var(--accent);
  background: rgba(124, 156, 255, 0.24);
  outline: none;
}
