@import url('/web/grounded.css');
:root {
  --bg-base: #09090b;
  --bg-surface: #121214;
  --bg-panel: #18181b;
  --bg-hover: #27272a;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-alpha: rgba(99, 102, 241, 0.15);
  
  --text-main: #f8fafc;
  --text-sec: #94a3b8;
  --text-muted: #64748b;
  --bg-topbar: rgba(9, 9, 11, 0.8);
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --font: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.light-theme {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-panel: #ffffff;
  --bg-hover: #f1f5f9;
  
  --border-subtle: rgba(0, 0, 0, 0.08);
  
  --accent-alpha: rgba(99, 102, 241, 0.1);
  
  --text-main: #0f172a;
  --text-sec: #475569;
  --text-muted: #64748b;
  --bg-topbar: rgba(255, 255, 255, 0.8);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg-base); color: var(--text-main); direction: rtl; line-height: 1.6; font-size: 14px; -webkit-font-smoothing: antialiased; transition: background 0.3s ease, color 0.3s ease; }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

/* Notice Toast */
#notice {
  position: fixed;
  bottom: 28px;
  left: 28px;
  right: auto;
  background: #18181b;
  border: 1px solid var(--border-subtle);
  padding: 14px 20px;
  border-radius: var(--radius);
  z-index: 99999;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
  font-weight: 500;
  min-width: 320px;
  max-width: 480px;
  direction: rtl;
  pointer-events: none;
}
#notice.visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
#notice.error {
  border-color: #ef4444;
  color: #fef2f2;
  background: #2b1113;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(239, 68, 68, 0.25);
}
#notice.success {
  border-color: #10b981;
  color: #ecfdf5;
  background: #062e24;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(16, 185, 129, 0.25);
}

body.light-theme #notice { background: #ffffff; color: #18181b; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15); }
body.light-theme #notice.success { background: #ecfdf5; color: #065f46; border-color: #10b981; }
body.light-theme #notice.error { background: #fef2f2; color: #991b1b; border-color: #ef4444; }

.notice-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.notice-text {
  flex: 1;
  text-align: right;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-main);
}
.notice-action-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.notice-action-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.03);
}

/* Typography */
h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.5px; }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
p { color: var(--text-sec); }
.eyebrow { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.5px; }
.text-muted { color: var(--text-muted); font-size: 13px; }

/* Layout Grid */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  height: 100vh;
  padding: 16px 14px 14px;
  z-index: 100;
  transition: background 0.3s ease;
  overflow: hidden;
  box-sizing: border-box;
}
.main-wrapper { flex: 1; margin-right: 260px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: 70px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-topbar); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: space-between; padding: 0 40px; position: sticky; top: 0; z-index: 90; transition: background 0.3s ease; }
.content { padding: 40px; max-width: 1300px; width: 100%; margin: 0 auto; flex: 1; animation: fadeIn 0.4s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Sidebar Elements */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 0 6px; flex-shrink: 0; }
.brand-icon { width: 40px; height: 40px; background: linear-gradient(135deg, var(--accent), #818cf8); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 4px 12px var(--accent-alpha); }
.brand-info strong { font-size: 17px; display: block; letter-spacing: -0.5px; }
.brand-info small { color: var(--text-muted); font-size: 12px; }

#context-zone { flex-shrink: 0; }
.context-pill { background: rgba(255,255,255,0.03); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; }
.context-pill small { color: var(--text-muted); font-size: 11px; display: block; margin-bottom: 2px; }
.context-pill strong { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.context-pill button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 11px; padding: 0; }
.context-pill button:hover { color: var(--accent-hover); text-decoration: underline; }

#navigation {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 4px;
  padding-right: 2px;
  margin-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}
#navigation::-webkit-scrollbar {
  width: 4px;
}
#navigation::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}
#navigation::-webkit-scrollbar-track {
  background: transparent;
}

