/* style.css — intraGPT Design System + Components */
/* CI-Farben: StocKinger Petrol #0078AB */

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  /* Type Scale (fluid) */
  --text-xs:   clamp(0.7rem,   0.65rem + 0.2vw, 0.8125rem);
  --text-sm:   clamp(0.8125rem, 0.76rem + 0.25vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.88rem + 0.35vw, 1.0625rem);
  --text-lg:   clamp(1.0625rem, 0.95rem + 0.65vw, 1.375rem);
  --text-xl:   clamp(1.375rem,  1rem    + 1.2vw,  2rem);

  /* Spacing (4px system) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Fonts */
  --font-display: 'Space Grotesk', 'DM Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', 'Inter', system-ui, sans-serif;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 300ms cubic-bezier(0.16, 1, 0.3, 1);

  /* StocKinger CI Palette — Petrol #0078AB — LIGHT MODE (default) */
  --color-bg:             #f4f7f9;
  --color-surface:        #ffffff;
  --color-surface-2:      #edf2f6;
  --color-surface-offset: #f0f4f7;
  --color-surface-offset-2: #e4ecf1;
  --color-surface-dynamic: #d8e4eb;
  --color-divider:        #d4dfe6;
  --color-border:         #c2d1da;

  --color-text:           #1a2b36;
  --color-text-muted:     #4a6a7d;
  --color-text-faint:     #7f9aaa;
  --color-text-inverse:   #ffffff;

  --color-primary:        #0078AB;
  --color-primary-hover:  #006996;
  --color-primary-active: #005a82;
  --color-primary-light:  #0090cc;
  --color-primary-highlight: oklch(from #0078AB l c h / 0.10);
  --color-primary-surface: oklch(from #0078AB l c h / 0.06);

  --color-error:          #d93636;
  --color-error-hover:    #c02828;
  --color-success:        #2e8b32;
  --color-warning:        #d68a00;

  --shadow-sm: 0 1px 2px oklch(0.3 0 0 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.3 0 0 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.3 0 0 / 0.1);

  /* Sidebar width */
  --sidebar-width: 300px;
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */
[data-theme="dark"] {
  --color-bg:             #0a1a24;
  --color-surface:        #0f2535;
  --color-surface-2:      #163042;
  --color-surface-offset: #122a3a;
  --color-surface-offset-2: #1d3a50;
  --color-surface-dynamic: #1f4a64;
  --color-divider:        #1e3d54;
  --color-border:         #275068;

  --color-text:           #e0ecf2;
  --color-text-muted:     #8aadbe;
  --color-text-faint:     #567a8e;
  --color-text-inverse:   #ffffff;

  --color-primary:        #0078AB;
  --color-primary-hover:  #006996;
  --color-primary-active: #005a82;
  --color-primary-light:  #35a0cc;
  --color-primary-highlight: oklch(from #0078AB l c h / 0.12);
  --color-primary-surface: oklch(from #0078AB l c h / 0.08);

  --color-error:          #e85454;
  --color-error-hover:    #d04040;
  --color-success:        #4caf50;
  --color-warning:        #ff9800;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}


/* ============================================
   LAYOUT — App Shell
   ============================================ */
html {
  transition: background-color var(--transition-slow);
}
html, .app, .sidebar, .main, .topbar, .chat-input-area,
.message-bubble, .chat-area, .system-prompt-bar, .system-prompt-full,
.prompt-detail-bar, .api-key-section, .sidebar-header, .sidebar-footer {
  transition: background-color var(--transition-slow), border-color var(--transition-slow), color var(--transition-slow);
}

.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition-slow), background-color var(--transition-slow);
  z-index: 100;
  box-shadow: 1px 0 4px oklch(0.3 0 0 / 0.04);
}
[data-theme="dark"] .sidebar {
  box-shadow: 1px 0 4px oklch(0 0 0 / 0.2);
}

.sidebar-header {
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.sidebar-logo svg {
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.sidebar-logo-wrap {
  display: flex;
  flex-direction: column;
}
.sidebar-logo-sub {
  font-size: 0.6rem;
  color: var(--color-primary-light);
  letter-spacing: 0.02em;
  font-weight: 400;
}

.btn-new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  transition: background var(--transition-interactive);
}
.btn-new-chat:hover { background: var(--color-primary-hover); }
.btn-new-chat:active { background: var(--color-primary-active); }
.btn-new-chat svg { width: 16px; height: 16px; }

/* API Key Section */
.api-key-section {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}
.api-key-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-1) 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.api-key-toggle svg {
  width: 14px; height: 14px;
  transition: transform var(--transition-interactive);
}
.api-key-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.api-key-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-slow);
}
.api-key-content.open {
  max-height: 430px;
}
.api-key-input-wrap {
  margin-top: var(--space-2);
  position: relative;
}
.api-key-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  padding-right: var(--space-8);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--color-text);
  font-family: monospace;
}
.api-key-input::placeholder { color: var(--color-text-faint); }
.api-key-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px oklch(from #0078AB l c h / 0.15);
}
.api-key-visibility {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  padding: var(--space-1);
}
.api-key-visibility:hover { color: var(--color-text-muted); }
.api-key-visibility svg { width: 14px; height: 14px; }

