:root {
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg-canvas: #090d16;
  --bg-surface: #0f172a;
  --bg-elevated: #1e293b;
  --bg-elevated-hover: #263449;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --brand-indigo: #6366f1;
  --brand-cyan: #38bdf8;
  --grad-brand: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%);

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --shadow-card: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px -4px rgba(99, 102, 241, 0.38);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-canvas);
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
}

p {
  margin: 0;
}

button,
input,
textarea,
select {
  font-family: inherit;
  color: inherit;
}

input:not([type="checkbox"]),
textarea,
select {
  width: 100%;
  font-size: 16px;
  line-height: 1.4;
  background: var(--bg-canvas);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-height: 44px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:not([type="checkbox"]):focus,
textarea:focus,
select:focus {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary {
  background: var(--grad-brand);
  color: #ffffff;
  padding: 0 16px;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0 12px;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-elevated-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0 14px;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 0 14px;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.24);
}

.btn-icon {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
}

.btn-compact {
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.btn-full {
  width: 100%;
}

.btn-chip {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 0 12px;
  font-size: 12.5px;
  flex: 1 1 auto;
  white-space: nowrap;
}

.btn-chip:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-chip-danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.25);
}

/* Avatar Presets */
.avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.av-indigo { background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%); }
.av-cyan { background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%); }
.av-emerald { background: linear-gradient(135deg, #10b981 0%, #047857 100%); }
.av-amber { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.av-rose { background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%); }
.av-purple { background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%); }

/* Login View */
.login-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.login-logo {
  flex-shrink: 0;
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-slogan {
  font-size: 13px;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-row-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.status-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.32);
  color: var(--text-primary);
}

.status-banner.status-error {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.status-banner.status-success {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}

.denied-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  text-align: center;
}

.denied-message {
  font-weight: 600;
  color: #fecaca;
}

.denied-email {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  word-break: break-all;
}

/* App Shell (Mobile-First Master-Detail) */
.app-shell {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bot-list-pane {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  min-width: 0;
  background: rgba(15, 23, 42, 0.92);
}

.chat-pane {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  min-width: 0;
  background: rgba(9, 13, 22, 0.78);
}

body.chat-open .bot-list-pane {
  display: none;
}

body.chat-open .chat-pane {
  display: flex;
}

@media (min-width: 768px) {
  .app-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .bot-list-pane,
  body.chat-open .bot-list-pane {
    display: flex;
    border-right: 1px solid var(--border-subtle);
  }

  .chat-pane,
  body.chat-open .chat-pane {
    display: flex;
  }

  #chatBackBtn {
    display: none;
  }
}

/* Bot List Header & Items */
.pane-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  line-height: 1.2;
}

.user-email-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-wrap {
  width: 100%;
}

.bot-list-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bot-row {
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 12px;
  border: 1px solid transparent;
  background: transparent;
}

.bot-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.bot-row.is-active {
  background: var(--bg-elevated);
  border-color: rgba(99, 102, 241, 0.45);
}

.bot-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bot-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bot-row-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-row-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.bot-row-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bot-row-role {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--grad-brand);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.empty-list-hint {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.pane-footer {
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.build-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Chat View */
.chat-empty-state {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 10px;
  color: var(--text-muted);
}

.chat-empty-state h2 {
  color: var(--text-primary);
  font-size: 20px;
}

.chat-empty-state p {
  max-width: 320px;
  font-size: 14px;
}

.chat-active-wrap {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  min-width: 0;
}

.chat-bot-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-bot-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chat-bot-name {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(99, 102, 241, 0.16);
  color: var(--brand-cyan);
  border: 1px solid rgba(56, 189, 248, 0.28);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.chat-bot-role {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.chat-header-actions .btn-secondary {
  font-size: 12.5px;
  padding: 0 10px;
}

@media (max-width: 430px) {
  .model-badge {
    display: none;
  }
}

.chat-messages-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.load-older-wrap {
  display: flex;
  justify-content: center;
  padding-bottom: 6px;
}

.chat-messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  min-width: 0;
  gap: 4px;
}

.msg-row.msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.msg-bot {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  max-width: 100%;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.5;
}

.msg-user .msg-bubble {
  background: var(--grad-brand);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.msg-bot .msg-bubble {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.msg-bubble.is-streaming::after {
  content: '▍';
  margin-left: 3px;
  color: var(--brand-cyan);
  animation: pulse-caret 0.9s infinite;
}

@keyframes pulse-caret {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.msg-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

/* Markdown inside messages */
.msg-content p + p {
  margin-top: 8px;
}

.msg-content ul,
.msg-content ol {
  margin: 6px 0;
  padding-left: 20px;
}

.msg-content li + li {
  margin-top: 3px;
}

.msg-content code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: 5px;
}

.msg-user .msg-content code {
  background: rgba(9, 13, 22, 0.3);
  border-color: rgba(255, 255, 255, 0.25);
}

.msg-content .md-pre {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  max-width: 100%;
}

.msg-content .md-pre code {
  background: transparent;
  border: none;
  padding: 0;
  white-space: pre;
}

.msg-content a {
  color: var(--brand-cyan);
  text-decoration: underline;
}

.msg-user .msg-content a {
  color: #ffffff;
}

.md-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin-top: 6px;
}

/* System / Memory Event Notice */
.chat-event-pill {
  align-self: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
  font-size: 12.5px;
  text-align: center;
}

.chat-event-pill.is-error {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

/* Approval Cards */
.approval-card {
  width: 100%;
  max-width: 460px;
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid rgba(245, 158, 11, 0.42);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}

.approval-card.status-executed {
  border-color: rgba(16, 185, 129, 0.42);
}

.approval-card.status-rejected,
.approval-card.status-expired,
.approval-card.status-failed {
  border-color: rgba(239, 68, 68, 0.35);
}

.approval-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.approval-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
}

.approval-type {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-pending { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.badge-executing { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.badge-executed { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.badge-rejected,
.badge-failed,
.badge-expired { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }

.approval-payload {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.payload-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.payload-key {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.payload-val {
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

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

.approval-actions button {
  flex: 1 1 0;
}

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

/* Composer */
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-composer textarea {
  flex: 1 1 auto;
  min-height: 44px;
  max-height: 140px;
  resize: none;
  overflow-y: auto;
  field-sizing: content;
}

.btn-send {
  flex-shrink: 0;
  padding: 0 18px;
}

/* Touch Sheets */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.74);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-panel {
  width: 100%;
  max-height: 92dvh;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

@media (min-width: 768px) {
  .sheet-backdrop {
    align-items: center;
    padding: 24px;
  }

  .sheet-panel {
    max-width: 560px;
    max-height: 86dvh;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
  }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sheet-title {
  font-size: 18px;
  font-weight: 700;
}

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Avatar Color Swatch Picker */
.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.av-swatch {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  border: 2px solid transparent;
  padding: 0;
}

.av-swatch.is-selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.45);
}

/* Tools Checklist */
.tools-fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.tools-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-row {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}

.check-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand-indigo);
  flex-shrink: 0;
}

.sheet-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
}

.sheet-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Memory Sheet Tabs & Lists */
.sheet-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-canvas);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.sheet-tab {
  min-height: 44px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
}

.sheet-tab.is-active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.memory-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.memory-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sheet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet-item-card {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sheet-item-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-primary);
}

.sheet-item-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.sheet-item-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.sheet-item-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
