﻿/* ---- Design tokens ----
   Palette: cool graphite sidebar (#161B22), warm porcelain canvas (#F7F7F5),
   signal accent teal (#0F9B8E) used sparingly for actions/active states.
   Type: Inter for UI text, JetBrains Mono for anything technical
   (account names, API keys) - the signature: technical data always renders
   in mono so a glance tells you "this is a system value, not prose".
*/
:root {
  --graphite: #161B22;
  --graphite-soft: #232B36;
  --porcelain: #F7F7F5;
  --ink: #1C2126;
  --ink-muted: #6B7280;
  --hairline: #E4E3DF;
  --teal: #0F9B8E;
  --teal-soft: #E5F5F3;
  --danger: #C0392B;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background: var(--porcelain);
}
.mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--graphite);
}
.login-card {
  width: 360px;
  background: var(--porcelain);
  border-radius: 12px;
  padding: 40px 32px;
  text-align: center;
}
.login-mark {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--teal);
  font-size: 13px;
  margin-bottom: 8px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.login-sub { color: var(--ink-muted); font-size: 13px; margin-bottom: 24px; }
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 12px; font-weight: 600; margin: 14px 0 6px; color: var(--ink-muted); }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--hairline);
  border-radius: 8px; font-size: 14px; font-family: 'Inter', sans-serif;
}
.login-card input:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.login-card button,
.login-card .login-action {
  width: 100%; margin-top: 20px; padding: 11px; border: none; border-radius: 8px;
  background: var(--teal); color: white; font-weight: 600; font-size: 14px; cursor: pointer;
  display: inline-block; text-decoration: none; text-align: center;
}
.login-card button:hover,
.login-card .login-action:hover { background: #0C8377; }
.login-card .login-action.is-loading {
  pointer-events: none;
  opacity: 0.8;
}
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; }
.login-footnote { margin-top: 24px; font-size: 11px; color: var(--ink-muted); }
.hidden { display: none !important; }

/* ---------- App shell ---------- */
.app-shell { display: flex; height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--graphite);
  color: #E5E7EB;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header { display: flex; align-items: center; gap: 8px; padding: 18px 16px; }
.brand-mark {
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 12px;
  color: var(--teal); border: 1px solid var(--teal); border-radius: 4px; padding: 2px 6px;
}
.brand-name { font-weight: 600; font-size: 14px; }