.api-key-save {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.api-key-save input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 14px;
  height: 14px;
}

.storage-indicator {
  font-size: 0.65rem;
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-align: center;
  line-height: 1.3;
}
.storage-indicator.available {
  color: var(--color-success);
  background: oklch(from #4caf50 l c h / 0.08);
}
.storage-indicator.unavailable {
  color: var(--color-warning);
  background: oklch(from #ff9800 l c h / 0.08);
}

.custom-instructions-label {
  margin-top: var(--space-3);
}

.custom-instructions-input {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--color-text);
  font-family: var(--font-body);
}
.custom-instructions-input::placeholder { color: var(--color-text-faint); }
.custom-instructions-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px oklch(from #0078AB l c h / 0.15);
}

.custom-instructions-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: 0.65rem;
  color: var(--color-text-faint);
}

.custom-instructions-save {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: 0.65rem;
  font-weight: 600;
}
.custom-instructions-save:hover { background: var(--color-primary-hover); }
.custom-instructions-save:disabled {
  opacity: 0.55;
  cursor: default;
}

.custom-instructions-status {
  min-height: 16px;
  margin-top: var(--space-1);
  font-size: 0.65rem;
  color: var(--color-text-faint);
}

/* Prompt Library */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-3) 0;
}

.sidebar-section-label {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
  font-weight: 500;
}

.btn-load-prompts {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.65rem;
  color: var(--color-primary-light);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--transition-interactive);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-family: var(--font-body);
}
.btn-load-prompts:hover {
  background: var(--color-primary-surface);
  color: var(--color-primary);
}
.btn-load-prompts svg {
  width: 14px;
  height: 14px;
}

.folder-empty {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.6;
}
.folder-empty p {
  margin-bottom: var(--space-2);
}
.folder-empty code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--color-surface-2);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
  color: var(--color-primary-light);
}

/* Prompt detail bar */
.prompt-detail-bar {
  display: none;
  padding: var(--space-2) var(--space-6);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}
.prompt-detail-bar.visible {
  display: flex;
}
.prompt-detail-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex: 1;
  min-width: 200px;
}
.prompt-detail-tags {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.prompt-tag {
  font-size: 0.6rem;
  padding: 0.15em 0.5em;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  color: var(--color-text-faint);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

/* Prompt count badge */
.prompt-count {
  font-size: 0.6rem;
  padding: 0.1em 0.4em;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  color: var(--color-text-faint);
  margin-left: auto;
}

/* Folder tree */
.folder {
  user-select: none;
}
.folder-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  padding-left: var(--space-5);
  width: 100%;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  border-radius: 0;
}
.folder-header:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.folder-header svg {
  width: 14px; height: 14px;
  flex-shrink: 0;
  transition: transform var(--transition-interactive);
}
.folder-header[aria-expanded="true"] svg:first-child {
  transform: rotate(90deg);
}
.folder-header .folder-icon {
  color: var(--color-primary-light);
  opacity: 0.7;
}

.folder-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-slow);
}
.folder-items.open {
  max-height: 500px;
}

