/* ==========================================================================
   MIICiQ — Enterprise Knowledge Assistant Stylesheet
   Modern, Dark/Light High-End Intranet Design System
   ========================================================================== */

:root {
  /* Color Tokens */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.75);
  --bg-hover: rgba(51, 65, 85, 0.6);
  --bg-input: #0f172a;
  
  --border-subtle: #1e293b;
  --border-medium: #334155;
  --border-focus: #38bdf8;

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

  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --gradient-brand: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #6366f1 100%);
  --gradient-card: linear-gradient(180deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.7) 100%);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.25);

  --sidebar-width: 280px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* App Shell Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* New Chat Action Button */
.sidebar-action-wrap {
  padding: 0.85rem 1rem;
}

.btn-new-chat {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-new-chat:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Nav & Mode Switcher */
.sidebar-nav {
  padding: 0.25rem 1rem 0.75rem;
}

.mode-toggle {
  display: flex;
  background: var(--bg-primary);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Session History List */
.sidebar-history {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
}

.history-heading {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.5rem 0.35rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
  transition: all 0.15s ease;
}

.history-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.history-item.active {
  background: rgba(6, 182, 212, 0.15);
  border-left: 3px solid var(--accent-cyan);
  color: #ffffff;
  font-weight: 500;
}

.history-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  opacity: 0;
  cursor: pointer;
  padding: 0.2rem;
  transition: opacity 0.15s, color 0.15s;
}

.history-item:hover .history-del-btn {
  opacity: 0.8;
}

.history-del-btn:hover {
  color: var(--accent-rose);
  opacity: 1;
}

/* Sidebar Footer & User Profile */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.user-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--accent-indigo);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role-badge {
  font-size: 0.65rem;
  color: var(--accent-cyan);
}

.btn-switch-role {
  background: none;
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.45rem;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-switch-role:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.2s;
}

.admin-nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Top Navigation Bar */
.top-nav {
  height: 56px;
  padding: 0 1.5rem;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 20;
}

.top-nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
}

.active-chat-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.top-nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.system-status-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.status-dot.online {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.status-dot.offline {
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

/* Chat Messages Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

.messages-list {
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 1rem;
}

/* Empty State / Welcome Screen */
.welcome-screen {
  max-width: 720px;
  margin: 3rem auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-glow);
}

.welcome-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.welcome-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 520px;
  margin-bottom: 2rem;
}

.quick-prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
}

.prompt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.prompt-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.prompt-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.prompt-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Message Bubbles */
.message-row {
  display: flex;
  gap: 1rem;
  width: 100%;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row.user {
  justify-content: flex-end;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.message-avatar.ai {
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.message-avatar.user {
  background: var(--accent-indigo);
  color: #ffffff;
}

.message-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.message-bubble {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.93rem;
  line-height: 1.6;
  position: relative;
}

.message-row.user .message-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: var(--radius-sm);
}

.message-row.assistant .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
}

/* Markdown Formatting Inside AI Bubble */
.message-bubble p {
  margin-bottom: 0.75rem;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble ul, .message-bubble ol {
  margin: 0.5rem 0 0.75rem 1.5rem;
}

.message-bubble li {
  margin-bottom: 0.35rem;
}

.message-bubble code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.85em;
  color: #38bdf8;
}

.message-bubble strong {
  color: #ffffff;
}

/* Source Citations Section */
.citations-wrap {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.citations-header {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.citations-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.citation-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.citation-pill:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
  color: #ffffff;
  transform: translateY(-1px);
}

.citation-badge {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.05rem 0.3rem;
  border-radius: var(--radius-full);
}

/* Feedback & Action Toolbar */
.message-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding-left: 0.25rem;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.action-btn.active-thumbs-up {
  color: var(--accent-emerald);
}

.action-btn.active-thumbs-down {
  color: var(--accent-rose);
}

.latency-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0.2rem;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* Chat Input Bar */
.chat-input-area {
  padding: 1rem 1.5rem 1.25rem;
  background: linear-gradient(180deg, rgba(11, 15, 25, 0) 0%, var(--bg-primary) 30%);
  flex-shrink: 0;
}

.input-box-container {
  max-width: 840px;
  margin: 0 auto;
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-box-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  max-height: 180px;
  padding: 0.35rem 0;
}

.chat-textarea::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-cyan);
  border: none;
  color: #0b0f19;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  background: #38bdf8;
  transform: scale(1.05);
}

.btn-send:disabled {
  background: var(--border-medium);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.input-footer-note {
  max-width: 840px;
  margin: 0.4rem auto 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Native Modal Dialogs (closedby="any") */
dialog {
  margin: auto;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 640px;
  width: 90%;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.6);
  outline: none;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.dialog-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.dialog-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.btn-close-dialog {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.btn-close-dialog:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.dialog-body {
  font-size: 0.9rem;
  line-height: 1.6;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
}

/* Search Page Styles */
.search-container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  height: 100%;
}

.search-header-wrap {
  margin-bottom: 1.5rem;
}

.search-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--border-focus);
}

.filter-pills-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.filter-pill.active {
  background: var(--accent-cyan);
  color: #0b0f19;
  font-weight: 600;
  border-color: var(--accent-cyan);
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.search-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: transform 0.2s, border-color 0.2s;
}

.search-result-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.card-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.card-doc-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
}

.score-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  font-weight: 600;
}

.card-snippet {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Admin Dashboard Styles */
.admin-container {
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  height: 100%;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
}

.admin-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-tab-btn {
  padding: 0.75rem 0.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  font-weight: 600;
}

.data-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.data-table th {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.badge-status {
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-status.indexed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.badge-status.processing {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-status.failed {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

/* Upload Form Card */
.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.form-control {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  overflow: auto;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(6, 182, 212, 0.12), transparent 60%),
    var(--bg-primary);
}

.login-card {
  width: min(100%, 420px);
  max-width: 420px;
  flex: 0 0 auto;
  margin: 0 auto;
  background: var(--bg-card);
  background-image: var(--gradient-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.75rem;
  text-align: center;
}

.login-logo {
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  margin-bottom: 0.35rem;
}

.login-title {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.login-subtitle {
  margin: 0.4rem 0 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-submit {
  margin-top: 0.5rem;
  background: var(--gradient-brand);
  border-color: transparent;
  color: #ffffff;
}

.login-submit:hover {
  background: var(--gradient-brand);
  border-color: transparent;
  filter: brightness(1.08);
}

.login-error {
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: var(--radius-sm);
}

.login-note {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.login-note a {
  color: var(--text-link);
  text-decoration: none;
}

.login-note a:hover {
  text-decoration: underline;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  }

  .mobile-menu-btn {
    display: block;
  }

  .quick-prompts-grid {
    grid-template-columns: 1fr;
  }
}
