:root {
  --teal-deep: #06363C;
  --teal-deeper: #042428;
  --teal-mid: #0F7469;
  --teal-light: #2BA08F;
  --teal-soft: #CAE1DE;
  --gold: #C29A5B;
  --gold-soft: #EFE8DE;
  --cream: #F8F6F1;
  --ink: #2A2B29;
  --ink-soft: #4A4D4A;
  --muted: rgba(42, 43, 41, 0.55);
  --border: rgba(42, 43, 41, 0.10);
  --border-soft: rgba(42, 43, 41, 0.06);
  --row-hover: #FAF7F0;
  --user-bubble: var(--teal-deep);
  --assistant-bubble: #fff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #FBFAF7;
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 280px 1fr; height: 100vh; }

.sidebar {
  background: var(--teal-deeper);
  color: #fff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.brand {
  padding: 22px 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img { height: 36px; width: auto; }
.brand .name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.3px;
}
.brand .name em { font-style: italic; font-weight: 400; color: rgba(255,255,255,0.55); }

/* ---------- Sidebar nav (Chat / Knowledgebase) ---------- */
.sidebar-nav {
  padding: 6px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 12px;
  padding-bottom: 14px;
}
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-left: 3px solid transparent;
  margin-left: -3px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sidebar-nav .nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: #fff;
}
.sidebar-nav .nav-item.active {
  background: rgba(194,154,91,0.12);
  border-left-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}
.sidebar-nav .nav-item svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.new-chat {
  margin: 16px 18px 6px;
  padding: 11px 14px;
  background: var(--gold);
  color: var(--teal-deeper);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.15s;
}
.new-chat:hover { filter: brightness(1.05); }

.sessions-label {
  padding: 18px 22px 8px;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.4);
  font-weight: 700;
  text-transform: uppercase;
}
.sessions {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
}
.session-item {
  padding: 10px 22px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  border-left: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.session-item.active { background: rgba(194,154,91,0.12); border-left-color: var(--gold); color: var(--gold); font-weight: 600; }

.sidebar-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}
.sidebar-footer button {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
}
.sidebar-footer button:hover { color: var(--gold); }

/* ---------- Main ---------- */
.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #FBFAF7;
}

.topbar {
  padding: 18px 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--teal-deep);
  letter-spacing: -0.2px;
}
.topbar h1 em { font-style: italic; font-weight: 400; color: var(--ink-soft); }
.topbar .user-pill {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 12px;
  background: var(--cream);
  border-radius: 16px;
  border: 1px solid var(--border-soft);
}