.prompt-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  padding-left: calc(var(--space-5) + var(--space-6));
  width: 100%;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  text-align: left;
  line-height: 1.4;
}
.prompt-item:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.prompt-item.active {
  color: var(--color-primary-light);
  background: var(--color-primary-surface);
}
.prompt-item svg {
  width: 12px; height: 12px;
  flex-shrink: 0;
  opacity: 0.5;
}

/* Chat history */
.sidebar-footer {
  border-top: 1px solid var(--color-divider);
  flex-shrink: 0;
  max-height: 200px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.history-item {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-4);
  width: 100%;
  text-align: left;
  transition: background var(--transition-interactive);
}
.history-item:hover { background: var(--color-surface-2); }
.history-item-title {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.history-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.history-item-date {
  font-size: 0.65rem;
  color: var(--color-text-faint);
  line-height: 1.3;
}
.history-item-count {
  font-size: 0.6rem;
  color: var(--color-text-faint);
  opacity: 0.7;
}
.history-item-local {
  font-size: 0.6rem;
  color: var(--color-primary);
  font-weight: 600;
}
.history-item.active {
  background: var(--color-primary-surface);
  border-left: 2px solid var(--color-primary);
}

.history-empty {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-style: italic;
}

.history-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: 0.65rem;
  color: var(--color-text-faint);
  transition: all var(--transition-interactive);
  border-top: 1px solid var(--color-divider);
}
.history-clear:hover {
  color: var(--color-error);
  background: oklch(from #e85454 l c h / 0.06);
}
.history-clear svg {
  width: 12px;
  height: 12px;
}


/* ---- MAIN AREA ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg);
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
  min-height: 48px;
  background: var(--color-bg);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.breadcrumb-separator {
  color: var(--color-text-faint);
}
.breadcrumb-current {
  color: var(--color-text);
  font-weight: 600;
  font-family: var(--font-display);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.hamburger {
  display: none;
  padding: var(--space-1);
  color: var(--color-text-muted);
}
.hamburger:hover { color: var(--color-text); }
.hamburger svg { width: 20px; height: 20px; }

/* Header icon buttons */
.btn-theme-toggle,
.btn-temporary-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  flex-shrink: 0;
}
.btn-theme-toggle:hover,
.btn-temporary-mode:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.btn-theme-toggle svg,
.btn-temporary-mode svg {
  width: 18px;
  height: 18px;
}
.btn-temporary-mode.active {
  color: var(--color-primary);
  background: var(--color-primary-surface);
  box-shadow: inset 0 0 0 1px oklch(from #0078AB l c h / 0.28);
}
.btn-temporary-mode.active:hover {
  color: var(--color-primary-light);
  background: var(--color-primary-highlight);
}
.btn-temporary-mode svg {
  width: 22px;
  height: 22px;
}
/* In light mode: show moon, hide sun */
.btn-theme-toggle .icon-sun  { display: none; }
.btn-theme-toggle .icon-moon { display: block; }
/* In dark mode: show sun, hide moon */
[data-theme="dark"] .btn-theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .btn-theme-toggle .icon-moon { display: none; }


/* System prompt bar */
.system-prompt-bar {
  display: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-6);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}
.system-prompt-bar.visible { display: flex; }
.system-prompt-label {
  font-size: var(--text-xs);
  color: var(--color-primary-light);
  font-weight: 500;
  white-space: nowrap;
}
.system-prompt-name {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.system-prompt-toggle {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--transition-interactive);
}
.system-prompt-toggle:hover {
  color: var(--color-text-muted);
  background: var(--color-surface-2);
}
.system-prompt-full {
  display: none;
  padding: var(--space-3) var(--space-6);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.system-prompt-full.visible { display: block; }


/* Chat area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Empty / Welcome State */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-4);
  padding: var(--space-8);
}
.chat-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-divider);
}
.chat-empty-icon svg {
  width: 28px;
  height: 28px;
  color: var(--color-primary);
  opacity: 0.6;
}
.chat-empty-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}
.chat-empty-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 400px;
  line-height: 1.6;
}

