/* ══════════════════════════════════════════════════════════
   Jivas Office — Translation Workspace
   Fullscreen, professional, optimized for Pali-Việt work
   ══════════════════════════════════════════════════════════ */

/* ── Reset & Fullscreen ── */
*, *::before, *::after { box-sizing: border-box; }
body.office-page {
  padding: 0 !important; margin: 0;
  max-width: 100% !important; width: 100% !important;
  background: #0f1117;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.office-page > header,
body.office-page > footer { display: none !important; }
body.office-page > main {
  padding: 0; margin: 0; max-width: 100%;
  height: 100vh; height: 100dvh;
}
#officeApp {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  color: #e1e4e8;
  overflow: hidden;
}

/* ── Login ── */
.office-login-overlay {
  display: flex; align-items: center; justify-content: center;
  height: 100vh;
  background: #0f1117;
}
.office-login-card {
  background: #1c1f26; border-radius: 16px; padding: 44px 40px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 20px 60px rgba(0,0,0,0.5);
  max-width: 380px; width: 90%;
}
.office-login-icon { font-size: 44px; margin-bottom: 10px; }
.office-login-card h2 {
  margin: 0 0 4px; font-size: 20px; font-weight: 700;
  color: #f0f0f0; letter-spacing: -0.3px;
}
.office-login-card p {
  margin: 0 0 24px; color: #7a8296; font-size: 13px; line-height: 1.4;
}
#telegramLogin { display: flex; justify-content: center; }

/* ── Main Layout ── */
.office-main {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  background: #0f1117;
}