/* ---------- Thread ---------- */
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0;
}
.thread-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--muted);
}
.empty-state h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--teal-deep);
  margin-bottom: 8px;
}
.empty-state p { font-size: 14px; max-width: 460px; margin: 0 auto; }
.suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 28px;
  text-align: left;
}
.suggestion {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.suggestion:hover {
  border-color: var(--gold);
  background: var(--cream);
  color: var(--ink);
}

.message { display: flex; flex-direction: column; gap: 8px; }
.message.user { align-items: flex-end; }
.message.assistant { align-items: flex-start; }

.bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.message.user .bubble {
  background: var(--user-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message.assistant .bubble {
  background: var(--assistant-bubble);
  color: var(--ink);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(42,43,41,0.04);
}

/* ---------- Markdown inside assistant bubble ---------- */
.bubble.markdown { white-space: normal; }
.bubble.markdown h1,
.bubble.markdown h2,
.bubble.markdown h3,
.bubble.markdown h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  color: var(--teal-deep);
  letter-spacing: -0.2px;
  line-height: 1.25;
  margin: 14px 0 6px;
}
.bubble.markdown h1 { font-size: 18px; }
.bubble.markdown h2 { font-size: 16px; }
.bubble.markdown h3 { font-size: 14px; font-family: 'Inter', sans-serif; font-weight: 700; color: var(--ink); }
.bubble.markdown h4 { font-size: 13px; font-family: 'Inter', sans-serif; font-weight: 700; }
.bubble.markdown > *:first-child { margin-top: 0; }
.bubble.markdown > *:last-child { margin-bottom: 0; }
.bubble.markdown p { margin: 0 0 10px; line-height: 1.55; }
.bubble.markdown strong { color: var(--ink); font-weight: 700; }
.bubble.markdown em { font-style: italic; }
.bubble.markdown ul,
.bubble.markdown ol { margin: 0 0 10px; padding-left: 22px; line-height: 1.55; }
.bubble.markdown li { margin-bottom: 4px; }
.bubble.markdown li > p { margin: 0 0 4px; }
.bubble.markdown blockquote {
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  margin: 10px 0;
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  color: var(--ink-soft);
  font-size: 13px;
}
.bubble.markdown blockquote > *:last-child { margin-bottom: 0; }
.bubble.markdown code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  background: var(--cream);
  border: 1px solid var(--border-soft);
  padding: 1px 5px;
  border-radius: 4px;
}
.bubble.markdown pre {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0 0 10px;
}
.bubble.markdown pre code { border: none; padding: 0; background: none; }
.bubble.markdown hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.bubble.markdown a {
  color: var(--teal-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bubble.markdown a:hover { color: var(--teal-deep); }

.bubble.markdown a.cite-link {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--teal-deep);
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 0 5px;
  margin: 0 2px;
  line-height: 1.5;
  text-decoration: none;
  vertical-align: baseline;
  transition: background 0.12s, color 0.12s;
}
.bubble.markdown a.cite-link:hover {
  background: var(--gold);
  color: var(--teal-deeper);
}

.citation {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 6px;
}
.citation .citation-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--gold);
  color: var(--teal-deeper);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
}
.citation.flash {
  animation: cite-flash 1.2s ease-out;
}
@keyframes cite-flash {
  0%, 30% { box-shadow: 0 0 0 4px rgba(194,154,91,0.5); transform: scale(1.05); }
  100%    { box-shadow: 0 0 0 0 rgba(194,154,91,0); transform: scale(1); }
}

/* ---------- Source drawer (slides in from right) ---------- */
.source-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.25s;
}
.source-drawer.open {
  pointer-events: auto;
  visibility: visible;
}
.source-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 36, 40, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.source-drawer.open .source-drawer-backdrop { opacity: 1; }
.source-drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 92vw);
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(4, 36, 40, 0.25);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.source-drawer.open .source-drawer-panel { transform: translateX(0); }

.source-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: #FBFAF7;
}
.source-drawer-meta { flex: 1; min-width: 0; }
.source-drawer-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.source-drawer-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--teal-deep);
  letter-spacing: -0.2px;
  line-height: 1.25;
  margin-bottom: 4px;
  word-break: break-word;
}
.source-drawer-path {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.4;
}
.source-drawer-close {
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.source-drawer-close:hover { background: var(--cream); color: var(--ink); }

.source-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px 40px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}
.source-drawer-body h1,
.source-drawer-body h2,
.source-drawer-body h3,
.source-drawer-body h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  color: var(--teal-deep);
  margin: 18px 0 8px;
  line-height: 1.25;
  letter-spacing: -0.2px;
}
.source-drawer-body h1 { font-size: 22px; }
.source-drawer-body h2 { font-size: 18px; }
.source-drawer-body h3 { font-size: 15px; font-family: 'Inter', sans-serif; font-weight: 700; color: var(--ink); }
.source-drawer-body > *:first-child { margin-top: 0; }
.source-drawer-body p { margin: 0 0 12px; }
.source-drawer-body strong { font-weight: 700; color: var(--ink); }
.source-drawer-body ul,
.source-drawer-body ol { margin: 0 0 12px; padding-left: 22px; }
.source-drawer-body li { margin-bottom: 4px; }
.source-drawer-body blockquote {
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  margin: 10px 0;
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  color: var(--ink-soft);
}
.source-drawer-body code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  background: var(--cream);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
}
.source-drawer-body hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.source-drawer-body a { color: var(--teal-mid); }

.source-loading,
.source-error {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 28px 12px;
}