/* Messages */
.message {
  display: flex;
  gap: var(--space-3);
  max-width: 760px;
  animation: messageIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.message-assistant {
  align-self: flex-start;
}

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

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
}
.message-user .message-avatar {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.message-assistant .message-avatar {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.message-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.65;
  max-width: 600px;
}
.message-user .message-bubble {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-bottom-right-radius: var(--radius-sm);
}
.message-assistant .message-bubble {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: var(--radius-sm);
}

/* Markdown in assistant messages */
.message-assistant .message-bubble h1,
.message-assistant .message-bubble h2,
.message-assistant .message-bubble h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
}
.message-assistant .message-bubble h1 { font-size: var(--text-base); }
.message-assistant .message-bubble h2 { font-size: var(--text-sm); }
.message-assistant .message-bubble h3 { font-size: var(--text-sm); color: var(--color-text-muted); }
.message-assistant .message-bubble p { margin-bottom: var(--space-2); }
.message-assistant .message-bubble p:last-child { margin-bottom: 0; }
.message-assistant .message-bubble ul,
.message-assistant .message-bubble ol {
  padding-left: var(--space-5);
  margin-bottom: var(--space-2);
}
.message-assistant .message-bubble li {
  margin-bottom: var(--space-1);
}
.message-assistant .message-bubble code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--color-surface-2);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
  color: var(--color-primary-light);
}
.message-assistant .message-bubble pre {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  overflow-x: auto;
  margin: var(--space-2) 0;
}
.message-assistant .message-bubble pre code {
  background: none;
  padding: 0;
  color: var(--color-text);
  font-size: var(--text-xs);
}
.message-assistant .message-bubble strong {
  font-weight: 600;
  color: var(--color-text);
}
.message-assistant .message-bubble blockquote {
  border-left: 3px solid var(--color-primary);
  padding-left: var(--space-3);
  margin: var(--space-2) 0;
  color: var(--color-text-muted);
  font-style: italic;
}
.message-assistant .message-bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--space-2) 0;
  font-size: var(--text-xs);
}
.message-assistant .message-bubble th,
.message-assistant .message-bubble td {
  border: 1px solid var(--color-border);
  padding: var(--space-1) var(--space-2);
  text-align: left;
}
.message-assistant .message-bubble th {
  background: var(--color-surface-2);
  font-weight: 600;
}

/* Welcome message */
.message-welcome .message-bubble {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  color: var(--color-text-muted);
  font-style: italic;
}

/* ============================================
   MESSAGE ACTIONS (copy, email, download, edit)
   ============================================ */
.message-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-interactive);
}
.message-assistant:hover .message-actions,
.message-user:hover .message-actions,
.message-actions:focus-within {
  opacity: 1;
}
.message-user .message-actions {
  justify-content: flex-end;
}

.msg-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  transition: all var(--transition-interactive);
  position: relative;
}
.msg-action-btn:hover {
  color: var(--color-text-muted);
  background: var(--color-surface-2);
}
.msg-action-btn svg {
  width: 14px;
  height: 14px;
}
.msg-action-btn .action-tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface-dynamic);
  color: var(--color-text);
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms;
}
.msg-action-btn:hover .action-tooltip {
  opacity: 1;
}

/* Download dropdown */
.download-dropdown-wrap {
  position: relative;
}
.download-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  display: none;
  z-index: 50;
  box-shadow: var(--shadow-md);
  min-width: 100px;
}
.download-dropdown.open {
  display: block;
}
.download-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-3);
  font-size: 0.7rem;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-interactive);
  white-space: nowrap;
}
.download-option:hover {
  background: var(--color-primary-surface);
  color: var(--color-text);
}

/* Copied feedback */
.msg-action-btn.copied {
  color: var(--color-success);
}