/* ── Top Bar — compact ── */
.office-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: #161920;
  border-bottom: 1px solid #252830;
  height: 42px; flex-shrink: 0;
}
.office-topbar-left {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.office-home-link {
  font-size: 16px; text-decoration: none;
  display: flex; align-items: center; opacity: 0.7;
  transition: opacity 0.15s;
}
.office-home-link:hover { opacity: 1; }
.office-topbar-title {
  font-weight: 700; font-size: 13px; color: #8b92a5;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.office-rooms-tabs {
  display: flex; gap: 4px; flex: 1;
  overflow-x: auto; white-space: nowrap;
  padding: 0 6px;
  -ms-overflow-style: none; scrollbar-width: none;
}
.office-rooms-tabs::-webkit-scrollbar { display: none; }
.office-room-tab {
  padding: 5px 14px; border-radius: 6px;
  border: 1px solid transparent; background: transparent;
  font-size: 12px; cursor: pointer;
  transition: all 0.15s ease;
  color: #7a8296; font-weight: 500;
  white-space: nowrap;
}
.office-room-tab:hover { background: #1c1f26; color: #b0b8cc; }
.office-room-tab.active {
  background: #252830; color: #e1e4e8;
  border-color: #363b48;
}
.office-admin-btn {
  width: 30px; height: 30px; border-radius: 6px;
  border: 1px solid #252830; background: transparent;
  cursor: pointer; color: #5a6070;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.office-admin-btn:hover { background: #1c1f26; color: #b0b8cc; border-color: #363b48; }

/* ── Content: 3-column ── */
.office-content {
  display: flex; flex: 1; overflow: hidden;
}

/* ── Sessions Sidebar — narrow ── */
.office-sidebar {
  width: 200px; min-width: 160px;
  background: #131620; border-right: 1px solid #1e222d;
  display: flex; flex-direction: column; flex-shrink: 0;
}
.office-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; font-weight: 600; font-size: 11px;
  border-bottom: 1px solid #1e222d; color: #5a6070;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.office-btn-icon {
  width: 26px; height: 26px; border-radius: 5px;
  border: 1px solid #252830; background: transparent;
  cursor: pointer; color: #5a6070;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.office-btn-icon:hover { background: #1c1f26; color: #b0b8cc; border-color: #363b48; }
.office-session-list { flex: 1; overflow-y: auto; }
.office-session-list::-webkit-scrollbar { width: 3px; }
.office-session-list::-webkit-scrollbar-thumb { background: #252830; border-radius: 3px; }
.office-empty-hint {
  padding: 20px 12px; color: #4a5168; font-size: 12px;
  text-align: center; line-height: 1.5;
}
.office-session-item {
  padding: 8px 10px; cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.1s; color: #7a8296;
}
.office-session-item:hover { background: #1a1d27; }
.office-session-item.active {
  background: #1a2332; border-left-color: #5b9cf6;
  color: #e1e4e8;
  box-shadow: inset 0 0 0 1px rgba(91,156,246,0.15);
}
.office-session-title {
  font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.office-session-status {
  display: inline-block; width: 5px; height: 5px;
  border-radius: 50%; background: #3fb950; margin-right: 5px;
  vertical-align: middle;
}
.office-session-time {
  font-size: 10px; color: #3d4455; margin-top: 1px;
}
.office-session-top-row {
  display: flex; align-items: center; gap: 4px;
}
.office-session-top-row .office-session-title { flex: 1; min-width: 0; }
.office-session-top-row .office-session-meta {
  font-size: 9px; color: #3d4455; flex-shrink: 0; white-space: nowrap;
}

/* ── Chat Area — maximized ── */
.office-chat {
  flex: 1; display: flex; flex-direction: column;
  background: #0f1117; min-width: 0;
}
.office-chat-header {
  padding: 6px 16px; background: #161920;
  border-bottom: 1px solid #1e222d;
  display: flex; align-items: center;
  flex-shrink: 0; height: 38px; gap: 10px;
}
.office-chat-title {
  font-weight: 600; font-size: 13px; color: #b0b8cc;
  white-space: nowrap; flex-shrink: 0;
}
.office-chat-members {
  display: flex; gap: 3px; flex-wrap: nowrap;
  flex: 1; justify-content: flex-end;
  overflow-x: auto; overflow-y: hidden;
  -ms-overflow-style: none; scrollbar-width: none;
}
.office-chat-members::-webkit-scrollbar { display: none; }
.office-member-badge {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 6px; border-radius: 8px;
  font-size: 10px; background: #1c1f26; color: #7a8296;
  font-weight: 500; border: 1px solid #252830;
  white-space: nowrap; flex-shrink: 0;
}
.office-member-badge .online-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: #3fb950; flex-shrink: 0;
}
.office-member-badge .online-dot.thinking {
  background: #d29922;
  animation: offBlink 1.4s infinite both;
}


/* ── Cache Status Bar ── */
.cache-status-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 16px; gap: 10px;
  background: #12141a; border-bottom: 1px solid #1c1f26;
  font-size: 11px; color: #7a8296;
  flex-shrink: 0;
}
.cache-status-items {
  display: flex; gap: 6px; align-items: center;
}
.cache-status-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 6px;
  font-size: 10px; font-weight: 600;
  border: 1px solid #252830;
  transition: all 0.2s;
}
.cache-status-badge.cached {
  background: #0d2818; color: #3fb950;
  border-color: #1a3a2a;
}
.cache-status-badge.not-cached {
  background: #1c1f26; color: #484d5b;
  border-color: #252830;
}
.cache-status-badge .cache-icon { font-size: 9px; }
.cache-status-label {
  color: #555a6a; font-size: 10px; margin-left: 2px;
}
.cache-status-meta {
  display: flex; gap: 10px; align-items: center;
  font-size: 10px; color: #555a6a;
}
.cache-status-meta .cache-size { color: #7a8296; }
.cache-status-meta .cache-ttl {
  color: #d29922;
  font-variant-numeric: tabular-nums;
}
.cache-status-meta .cache-ttl.expiring { color: #f85149; }

/* ── Messages ── */
.office-chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.office-chat-messages::-webkit-scrollbar { width: 4px; }
.office-chat-messages::-webkit-scrollbar-thumb { background: #252830; border-radius: 4px; }
.office-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; color: #3d4455; font-size: 13px; gap: 6px;
}
.office-empty-state-icon { font-size: 36px; opacity: 0.4; }

.office-msg {
  max-width: 85%; animation: offFadeIn 0.2s ease;
}
.office-msg-user { align-self: flex-end; }
.office-msg-user .office-msg-bubble {
  background: #1d4ed8; color: #e8edf5;
  border-radius: 14px 14px 4px 14px;
  padding: 8px 14px;
}
.office-msg-jiva { align-self: flex-start; max-width: 90%; }
.office-msg-jiva .office-msg-bubble {
  background: #1c1f26;
  border-radius: 12px 12px 12px 2px;
  padding: 14px 20px 16px;
  border-left: 3px solid var(--jiva-color, #5b9cf6);
  border-top: 1px solid #252830;
  border-right: 1px solid #252830;
  border-bottom: 1px solid #252830;
}
.office-msg-sender {
  font-size: 11px; font-weight: 600;
  margin-bottom: 6px; color: var(--jiva-color, #5b9cf6);
  letter-spacing: 0.3px;
}
.office-msg-content {
  font-size: 14px; line-height: 1.75;
  word-wrap: break-word; color: #d1d5de;
}
.office-msg-content p { margin: 0 0 8px; }
.office-msg-content p:last-child { margin: 0; }
.office-msg-content h1, .office-msg-content h2,
.office-msg-content h3, .office-msg-content h4 {
  margin: 16px 0 8px; color: #e1e4e8;
  padding-bottom: 4px; border-bottom: 1px solid #252830;
}
.office-msg-content h1 { font-size: 16px; }
.office-msg-content h2 { font-size: 15px; }
.office-msg-content h3 { font-size: 14px; }
.office-msg-content h4 { font-size: 13px; border-bottom: none; }
.office-msg-content h1:first-child, .office-msg-content h2:first-child,
.office-msg-content h3:first-child, .office-msg-content h4:first-child { margin-top: 0; }
.office-msg-content ul, .office-msg-content ol {
  margin: 6px 0; padding-left: 20px;
}
.office-msg-content li { margin-bottom: 3px; }
.office-msg-content li > ul, .office-msg-content li > ol {
  margin: 3px 0 3px 4px;
}
.office-msg-content blockquote {
  margin: 8px 0; padding: 6px 12px;
  border-left: 3px solid var(--jiva-color, #5b9cf6);
  background: rgba(255,255,255,0.02);
  border-radius: 0 6px 6px 0;
  color: #b0b8cc;
}
.office-msg-content hr {
  border: none; border-top: 1px solid #252830;
  margin: 12px 0;
}
.office-msg-content strong { color: #e8ecf2; }
.office-msg-content code {
  background: rgba(255,255,255,0.06); padding: 1px 5px;
  border-radius: 3px; font-size: 13px;
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
  color: #e6b450;
}
.office-msg-content pre {
  background: #0a0c10; color: #d1d5de;
  padding: 12px; border-radius: 8px;
  overflow-x: auto; font-size: 13px;
  margin: 6px 0; line-height: 1.5;
  border: 1px solid #1e222d;
}
.office-msg-content pre code { background: none; padding: 0; color: inherit; }
.office-msg-system {
  align-self: center;
  font-size: 11px; color: #3d4455;
  padding: 3px 12px; background: #161920;
  border-radius: 10px;
}
.office-msg-thinking {
  align-self: flex-start;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #5a6070;
  padding: 6px 14px;
  background: #1c1f26; border-radius: 14px;
  border: 1px solid #252830;
}
.office-thinking-dots { display: inline-flex; gap: 3px; }
.office-thinking-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: #3d4455; animation: offBlink 1.4s infinite both;
}
.office-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.office-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes offBlink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}
@keyframes offFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Chat Input ── */
.office-chat-input {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 20px; background: #161920;
  border-top: 1px solid #1e222d;
  flex-shrink: 0;
}
.office-chat-input textarea {
  flex: 1; resize: none;
  border: 1px solid #252830; border-radius: 10px;
  padding: 9px 14px; font-size: 14px;
  font-family: inherit; max-height: 120px;
  outline: none; transition: border-color 0.15s;
  background: #0f1117; color: #e1e4e8;
  line-height: 1.5;
}
.office-chat-input textarea:focus { border-color: #5b9cf6; }
.office-chat-input textarea::placeholder { color: #3d4455; }
.office-send-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: #1d4ed8; color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s;
}
.office-send-btn:hover { background: #2563eb; }

/* ══════════════════════════════════════════════════════
   Translation Theme — Pali-Việt
   ══════════════════════════════════════════════════════ */

/* ── Pali Term Highlighting ── */
.pali-term {
  color: #e6a96f; font-weight: 500; cursor: help;
  border-bottom: 1px dotted rgba(230,169,111,0.3);
}
.pali-term:hover { background: rgba(230,169,111,0.1); border-radius: 2px; }

/* ── Markdown Tables in Chat ── */
.office-msg-content table {
  width: 100%; border-collapse: collapse;
  margin: 8px 0; font-size: 13px;
  border: 1px solid #252830; border-radius: 6px;
  overflow: hidden;
}
.office-msg-content th {
  background: #1a1d27; padding: 6px 10px;
  text-align: left; border-bottom: 2px solid #252830;
  font-size: 11px; font-weight: 600; color: #7a8296;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.office-msg-content td {
  padding: 5px 10px; border-bottom: 1px solid #1e222d;
}
.office-msg-content tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.office-msg-content tr:hover { background: rgba(255,255,255,0.03); }
.office-msg-content td:first-child { color: #e6a96f; font-style: italic; }
.office-msg-content td:nth-child(2) { color: #7ee787; }

/* ── Glossary Panel ── */
.glossary-panel {
  width: 260px; border-left: 1px solid #1e222d;
  display: flex; flex-direction: column;
  background: #131620; flex-shrink: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
}
.glossary-panel.collapsed {
  width: 0; min-width: 0; overflow: hidden;
  border-left: none;
}
.glossary-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid #1e222d;
}
.glossary-title {
  font-weight: 600; font-size: 11px; color: #5a6070;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.glossary-search {
  width: calc(100% - 20px); margin: 8px 10px;
  padding: 6px 10px; border: 1px solid #252830;
  border-radius: 6px; font-size: 12px;
  outline: none; background: #0f1117; color: #e1e4e8;
  font-family: inherit;
}
.glossary-search:focus { border-color: #5b9cf6; }
.glossary-search::placeholder { color: #3d4455; }
.glossary-list {
  flex: 1; overflow-y: auto; padding: 0 10px;
}
.glossary-list::-webkit-scrollbar { width: 3px; }
.glossary-list::-webkit-scrollbar-thumb { background: #252830; border-radius: 3px; }
.glossary-item {
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 6px;
  padding: 4px 0; border-bottom: 1px solid #1a1d27;
  font-size: 12px;
}
.glossary-item:last-child { border-bottom: none; }
.glossary-pali {
  color: #e6a96f; font-weight: 500; font-style: italic;
  white-space: nowrap;
}
.glossary-arrow { color: #3d4455; font-size: 10px; flex-shrink: 0; }
.glossary-viet {
  color: #7ee787; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.glossary-strict { font-weight: 700; }
.glossary-stats {
  padding: 6px 12px; border-top: 1px solid #1e222d;
  font-size: 10px; color: #3d4455; text-align: center;
  flex-shrink: 0;
}
.glossary-toggle-btn.active {
  background: #252830; color: #5b9cf6; border-color: #5b9cf6;
}

/* ── Approval Buttons ── */
.approval-buttons {
  display: flex; gap: 6px; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid #252830;
}
.approval-btn {
  padding: 5px 14px; border-radius: 6px;
  border: 1px solid; cursor: pointer;
  font-size: 12px; font-weight: 500;
  font-family: inherit; transition: all 0.15s;
  background: transparent;
}
.approval-btn:hover { filter: brightness(1.2); }
.approval-btn.approve { border-color: #238636; color: #3fb950; }
.approval-btn.approve:hover { background: rgba(35,134,54,0.15); }
.approval-btn.discuss { border-color: #9e6a03; color: #d29922; }
.approval-btn.discuss:hover { background: rgba(158,106,3,0.15); }
.approval-btn.edit { border-color: #1f6feb; color: #58a6ff; }
.approval-btn.edit:hover { background: rgba(31,111,235,0.15); }

/* ── Modals ── */
.office-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.office-modal-content {
  background: #1c1f26; border-radius: 12px;
  width: 90%; max-width: 500px; max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 0 0 1px #252830, 0 20px 60px rgba(0,0,0,0.5);
}
.office-modal-content::-webkit-scrollbar { width: 4px; }
.office-modal-content::-webkit-scrollbar-thumb { background: #252830; border-radius: 4px; }
.office-modal-lg { max-width: 680px; }
.office-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid #252830;
  position: sticky; top: 0; background: #1c1f26; z-index: 1;
  border-radius: 12px 12px 0 0;
}
.office-modal-header h3 {
  margin: 0; font-size: 15px; font-weight: 600; color: #e1e4e8;
}
.office-modal-close {
  width: 28px; height: 28px; border: none; background: none;
  font-size: 20px; cursor: pointer; color: #5a6070;
  border-radius: 6px; display: flex;
  align-items: center; justify-content: center;
}
.office-modal-close:hover { background: #252830; color: #e1e4e8; }
.office-modal-tabs { display: flex; gap: 2px; }
.office-tab {
  padding: 6px 14px; border-radius: 6px;
  border: none; background: none;
  font-size: 12px; cursor: pointer;
  color: #5a6070; font-weight: 500;
  transition: all 0.15s;
}
.office-tab:hover { background: #252830; color: #b0b8cc; }
.office-tab.active { background: #252830; color: #e1e4e8; }
.office-tab-content { padding: 16px 20px; }

/* ── Forms ── */
.office-modal-content > .office-form { padding: 20px 24px 24px; }
.office-form label {
  display: block; margin-bottom: 14px;
  font-size: 12px; font-weight: 600; color: #7a8296;
}
.office-form input[type="text"],
.office-form select,
.office-form textarea {
  display: block; width: 100%; margin-top: 5px;
  padding: 8px 10px; border: 1px solid #252830;
  border-radius: 6px; font-size: 13px;
  font-family: inherit; outline: none;
  box-sizing: border-box; color: #e1e4e8;
  background: #0f1117;
  transition: all 0.15s;
}
.office-form input:focus,
.office-form select:focus,
.office-form textarea:focus {
  border-color: #5b9cf6;
}
.office-form input::placeholder,
.office-form textarea::placeholder { color: #3d4455; }
.office-form-row { display: flex; gap: 10px; }
.office-form-row > label { flex: 1; }
.office-form-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid #252830;
}

/* ── Buttons ── */
.office-btn-primary {
  padding: 7px 16px; border-radius: 6px;
  background: #1d4ed8; color: #fff; border: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.office-btn-primary:hover { background: #2563eb; }
.office-btn-cancel {
  padding: 7px 16px; border-radius: 6px;
  background: #252830; color: #7a8296; border: none;
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.office-btn-cancel:hover { background: #363b48; color: #b0b8cc; }
.office-btn-sm {
  padding: 4px 10px; border-radius: 5px;
  background: transparent; border: 1px solid #252830;
  font-size: 11px; cursor: pointer; color: #7a8296;
  font-weight: 500;
}
.office-btn-sm:hover { background: #252830; color: #b0b8cc; }
.office-btn-danger {
  padding: 4px 10px; border-radius: 5px;
  background: transparent; border: 1px solid #3d1f1f;
  font-size: 11px; cursor: pointer; color: #f85149;
  font-weight: 500;
}
.office-btn-danger:hover { background: #3d1f1f; }

/* ── Admin List ── */
.office-admin-toolbar { margin-bottom: 12px; }
.office-admin-list { display: flex; flex-direction: column; gap: 6px; }
.office-admin-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid #252830;
  border-radius: 8px; background: #161920;
  transition: border-color 0.15s;
}
.office-admin-card:hover { border-color: #363b48; }
.office-admin-card-badge {
  font-size: 22px; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: #1c1f26; border-radius: 8px;
}
.office-admin-card-info { flex: 1; min-width: 0; }
.office-admin-card-name { font-weight: 600; font-size: 13px; color: #e1e4e8; }
.office-admin-card-meta { font-size: 11px; color: #5a6070; margin-top: 1px; }
.office-admin-card-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── Members Section ── */
.office-members-section {
  margin-top: 6px; padding-top: 14px; border-top: 1px solid #252830;
}
.office-members-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.office-members-header h4 {
  margin: 0; font-size: 13px; font-weight: 600; color: #7a8296;
}
.office-member-row {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border: 1px solid #252830;
  border-radius: 8px; margin-bottom: 6px;
  background: #161920;
}
.office-member-row select {
  width: auto; margin: 0; padding: 4px 6px;
  font-size: 11px; border-radius: 4px;
  border: 1px solid #252830; background: #0f1117; color: #e1e4e8;
}
.office-member-row .member-role-prompt {
  flex: 1; padding: 4px 6px; font-size: 11px;
  border: 1px solid #252830; border-radius: 4px;
  background: #0f1117; color: #e1e4e8;
  font-family: inherit; outline: none;
}
.office-member-row .member-role-prompt:focus { border-color: #5b9cf6; }

/* ── Jiva Colors ── */
.jiva-color-0 { --jiva-color: #5b9cf6; }
.jiva-color-1 { --jiva-color: #f0883e; }
.jiva-color-2 { --jiva-color: #3fb950; }
.jiva-color-3 { --jiva-color: #f85149; }
.jiva-color-4 { --jiva-color: #bc8cff; }
.jiva-color-5 { --jiva-color: #79c0ff; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .glossary-panel:not(.collapsed) { width: 220px; }
}
@media (max-width: 768px) {
  .office-sidebar { width: 170px; min-width: 140px; }
  .office-chat-messages { padding: 12px; }
  .office-chat-input { padding: 10px 12px; }
  .office-chat-header { padding: 8px 12px; }
  .office-modal-content { width: 95%; border-radius: 10px; }
  .glossary-panel {
    position: fixed; right: 0; top: 42px; bottom: 0;
    z-index: 50; box-shadow: -2px 0 20px rgba(0,0,0,0.4);
  }
  .glossary-panel.collapsed { box-shadow: none; }
}
@media (max-width: 540px) {
  .office-content { flex-direction: column; }
  .office-sidebar {
    width: 100%; max-width: 100%;
    max-height: 100px; border-right: none;
    border-bottom: 1px solid #1e222d;
  }
  .office-session-list {
    display: flex; overflow-x: auto;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .office-session-list::-webkit-scrollbar { display: none; }
  .office-session-item {
    white-space: nowrap; border-left: none;
    border-bottom: 2px solid transparent;
  }
  .office-session-item.active { border-bottom-color: #5b9cf6; border-left: none; }
}


/* ====== UX Enhancement Styles ====== */

/* Toast notifications */
.office-toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 10000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.office-toast {
  padding: 10px 16px; border-radius: 8px;
  font-size: 13px; color: #e6edf3;
  background: #1c2028; border: 1px solid #30363d;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
.office-toast-success { border-color: #238636; background: #0d1117; }
.office-toast-error { border-color: #f85149; background: #1c0c0c; }
.office-toast-hide { opacity: 0; transform: translateX(20px); transition: all 0.3s ease; }
@keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* Offline banner */
.office-offline-banner {
  display: none; position: fixed; top: 0; left: 0; right: 0;
  background: #da3633; color: #fff; text-align: center;
  padding: 6px; font-size: 12px; z-index: 9999;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { transform:translateY(-100%); } to { transform:translateY(0); } }

/* Session item hover actions */
.session-actions {
  display: flex; gap: 1px; align-items: center;
  margin-top: 4px; flex-shrink: 0;
}
.session-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: 10px; padding: 1px 3px; border-radius: 3px;
  opacity: 0.5; transition: all 0.15s; color: #5a6070;
  line-height: 1;
}
.session-action-btn:hover { opacity: 1; background: rgba(255,255,255,0.08); color: #b0b8cc; }
.session-action-delete:hover { background: rgba(248,81,73,0.15); }
.session-pin-icon { font-size: 10px; margin-right: 3px; }

/* Message hover actions */
.msg-hover-actions {
  display: none; position: absolute; top: 4px; right: 4px;
  gap: 4px; align-items: center;
  background: #161920; border: 1px solid #30363d;
  border-radius: 6px; padding: 2px 6px;
}
.office-msg:hover .msg-hover-actions { display: flex; }
.msg-timestamp {
  font-size: 10px; color: #484f58; white-space: nowrap;
}
.msg-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; padding: 2px 4px; border-radius: 3px;
  opacity: 0.5; transition: opacity 0.15s;
}
.msg-action-btn:hover { opacity: 1; background: rgba(255,255,255,0.08); }

/* Cost Badge */
.cost-badge {
  display: inline-block;
  background: #1a1a2e;
  color: #4ade80;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(74, 222, 128, 0.3);
  margin-left: 8px;
  cursor: help;
  white-space: pre-line;
}
.cost-badge:hover {
  background: #16213e;
  border-color: #4ade80;
}

/* ── Attach File ── */
.office-attach-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: transparent; color: #5a6070;
  border: 1px solid #252830; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
  font-size: 18px;
}
.office-attach-btn:hover { background: #1c1f26; color: #b0b8cc; border-color: #363b48; }
.office-chat-input-wrapper {
  display: flex; flex-direction: column; flex: 1; gap: 6px;
}
.office-file-preview {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: #1c1f26;
  border: 1px solid #252830; border-radius: 8px;
  font-size: 12px; color: #7a8296;
}
.office-file-preview-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.office-file-preview-remove {
  background: none; border: none; cursor: pointer;
  color: #f85149; font-size: 14px; padding: 0 2px;
  opacity: 0.7; transition: opacity 0.15s;
}
.office-file-preview-remove:hover { opacity: 1; }
.office-file-preview-icon { font-size: 16px; flex-shrink: 0; }
.office-file-preview-size { font-size: 10px; color: #3d4455; flex-shrink: 0; }
/* ── Performance: CSS containment ── */
.office-chat-messages {
  contain: content;
}
.office-chat-input {
  contain: layout style;
}

/* ── Final Result Message ── */
.office-msg-result .office-msg-bubble {
  border-left: 4px solid #4ade80 !important;
  background: linear-gradient(135deg, #0f2018 0%, #1c1f26 100%) !important;
  border-top: 1px solid rgba(74, 222, 128, 0.2) !important;
  border-right: 1px solid rgba(74, 222, 128, 0.15) !important;
  border-bottom: 1px solid rgba(74, 222, 128, 0.15) !important;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.06);
}
.office-result-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; color: #4ade80;
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 6px; padding: 2px 8px;
  background: rgba(74, 222, 128, 0.1);
  border-radius: 4px; width: fit-content;
}
.office-result-label::before {
  content: '\2728';
  font-size: 11px;
}
.office-result-flash .office-msg-bubble {
  animation: resultFlash 1.5s ease;
}
@keyframes resultFlash {
  0%, 100% { box-shadow: 0 0 12px rgba(74, 222, 128, 0.06); }
  50% { box-shadow: 0 0 24px rgba(74, 222, 128, 0.25); }
}

/* ── View Result Button ── */
.office-chat-header-left {
  display: flex; align-items: center; gap: 8px;
}
.office-view-result-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 6px;
  border: 1px solid rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.08);
  color: #4ade80; font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  font-family: inherit;
}
.office-view-result-btn:hover {
  background: rgba(74, 222, 128, 0.15);
  border-color: #4ade80;
}
.office-view-result-btn svg { flex-shrink: 0; }

/* ── Multiple Thinking Indicators ── */
.office-msg-thinking + .office-msg-thinking {
  margin-top: -8px;
}

/* Glossary edit */
.glossary-item { cursor: pointer; transition: background 0.15s; }
.glossary-item:hover { background: rgba(255,255,255,0.05); }
.glossary-item.editing { background: rgba(255,255,255,0.08); padding: 8px; cursor: default; display: block; position: relative; z-index: 10; }
.glossary-edit-form { display: flex; flex-direction: column; gap: 6px; }
.glossary-edit-pali, .glossary-edit-viet {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.15);
  color: #e0e0e0; padding: 4px 8px; border-radius: 4px; font-size: 13px; width: 100%; box-sizing: border-box;
}
.glossary-edit-pali:focus, .glossary-edit-viet:focus { border-color: #7c8aff; outline: none; }
.glossary-edit-strict { font-size: 12px; color: #aaa; display: flex; align-items: center; gap: 4px; }
.glossary-edit-actions { display: flex; gap: 6px; }
.glossary-btn-save, .glossary-btn-cancel {
  padding: 3px 12px; border: none; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.glossary-btn-save { background: #5a6aff; color: #fff; }
.glossary-btn-save:hover { background: #4a5aee; }
.glossary-btn-cancel { background: rgba(255,255,255,0.1); color: #ccc; }
.glossary-btn-cancel:hover { background: rgba(255,255,255,0.15); }

.cache-status-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  font-size: 0.75em;
}

/* Member badge tooltip */
.office-member-badge {
  cursor: help;
  position: relative;
}
.office-member-badge[title]:hover {
  background: #3a3d45;
}

/* Click-to-mention member badges */
.office-member-clickable {
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.office-member-clickable:hover {
  background: rgba(91, 156, 246, 0.15);
  transform: translateY(-1px);
}
.office-member-clickable:active {
  transform: scale(0.95);
}
.mention-flash {
  background: rgba(91, 156, 246, 0.3) !important;
}