.nav-group { margin-bottom: 14px; }
.nav-title { font-size: 11px; color: var(--text-muted); font-weight: 700; padding: 0 10px; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: var(--text-sec); border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); background: transparent; border: none; width: 100%; font-family: inherit; font-size: 13.5px; text-align: right; margin-bottom: 2px; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-item.active { background: var(--accent-alpha); color: var(--accent); font-weight: 600; }
.nav-item .icon { width: 18px; height: 18px; opacity: 0.8; }
.nav-item.active .icon { opacity: 1; }

.sidebar-footer { flex-shrink: 0; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.owner-tag { display: flex; align-items: center; gap: 10px; }
.owner-avatar { width: 32px; height: 32px; background: rgba(255,255,255,0.1); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; }
.logout-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 6px; border-radius: 4px; }
.logout-btn:hover { background: rgba(239, 68, 68, 0.1); color: var(--danger); }


/* Breadcrumb & Topbar */
.breadcrumb { font-size: 14px; color: var(--text-sec); display: flex; align-items: center; gap: 8px; }
.breadcrumb span { color: var(--text-muted); }

/* Components */
.card { background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 28px; margin-bottom: 24px; }
.card-header { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: flex-start; }
.card-header .badge { margin-top: 4px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.metric-card { background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; }
.followup-shortcut { width: 100%; font: inherit; color: inherit; text-align: start; }
.followup-shortcut:focus-visible, .owner-followups:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.owner-followups { scroll-margin-block-start: 24px; }
.owner-quick-start { display: flex; flex-direction: column; }
.quick-start-steps { margin: 8px 0 24px; padding-inline-start: 24px; color: var(--text-main); font-size: 13px; line-height: 1.9; }
.quick-start-steps li { padding-block: 6px; padding-inline-start: 6px; }
.owner-quick-start > .btn { align-self: flex-start; }
.metric-card.interactive, .card.interactive, .interactive-stat-card { cursor: pointer; transition: var(--transition); }
.metric-card.interactive:hover, .card.interactive:hover, .interactive-stat-card:hover { border-color: var(--accent) !important; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
.metric-label { font-size: 13px; color: var(--text-sec); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.metric-value { font-size: 28px; font-weight: 700; color: var(--text-main); margin-bottom: 6px; }
.metric-desc { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 10px 20px; font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition); font-family: inherit; min-height: 40px; }
.btn:hover { background: var(--accent-hover); }
.btn.outline { background: transparent; border: 1px solid var(--border-subtle); color: var(--text-main); }
.btn.outline:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.15); }
.btn.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.sm { padding: 6px 14px; min-height: 32px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon { width: 18px; height: 18px; }

/* Forms */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; color: var(--text-sec); }
input, select, textarea { width: 100%; background: var(--bg-surface); border: 1px solid var(--border-subtle); color: var(--text-main); border-radius: var(--radius-sm); padding: 12px 16px; font-family: inherit; font-size: 14px; outline: none; transition: var(--transition); }
input:focus, select:focus, textarea:focus { border-color: var(--border-focus); background: var(--bg-hover); }
.check-label { display: flex; align-items: center; gap: 10px; cursor: pointer; flex-direction: row; margin-bottom: 12px; }
.check-label input[type="checkbox"], .check-label input[type="radio"], input[type="checkbox"], input[type="radio"] { width: 18px !important; height: 18px !important; min-width: 18px !important; flex-shrink: 0 !important; accent-color: var(--accent); cursor: pointer; padding: 0 !important; margin: 0 !important; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg-hover); color: var(--text-sec); white-space: nowrap; }
.badge.success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge.warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge.danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Table */
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; text-align: right; }
th { padding: 14px 16px; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); font-weight: 500; }
td { padding: 16px; border-bottom: 1px solid var(--border-subtle); font-size: 14px; color: var(--text-main); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Login View */
.login-wrap { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at top, #141417, var(--bg-base)); }
.login-box { max-width: 420px; width: 100%; background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 40px; box-shadow: 0 20px 40px rgba(0,0,0,0.4); text-align: center; }
.login-box .brand-icon { margin: 0 auto 20px; width: 56px; height: 56px; border-radius: 14px; }
.login-box .brand-icon svg { width: 32px; height: 32px; }
.login-box h1 { font-size: 22px; margin-bottom: 8px; }
.login-box p { font-size: 14px; margin-bottom: 32px; }
.login-box label { text-align: right; }

/* Wizard Stepper */
.stepper-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; background: var(--bg-panel); padding: 16px 24px; border-radius: var(--radius); border: 1px solid var(--border-subtle); }
.step-item { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-weight: 500; position: relative; }
.step-item.active { color: var(--text-main); }
.step-item.done { color: var(--success); }
.step-number { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-hover); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; border: 1px solid var(--border-subtle); }
.step-item.active .step-number { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-item.done .step-number { background: rgba(16, 185, 129, 0.15); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }
.step-connector { flex: 1; height: 2px; background: var(--bg-hover); margin: 0 16px; border-radius: 2px; }
.step-connector.filled { background: var(--success); }

.step-content { display: none; animation: fadeIn 0.3s ease; }
.step-content.active { display: block; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; background: var(--bg-panel); border: 1px dashed var(--border-subtle); border-radius: var(--radius); }
.empty-state-icon { width: 64px; height: 64px; background: var(--bg-hover); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; color: var(--text-muted); }
.empty-state-icon svg { width: 32px; height: 32px; }

/* List Row */
.list-row { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); margin-bottom: 12px; background: var(--bg-panel); transition: var(--transition); }
.list-row:hover { border-color: rgba(255,255,255,0.15); }
.list-row-icon { width: 40px; height: 40px; background: var(--bg-hover); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-sec); }
.list-row-content { flex: 1; }
.list-row-content strong { display: block; font-size: 15px; margin-bottom: 4px; }
.list-row-content p { margin: 0; font-size: 13px; }
.list-row-actions { display: flex; gap: 8px; }