.message-editing .message-bubble {
  width: min(720px, 100%);
}
.message-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.message-editor-input {
  width: 100%;
  min-height: 160px;
  max-height: 420px;
  resize: vertical;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  line-height: 1.55;
  padding: var(--space-3);
}
.message-editor-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-surface);
}
.message-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}
.message-editor-btn {
  min-height: 32px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-interactive);
}
.message-editor-btn.secondary {
  color: var(--color-text-muted);
  background: var(--color-surface-2);
}
.message-editor-btn.secondary:hover {
  color: var(--color-text);
}
.message-editor-btn.primary {
  color: white;
  background: var(--color-primary);
}
.message-editor-btn.primary:hover {
  background: var(--color-primary-hover);
}


/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0;
  animation: messageIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.typing-dots {
  display: flex;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-faint);
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}


/* ============================================
   INPUT AREA + FILE UPLOAD
   ============================================ */
.chat-input-area {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-divider);
  background: var(--color-bg);
  flex-shrink: 0;
}

/* File attachment preview */
.file-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.file-attachments:empty {
  display: none;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  padding-right: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.65rem;
  color: var(--color-text-muted);
  max-width: 200px;
  animation: messageIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.file-chip-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--color-primary-surface);
  color: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
}
.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.file-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  transition: all var(--transition-interactive);
  flex-shrink: 0;
}
.file-chip-remove:hover {
  color: var(--color-error);
  background: oklch(from #e85454 l c h / 0.1);
}
.file-chip-remove svg {
  width: 10px;
  height: 10px;
}

/* Image thumbnail preview */
.file-chip.is-image .file-chip-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
}
.file-chip.is-image .file-chip-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
  max-width: 760px;
  margin: 0 auto;
}
.chat-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px oklch(from #0078AB l c h / 0.12);
}

/* Drag & Drop overlay */
.chat-input-wrap.drag-over {
  border-color: var(--color-primary-light);
  background: var(--color-primary-surface);
  box-shadow: 0 0 0 2px oklch(from #0078AB l c h / 0.2);
}

/* Plus button for file upload */
.btn-attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
  transition: all var(--transition-interactive);
  flex-shrink: 0;
}
.btn-attach:hover {
  color: var(--color-primary-light);
  background: var(--color-primary-surface);
}
.btn-attach svg { width: 18px; height: 18px; }

.chat-input {
  flex: 1;
  background: none;
  border: none;
  resize: none;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text);
  padding: var(--space-1) 0;
  min-height: 24px;
  max-height: 120px;
  font-family: var(--font-body);
}
.chat-input::placeholder { color: var(--color-text-faint); }
.chat-input:focus { outline: none; }

.btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  transition: all var(--transition-interactive);
  flex-shrink: 0;
}
.btn-send:hover { background: var(--color-primary-hover); }
.btn-send:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  background: var(--color-surface-2);
}
.btn-send svg { width: 16px; height: 16px; }


/* Error toast */
.error-toast {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-error);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: all var(--transition-slow);
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  text-align: center;
}
.error-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.6);
  z-index: 90;
  opacity: 0;
  transition: opacity var(--transition-slow);
}
.sidebar-overlay.visible {
  opacity: 1;
}


/* ============================================
   SCROLLBAR STYLING
   ============================================ */
.sidebar-content::-webkit-scrollbar,
.sidebar-footer::-webkit-scrollbar,
.chat-area::-webkit-scrollbar,
.system-prompt-full::-webkit-scrollbar {
  width: 4px;
}
.sidebar-content::-webkit-scrollbar-track,
.sidebar-footer::-webkit-scrollbar-track,
.chat-area::-webkit-scrollbar-track,
.system-prompt-full::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb,
.sidebar-footer::-webkit-scrollbar-thumb,
.chat-area::-webkit-scrollbar-thumb,
.system-prompt-full::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}


/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: block;
  }

  .hamburger {
    display: flex;
  }

  .chat-input-area {
    padding: var(--space-3) var(--space-4);
  }
  .topbar {
    padding: var(--space-3) var(--space-4);
  }
  .chat-area {
    padding: var(--space-4);
  }
  .system-prompt-bar {
    padding: var(--space-2) var(--space-4);
  }
  .system-prompt-full {
    padding: var(--space-3) var(--space-4);
  }
}

@media (max-width: 480px) {
  .message-bubble {
    max-width: 85vw;
  }
  .message-actions {
    opacity: 1;
  }
}