.new-chat-btn {
  margin: 4px 16px 12px; padding: 10px; border-radius: 8px; border: 1px solid #2B3440;
  background: var(--graphite-soft); color: #E5E7EB; font-size: 13px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.new-chat-btn:hover { background: #2B3440; }
.new-chat-btn .plus { color: var(--teal); font-weight: 700; }

.session-list-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #6B7280; padding: 0 16px; margin-bottom: 8px; }
.session-list { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 1; }
.session-list li {
  padding: 9px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; color: #C9CDD3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-list li:hover, .session-list li.active { background: var(--graphite-soft); color: white; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid #232B36; }
.user-badge { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-initials {
  width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-group { font-size: 11px; color: #8B94A0; font-family: 'JetBrains Mono', monospace; }
.logout-btn {
  width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #2B3440; background: transparent;
  color: #C9CDD3; font-size: 12px; cursor: pointer;
}
.logout-btn:hover { background: var(--graphite-soft); }

/* ---------- Main / chat ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--hairline);
  background: white;
}
.combo-group { display: flex; flex-direction: column; gap: 4px; }
.combo-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); font-weight: 600; }
.combo {
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px; padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--hairline); background: var(--porcelain); min-width: 160px;
}
.reveal-btn {
  margin-left: auto; align-self: flex-end; font-size: 12px; padding: 7px 12px; border-radius: 6px;
  border: 1px solid var(--hairline); background: white; cursor: pointer; color: var(--ink);
}
.reveal-btn:hover { border-color: var(--teal); color: var(--teal); }

.messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.response-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 24px;
  border-top: 1px solid var(--hairline);
  background: #fcfcfb;
}
.response-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}
.response-status.busy {
  color: #7a5b00;
  background: #fff3cd;
  border: 1px solid #f0d58c;
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.response-status.busy::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d39e00;
  animation: processingPulse 0.9s ease-in-out infinite;
}
.response-status.success { color: #0c8377; }
.response-status.error { color: var(--danger); }
.response-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.response-time {
  font-size: 12px;
  color: var(--ink-muted);
  font-family: 'JetBrains Mono', monospace;
}
@keyframes processingPulse {
  0%, 100% { transform: scale(0.75); opacity: 0.5; }
  50% { transform: scale(1); opacity: 1; }
}
.empty-state { margin: auto; text-align: center; color: var(--ink-muted); }
.empty-mark { font-size: 28px; color: var(--teal); margin-bottom: 8px; }

.msg { max-width: 700px; padding: 12px 16px; border-radius: 12px; font-size: 14.5px; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--teal); color: white; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: white; border: 1px solid var(--hairline); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 10.5px; color: var(--ink-muted); margin-top: 6px; font-family: 'JetBrains Mono', monospace; }
.msg-content > :first-child { margin-top: 0; }
.msg-content > :last-child { margin-bottom: 0; }
.msg.assistant .msg-content h1,
.msg.assistant .msg-content h2,
.msg.assistant .msg-content h3,
.msg.assistant .msg-content h4,
.msg.assistant .msg-content h5,
.msg.assistant .msg-content h6 {
  margin: 0.4em 0 0.45em;
  line-height: 1.25;
}
.msg.assistant .msg-content p { margin: 0.45em 0; }
.msg.assistant .msg-content ul,
.msg.assistant .msg-content ol {
  margin: 0.45em 0 0.45em 1.2em;
  padding: 0;
}
.msg.assistant .msg-content li { margin: 0.2em 0; }
.msg.assistant .msg-content pre {
  margin: 0.55em 0;
  padding: 10px 12px;
  background: #111827;
  color: #e5e7eb;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.msg.assistant .msg-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: #f1f3f6;
  padding: 1px 4px;
  border-radius: 4px;
}
.msg.assistant .msg-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}
.msg.assistant .msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6em 0;
  display: block;
  overflow-x: auto;
}
.msg.assistant .msg-content th,
.msg.assistant .msg-content td {
  border: 1px solid var(--hairline);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.msg.assistant .msg-content thead th {
  background: #f8fafc;
  font-weight: 600;
}
.msg.assistant .msg-content blockquote {
  margin: 0.6em 0;
  padding: 0.2em 0.8em;
  border-left: 3px solid var(--hairline);
  color: var(--ink-muted);
}
.msg.assistant .msg-content a {
  color: #0b7285;
  text-decoration: underline;
}
.media-output { max-width: 700px; max-height: 500px; align-self: flex-start; border-radius: 10px; border: 1px solid var(--hairline); }
.media-output.user-attachment { max-width: 340px; max-height: 340px; align-self: flex-end; }
.user-attachment-file {
  max-width: 340px;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: white;
}
.user-attachment-name {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--ink);
}

.composer { position: relative; display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--hairline); background: white; overflow: visible; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--hairline); border-radius: 10px; padding: 12px 14px;
  font-family: 'Inter', sans-serif; font-size: 14px; max-height: 160px;
}
.composer textarea:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.composer button {
  padding: 0 20px; border-radius: 10px; border: none; background: var(--teal); color: white;
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.composer button:disabled { opacity: 0.5; cursor: not-allowed; }
.composer button:hover:not(:disabled) { background: #0C8377; }
.attachment-tray {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(100% + 8px);
  padding: 10px;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  z-index: 10;
}
.attachment-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.attachment-clear-btn {
  border: 1px solid var(--hairline) !important;
  background: white !important;
  color: var(--ink) !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  cursor: pointer;
}
.attachment-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 6px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-size: 12px;
  background: var(--porcelain);
}
.attachment-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--hairline);
}
.attachment-file-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: #eceef2;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--hairline);
}
.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-remove-btn {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 50% !important;
  border: 1px solid var(--hairline) !important;
  background: white !important;
  color: var(--ink-muted) !important;
  font-size: 18px !important;
  line-height: 1;
  padding: 0 !important;
}
.attachment-error {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 24px;
  color: var(--danger);
  font-size: 12px;
  z-index: 11;
}
.messages.dragging { outline: 2px dashed var(--teal); outline-offset: -12px; background: var(--teal-soft); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(22,27,34,0.55); display: flex; align-items: center; justify-content: center; }
.modal-card { background: white; border-radius: 12px; padding: 24px; width: 420px; }
.modal-card h3 { margin: 0 0 12px; font-size: 15px; }
.key-mono {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; background: var(--teal-soft);
  padding: 12px; border-radius: 8px; word-break: break-all; margin-bottom: 16px;
}
.modal-card button {
  width: 100%; padding: 9px; border-radius: 8px; border: none; background: var(--graphite);
  color: white; font-size: 13px; cursor: pointer;
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .topbar { flex-wrap: wrap; }
}














/* ---------- Prompt library UI ---------- */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 12px 10px;
}

.nav-btn {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #2B3440;
  background: transparent;
  color: #D1D5DB;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--graphite-soft);
  color: #fff;
}

.nav-btn .plus { color: var(--teal); font-weight: 700; }

.view-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

#prompt-library-view {
  background: #F8FBFE;
  padding: 18px 18px 12px;
  gap: 12px;
  overflow: auto;
}

/* ── Usage page ── */
#usage-view {
  background: var(--porcelain);
  padding: 0;
  overflow-y: auto;
}
.usage-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 32px;
}
.usage-title {
  margin: 0 0 28px;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid #1E3A5F;
  padding-bottom: 10px;
}
.usage-section-heading {
  margin: 28px 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: #1E3A5F;
}
.usage-list {
  margin: 0 0 8px;
  padding-left: 22px;
}
.usage-list li {
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-muted);
}
.usage-list li strong {
  color: var(--ink);
  font-weight: 600;
}
.usage-sub-heading {
  margin: 18px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.usage-note {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--ink-muted);
  font-style: italic;
}

.prompt-library-head h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0.04em;
}

.prompt-level-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.prompt-level-tab {
  border: 1px solid #0b3d66;
  background: #07345e;
  color: #fff;
  border-radius: 8px;
  height: 38px;
  cursor: pointer;
  font-weight: 600;
}

.prompt-level-tab.active {
  background: #0074d9;
}

.prompt-filters {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.prompt-filter-select,
.prompt-search-input {
  border: 1px solid #8ec4ff;
  border-radius: 8px;
  min-height: 38px;
  font-size: 14px;
  background: white;
}

.prompt-search-input {
  padding: 8px 10px;
}

.prompt-favorite-filter,
.create-prompt-btn {
  border: 1px solid #0b6ac9;
  background: #fff;
  color: #0b6ac9;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 12px;
  font-weight: 600;
  cursor: pointer;
}

.prompt-favorite-filter.active,
.create-prompt-btn {
  background: #0b6ac9;
  color: #fff;
}

.prompt-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
}