/* The matched chunk is highlighted with a gold underglow + ring */
.source-drawer-body .source-highlight {
  background: linear-gradient(180deg, var(--gold-soft) 0%, #FCF7EC 100%);
  border-left: 3px solid var(--gold);
  padding: 8px 12px;
  margin-left: -12px;
  margin-right: -12px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(194,154,91,0.25);
  scroll-margin-top: 80px;
  animation: source-highlight-pulse 1.6s ease-out;
}
@keyframes source-highlight-pulse {
  0%   { box-shadow: 0 0 0 6px rgba(194,154,91,0.6); }
  100% { box-shadow: 0 0 0 1px rgba(194,154,91,0.25); }
}

@media (max-width: 640px) {
  .source-drawer-panel { width: 100vw; }
}

/* ---------- Knowledgebase page ---------- */
.kb-main {
  overflow-y: auto;
  background: #FBFAF7;
}
.kb-shell {
  max-width: 1140px;
  margin: 0 auto;
  padding: 36px 40px 60px;
}
.kb-header {
  margin-bottom: 14px;
}
.kb-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 36px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.kb-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
  padding-bottom: 0;
}
.kb-tab {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 0 14px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}
.kb-tab:hover { color: var(--ink); }
.kb-tab.active {
  color: var(--gold);
}
.kb-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px 2px 0 0;
}

.kb-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: -0.2px;
  margin-bottom: 22px;
}

.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 22px;
}
.kb-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 28px 30px 24px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  box-shadow: 0 1px 2px rgba(42,43,41,0.04);
}
.kb-card:hover,
.kb-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(42,43,41,0.08);
  border-color: var(--gold);
  outline: none;
}
.kb-card-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.3px;
  line-height: 1.2;
  margin-bottom: 14px;
}
.kb-card-excerpt {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 22px;
}
.kb-card-cta {
  align-self: flex-start;
  background: var(--gold);
  color: var(--teal-deeper);
  padding: 10px 28px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: filter 0.12s, background 0.12s;
}
.kb-card-cta:hover {
  filter: brightness(1.05);
}

.kb-loading,
.kb-empty,
.kb-error {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 40px 12px;
}
.kb-error { color: #C24545; }

/* ---------- Post detail page ---------- */
.post-main {
  overflow-y: auto;
  background: #FBFAF7;
}
.post-shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 36px 80px;
  position: relative;
}
.breadcrumb {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 24px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.breadcrumb a {
  color: var(--gold);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 500; }

.post-article {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 40px 50px 50px;
  box-shadow: 0 1px 2px rgba(42,43,41,0.04);
}
.post-article h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--teal-deep);
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin: 0 0 14px;
}
.post-article h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--teal-deep);
  letter-spacing: -0.2px;
  margin: 26px 0 10px;
}
.post-article h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 22px 0 8px;
}
.post-article p { margin: 0 0 14px; }
.post-article ul, .post-article ol { margin: 0 0 14px; padding-left: 24px; }
.post-article li { margin-bottom: 6px; }
.post-article strong { font-weight: 700; color: var(--ink); }
.post-article em { font-style: italic; }
.post-article hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.post-article blockquote {
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  color: var(--ink-soft);
}
.post-article code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  background: var(--cream);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
}
.post-article a { color: var(--teal-mid); text-decoration: underline; text-underline-offset: 2px; }
.post-article a:hover { color: var(--teal-deep); }

.post-loading, .post-error {
  text-align: center;
  color: var(--muted);
  padding: 40px 12px;
}
.post-error { color: #C24545; }

.post-cta {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.post-ask-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--teal-mid);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(15, 116, 105, 0.25);
  transition: background 0.12s, transform 0.12s;
}
.post-ask-btn:hover {
  background: var(--teal-deep);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .kb-shell { padding: 24px 20px 40px; }
  .kb-title { font-size: 28px; }
  .post-shell { padding: 20px 16px 60px; }
  .post-article { padding: 24px 20px; }
}