/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: var(--color-bg);
  padding: var(--space-4);
}
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.login-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}
.login-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.login-field label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}
.login-field input {
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  font-family: var(--font-body);
}
.login-field input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px oklch(from #0078AB l c h / 0.15);
}
.login-field input::placeholder {
  color: var(--color-text-faint);
}
.login-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  min-height: 1.2em;
}
.login-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  transition: background var(--transition-interactive);
  cursor: pointer;
}
.login-btn:hover { background: var(--color-primary-hover); }
.login-btn:active { background: var(--color-primary-active); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.link-button {
  background: none;
  border: none;
  color: var(--color-primary);
  text-align: left;
  padding: 0;
  font-size: var(--text-xs);
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; }


/* ============================================
   SIDEBAR USER SECTION
   ============================================ */
.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-divider);
  flex-shrink: 0;
  gap: var(--space-2);
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}
.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}
.sidebar-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-user-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.6rem;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sidebar-user-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.sidebar-user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
  transition: all var(--transition-interactive);
}
.sidebar-user-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.sidebar-user-btn svg { width: 16px; height: 16px; }

/* Company logo in sidebar */
.sidebar-company-logo {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  object-fit: contain;
  flex-shrink: 0;
}


/* ============================================
   ADMIN MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
  transition: all var(--transition-interactive);
}
.modal-close:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.modal-close svg { width: 16px; height: 16px; }
.modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-divider);
  padding: 0 var(--space-5);
  flex-shrink: 0;
}
.modal-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-faint);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-interactive);
  margin-bottom: -1px;
}
.modal-tab:hover { color: var(--color-text-muted); }
.modal-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
}

/* Admin table */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.admin-count {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.admin-btn {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  transition: all var(--transition-interactive);
  cursor: pointer;
}
.admin-btn:hover {
  background: var(--color-surface-offset-2);
  color: var(--color-text);
}
.admin-btn.primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}
.admin-btn.primary:hover { background: var(--color-primary-hover); }
.admin-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  transition: all var(--transition-interactive);
  cursor: pointer;
}
.admin-btn-sm:hover { color: var(--color-primary); background: var(--color-primary-surface); }
.admin-btn-sm.danger:hover { color: var(--color-error); background: oklch(from #e85454 l c h / 0.08); }
.admin-btn-sm svg { width: 14px; height: 14px; }

.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}
.admin-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}
.admin-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  vertical-align: middle;
}
.admin-table .td-email {
  color: var(--color-text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}
.admin-table .td-actions {
  white-space: nowrap;
}
.role-badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.role-badge.role-user { background: var(--color-surface-2); color: var(--color-text-muted); }
.role-badge.role-admin { background: oklch(from #0078AB l c h / 0.12); color: var(--color-primary); }
.role-badge.role-partneradmin { background: oklch(from #008a64 l c h / 0.12); color: #008a64; }
.role-badge.role-superadmin { background: oklch(from #d68a00 l c h / 0.12); color: var(--color-warning); }
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
}
.status-dot.status-active { background: var(--color-success); }
.status-dot.status-inactive { background: var(--color-text-faint); }

/* Admin form */
.admin-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.admin-form-header h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}
.admin-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-row label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row input[type="url"],
.form-row textarea,
.form-row select {
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  font-family: var(--font-body);
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px oklch(from #0078AB l c h / 0.12);
}
.admin-mail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
}
.admin-mail-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--color-bg);
}
.admin-mail-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.admin-mail-card-head strong {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.admin-mail-card-head span {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.admin-mail-card label {
  display: block;
  margin: var(--space-2) 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}
.admin-mail-card input,
.admin-mail-card textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--color-text);
  font-family: var(--font-body);
}
.admin-mail-card textarea {
  resize: vertical;
  min-height: 120px;
}
.admin-mail-card input:focus,
.admin-mail-card textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px oklch(from #0078AB l c h / 0.12);
}
.admin-mail-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-direction: row;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}
.form-actions {
  flex-direction: row;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  min-height: 1em;
}
.admin-loading, .admin-error {
  padding: var(--space-6);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.admin-error { color: var(--color-error); }