.prompt-library-empty {
  background: #fff;
  border: 1px dashed #aec6dc;
  border-radius: 10px;
  padding: 24px;
  color: var(--ink-muted);
  text-align: center;
}

.prompt-card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #d8e4ef;
  padding: 12px;
  border-left-width: 3px;
}

.prompt-card[data-level='organization'] { border-left-color: #0096ff; }
.prompt-card[data-level='department'] { border-left-color: #00b96f; }
.prompt-card[data-level='client'] { border-left-color: #f59e0b; }
.prompt-card[data-level='personal'] { border-left-color: #8b5cf6; }

.prompt-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.prompt-module {
  color: #1184dc;
  font-size: 14px;
  font-weight: 700;
}

.prompt-level-badge {
  font-size: 11px;
  font-weight: 600;
  background: #ebf5ef;
  color: #1f5132;
  border-radius: 999px;
  padding: 2px 8px;
  text-transform: capitalize;
}

.prompt-title {
  margin: 8px 0 4px;
  font-size: 22px;
}

.prompt-text {
  margin: 0;
  color: #2b3742;
  font-size: 14px;
  line-height: 1.4;
  min-height: 58px;
}

.prompt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.prompt-tag-chip {
  border: 1px solid #c7d1db;
  border-radius: 999px;
  font-size: 11px;
  color: #5b6470;
  padding: 2px 8px;
  background: #f5f8fb;
}

.prompt-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.prompt-card-btn {
  border: 1px solid #c8d7e6;
  background: white;
  border-radius: 5px;
  width: 26px;
  height: 26px;
  cursor: pointer;
}

.prompt-card-btn.favorite.is-favorite {
  color: #f59e0b;
  border-color: #f4d9a3;
}

.msg.assistant {
  position: relative;
  padding-right: 44px;
}

.save-prompt-inline-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid #d4d8dd;
  border-radius: 6px;
  background: #fff;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.prompt-save-card {
  width: min(820px, calc(100vw - 40px));
}

.prompt-save-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.prompt-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-muted);
}

.prompt-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.prompt-form-row {
  margin-bottom: 12px;
}

.prompt-save-card label {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.prompt-save-card input,
.prompt-save-card textarea,
.prompt-save-card select {
  width: 100%;
  border: 1px solid #8ec4ff;
  border-radius: 7px;
  padding: 9px 10px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

.prompt-save-card textarea {
  resize: vertical;
  min-height: 96px;
}

.tag-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.tag-input-row button {
  border: none;
  border-radius: 7px;
  padding: 0 14px;
  background: #0b6ac9;
  color: white;
  cursor: pointer;
}

.prompt-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.prompt-tag-list .prompt-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.prompt-tag-remove {
  border: none;
  background: transparent;
  color: #8a94a0;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.prompt-checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.prompt-checkbox-row input {
  width: auto;
}

.prompt-form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0 0 10px;
}

.prompt-save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.prompt-cancel-btn,
.prompt-save-btn {
  border: none;
  border-radius: 7px;
  min-height: 36px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}

.prompt-cancel-btn {
  background: #eef2f7;
  color: #3f4750;
}

.prompt-save-btn {
  background: #0b6ac9;
  color: white;
}

@media (max-width: 1100px) {
  .prompt-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .prompt-form-grid,
  .prompt-level-tabs {
    grid-template-columns: 1fr;
  }
}


/* ---------- Screenshot parity refinements ---------- */
.sidebar {
  width: 270px;
  background: #012f57;
}

.sidebar-header-compact {
  background: #ffffff;
  color: #002d53;
  border-right: 1px solid #dbe4ee;
}

.sidebar-header-compact .brand-mark {
  color: #fff;
  background: #0b6ac9;
  border-color: #0b6ac9;
}

.sidebar-header-compact .brand-name {
  color: #3a8fda;
  font-weight: 700;
}

.nav-btn {
  border: none;
  background: transparent;
  color: #e7edf5;
  font-weight: 500;
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-btn-muted { opacity: 0.9; }

.nav-icon {
  display: inline-flex;
  width: 18px;
  margin-right: 8px;
  color: #d6e8fb;
  font-weight: 700;
}

.session-list-label {
  color: #9fc0de;
  margin-top: 2px;
}

.quick-history {
  color: #ffffff;
  padding: 0 16px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.history-day {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
}

.history-text {
  font-size: 12px;
  color: #f4f8fc;
  line-height: 1.3;
}

.session-list {
  padding: 8px 8px;
}

.session-list li {
  font-size: 12px;
  color: #e8eef4;
}

.sidebar-bottom-links {
  padding: 8px 12px;
  display: grid;
  gap: 8px;
}

.sidebar-link-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #e9f0f8;
  border-radius: 20px;
  min-height: 34px;
  cursor: pointer;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.user-group {
  color: #c8d9ea;
}

.topbar-screenshot {
  justify-content: space-between;
  background: #fff;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-user-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #0b6ac9;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-user-group,
.top-user-role {
  font-size: 11px;
  color: #7f8c9b;
}

.top-user-name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin: 1px 0;
}

.messages {
  background: #f6fbff;
}

.msg.user {
  background: #d7ebfb;
  color: #1a2530;
  border: 1px solid #c4def5;
}

.msg.assistant {
  border: none;
  background: transparent;
  padding-left: 0;
}

.save-prompt-inline-btn {
  top: 6px;
  right: -34px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 11px;
}

#prompt-library-view {
  background: #f7fcff;
  padding: 16px 14px;
}

.prompt-library-head h2 {
  font-size: 36px;
  font-weight: 700;
}

.prompt-level-tab {
  border-radius: 4px;
  background: #022f57;
  border-color: #0d4677;
  height: 34px;
  font-size: 13px;
}

.prompt-level-tab.active {
  background: #0074d9;
}

.prompt-filters {
  grid-template-columns: 190px 1fr auto auto;
}

.prompt-filter-select,
.prompt-search-input {
  min-height: 34px;
  border-radius: 3px;
}

.prompt-favorite-filter,
.create-prompt-btn {
  min-height: 34px;
  border-radius: 3px;
  font-size: 13px;
}

.prompt-library-grid {
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 10px;
}

.prompt-card {
  border: 1px solid #d0e2f2;
  border-radius: 3px;
  padding: 10px;
  min-height: 190px;
}

.prompt-title {
  font-size: 28px;
  margin: 6px 0 2px;
}

.prompt-text {
  font-size: 13px;
  min-height: 66px;
}

.prompt-card-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.prompt-card-btn {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 2px;
  font-size: 9px;
  line-height: 16px;
  padding: 0;
}

.prompt-card-btn.favorite {
  background: #f6b025;
  color: #fff;
}

.prompt-card-btn.edit {
  background: #3aa7ff;
  color: #fff;
}

.prompt-card-btn.delete {
  background: #ff6b6b;
  color: #fff;
}

.prompt-save-card {
  padding: 0;
  border-radius: 6px;
  overflow: hidden;
  width: min(960px, calc(100vw - 48px));
}

.prompt-save-header-bar {
  background: #022f57;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.prompt-save-header-bar h3 {
  margin: 0;
  font-size: 28px;
}

.prompt-close {
  color: #fff;
}

.prompt-save-body {
  padding: 16px;
}

.prompt-toggle-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.switch-label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 0 !important;
}

.switch-label input {
  width: auto;
}

@media (max-width: 1400px) {
  .top-user-name { font-size: 18px; }
  .prompt-title { font-size: 23px; }
}


/* ---------- Final screenshot micro-tuning ---------- */
.app-shell {
  background: #eef4f8;
}

.sidebar {
  width: 258px;
}

.sidebar-header-compact {
  min-height: 68px;
  padding: 14px 14px;
}

.sidebar-header-compact .brand-name {
  line-height: 1;
  font-size: 31px;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  padding-top: 12px;
}

.nav-btn {
  min-height: 34px;
  border-radius: 4px;
  font-size: 18px;
  padding: 7px 10px;
}

.nav-icon {
  width: 16px;
  margin-right: 7px;
}

.quick-history {
  padding-bottom: 10px;
}

.history-day {
  margin-top: 8px;
  font-size: 18px;
}

.history-text {
  font-size: 16px;
}

.topbar {
  padding: 10px 16px;
}

.combo-label {
  font-size: 14px;
}

.combo {
  min-width: 175px;
  min-height: 34px;
  font-size: 16px;
}

.reveal-btn {
  min-height: 34px;
  font-size: 14px;
}

.top-user-block {
  gap: 8px;
}

.top-avatar {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.top-user-group,
.top-user-role {
  font-size: 12px;
}

.top-user-name {
  font-size: 28px;
}

.top-signout {
  color: #ff4b4b;
  font-weight: 600;
  font-size: 16px;
  margin-left: 4px;
  white-space: nowrap;
}

.messages {
  padding: 20px 22px;
  gap: 12px;
}

.msg {
  max-width: 900px;
  font-size: 15px;
  line-height: 1.45;
}

.response-status-row {
  min-height: 40px;
}

.composer {
  padding: 12px 20px;
}

.composer textarea {
  min-height: 52px;
  font-size: 15px;
}

.composer button {
  min-height: 44px;
}

#prompt-library-view {
  padding: 12px 14px;
  gap: 10px;
}

.prompt-library-head h2 {
  font-size: 38px;
  letter-spacing: 0;
}

.prompt-level-tabs {
  gap: 4px;
}

.prompt-level-tab {
  height: 36px;
  font-size: 16px;
  letter-spacing: 0;
}

.prompt-filters {
  gap: 8px;
}

.prompt-filter-select,
.prompt-search-input,
.prompt-favorite-filter,
.create-prompt-btn {
  min-height: 36px;
  font-size: 15px;
}

.prompt-library-grid {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 9px;
}

.prompt-card {
  min-height: 196px;
  padding: 9px;
}

.prompt-module {
  font-size: 20px;
}

.prompt-level-badge {
  font-size: 12px;
}

.prompt-title {
  font-size: 30px;
  margin: 5px 0 4px;
}

.prompt-text {
  font-size: 15px;
  min-height: 74px;
}

.prompt-tag-chip {
  font-size: 12px;
}

.prompt-card-btn {
  width: 17px;
  height: 17px;
  font-size: 9px;
}

.prompt-save-card {
  width: min(1000px, calc(100vw - 38px));
}

.prompt-save-header-bar h3 {
  font-size: 32px;
}

.prompt-save-body {
  padding: 14px 16px 16px;
}

.prompt-save-card label {
  font-size: 14px;
}

.prompt-save-card input,
.prompt-save-card textarea,
.prompt-save-card select {
  min-height: 38px;
  font-size: 15px;
}

.prompt-save-card textarea {
  min-height: 108px;
}

.switch-label {
  font-size: 14px;
}

.prompt-cancel-btn,
.prompt-save-btn {
  min-height: 38px;
  font-size: 14px;
}

@media (max-width: 1600px) {
  .sidebar-header-compact .brand-name { font-size: 26px; }
  .nav-btn { font-size: 15px; }
  .history-day { font-size: 14px; }
  .history-text { font-size: 13px; }
  .combo, .prompt-level-tab, .prompt-title { font-size: inherit; }
  .top-user-name { font-size: 20px; }
}


/* ---------- Exact screenshot mode: typography normalization ---------- */
.sidebar-header-compact .brand-name { font-size: 20px; }
.nav-btn { font-size: 13px; min-height: 32px; }
.history-day { font-size: 13px; }
.history-text { font-size: 12px; }
.combo-label { font-size: 10px; }
.combo { font-size: 12.5px; min-height: 32px; }
.reveal-btn { font-size: 12px; min-height: 32px; }
.top-user-group, .top-user-role { font-size: 11px; }
.top-user-name { font-size: 16px; }
.top-signout { font-size: 12px; }
.msg { font-size: 14px; }
.composer textarea { font-size: 14px; min-height: 46px; }
.prompt-library-head h2 { font-size: 34px; }
.prompt-level-tab { font-size: 13px; height: 34px; }
.prompt-filter-select, .prompt-search-input, .prompt-favorite-filter, .create-prompt-btn { font-size: 13px; min-height: 34px; }
.prompt-library-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.prompt-module { font-size: 14px; }
.prompt-title { font-size: 22px; }
.prompt-text { font-size: 13px; }
.prompt-tag-chip { font-size: 11px; }
.prompt-save-header-bar h3 { font-size: 24px; }
.prompt-save-card label { font-size: 13px; }
.prompt-save-card input, .prompt-save-card textarea, .prompt-save-card select { font-size: 14px; min-height: 36px; }
.switch-label { font-size: 13px; }


/* ---------- Alignment hotfix (responsive, non-functional) ---------- */
.topbar-screenshot {
  align-items: center;
}

.topbar-left {
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.top-user-block {
  margin-left: auto;
  min-width: 0;
  flex-shrink: 1;
}

.top-user-meta {
  min-width: 0;
}

.top-user-name,
.top-user-role,
.top-user-group {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reveal-btn {
  white-space: nowrap;
  align-self: center;
}

/* keep save button inside user bubble so it can't overlap header */
.msg.user {
  position: relative;
  padding-right: 36px;
}

.msg.user .save-prompt-inline-btn {
  right: 8px;
  top: 8px;
}

@media (max-width: 1100px) {
  .topbar-screenshot {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .topbar-left {
    width: 100%;
    gap: 8px;
  }

  .top-user-block {
    width: 100%;
    justify-content: flex-end;
  }

  .top-signout {
    margin-left: 8px;
  }
}

@media (max-width: 760px) {
  .topbar-screenshot {
    padding: 8px 10px;
  }

  .topbar-left {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .combo {
    min-width: 0;
    width: 100%;
  }

  .reveal-btn {
    width: fit-content;
  }

  .top-user-block {
    justify-content: flex-start;
    gap: 6px;
  }

  .top-user-name {
    font-size: 14px;
  }

  .top-user-role,
  .top-user-group,
  .top-signout {
    font-size: 11px;
  }
}


/* ---------- Revert: model/account alignment only ---------- */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  width: auto;
}

.topbar-left .combo-group {
  flex: 0 0 auto;
}

.topbar-left .combo {
  width: auto;
  min-width: 160px;
}

@media (max-width: 1100px) {
  .topbar-left {
    width: auto;
    flex-wrap: nowrap;
    gap: 10px;
  }
}

@media (max-width: 760px) {
  .topbar-left {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
  }

  .topbar-left .combo {
    width: auto;
    min-width: 130px;
  }
}


/* ---------- Requested removal from top/chat area ---------- */
.top-user-block {
  display: none !important;
}

.save-prompt-inline-btn {
  display: none !important;
}

.msg.user {
  padding-right: 16px;
}


/* ---------- Brand logo image ---------- */
.brand-logo-wrap {
  justify-content: flex-start;
  padding: 10px 12px;
}

.brand-logo-img {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
}


/* ---------- Brand logo fit in title slot ---------- */
.brand-logo-wrap {
  min-height: 72px;
  align-items: center;
}

.brand-logo-img {
  width: auto;
  max-width: 220px;
  max-height: 44px;
  object-fit: contain;
}


/* ---------- Fill full white header space with logo ---------- */
.brand-logo-wrap {
  width: 100%;
  min-height: 84px;
  padding: 8px 10px;
  justify-content: center;
  align-items: center;
}

.brand-logo-wrap .brand-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: 68px;
  object-fit: contain;
}


/* ---------- Re-enable query-bubble save prompt icon ---------- */
.msg.user {
  position: relative;
  padding-right: 36px;
}

.save-prompt-inline-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 8px;
  top: 8px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #d4d8dd;
  background: #fff;
  color: #0d2c4a;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}


/* ---------- Save icon style (match reference screenshot) ---------- */
.msg.user {
  position: relative;
  overflow: visible;
  padding-right: 16px;
}

.msg.user .save-prompt-inline-btn {
  position: absolute;
  right: 12px;
  bottom: -24px;
  width: 20px;
  height: 18px;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
}

.msg.user .save-prompt-inline-btn::before {
  content: "";
  width: 12px;
  height: 14px;
  border: 1.6px solid #223244;
  border-radius: 2px 2px 0 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
  box-sizing: border-box;
  background: #fff;
}

.msg.user .save-prompt-inline-btn:hover::before {
  border-color: #0b6ac9;
}


/* ---------- Final position lock: save icon below query bubble ---------- */
.msg.user .save-prompt-inline-btn {
  top: auto !important;
  bottom: -22px !important;
  right: 10px !important;
  left: auto !important;
}


/* ---------- Prompt Library: reference-style modal + action icons ---------- */
#prompt-library-view .prompt-card-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

#prompt-library-view .prompt-card-btn {
  width: 30px;
  height: 28px;
  border: 1px solid #d8e0ea;
  background: #ffffff;
  border-radius: 6px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#prompt-library-view .prompt-card-btn .action-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#prompt-library-view .prompt-card-btn.favorite .action-icon {
  color: #b9c2cd;
}

#prompt-library-view .prompt-card-btn.favorite.is-favorite {
  border-color: #16a34a;
  background: #fff7df;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

#prompt-library-view .prompt-card-btn.favorite.is-favorite .action-icon {
  color: #16a34a;
}

#prompt-library-view .prompt-card-btn.edit .action-icon {
  color: #2c99f2;
}

#prompt-library-view .prompt-card-btn.delete .action-icon {
  color: #ff5b5b;
  font-size: 13px;
}