/* Utilities */
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end { display: flex; justify-content: flex-end; gap: 12px; }

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px;
}
.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}
.session-text-manager [hidden] {
  display: none;
}
.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  direction: rtl;
}
.modal-backdrop.visible .modal-card {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-alpha);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-icon svg {
  width: 22px;
  height: 22px;
}
.modal-icon.danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}
.modal-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}
.modal-body {
  color: var(--text-sec);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 24px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.btn.danger {
  background: var(--danger);
  color: #fff;
  border: none;
}
.btn.danger:hover {
  background: #dc2626;
}

/* Modal Variants */
.modal-card.wide {
  max-width: 680px;
}
.modal-card.large {
  max-width: 860px;
}

/* Filter Toolbar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

/* Chat & Ticket Modal Styles */
.ticket-card-item {
  transition: all 0.2s ease;
  cursor: pointer;
}
.ticket-card-item:hover {
  border-color: var(--accent) !important;
  background: var(--bg-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.chat-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  scrollbar-width: thin;
}
.chat-msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.7;
}
.chat-msg.student {
  align-self: flex-start;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-bottom-right-radius: 2px;
}
.chat-msg.teacher {
  align-self: flex-end;
  background: var(--accent-alpha);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
}
.chat-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.chat-msg-body {
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-outbox-info {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Log Entries */
.log-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
  transition: var(--transition);
}
.log-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}
.log-item summary {
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
  font-weight: 500;
  outline: none;
}
.log-item pre {
  background: var(--bg-base);
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 12px;
  overflow-x: auto;
  color: #93c5fd;
  direction: ltr;
  text-align: left;
  line-height: 1.5;
  margin: 0;
}

/* Mobile Navigation & Responsive Overrides */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .sidebar-overlay.open {
    display: block;
    opacity: 1;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 270px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.5);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-right: 0 !important;
    padding-bottom: 72px;
  }

  .topbar {
    padding: 0 16px;
    height: 58px;
  }

  .mobile-menu-btn {
    display: inline-flex !important;
  }

  #global-search {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .metric-card {
    padding: 18px;
  }

  .metric-value {
    font-size: 22px;
  }

  .card {
    padding: 18px;
  }

  .modal-card.wide, .modal-card.large, .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh !important;
    margin: 8px !important;
    border-radius: var(--radius) !important;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    z-index: 95;
    justify-content: space-around;
    align-items: center;
    padding: 4px 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
  }

  .bottom-nav-item {
    background: transparent;
    border: none;
    color: var(--text-sec);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    transition: var(--transition);
    border-radius: var(--radius-sm);
  }

  .bottom-nav-item .icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
  }

  .bottom-nav-item:hover {
    color: var(--text-main);
  }

  .bottom-nav-item.active {
    color: var(--accent);
    font-weight: 600;
  }

  .bottom-nav-item.active .icon {
    opacity: 1;
    transform: scale(1.1);
  }

  #notice {
    bottom: 76px;
    left: 16px;
    right: 16px;
    min-width: 0;
    max-width: none;
  }
}