.thinking {
  display: inline-flex;
  gap: 4px;
  padding: 4px 8px;
  align-items: center;
}
.thinking span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: pulse 1.2s infinite;
}
.thinking span:nth-child(2) { animation-delay: 0.2s; }
.thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* Citations */
.citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  max-width: 80%;
}
.citation {
  font-size: 11px;
  padding: 5px 10px;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: var(--teal-deep);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.citation:hover { background: var(--gold); color: var(--teal-deeper); }

/* ---------- Composer ---------- */
.composer {
  padding: 18px 28px 24px;
  background: #FBFAF7;
  border-top: 1px solid var(--border-soft);
}
.composer-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-inner:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(194,154,91,0.15);
}
.composer textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 14px;
  line-height: 1.5;
  max-height: 180px;
  padding: 8px 0;
}
.send-btn {
  background: var(--teal-mid);
  color: #fff;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.send-btn:hover:not(:disabled) { background: var(--teal-deep); }
.send-btn:disabled { background: var(--muted); cursor: not-allowed; }

.disclaimer {
  max-width: 760px;
  margin: 8px auto 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  background: var(--teal-deeper);
}

/* Split: video card on the left (~77%) + narrow sign-in panel on the right (~23%) */
.login-split {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 3.3fr) minmax(0, 1fr);   /* ≈77/23 */
  gap: 0;
  align-items: center;
}

/* ---- Video card (floating, rounded, 16:9, embedded in teal page) ---- */
.login-video {
  position: relative;
  width: calc(100% - 80px);
  max-width: 1400px;
  aspect-ratio: 16 / 9;
  margin: 40px;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  cursor: zoom-in;
  outline: none;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(194, 154, 91, 0.18);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.login-video:hover {
  transform: translateY(-2px);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(194, 154, 91, 0.35);
}
.login-video:focus-visible {
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 0 0 3px var(--gold);
}
.login-video video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;             /* container matches 16:9, no crop, no letterbox */
}

.video-sound-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s ease, transform 0.15s ease;
  z-index: 2;
}
.video-sound-toggle:hover {
  background: rgba(0,0,0,0.75);
  transform: scale(1.05);
}

.video-overlay-hint {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.login-video:hover .video-overlay-hint,
.login-video:focus-visible .video-overlay-hint { opacity: 1; }

/* ---- Sign-in panel (right column, flat white, no card) ---- */
.login-card {
  background: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 56px 32px 28px;
  position: relative;
}
.login-card > * { width: 100%; max-width: 340px; }
.login-card .powered-by {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

/* ---- Lightbox modal ---- */
.video-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.video-modal.open { display: flex; }
.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 54, 60, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.video-modal-frame {
  position: relative;
  width: min(95vw, 1600px);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.55);
  z-index: 1;
}
.video-modal-frame video {
  width: 100%;
  height: 100%;
  display: block;
}
.video-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.video-modal-close:hover { background: rgba(0,0,0,0.8); }

/* ---- Responsive: stack vertically below 860px ---- */
@media (max-width: 860px) {
  .login-split {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .login-video {
    height: 56vw;     /* 16:9 at full viewport width */
    max-height: 480px;
  }
  .login-card {
    min-height: 0;
    padding: 36px 28px 64px;
  }
}
.login-card .brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
}
.login-card .brand-mark img { height: 44px; }
.login-card .brand-mark .name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  color: var(--teal-deep);
  font-weight: 600;
}
.login-card .brand-mark em { font-style: italic; color: var(--ink-soft); font-weight: 400; }
.login-card h2 {
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
  text-align: center;
}
.login-card p.lede {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 22px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.15s;
}
.field input:focus { outline: none; border-color: var(--gold); }
.field.totp input { letter-spacing: 6px; text-align: center; font-size: 18px; }
.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--teal-mid);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 6px;
}
.btn-login:hover:not(:disabled) { background: var(--teal-deep); }
.btn-login:disabled { background: var(--muted); cursor: not-allowed; }
.error-msg {
  background: #FFEBEB;
  color: #C24545;
  border: 1px solid #F0BCBC;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 14px;
}
.login-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- TOTP setup ---------- */
.qr-target {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 14px auto 16px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 200px;
  width: fit-content;
}
.qr-target img {
  width: 192px;
  height: 192px;
  display: block;
  image-rendering: pixelated;
}
.manual-secret {
  margin-bottom: 14px;
}
.manual-secret label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.manual-secret-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.manual-secret-row code {
  flex: 1;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  word-break: break-all;
  line-height: 1.35;
  color: var(--ink);
}
.copy-btn {
  background: var(--gold-soft);
  color: var(--teal-deep);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.copy-btn:hover { background: var(--gold); color: var(--teal-deeper); }
.copy-btn.copied { background: var(--teal-mid); color: #fff; border-color: var(--teal-mid); }