#prompt-library-view .prompt-card-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#prompt-library-view .prompt-card-btn.run {
  border-color: #16a34a;
  background: #f0fdf4;
}

#prompt-library-view .prompt-card-btn.run .action-icon {
  color: #16a34a;
  font-size: 12px;
}

#prompt-library-view .prompt-card-btn.run:hover {
  background: #dcfce7;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

#prompt-library-view .prompt-card-btn.preview {
  border-color: #6366f1;
  background: #eef2ff;
}

#prompt-library-view .prompt-card-btn.preview .action-icon {
  color: #6366f1;
  font-size: 13px;
}

#prompt-library-view .prompt-card-btn.preview:hover {
  background: #e0e7ff;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

#prompt-library-view .prompt-card-btn:hover:not(:disabled) {
  border-color: #98c2ea;
  box-shadow: 0 0 0 2px rgba(44, 153, 242, 0.08);
}

/* ---------- Run Prompt modal ---------- */
.run-prompt-card {
  width: min(560px, calc(100vw - 48px));
}

.run-prompt-card .prompt-save-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  min-height: 56px;
}

.run-prompt-card .prompt-save-header-bar h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
}

.run-prompt-card .prompt-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  line-height: 1;
}

.run-prompt-card .prompt-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.run-prompt-card .prompt-save-body {
  padding: 20px 24px 24px;
}