/* Enhanced Questions Monitoring Cards & User Badges */
.q-item-card {
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-surface);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.question-card-item {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.question-card-item:hover {
  border-color: var(--accent) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.light-theme .question-card-item {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.light-theme .question-card-item:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* Question Filters Slider & Drawer */
.q-slider-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  min-width: 120px;
  text-align: center;
}
.q-slider-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.q-slider-card.active {
  background: var(--accent-alpha);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 1.5px var(--accent);
}
.light-theme .q-slider-card {
  background: #ffffff;
  border-color: #e2e8f0;
}
.light-theme .q-slider-card:hover {
  background: #f8fafc;
}
.light-theme .q-slider-card.active {
  background: #eef2ff;
  border-color: #6366f1;
}

.q-chip-track::-webkit-scrollbar {
  display: none;
}
.q-chip-track {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.modal-close-corner-btn {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  z-index: 30;
  transition: all 0.2s ease;
}
.modal-close-corner-btn:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  transform: scale(1.05);
}
.light-theme .modal-close-corner-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}
.light-theme .modal-close-corner-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
}




/* Scoped to the redesigned owner finance and incident pages. */
.main-wrapper:has(.finance-view), .main-wrapper:has(.operations-view) { min-width: 0; }
.finance-view, .operations-view { min-width: 0; }
.finance-view .grid-2 > *, .finance-view .grid-3 > *, .finance-view .grid-4 > *,
.operations-view .grid-3 > *, .finance-view .card-header > div, .operations-view .card-header > div { min-width: 0; }
.finance-view .table-wrap, .operations-view .table-wrap { max-width: 100%; }
.finance-view code, .operations-view code, .operations-view pre { overflow-wrap: anywhere; }
.operations-view pre { white-space: pre-wrap; max-width: 100%; }