.run-prompt-preview {
  margin-bottom: 16px;
}

.run-prompt-preview label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: #303840;
  margin-bottom: 6px;
}

.run-prompt-text-display {
  background: #f4f7fa;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #303840;
  max-height: 120px;
  overflow-y: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.run-prompt-go-btn {
  background: #16a34a !important;
  border-color: #16a34a !important;
}

.run-prompt-go-btn:hover {
  background: #15803d !important;
}

.run-prompt-newchat-btn {
  background: #0ea5e9 !important;
  border-color: #0ea5e9 !important;
}

.run-prompt-newchat-btn:hover {
  background: #0284c7 !important;
}

/* ---------- Preview Prompt modal ---------- */
.preview-prompt-card {
  width: min(620px, calc(100vw - 48px));
}

.preview-prompt-card .prompt-save-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  min-height: 56px;
}

.preview-prompt-card .prompt-save-header-bar h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.preview-prompt-card .prompt-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  line-height: 1;
}

.preview-prompt-card .prompt-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.preview-prompt-card .prompt-save-body {
  padding: 20px 24px 24px;
}

.preview-meta-row {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}

.preview-meta-item {
  flex: 1;
}

.preview-meta-item label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  color: #6b7a8d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.preview-meta-item span {
  font-size: 14px;
  font-weight: 500;
  color: #303840;
}

.preview-section {
  margin-bottom: 20px;
}

.preview-section label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  color: #6b7a8d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.preview-prompt-body {
  background: #f4f7fa;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #303840;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-prompt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preview-no-tags {
  font-size: 13px;
  color: #9aa6b2;
  font-style: italic;
}

.preview-prompt-card .prompt-save-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

#prompt-save-modal .prompt-save-card {
  width: min(96vw, 1260px);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  background: #ffffff;
}

#prompt-save-modal .prompt-save-header-bar {
  height: 56px;
  padding: 0 20px;
  background: #072f57;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#prompt-save-modal .prompt-save-header-bar h3 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: lowercase;
}

#prompt-save-modal .prompt-close {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

#prompt-save-modal .prompt-save-body {
  background: #ffffff;
  padding: 14px 22px 12px;
}

#prompt-save-modal .prompt-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

#prompt-save-modal .prompt-save-card label {
  color: #303840;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  display: inline-block;
}

#prompt-save-modal .prompt-save-card input,
#prompt-save-modal .prompt-save-card textarea,
#prompt-save-modal .prompt-save-card select {
  border: 1px solid #2e99f0;
  border-radius: 4px;
  min-height: 38px;
  background: #ffffff;
}

#prompt-save-modal .prompt-save-card textarea {
  min-height: 76px;
}

#prompt-save-modal .prompt-form-row {
  margin-top: 10px;
}