.finance-view .btn { flex: none; width: auto; justify-self: start; align-self: end; min-height: 32px; padding: 6px 14px; font-size: 13px; }
.finance-view .metric-value { font-size: 23px; overflow-wrap: anywhere; }
.finance-toolbar { display: grid; gap: 12px; }
.finance-rate-form, .finance-period-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.finance-rate-form .form-group, .finance-period-form .form-group { margin: 0; flex: 0 1 240px; min-width: 0; }
.finance-period-form { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.finance-overview { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.finance-overview strong { display: block; margin-top: 6px; font-size: 20px; }
.finance-report-note { grid-column: 1 / -1; }
.finance-section > summary, .finance-advanced > summary { cursor: pointer; font-weight: 600; }
.finance-section-body { padding-top: 18px; }
.finance-advanced { margin: 12px 0; }
.finance-advanced[open] > summary { margin-bottom: 16px; }
#maintenance-card { padding: 20px 24px; }
#maintenance-card p { margin-bottom: 10px; }
#maintenance-card .mb-3 { margin-bottom: 10px; }
.maintenance-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.maintenance-actions .btn { flex: none; width: auto; }
.bot-wizard-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.bot-manual-link { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.bot-manual-link > summary { cursor: pointer; font-weight: 600; }
.bot-manual-link > p { margin: 12px 0; }
.pricing-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; margin: 20px 0; }
.pricing-controls label { display: block; margin-bottom: 12px; }
.pricing-controls input[type="range"] { width: 100%; accent-color: var(--accent); padding: 0; cursor: pointer; }
.pricing-selected { background: var(--accent-alpha); font-weight: 600; }
.finance-activity-chart { display: flex; gap: 5px; height: 130px; align-items: end; margin: 20px 0 8px; direction: ltr; }
.finance-activity-chart > div { flex: 1; height: 100%; display: flex; align-items: end; }
.finance-activity-chart span { display: block; width: 100%; background: var(--border-subtle); border-radius: 3px 3px 0 0; }
.finance-activity-chart span.active { background: var(--accent); }
@media (max-width: 640px) {
  .pricing-controls { grid-template-columns: 1fr; gap: 16px; }
  .finance-overview { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .finance-rate-form .form-group, .finance-period-form .form-group { flex: 1 1 150px; }
}



/* Answering statistics (collapsible section on the events page) */
.stats-details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.stats-details > summary::-webkit-details-marker { display: none; }
.stats-details > summary::before { content: '‹'; display: inline-block; transition: transform .2s; font-size: 18px; color: var(--text-sec); }
.stats-details[open] > summary::before { transform: rotate(-90deg); }
.stats-body { margin-top: 14px; }
.stats-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.stats-toolbar p { margin: 0; }
.stats-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-tile { border: 1px solid var(--border-subtle); border-radius: 12px; padding: 12px 14px; background: var(--bg-hover); min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-sec); }
.stat-value { font-size: 22px; font-weight: 700; margin: 2px 0; }
.stat-hint { font-size: 11.5px; color: var(--text-muted); }
.stats-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.stats-chart { border: 1px solid var(--border-subtle); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.stats-chart h4 { margin: 0 0 8px; font-size: 14px; }
.stats-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--text-sec); margin-bottom: 6px; }
.stats-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-left: 4px; }
.reason-row { margin-bottom: 10px; }
.reason-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.reason-track { background: rgba(220, 38, 38, .15); border-radius: 4px; height: 8px; }
.reason-fill { background: #dc2626; border-radius: 4px; height: 8px; }
.stats-note { font-size: 11.5px; margin-top: 10px; }


/* Question detail modal: label above value, nothing can overlap its neighbour */
.qd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 18px; font-size: 12.5px; }
.qd-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.qd-cell .badge { align-self: flex-start; max-width: 100%; white-space: normal; text-align: right; }
.qd-sources-body { margin-top: 10px; }
.qd-h { margin: 14px 0 8px; font-size: 13px; color: var(--text-sec); }
.qd-paragraph { border: 1px solid var(--border-subtle); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--bg-surface); }
.qd-paragraph-text { font-size: 13px; line-height: 1.8; margin-bottom: 6px; }
.qd-quote { font-size: 12.5px; color: var(--text-sec); line-height: 1.8; padding-right: 10px; border-right: 3px solid var(--accent); margin-top: 4px; }
.qd-source { border: 1px solid var(--border-subtle); border-radius: 10px; margin-bottom: 8px; background: var(--bg-surface); }
.qd-source.is-cited { border-color: rgba(16, 185, 129, .45); }
.qd-source > summary { cursor: pointer; padding: 9px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; }
.qd-source-text { padding: 4px 12px 12px; font-size: 13px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.qd-source-text mark { background: rgba(16, 185, 129, .28); color: inherit; border-radius: 4px; padding: 0 2px; }
.qd-source-tag { font-family: monospace; font-size: 11px; background: var(--accent-alpha); color: var(--accent); border-radius: 6px; padding: 1px 7px; }