#prompt-save-modal .prompt-tag-list {
  border: 1px solid #2e99f0;
  border-radius: 4px;
  min-height: 38px;
  padding: 5px;
  background: #ffffff;
}

#prompt-save-modal .prompt-tag-list .prompt-tag-chip {
  background: #eef4fa;
  border: 1px solid #d8e0ea;
  border-radius: 4px;
}

#prompt-save-modal .prompt-tag-list:empty {
  display: none;
  border: 0;
  min-height: 0;
  padding: 0;
}

#prompt-save-modal .prompt-toggle-row {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

#prompt-save-modal .switch-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #303840;
  font-weight: 500;
  cursor: pointer;
}

#prompt-save-modal .switch-label input[type="checkbox"] {
  appearance: none;
  width: 36px;
  height: 36px;
  border: 2px solid #c8d1da;
  border-radius: 8px;
  background: #ffffff;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#prompt-save-modal .switch-label input[type="checkbox"]::after {
  content: "\2605";
  position: absolute;
  font-size: 20px;
  line-height: 1;
  color: #c8d1da;
  transition: color 0.2s ease;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
}

#prompt-save-modal .switch-label input[type="checkbox"]:checked {
  border-color: #22a34a;
  background: #f0fdf4;
}

#prompt-save-modal .switch-label input[type="checkbox"]:checked::after {
  color: #22a34a;
  transform: translate(-50%, -50%);
}

#prompt-save-modal .prompt-save-actions {
  margin-top: 10px;
  justify-content: flex-end;
}

#prompt-save-modal .prompt-cancel-btn {
  border-radius: 8px;
}

#prompt-save-modal .prompt-save-btn {
  border-radius: 8px;
  min-width: 74px;
  min-height: 34px;
  text-transform: lowercase;
}


/* ---------- Assistant response quick actions ---------- */
.msg.assistant .msg-actions {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.msg.assistant .msg-action-btn {
  width: 24px;
  height: 22px;
  border: 1px solid #d7dfe8;
  border-radius: 4px;
  background: #ffffff;
  color: #4a5562;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.msg.assistant .msg-action-btn:hover {
  border-color: #97c1e9;
  box-shadow: 0 0 0 2px rgba(44, 153, 242, 0.08);
}

.msg.assistant .msg-action-btn.active {
  border-color: #2c99f2;
  color: #0f6fbe;
  background: #eef6ff;
}

.download-wrap {
  position: relative;
  display: inline-flex;
}

.download-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1px solid #d7dfe8;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  gap: 0;
  z-index: 20;
  overflow: hidden;
}

.download-menu.hidden {
  display: none;
}

.download-option {
  border: none;
  background: none;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #303840;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.download-option:hover {
  background: #eef6ff;
  color: #0f6fbe;
}

.download-option + .download-option {
  border-left: 1px solid #e8ecf1;
}

.export-download-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 24px;
  background: #0ea5e9;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.export-download-btn:hover {
  background: #0284c7;
}


/* ---------- Prompt card redesign: clear sections ---------- */
#prompt-library-view .prompt-card {
  position: relative;
  padding: 0;
  border: 1px solid #d0dbe8;
  border-radius: 10px;
  border-left-width: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#prompt-library-view .prompt-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f4f7fb;
  border-bottom: 1px solid #e2e9f0;
  gap: 8px;
}

#prompt-library-view .prompt-module {
  font-size: 13px;
  font-weight: 700;
  color: #1184dc;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

#prompt-library-view .prompt-level-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

#prompt-library-view .prompt-card[data-level="organization"] .prompt-level-badge {
  background: #dbeafe;
  color: #1e40af;
}
#prompt-library-view .prompt-card[data-level="department"] .prompt-level-badge {
  background: #dcfce7;
  color: #166534;
}
#prompt-library-view .prompt-card[data-level="personal"] .prompt-level-badge {
  background: #f3e8ff;
  color: #6b21a8;
}

#prompt-library-view .prompt-card-body {
  padding: 12px 14px 10px;
  flex: 1;
}

#prompt-library-view .prompt-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a2332;
  margin: 0 0 8px;
  line-height: 1.3;
  background: #edf2f7;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  display: inline-block;
}

#prompt-library-view .prompt-text {
  font-size: 13px;
  line-height: 1.55;
  color: #4b5c6e;
  margin: 0;
  min-height: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#prompt-library-view .prompt-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 10px;
  border-top: 1px solid #edf1f5;
  gap: 8px;
}

#prompt-library-view .prompt-tags {
  position: static;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  margin-top: 0;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

#prompt-library-view .prompt-tag-chip {
  min-width: 0;
  height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

#prompt-library-view .prompt-card-actions {
  position: static;
  display: flex;
  gap: 5px;
  margin-top: 0;
  flex-shrink: 0;
}


/* ---------- Prompt filters layout (without favorite button) ---------- */
#prompt-library-view .prompt-filters {
  grid-template-columns: minmax(170px, 220px) minmax(220px, 1fr) auto;
}


/* ---------- Prompt modal/header alignment fixes ---------- */
#prompt-save-modal .prompt-save-header-bar {
  gap: 12px;
}

#prompt-save-modal .prompt-save-header-bar h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

#prompt-save-modal .prompt-close {
  width: auto !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#prompt-library-view .prompt-filters {
  align-items: center;
}

#prompt-library-view .create-prompt-btn {
  height: 38px;
  align-self: center;
  white-space: nowrap;
}


/* ---------- Clear save-from-query icon + saved highlight ---------- */
.msg.user {
  position: relative;
  overflow: visible;
  padding-right: 14px;
}

.msg.user .save-prompt-inline-btn {
  position: absolute !important;
  right: 8px !important;
  bottom: -26px !important;
  width: 26px !important;
  height: 24px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #d6dee8 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  color: #9aa6b2 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  z-index: 4;
}

.msg.user .save-prompt-inline-btn::before {
  content: "?" !important;
  font-size: 13px;
  line-height: 1;
  color: #0b3d66;
}

.msg.user .save-prompt-inline-btn:hover {
  border-color: #b8c6d6 !important;
  color: #6f8092 !important;
}

.msg.user .save-prompt-inline-btn.is-saved {
  border-color: #16a34a !important;
  background: #fff7df !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.22);
  color: #16a34a !important;
}

.msg.user .save-prompt-inline-btn.is-saved::before {
  color: #16a34a;
}


/* ---------- Hard override: readable save icon text ---------- */
.msg.user .save-prompt-inline-btn::before {
  content: none !important;
  display: none !important;
}

.msg.user .save-prompt-inline-btn {
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  color: #9aa6b2 !important;
  text-indent: 0 !important;
}

.msg.user .save-prompt-inline-btn.is-saved {
  color: #16a34a !important;
}


/* ---------- Final query-save button style (match prompt-card favorite) ---------- */
.msg.user .save-prompt-inline-btn {
  position: absolute !important;
  right: 8px !important;
  bottom: -26px !important;
  width: 30px !important;
  height: 28px !important;
  border: 1px solid #d8e0ea !important;
  background: #ffffff !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  color: #b9c2cd !important;
  box-shadow: none !important;
  z-index: 6 !important;
}

.msg.user .save-prompt-inline-btn::before {
  content: none !important;
  display: none !important;
}

.msg.user .save-prompt-inline-btn:hover {
  border-color: #98c2ea !important;
  box-shadow: 0 0 0 2px rgba(44, 153, 242, 0.08) !important;
  color: #8fa0b3 !important;
}

.msg.user .save-prompt-inline-btn.is-saved {
  border-color: #16a34a !important;
  background: #fff7df !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18) !important;
  color: #16a34a !important;
}


/* ---------- Query save button: bookmark icon + strict saved highlight ---------- */
.msg.user .save-prompt-inline-btn {
  position: absolute !important;
  right: 8px !important;
  bottom: -26px !important;
  width: 30px !important;
  height: 28px !important;
  border: 1px solid #d8e0ea !important;
  background: #ffffff !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  z-index: 8 !important;
}

.msg.user .save-prompt-inline-btn::before {
  content: "" !important;
  display: block !important;
  width: 18px;
  height: 18px;
  border: none;
  clip-path: none;
  border-radius: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23707e8c' d='M5 2C3.34 2 2 3.34 2 5v14c0 1.66 1.34 3 3 3h14c1.66 0 3-1.34 3-3V7.83c0-.53-.21-1.04-.59-1.41l-3.83-3.83A2 2 0 0016.17 2H5zm0 2h1v4c0 .55.45 1 1 1h8c.55 0 1-.45 1-1V2h.17L20 5.83V19c0 .55-.45 1-1 1h-1v-7c0-.55-.45-1-1-1H7c-.55 0-1 .45-1 1v7H5c-.55 0-1-.45-1-1V5c0-.55.45-1 1-1zm3 0v3h6V4H8zm0 10h8v6H8v-6zm3 1v2h2v-2h-2z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.msg.user .save-prompt-inline-btn:hover {
  border-color: #b8c6d6 !important;
}

.msg.user .save-prompt-inline-btn[data-saved="true"] {
  border-color: #16a34a !important;
  background: #fff7df !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18) !important;
}

.msg.user .save-prompt-inline-btn[data-saved="true"]::before {
  color: #16a34a;
}

.msg.user .save-prompt-inline-btn[data-saved="false"] {
  border-color: #d8e0ea !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.msg.user .save-prompt-inline-btn[data-saved="false"]::before {
  color: #9aa8b7;
}


/* ---------- Saved state: green floppy disk ---------- */
.msg.user .save-prompt-inline-btn[data-saved="true"]::before,
.msg.user .save-prompt-inline-btn.is-saved::before {
  content: "" !important;
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  border: none !important;
  clip-path: none !important;
  border-radius: 0 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2316a34a' d='M5 2C3.34 2 2 3.34 2 5v14c0 1.66 1.34 3 3 3h14c1.66 0 3-1.34 3-3V7.83c0-.53-.21-1.04-.59-1.41l-3.83-3.83A2 2 0 0016.17 2H5zm0 2h1v4c0 .55.45 1 1 1h8c.55 0 1-.45 1-1V2h.17L20 5.83V19c0 .55-.45 1-1 1h-1v-7c0-.55-.45-1-1-1H7c-.55 0-1 .45-1 1v7H5c-.55 0-1-.45-1-1V5c0-.55.45-1 1-1zm3 0v3h6V4H8zm0 10h8v6H8v-6zm3 1v2h2v-2h-2z'/%3E%3C/svg%3E") !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-color: transparent !important;
}

/* ---------- Toast notifications ---------- */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 320px;
  max-width: 480px;
  padding: 14px 18px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  font-size: 14px;
  line-height: 1.45;
  color: #fff;
  animation: toast-in .35s ease-out;
}

.toast.toast-exit {
  animation: toast-out .3s ease-in forwards;
}

.toast-error {
  background: #C0392B;
}

.toast-icon {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast-close:hover {
  color: #fff;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}
