/* ------------------------------
   THEME VARIABLES
------------------------------ */
:root {
  --bg: #f4f5f7;
  --bg-secondary: #f0f0f0;
  --bg-alt: #f5f5f5;
  --field-bg: #f5f5f5;
  --text: #222;
  --text-muted: #888;
  --text-secondary: #999;
  --success: #28a745;
  --panel-bg: #fff;
  --panel-border: #ddd;
  --border: #ddd;
  --accent: #007bff;
  --accent-hover: #005fcc;
  --sidebar-bg: #111;
  --sidebar-border: #222;
  --nav-btn-bg: #1a1a1a;
  --nav-btn-hover: #2a2a2a;
  --bubble-user: #007bff;
  --bubble-ai: #e5e7eb;
  --danger: #dc3545;
  --tooltip-bg: #1a1a2e;
  --tooltip-text: #e0e0ff;
  --tooltip-border: #2a2a4a;
}

body.dark {
  --bg: #0d0d0d;
  --bg-secondary: #222;
  --bg-alt: #1f1f1f;
  --field-bg: #2a2a2a;
  --text: #eee;
  --text-muted: #999;
  --text-secondary: #bbb;
  --success: #4caf50;
  --panel-bg: #1a1a1a;
  --panel-border: #333;
  --border: #444;
  --accent: #4da3ff;
  --accent-hover: #1c7be0;
  --sidebar-bg: #000;
  --sidebar-border: #111;
  --nav-btn-bg: #111;
  --nav-btn-hover: #222;
  --bubble-user: #4da3ff;
  --bubble-ai: #2a2a2a;
  --danger: #f77;
  --tooltip-bg: #161625;
  --tooltip-text: #c8c8f0;
  --tooltip-border: #2e2e50;
}

/* ------------------------------
   GLOBAL
------------------------------ */
* {
  box-sizing: border-box;
  /* Thin auto-hiding scrollbars (Firefox) */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

*:hover,
*:focus-within {
  scrollbar-color: rgba(128, 128, 128, 0.45) transparent;
}

/* Webkit (Chrome, Edge, Safari) — hidden by default, visible on hover */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
  transition: background 0.3s;
}
*:hover::-webkit-scrollbar-thumb,
*:focus-within::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.45);
}
*:hover::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.7);
}

body {
  margin: 0;
  font-family: "Inter", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

/* Prevent text selection on buttons for rapid clicking */
button {
  user-select: none;
  -webkit-user-select: none;
}

/* Focus-visible for keyboard accessibility */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ------------------------------
   AUTH GATE
------------------------------ */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d0d;
}
.auth-gate-card {
  text-align: center;
  max-width: 400px;
  padding: 48px 32px;
}
.auth-gate-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  border-radius: 16px;
}
.auth-gate-loading p {
  color: #999;
  margin-top: 16px;
  font-size: 0.95rem;
}
.auth-gate-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top-color: #4da3ff;
  border-radius: 50%;
  margin: 0 auto;
  animation: authSpin 0.8s linear infinite;
}
@keyframes authSpin {
  to { transform: rotate(360deg); }
}
.auth-gate-prompt h2 {
  font-size: 1.25rem;
  margin: 0 0 8px;
  color: #eee;
}
.auth-gate-prompt p {
  color: #999;
  margin: 0 0 24px;
  line-height: 1.5;
}
.auth-gate-btn {
  background: #4da3ff;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.auth-gate-btn:hover {
  background: #1c7be0;
  transform: translateY(-1px);
}
.auth-gate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.auth-gate-error p {
  color: #d9534f;
  line-height: 1.5;
}

/* System-down state */
.auth-gate-system-down {
  text-align: center;
}
.auth-gate-system-down h2 {
  font-size: 1.25rem;
  margin: 0 0 8px;
  color: #00d4ff;
}
.auth-gate-system-down p {
  color: #999;
  margin: 0 0 24px;
  line-height: 1.5;
}
.auth-gate-system-down-logo {
  width: 240px;
  height: auto;
  margin-bottom: 16px;
  border-radius: 0;
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at center, black 35%, transparent 72%);
  mask-image: radial-gradient(ellipse 80% 80% at center, black 35%, transparent 72%);
}
.auth-gate-retry-btn {
  background: #00d4ff !important;
  color: #0a0a0a !important;
}
.auth-gate-retry-btn:hover {
  background: #33dfff !important;
}

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ------------------------------
   SIDEBAR
------------------------------ */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.15s ease;
  z-index: 10;
}

/* .sidebar.collapsed {
  transform: translateX(-240px);
} */

.sidebar.collapsed {
  transform: translateX(-240px);
  width: 0;
  padding: 0;
  border: none;
}


/* Sidebar hover zone — invisible strip along the left edge */
.sidebar-hover-zone {
  position: fixed;
  top: 0;
  left: 0;
  width: 52px;
  height: 100vh;
  z-index: 20;
  pointer-events: none;           /* default: pass-through */
}
.sidebar-hover-zone.active {
  pointer-events: auto;           /* JS adds .active when sidebar collapses */
  cursor: pointer;
}

/* Floating arrow button */
.sidebar-toggle-floating {
  position: absolute;
  top: 20px;
  left: 12px;
  background: var(--sidebar-bg);
  color: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 18px;
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s;
  pointer-events: auto;           /* always clickable */
}

.sidebar-toggle-floating.fade-on-hover {
  opacity: 0;
  transition: opacity 0.3s;
}
/* Reveal arrow when hovering anywhere in the zone */
.sidebar-hover-zone:hover .sidebar-toggle-floating.fade-on-hover {
  opacity: 1;
}

.sidebar-toggle-floating:hover {
  background: #222;
}

.sidebar-toggle-floating.rotated {
  transform: rotate(180deg);
}

/* Logo */
.logo-block {
  display: flex;
  justify-content: center;
  margin: 10px 0 35px 0;
}

.logo-icon {
  width: 110px;
  height: 110px;
  animation: fadeIn 0.4s ease;
}

/* Nav buttons */
.nav-btn {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--nav-btn-bg);
  color: #fff;
  border: none;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.15s ease;
}

.nav-btn:hover {
  background: var(--nav-btn-hover);
  transform: translateX(3px);
}

.nav-btn.active {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.6);
}

/* Footer buttons */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.lang-select {
  background: var(--nav-btn-bg);
  color: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: background 0.25s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px;
}
.lang-select:hover {
  background: var(--nav-btn-hover);
}
.lang-select:focus {
  border-color: var(--accent);
}
.lang-select option {
  background: #1a1a1a;
  color: #fff;
}

.icon-btn {
  background: var(--nav-btn-bg);
  color: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  transition: background 0.25s ease;
}

.icon-btn:hover {
  background: var(--nav-btn-hover);
}

/* ------------------------------
   MAIN CONTENT
------------------------------ */
.content {
  position: relative;
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  overflow-anchor: auto;
  margin: 5px 20px 0 20px;
  animation: fadeIn 0.3s ease;
  transition: opacity 0.3s ease-in-out;
}

/* ─── Page Load Overlay ─── */
.page-load-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.page-load-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.content:has(.page-load-overlay.active) {
  overflow: hidden;
}
.page-load-overlay-ring {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: overlayRingSpin 0.8s linear infinite;
}
@keyframes overlayRingSpin {
  to { transform: rotate(360deg); }
}
.page-load-overlay-text {
  font-size: 13px;
  color: var(--text-muted, #888);
  margin: 0;
  letter-spacing: 0.3px;
}

/* ─── Sidebar Collapse Lock (during page load) ─── */
.sidebar-collapse-locked #sidebarToggle,
.sidebar-collapse-locked .sidebar-toggle-floating {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}

/* ─── Page Load Progress Bar ─── */
.page-progress-bar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.page-progress-bar.active {
  opacity: 1;
}
.page-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover), var(--accent));
  background-size: 200% 100%;
  animation: progressShine 1.5s ease-in-out infinite;
  border-radius: 0 2px 2px 0;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.4);
}
.page-progress-bar.done .page-progress-fill {
  width: 100% !important;
  transition: width 0.2s ease;
}
.page-progress-bar.fade-out {
  opacity: 0;
  transition: opacity 0.4s ease 0.15s;
}
@keyframes progressShine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Lazy Panel Deferred Render ─── */
/* Panels collapse while loading off-screen, expand when scrolled into view */
.panel[data-lazy-state="loading"],
.panel[data-lazy-state="loaded"] {
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  border-color: transparent;
  opacity: 0;
}
.panel[data-lazy-state="ready"] {
  max-height: none;
  overflow: visible;
  opacity: 1;
  transition: opacity 0.15s ease;
}

/* ⭐ NEW: Add padding only when sidebar is collapsed */
body.sidebar-collapsed .content {
  padding-left: 40px;
}

/* Page transitions */
.page {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  display: none;
}

.page.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Conversation header with session ID */
.conversation-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.conversation-session-id {
  font-size: 12px;
  color: var(--text-muted, #888);
  font-family: monospace;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  user-select: all;
}
.conversation-session-id:hover {
  opacity: 1;
  color: var(--accent);
}
.conversation-session-id:empty {
  display: none;
}

/* ------------------------------
   CHAT NOTIFICATION BADGE
------------------------------ */
.chat-notify-badge {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  z-index: 9000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: chatBadgePulse 2s ease-in-out infinite;
}
.chat-notify-badge:hover {
  transform: scale(1.05);
}
.chat-notify-badge.hidden {
  display: none;
}
.chat-notify-icon {
  font-size: 18px;
}
@keyframes chatBadgePulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35); }
  50% { box-shadow: 0 4px 24px rgba(59, 130, 246, 0.5); }
}

/* Nav button notification dot */
.nav-notify-dot {
  display: none;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  margin-left: 8px;
  flex-shrink: 0;
  animation: dotPulse 1.5s ease-in-out infinite;
}
.nav-notify-dot.visible {
  display: inline-block;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ------------------------------
   TOAST NOTIFICATIONS
------------------------------ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  max-width: 400px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.toast.success {
  background: #2ecc71;
}
.toast.warning {
  background: #f0ad4e;
  color: #333;
}
.toast.error {
  background: #d9534f;
}
.toast.info {
  background: var(--accent);
}

/* ------------------------------
   CUSTOM TOOLTIPS
------------------------------ */
.odin-tooltip {
  position: fixed;
  z-index: 10000;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  max-width: 420px;
  white-space: normal;
  width: max-content;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  border: 1px solid var(--tooltip-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(100, 100, 200, 0.08);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.odin-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.odin-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--tooltip-border);
}
.odin-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--tooltip-bg);
  z-index: 1;
}

/* ------------------------------
   INPUTS & BUTTONS
------------------------------ */
input[type="text"],
textarea {
  width: 100%;
  /* padding: 12px; */
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  /* margin-top: 10px; */
  /* font-size: 15px; */
  background: var(--panel-bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 4px var(--accent);
  outline: none;
}

button.primary {
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 0;
  line-height: 1;
  transition: background 0.2s ease, transform 0.15s ease;
}

button.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

button.primary:active {
  transform: translateY(0);
}

button.secondary {
  padding: 10px 18px;
  background: #ff6b47;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-left: 8px;
  line-height: 1;
  transition: background 0.2s ease, transform 0.15s ease;
}

button.secondary:hover {
  background: #e55a3c;
  transform: translateY(-2px);
}

button.secondary:active {
  transform: translateY(0);
}

.hidden {
  display: none;
}

/* ------------------------------
   PANELS
------------------------------ */
.panel {
  background: var(--panel-bg);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Re-auth section in Support */
.reauth-panel {
  border-left: 3px solid var(--accent);
}
.reauth-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
  font-size: 0.95rem;
}
.reauth-status-icon {
  font-size: 12px;
  line-height: 1;
}
.reauth-checking { color: #f0ad4e; }
.reauth-connected { color: #5cb85c; }
.reauth-disconnected { color: #d9534f; }
.reauth-btn {
  margin-top: 0;
}

/* Support page sections */
.support-section h2 {
  margin-bottom: 12px;
}
.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.support-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.support-item-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #999);
  font-weight: 600;
}
.support-link {
  color: var(--accent);
  text-decoration: none;
}
.support-link:hover {
  text-decoration: underline;
}
.support-id-value {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: all;
  display: inline-block;
}
.support-id-value:hover {
  background: var(--accent);
  color: #fff;
}
.support-response-tiers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.support-tier {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.support-tier-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 72px;
  text-align: center;
  flex-shrink: 0;
}
.tier-enterprise { background: var(--accent); color: #fff; }
.tier-premium { background: rgba(168,85,247,0.85); color: #fff; }
.tier-standard { background: rgba(128,128,128,0.25); color: var(--text); }
.support-description {
  color: var(--text-secondary, #bbb);
  line-height: 1.6;
  margin-bottom: 12px;
}
.support-disclosure {
  background: rgba(128,128,128,0.06);
  border-left: 2px solid var(--panel-border);
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 0 6px 6px 0;
}
.support-disclosure h3 {
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
}
.support-disclosure p {
  color: var(--text);
  opacity: 0.75;
  line-height: 1.6;
  margin: 0;
}
.support-policy-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  margin-top: 8px;
  transition: color 0.2s;
}
.support-policy-link:hover {
  color: #e55a3c;
}
.support-rights-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.support-rights-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text);
  opacity: 0.75;
  line-height: 1.5;
}
.support-rights-list li:last-child {
  border-bottom: none;
}
.support-rights-list li strong {
  color: var(--text);
}

/* ------------------------------
   BUG REPORT FORM
------------------------------ */
.bug-report-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}
.bug-report-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.bug-report-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bug-report-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}
.bug-report-input,
.bug-report-textarea,
.bug-report-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  font-size: 14px;
  background: var(--panel-bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  line-height: 1.5;
  min-height: 42px;
  box-sizing: border-box;
}
.bug-report-input:focus,
.bug-report-textarea:focus,
.bug-report-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 4px var(--accent);
  outline: none;
}
/* Override browser autofill styles for dark mode */
.bug-report-input:-webkit-autofill,
.bug-report-input:-webkit-autofill:hover,
.bug-report-input:-webkit-autofill:focus,
.bug-report-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--panel-bg) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  border: 1px solid var(--panel-border);
  transition: background-color 5000s ease-in-out 0s;
}
.bug-report-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}
.bug-report-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}
.bug-report-charcount {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: -2px;
}
.bug-report-note {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--panel-bg);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.bug-report-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: normal;
}
.bug-report-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}
.bug-report-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}
.bug-report-submit {
  padding: 10px 18px;
}
.bug-report-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.bug-report-status {
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.bug-report-status.success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.bug-report-status.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.bug-report-status.hidden {
  display: none;
}

/* ------------------------------
   SUPPORT CHATBOT
------------------------------ */
.support-chatbot-panel {
  border-left: 3px solid var(--accent);
}
.support-chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.support-chatbot-header h2 {
  margin: 0;
}
.support-chatbot-actions {
  display: flex;
  gap: 6px;
}
.support-chatbot-clear {
  background: none;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--text);
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}
.support-chatbot-clear:hover {
  opacity: 1;
  background: var(--bg);
}
.support-chatbot-subtitle {
  margin: 0 0 12px;
  font-size: 13px;
  opacity: 0.65;
}
.support-chatbot-window {
  height: 320px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Welcome state */
.support-chatbot-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  flex: 1;
}
.support-chatbot-welcome-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.support-chatbot-welcome p {
  margin: 0 0 16px;
  font-size: 14px;
  opacity: 0.75;
}
.support-chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.support-chatbot-suggestion {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.support-chatbot-suggestion:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Chat bubbles (reuse existing patterns) */
.support-chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.45;
  font-size: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: fadeIn 0.2s ease;
}
.support-chat-bubble.user {
  background: var(--bubble-user);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.support-chat-bubble.assistant {
  background: var(--bubble-ai);
  color: var(--text);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}
.support-chat-bubble.assistant a {
  color: var(--accent);
  text-decoration: underline;
}
.support-chat-bubble.error {
  background: rgba(220, 53, 69, 0.08);
  color: #dc3545;
  margin-right: auto;
  border-left: 3px solid #dc3545;
  font-size: 13px;
}
body.dark .support-chat-bubble.error {
  background: rgba(255, 100, 100, 0.08);
  color: #f77;
  border-left-color: #f77;
}

/* Typing indicator */
.support-chat-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bubble-ai);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  margin-right: auto;
  max-width: 60px;
}
.support-chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.4;
  animation: supportTypingBounce 1.2s ease-in-out infinite;
}
.support-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.support-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes supportTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Input row */
.support-chatbot-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}
.support-chatbot-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.support-chatbot-input:focus {
  border-color: var(--accent);
}
.support-chatbot-input::placeholder {
  color: var(--text);
  opacity: 0.4;
}
.support-chatbot-charcount {
  display: none;
  position: absolute;
  right: 90px;
  bottom: -16px;
  font-size: 10px;
  color: var(--text-secondary, #999);
}
.support-chatbot-charcount.over-limit {
  color: #d9534f;
  font-weight: 600;
}
.support-chatbot-send {
  padding: 10px 18px;
  font-size: 14px;
  white-space: nowrap;
}
.support-chatbot-send:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Context bar */
.support-chatbot-context-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.65;
}
.support-chatbot-context-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.support-chatbot-context-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
}
.support-chatbot-context-hint {
  font-style: italic;
}

/* Intent badge on assistant bubbles */
.support-intent-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--accent);
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  margin-bottom: 6px;
  opacity: 0.8;
}
/* Intent-specific badge colors */
.support-intent-badge.intent-danger  { background: #d9534f; }
.support-intent-badge.intent-warn    { background: #e68a00; }
.support-intent-badge.intent-info    { background: #0074d9; }
.support-intent-badge.intent-guide   { background: #2eaa5e; }
.support-intent-badge.intent-neutral { background: #888; }

/* Context-used indicator */
.support-context-used {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  opacity: 0.55;
  margin: -4px 0 2px;
  flex-wrap: wrap;
}
.support-context-icon {
  font-size: 12px;
}
.support-context-tag {
  background: var(--panel-border);
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  text-transform: capitalize;
}

/* Inline suggestion pills (after assistant responses) */
.support-chatbot-suggestions.inline {
  justify-content: flex-start;
  margin: 0;
}

/* Code blocks inside assistant bubbles */
.support-chat-bubble pre.support-code-block {
  background: rgba(0, 0, 0, 0.06);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  overflow-x: auto;
  margin: 6px 0 2px;
  white-space: pre-wrap;
  word-break: break-word;
}
body.dark .support-chat-bubble pre.support-code-block {
  background: rgba(255, 255, 255, 0.06);
}
.support-chat-bubble code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
body.dark .support-chat-bubble code {
  background: rgba(255, 255, 255, 0.08);
}
.support-chat-bubble ul {
  margin: 4px 0;
  padding-left: 18px;
}
.support-chat-bubble li {
  margin: 2px 0;
}

/* System Message Modal */
.system-message-modal {
  max-width: 480px;
}
.system-message-modal .modal-header {
  border-top: 4px solid var(--accent);
  border-radius: 12px 12px 0 0;
}
.system-message-modal.msg-info .modal-header { border-top-color: var(--accent); }
.system-message-modal.msg-warning .modal-header { border-top-color: #f0a500; }
.system-message-modal.msg-error .modal-header { border-top-color: var(--danger); }

.system-message-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 15px;
  margin-right: 10px;
  flex-shrink: 0;
}
.msg-info .system-message-type-icon { background: rgba(66,133,244,0.15); color: var(--accent); }
.msg-warning .system-message-type-icon { background: rgba(240,165,0,0.15); color: #f0a500; }
.msg-error .system-message-type-icon { background: rgba(220,53,69,0.15); color: var(--danger); }

.msg-info .system-message-dismiss { background: var(--accent); }
.msg-info .system-message-dismiss:hover { background: var(--accent-hover); }
.msg-warning .system-message-dismiss { background: #f0a500; color: #1a1a1a; }
.msg-warning .system-message-dismiss:hover { background: #d49300; }
.msg-error .system-message-dismiss { background: var(--danger); }
.msg-error .system-message-dismiss:hover { background: #c0392b; }

/* Welcome Modal */
.welcome-modal {
  max-width: 520px;
  overflow: hidden;
}
.welcome-modal-hero {
  text-align: center;
  padding: 32px 24px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, #1c7be0 100%);
  color: #fff;
}
.welcome-modal-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.welcome-modal-hero h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}
.welcome-modal-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  opacity: 0.85;
}
.welcome-modal-body {
  max-height: 55vh;
  overflow-y: auto;
}
.welcome-section {
  margin-bottom: 18px;
}
.welcome-section h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.welcome-section p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  opacity: 0.9;
}
.welcome-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.6;
}
.welcome-steps li {
  margin-bottom: 6px;
  opacity: 0.9;
}
.welcome-section-terms {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px 16px;
}
.welcome-section-terms h3 {
  margin-bottom: 8px;
}
.welcome-links {
  margin-top: 10px;
  font-size: 13px;
}
.welcome-links a {
  color: var(--accent);
  text-decoration: none;
}
.welcome-links a:hover {
  text-decoration: underline;
}
.welcome-link-sep {
  margin: 0 8px;
  opacity: 0.4;
}
.welcome-actions {
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: center;
}
.welcome-accept-btn {
  /* width: auto !important; */
  padding: 10px 36px !important;
  font-size: 15px !important;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
}
.welcome-accept-btn:hover {
  background: var(--accent-hover);
}
.system-message-body-text {
  color: var(--text-secondary, #bbb);
  line-height: 1.65;
  margin: 0 0 20px;
  font-size: 0.95rem;
}
.system-message-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.system-message-dismiss {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  width: auto;
  padding: 9px 22px !important;
}
.system-message-dismiss:hover {
  background: #e55a3c;
}

/* ------------------------------
   SESSIONS PANEL (collapsible)
------------------------------ */
.session-panel {
  padding: 0;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.session-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  cursor: pointer;
  user-select: none;
}

.session-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-panel-title h2 {
  margin: 0;
  font-size: 1.1em;
}

.session-panel-arrow {
  display: inline-block;
  font-size: 0.7em;
  color: var(--text);
  opacity: 0.5;
  transition: transform 0.25s ease;
}

.session-panel.open .session-panel-arrow {
  transform: rotate(90deg);
}

.session-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 0.75em;
  font-weight: 600;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
}

.session-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 0.82em;
  font-weight: 500;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.session-action-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.session-action-btn:active {
  transform: translateY(0);
}

.session-action-icon {
  font-size: 1.1em;
  line-height: 1;
}

.session-refresh-btn {
  padding: 8px 10px;
  font-size: 1em;
}

.session-refresh-btn.spinning {
  animation: spin-once 0.6s ease;
}

@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Generic refresh spin for any button */
.btn-refreshing {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}
.btn-refreshing::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Action button loading state (for async operations) */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}
.btn-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: middle;
}
/* Dark-background buttons already use white spinner; light-bg buttons need dark spinner */
.secondary.btn-loading::after {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--accent);
}

/* Session list (expandable body) */
.session-panel-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 18px;
}

.session-panel-body.visible {
  max-height: 400px;
  overflow-y: auto;
  padding: 0 18px 14px;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Session search bar */
.session-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.session-search-input {
  flex: 1;
  padding: 7px 12px;
  font-size: 13px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
}

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

.session-search-input::placeholder {
  color: var(--text);
  opacity: 0.4;
}

.session-search-go,
.session-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.session-search-go:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.session-search-clear {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.7;
}

.session-search-clear:hover {
  opacity: 1;
  color: #dc3545;
  border-color: #dc3545;
}

/* Session pagination */
.session-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 0 2px;
  margin-top: 6px;
  border-top: 1px solid var(--panel-border);
  position: sticky;
  bottom: 0;
  background: var(--panel-bg);
  z-index: 2;
}

.session-pagination.hidden {
  display: none;
}

.session-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.session-page-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.session-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.session-page-btn.hidden {
  display: none;
}

.session-page-info {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.session-page-info .page-input {
  width: 32px;
  padding: 2px 4px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: textfield;
  -moz-appearance: textfield;
}
.session-page-info .page-input::-webkit-outer-spin-button,
.session-page-info .page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.session-page-info .page-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.25);
}

/* Audit log pagination */
.audit-pagination,
.jobs-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 4px;
  margin-top: 8px;
  position: sticky;
  bottom: 0;
  background: var(--panel-bg);
  z-index: 2;
}

.page-size-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 8px center;
  background-size: 10px 6px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 56px;
  text-align: center;
  text-align-last: left;
}
.page-size-select:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.15);
}
.page-size-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.25);
}
.page-size-select option {
  background: var(--panel-bg);
  color: var(--text);
  padding: 6px 10px;
}
body.dark .page-size-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23aaa'/%3E%3C/svg%3E");
  color-scheme: dark;
}

.audit-pagination.hidden,
.jobs-pagination.hidden {
  display: none;
}

/* Pagination nav group — hides prev/next/page-info when only 1 page */
.pagination-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.pagination-nav.hidden {
  display: none;
}

.audit-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  margin-left: 4px;
}

.audit-download-btn:hover {
  background: var(--accent);
  color: #fff;
}

.session-empty {
  text-align: center;
  color: var(--text);
  opacity: 0.5;
  font-size: 0.88em;
  padding: 12px 0;
  margin: 0;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  border: 1px solid transparent;
}

.session-item:hover {
  background: var(--bg);
  border-color: var(--panel-border);
}

.session-item.active {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.session-item-content {
  flex: 1;
  min-width: 0;
}

.session-item-preview {
  font-size: 0.88em;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-meta {
  font-size: 0.75em;
  color: var(--text);
  opacity: 0.55;
  margin-top: 2px;
}

.session-item-time {
  font-size: 0.78em;
  color: var(--text);
  opacity: 0.45;
  white-space: nowrap;
}

/* ------------------------------
   CHAT BUBBLES
------------------------------ */
.chat-window {
  height: 300px;
  overflow-y: auto;
  padding-right: 10px;
}

.bubble {
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  max-width: 80%;
  line-height: 1.4;
  white-space: pre-wrap;
}

.bubble.user {
  background: var(--bubble-user);
  color: #fff;
  margin-left: auto;
}

.bubble.ai {
  background: var(--bubble-ai);
  color: var(--text);
  margin-right: auto;
}

.bubble.results {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  white-space: pre-wrap;
  color: var(--text);
  margin-right: auto;
}

/* ------------------------------
   SHIMMER LOADING
------------------------------ */
.shimmer {
  background: linear-gradient(90deg, #ccc 0%, #e0e0e0 50%, #ccc 100%);
  background-size: 200% 100%;
  animation: shimmerMove 1.2s infinite;
  height: 14px;
  border-radius: 6px;
  margin-bottom: 10px;
}
body.dark .shimmer {
  background: linear-gradient(90deg, #333 0%, #444 50%, #333 100%);
  background-size: 200% 100%;
}

@keyframes shimmerMove {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ------------------------------
   HELP PAGE TABLES & ELEMENTS
------------------------------ */
.help-table-wrapper {
  overflow-x: auto;
  margin: 12px 0;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.help-table th,
.help-table td {
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  text-align: left;
  vertical-align: top;
}

/* Audit tables: tighter cells to fit 9 columns */
#rollbackAuditTable th,
#rollbackAuditTable td,
#adminAuditTable th,
#adminAuditTable td {
  padding: 8px 10px;
  font-size: 13px;
}
#rollbackAuditTable td,
#adminAuditTable td {
  word-break: break-word;
  max-width: 220px;
  overflow: auto;
  scrollbar-width: thin;
}
#rollbackAuditTable .audit-error-cell,
#adminAuditTable .audit-error-cell {
  max-width: 0;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}
.audit-value-cell {
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: thin;
  word-break: break-word;
}
.audit-value-cell::-webkit-scrollbar {
  width: 3px;
}
.audit-value-cell::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.35);
  border-radius: 3px;
}
#rollbackAuditTable td::-webkit-scrollbar,
#adminAuditTable td::-webkit-scrollbar {
  height: 3px;
}
#rollbackAuditTable td::-webkit-scrollbar-thumb,
#adminAuditTable td::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.35);
  border-radius: 3px;
}

.help-table thead th {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

.help-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.03);
}

body.dark .help-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.help-table tbody tr:hover {
  background: rgba(0, 123, 255, 0.06);
}

.help-table code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
  border: 1px solid var(--panel-border);
  display: inline-block;
  margin: 2px 0;
}

.help-table-compact th,
.help-table-compact td {
  text-align: center;
  padding: 8px 10px;
}

.help-table-compact td:first-child {
  text-align: left;
  font-weight: 500;
}

.help-field-info {
  color: var(--text);
  opacity: 0.8;
  font-size: 14px;
  margin: 4px 0;
}

.help-field-op {
  font-size: 13px;
  opacity: 0.7;
  margin: 2px 0 10px 0;
  font-style: italic;
}

.help-tip {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(0, 123, 255, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
}

.help-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255, 107, 71, 0.08);
  border-left: 3px solid #ff6b47;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
}

.help-note ul {
  margin: 6px 0 0 0;
  padding-left: 20px;
}

.help-note li {
  margin-bottom: 4px;
}

.help-code-block {
  margin: 8px 0;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow-x: auto;
}

.help-code-block code {
  font-size: 13px;
  white-space: nowrap;
}

/* ------------------------------
   ANIMATIONS
------------------------------ */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* ------------------------------
   ROLLBACK LOG
------------------------------ */
.rollback-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* --- Global Auto-Refresh --- */
.global-refresh {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 8px;
}
.global-refresh-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 6px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.global-refresh-icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}
.global-refresh-select {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 4px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.global-refresh-select option {
  background: var(--panel-bg);
  color: var(--text);
}
.global-refresh-countdown {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 32px;
  text-align: center;
}

.rollback-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rollback-filter-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.rollback-filter-group select,
.rollback-input {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 14px;
  min-width: 120px;
  color-scheme: light;
}
body.dark .rollback-filter-group select,
body.dark .rollback-input {
  color-scheme: dark;
}
.rollback-filter-group select option {
  background: var(--panel-bg);
  color: var(--text);
}

.rollback-input {
  width: 160px;
  margin-top: 0;
}

/* ── Multi-select pill filters ─────────────────────── */
.multi-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.filter-pill {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0.55;
  user-select: none;
  white-space: nowrap;
  line-height: 1.3;
}
.filter-pill:hover {
  opacity: 0.85;
  border-color: var(--accent);
}
.filter-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  opacity: 1;
}

.rollback-audit-filters {
  margin-bottom: 14px;
}

.rollback-table {
  margin-top: 0;
}

.rollback-table tbody tr {
  cursor: default;
}

.admin-uid-cell {
  white-space: nowrap;
}
.admin-uid-chip {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: #f0f1f4;
  padding: 4px 10px;
  border-radius: 6px;
  color: #333;
  vertical-align: middle;
}
.copy-id-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  padding: 5px;
  color: #666;
  transition: all 0.15s;
  vertical-align: middle;
  margin-left: 6px;
}
.copy-id-btn:hover {
  background: #e0e0e0;
  color: #333;
  border-color: #ccc;
}
.copy-id-btn.copied {
  background: #d4edda;
  border-color: #28a745;
  color: #28a745;
}
body.dark .admin-uid-chip {
  background: #2a2a2a;
  color: #ccc;
}
body.dark .copy-id-btn {
  background: #2a2a2a;
  border-color: #444;
  color: #aaa;
}
body.dark .copy-id-btn:hover {
  background: #333;
  color: #eee;
  border-color: #555;
}
body.dark .copy-id-btn.copied {
  background: #1a3a2a;
  border-color: #28a745;
  color: #5dd879;
}

.rollback-job-id {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  opacity: 0.85;
  white-space: nowrap;
}
.admin-job-id-link {
  cursor: pointer;
  transition: color 0.15s;
}
.admin-job-id-link:hover {
  color: var(--accent);
  opacity: 1;
}
.rollback-job-id .copy-id-btn {
  margin-left: 6px;
  vertical-align: middle;
}

/* Copyable IDs in modals */
.copyable-id {
  font-family: 'Courier New', monospace;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: background 0.15s, border-color 0.15s;
}
body.dark .copyable-id {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}
.copyable-id:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}
body.dark .copyable-id:hover {
  background: rgba(255, 255, 255, 0.12);
}
.copyable-id::after {
  content: ' \1F4CB';
  font-size: 11px;
  opacity: 0.4;
  transition: opacity 0.15s;
}
.copyable-id:hover::after {
  opacity: 0.8;
}

/* Action column buttons — uniform sizing on desktop */
.rollback-table tbody td:last-child {
  white-space: nowrap;
}
.rollback-table tbody td:last-child button {
  height: 32px;
  padding: 0 12px !important;
  font-size: 13px;
  line-height: 32px;
  vertical-align: middle;
  box-sizing: border-box;
  margin-right: 6px;
  min-width: 80px;
}
.rollback-table tbody td:last-child button:last-child {
  margin-right: 0;
}

.rollback-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-success { background: rgba(40, 167, 69, 0.15); color: #28a745; }
.badge-error   { background: rgba(220, 53, 69, 0.15); color: #dc3545; }
.badge-running { background: rgba(0, 123, 255, 0.15); color: #007bff; }
.badge-pending { background: rgba(108, 117, 125, 0.15); color: #6c757d; }
.badge-warning { background: rgba(255, 193, 7, 0.15); color: #b8860b; }

body.dark .badge-success { color: #5dd879; }
body.dark .badge-error   { color: #f77; }
body.dark .badge-running { color: #6db8ff; }
body.dark .badge-pending { color: #adb5bd; }
body.dark .badge-warning { color: #ffc107; }

.field-fail-count { color: #dc3545; font-weight: 600; }
body.dark .field-fail-count { color: #f77; }

/* Error details table (job detail views) */
.error-details-table { margin-top: 8px; font-size: 13px; }
.error-details-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.error-details-table td.centered { text-align: center; }
.error-details-table td.error-detail-msg { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error-details-table code { background: var(--field-bg, var(--bg-secondary, #f5f5f5)); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* Operation badges (audit tables) */
.op-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.3px;
}
.op-set          { background: rgba(0, 123, 255, 0.12); color: #007bff; }
.op-add          { background: rgba(40, 167, 69, 0.12); color: #28a745; }
.op-remove       { background: rgba(220, 53, 69, 0.12); color: #dc3545; }
.op-transition   { background: rgba(111, 66, 193, 0.12); color: #6f42c1; }
.op-rollback     { background: rgba(255, 193, 7, 0.12); color: #b8860b; }
.op-unsupported  { background: rgba(220, 53, 69, 0.10); color: #a94442; }
.op-default      { background: rgba(108, 117, 125, 0.10); color: #6c757d; }

body.dark .op-set         { color: #6db8ff; }
body.dark .op-add         { color: #5dd879; }
body.dark .op-remove      { color: #f77; }
body.dark .op-transition  { color: #b48eff; }
body.dark .op-rollback    { color: #ffc107; }
body.dark .op-unsupported { color: #f99; }
body.dark .op-default     { color: #adb5bd; }

/* Audit error expansion */
.audit-error-toggle {
  cursor: pointer;
  user-select: none;
}
.audit-error-toggle:hover {
  filter: brightness(0.85);
}
.audit-error-row.hidden {
  display: none;
}
.audit-error-cell {
  background: rgba(220, 53, 69, 0.06);
  color: #b71c1c;
  font-family: monospace;
  font-size: 12px;
  padding: 8px 14px !important;
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 3px solid #dc3545;
}
body.dark .audit-error-cell {
  background: rgba(255, 100, 100, 0.08);
  color: #f99;
  border-left-color: #f77;
}
.audit-error-scroll {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}
.audit-error-scroll::-webkit-scrollbar {
  height: 4px;
}
.audit-error-scroll::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.35);
  border-radius: 2px;
}

/* Job-level error dropdown (mirrors audit error expansion) */
.job-error-detail {
  margin-top: 10px;
  border-radius: 6px;
  overflow: hidden;
}
.job-error-detail.hidden {
  display: none;
}
.job-error-detail .audit-error-cell {
  border-radius: 6px;
}

/* Job table inline error rows (main table expand) */
.job-table-error-row.hidden {
  display: none;
}
.job-table-error-toggle {
  cursor: pointer;
  user-select: none;
}
.job-table-error-toggle:hover {
  filter: brightness(0.85);
}

/* Field-level rollback button in audit rows */
.field-rollback-btn {
  padding: 10px 18px;
  border: 1px solid #dc3545;
  border-radius: 4px;
  background: transparent;
  color: #dc3545;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.field-rollback-btn:hover {
  background: #dc3545;
  color: #fff;
}
.field-rollback-btn:active {
  background: #b71c1c;
  border-color: #b71c1c;
  color: #fff;
}
body.dark .field-rollback-btn {
  border-color: #f77;
  color: #f77;
}
body.dark .field-rollback-btn:hover {
  background: #f77;
  color: #1a1a2e;
}
body.dark .field-rollback-btn:active {
  background: #d44;
  border-color: #d44;
  color: #fff;
}

.rollback-loading {
  padding: 8px 0;
  min-height: 120px;
  overflow-anchor: none;
}

.rollback-empty {
  text-align: center;
  padding: 24px;
  opacity: 0.6;
  font-style: italic;
  overflow-anchor: none;
}

.rollback-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rollback-close-btn {
  padding: 5px 14px !important;
  margin: 0 !important;
  font-size: 13px;
}

.rollback-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.rollback-detail-field {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  font-size: 14px;
}

.rollback-mono {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  word-break: break-all;
}

.rollback-detail-jql,
.rollback-detail-payload,
.rollback-detail-errors {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  font-size: 14px;
}

.rollback-detail-summary {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.rollback-detail-jql code {
  background: transparent;
  font-size: 13px;
  word-break: break-all;
}

.rollback-detail-payload pre,
.rollback-detail-errors pre {
  margin: 8px 0 0 0;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
}

.rollback-detail-errors {
  border-left: 3px solid #dc3545;
}

.rollback-error {
  color: #dc3545;
  font-style: italic;
}

/* ------------------------------
   JOB PROGRESS TRACKER
------------------------------ */
.inline-progress-row td {
  padding: 0 !important;
  border-top: none !important;
}

.inline-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 0 8px 8px;
  animation: slideDown 0.15s ease;
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; padding: 0 12px; }
  to   { opacity: 1; max-height: 60px; padding: 8px 12px; }
}

.inline-progress-left {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 13px;
}

.inline-progress-text {
  font-weight: 600;
  font-size: 13px;
}

.inline-progress-phase {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-transform: capitalize;
}

.inline-progress-pct {
  font-size: 12px;
  opacity: 0.7;
}

.inline-progress-eta {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.8;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.inline-progress-bar-track {
  flex: 1;
  min-width: 80px;
  height: 8px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  overflow: hidden;
}

.inline-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.inline-progress-right {
  flex-shrink: 0;
}

.inline-cancel-btn {
  padding: 5px 12px !important;
  font-size: 12px !important;
  border-radius: 4px;
}

.inline-progress-done .inline-progress-wrap {
  border-left-color: #2ea043;
}

.inline-progress-done .inline-progress-bar-fill {
  background: #2ea043;
}

.inline-progress-done.done-failed .inline-progress-wrap {
  border-left-color: #f85449;
}

.inline-progress-done.done-failed .inline-progress-bar-fill {
  background: #f85449;
}

.inline-progress-done.done-partial .inline-progress-wrap {
  border-left-color: #d29922;
}

.inline-progress-done.done-partial .inline-progress-bar-fill {
  background: #d29922;
}

.inline-progress-done.done-cancelled .inline-progress-wrap {
  border-left-color: #888;
}

.inline-progress-done.done-cancelled .inline-progress-bar-fill {
  background: #888;
}

.inline-progress-fade {
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Admin Job Mini Progress Bar */
.admin-job-progress {
  margin-top: 4px;
}

.admin-job-progress-track {
  height: 6px;
  min-width: 80px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  overflow: hidden;
}

.admin-job-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.admin-job-progress-text {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.admin-job-progress-indeterminate {
  width: 40% !important;
  animation: adminProgressSlide 1.4s ease-in-out infinite;
}

.user-cancel-btn,
.admin-job-cancel-btn {
  margin-left: 6px;
}

@keyframes adminProgressSlide {
  0%   { margin-left: 0%;  width: 30%; }
  50%  { margin-left: 50%; width: 40%; }
  100% { margin-left: 0%;  width: 30%; }
}

/* ------------------------------\n   ADMIN DASHBOARD\n------------------------------ */
.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-section-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.admin-stat-card {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.admin-stat-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.admin-stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
  margin-bottom: 6px;
}

.admin-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.admin-concurrency-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.admin-input-wide {
  max-width: 320px;
  width: 100%;
}
.admin-input-narrow {
  width: 120px;
}

.admin-set-override {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
}

.admin-override-status {
  margin-top: 14px;
}

.admin-override-timestamp {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted, #888);
}

.rollback-detail-field.badge-success {
  border-color: #2ea04380;
  background: #2ea04318;
}

.rollback-detail-field.badge-danger {
  border-color: #f8544980;
  background: #f8544918;
}

.admin-override-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.admin-view-btn {
  padding: 10px 18px !important;
  margin: 0 !important;
}

/* Admin Detail Actions row (cancel/delete/close) */
.admin-detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Danger button (delete, shutdown, purge) */
.admin-danger-btn {
  background: #dc3545;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  line-height: 1;
}
.admin-danger-btn:hover { background: #c82333; }
.admin-danger-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Field Blocker ─── */
.admin-fb-scope-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.admin-fb-scope-bar label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.admin-fb-scope-bar select {
  flex: 1;
  max-width: 320px;
}
.admin-fb-scope-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 100px;
  margin-left: 6px;
  vertical-align: middle;
}
.admin-fb-scope-badge--cloud {
  background: rgba(59,130,246,0.12);
  color: #3b82f6;
}
body.dark .admin-fb-scope-badge--cloud {
  background: rgba(59,130,246,0.2);
  color: #60a5fa;
}
.admin-field-blocker-search {
  margin-bottom: 12px;
}

.admin-section-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.admin-fb-save-btn {
  background: var(--success, #28a745);
  animation: fbSavePulse 1.5s ease-in-out infinite;
}
.admin-fb-save-btn:hover {
  background: #218838;
  animation: none;
}
@keyframes fbSavePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(40, 167, 69, 0); }
}
.admin-fb-discard-btn {
  color: var(--text-muted, #888);
}

/* Save bar at bottom of field blocker */
.admin-fb-sticky-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-top: 12px;
  background: var(--panel-bg);
  border-top: 2px solid var(--accent);
  border-radius: 0 0 8px 8px;
  gap: 12px;
  animation: fbStickySlideUp 0.25s ease;
}
@keyframes fbStickySlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.admin-fb-sticky-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.admin-fb-sticky-actions {
  display: flex;
  gap: 8px;
}

/* Stats bar */
.admin-fb-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px 0;
}
.admin-fb-stat {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 100px;
  background: var(--border);
  color: var(--text);
  opacity: 0.8;
}
.admin-fb-stat--ok {
  background: rgba(40, 167, 69, 0.12);
  color: #28a745;
  opacity: 1;
}
.admin-fb-stat--blocked {
  background: rgba(220, 53, 69, 0.1);
  color: var(--danger);
  opacity: 1;
}
body.dark .admin-fb-stat--ok {
  background: rgba(40, 167, 69, 0.15);
  color: #5bd778;
}
body.dark .admin-fb-stat--blocked {
  background: rgba(220, 53, 69, 0.15);
  color: #f07080;
}

.admin-field-blocker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 480px;
  overflow-y: auto;
}
.admin-fb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  transition: opacity 0.15s;
}
.admin-fb-row .admin-fb-info {
  flex: 1;
  min-width: 0;
}
.admin-fb-row .admin-fb-toggle {
  width: 80px;
  text-align: center;
  flex-shrink: 0;
}
.admin-fb-header-row {
  background: transparent;
  border: none;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.7;
}
.admin-fb-col-header {
  width: 80px;
  text-align: center;
  flex-shrink: 0;
  font-size: 12px;
}
.admin-fb-row--blocked {
  opacity: 0.55;
}
.admin-fb-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.admin-fb-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.admin-fb-id {
  font-size: 11px;
  color: var(--text);
  opacity: 0.5;
}
.admin-fb-toggle {
  flex-shrink: 0;
  padding: 4px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--danger);
  color: #fff;
  transition: background 0.15s, color 0.15s;
}
.admin-fb-toggle--on {
  background: #28a745;
  color: #fff;
  border-color: #28a745;
}
.admin-fb-toggle:hover {
  filter: brightness(1.1);
}
.admin-fb-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}
.admin-fb-toggle--na {
  background: transparent;
  color: var(--text-muted, #888);
  border-color: var(--border, #444);
  cursor: default;
  font-style: italic;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Warning button (cancel) */
.admin-warning-btn {
  background: #e8a317;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  line-height: 1;
}
.admin-warning-btn:hover { background: #d19012; }
.admin-warning-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Auto-Configure (Rate Limit Calibration) */
.auto-config-progress {
  margin-top: 16px;
}

.auto-config-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}

.auto-config-status-label {
  font-weight: 600;
  color: var(--accent);
}

.auto-config-step-label {
  color: var(--text-muted, #888);
}

.auto-config-bar-track {
  width: 100%;
  height: 10px;
  background: var(--panel-border, #e0e0e0);
  border-radius: 5px;
  overflow: hidden;
}

.auto-config-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 5px;
  transition: width 0.4s ease;
}

.auto-config-bar-fill.bar-failed {
  background: #dc3545;
}

.auto-config-details {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted, #888);
}

.auto-config-cooldown {
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted, #888);
  background: var(--panel-bg, #f9f9f9);
  border: 1px solid var(--panel-border, #e0e0e0);
  border-radius: 6px;
}

.auto-config-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

/* Purge controls layout */
.purge-controls {
  margin-top: 14px;
}

.purge-row {
  margin-bottom: 14px;
}

.purge-action-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--panel-border);
}

.purge-age-input {
  width: 100px !important;
}

/* Chip-toggle group */
.purge-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.purge-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.purge-chip input[type="checkbox"] {
  display: none;
}

.purge-chip-label {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--panel-border);
  background: var(--bg);
  color: var(--text-muted, #999);
  transition: all 0.2s;
}

.purge-chip input[type="checkbox"]:checked + .purge-chip-label {
  background: #f854491a;
  border-color: #f85449;
  color: #f85449;
}

.purge-chip:hover .purge-chip-label {
  border-color: var(--accent);
}

/* Status summary in users table */
.admin-status-summary {
  font-size: 12px;
  max-width: 280px;
  white-space: normal;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.admin-status-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--panel-border);
  color: var(--text);
}
.admin-status-chip.status-completed { background: #28a74522; color: #1a7d34; }
.admin-status-chip.status-failed { background: #dc354522; color: #b02a37; }
.admin-status-chip.status-cancelled { background: #6c757d22; color: #5a6268; }
.admin-status-chip.status-partial_success { background: #e8a31722; color: #b07d12; }
.admin-status-chip.status-running { background: #007bff22; color: #0062cc; }
.admin-status-chip.status-queued { background: #17a2b822; color: #117a8b; }
.admin-status-chip.status-interrupted { background: #fd7e1422; color: #c96210; }
body.dark .admin-status-chip.status-completed { background: #28a74533; color: #5cdb5c; }
body.dark .admin-status-chip.status-failed { background: #dc354533; color: #ff6b6b; }
body.dark .admin-status-chip.status-cancelled { background: #6c757d33; color: #adb5bd; }
body.dark .admin-status-chip.status-partial_success { background: #e8a31733; color: #f0c040; }
body.dark .admin-status-chip.status-running { background: #007bff33; color: #5eb8ff; }
body.dark .admin-status-chip.status-queued { background: #17a2b833; color: #5ecfdf; }
body.dark .admin-status-chip.status-interrupted { background: #fd7e1433; color: #ffaa5c; }

/* --- Rollback Result Card --- */
.rollback-result-card {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 10px;
  background: rgba(40, 167, 69, 0.08);
  border-left: 4px solid #28a745;
}
.rollback-result-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #28a745;
}
.rollback-result-card.hidden { display: none; }
body.dark .rollback-result-card {
  background: rgba(40, 167, 69, 0.12);
  border-left-color: #5dd879;
}
body.dark .rollback-result-card h3 {
  color: #5dd879;
}

.rollback-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

/* --- GPU Quota Bar --- */
.gpu-quota-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.gpu-quota-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.gpu-quota-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.8;
}
.gpu-quota-tier {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
}
.gpu-quota-tier:empty { display: none; }
.gpu-quota-tier.tier-unauthorized,
.sched-quota-tier.tier-unauthorized {
  background: var(--danger);
  animation: pulse-unauthorized 2s ease-in-out infinite;
}
@keyframes pulse-unauthorized {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.gpu-quota-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 320px;
}
.gpu-quota-meter {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.gpu-quota-meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background 0.3s;
}
.gpu-meter-ok     { background: #28a745; }
.gpu-meter-warn   { background: #e8a317; }
.gpu-meter-critical { background: #dc3545; }

.gpu-quota-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

/* --- Schedule Quota Bar (user panel) --- */
.sched-quota-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.sched-quota-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sched-quota-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.8;
}
.sched-quota-tier {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
}
.sched-quota-tier:empty { display: none; }

.sched-quota-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 320px;
}
.sched-quota-meter {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.sched-quota-meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background 0.3s;
}
.sched-meter-ok       { background: #28a745; }
.sched-meter-warn     { background: #e8a317; }
.sched-meter-critical { background: #dc3545; }

.sched-quota-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

/* Admin schedule-quota result grid */
.admin-sched-quota-lookup {
  padding: 10px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.admin-sched-quota-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.admin-sched-quota-card {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  text-align: center;
}
.admin-sched-quota-card .sq-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.admin-sched-quota-card .sq-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text);
  opacity: 0.7;
  margin-top: 4px;
}

/* Admin Bulk Schedule Actions */
.admin-sched-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  flex-wrap: wrap;
}
.admin-sched-bulk-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  opacity: 0.6;
  margin-right: 4px;
}
.admin-sched-bulk-btn {
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  line-height: 1;
}
.admin-sched-bulk-btn:hover { background: var(--border); }
.admin-sched-bulk-btn.pause { border-color: #f59e0b; color: #f59e0b; }
.admin-sched-bulk-btn.pause:hover { background: #f59e0b; color: #fff; }
.admin-sched-bulk-btn.resume { border-color: #10b981; color: #10b981; }
.admin-sched-bulk-btn.resume:hover { background: #10b981; color: #fff; }
.admin-sched-bulk-btn.cancel { border-color: var(--danger); color: var(--danger); }
.admin-sched-bulk-btn.cancel:hover { background: var(--danger); color: #fff; }
.admin-sched-bulk-btn.delete { border-color: #ef4444; color: #ef4444; }
.admin-sched-bulk-btn.delete:hover { background: #ef4444; color: #fff; }
.admin-sched-bulk-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Admin Guide Bar & Button --- */
.admin-guide-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.admin-guide-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  line-height: 1;
}
.admin-guide-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeInOverlay 0.15s ease;
}
.modal-overlay.hidden { display: none; }

/* Detail modal (wider variant for job / schedule detail) */
.detail-modal-content {
  max-width: 780px;
  width: 94%;
}
.detail-modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.detail-modal-content .modal-body {
  padding: 16px 24px 24px;
}
/* Shimmer inside detail modal */
.detail-modal-content .shimmer {
  margin-bottom: 8px;
}

.modal-content {
  background: var(--panel-bg);
  color: var(--text);
  border-radius: 12px;
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: slideUp 0.15s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  margin: 0;
  font-size: 18px;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
  padding: 0 4px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.modal-close:hover { opacity: 1; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

/* ─── Draft Modal ─── */
.fb-draft-modal {
  max-width: 700px;
}
.fb-draft-search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.fb-draft-search input {
  flex: 1;
  margin-top: 0;
}
.fb-draft-search button {
  padding: 12px 18px;
  margin-top: 0;
}
.fb-draft-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.fb-draft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}
.fb-draft-item:hover {
  border-color: var(--accent);
  background: rgba(77, 163, 255, 0.03);
}
.fb-draft-info {
  flex: 1;
  min-width: 0;
}
.fb-draft-session {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  font-family: 'Courier New', monospace;
}
.fb-draft-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 3px;
}
.fb-draft-time {
  font-size: 11px;
  color: var(--text-muted);
}
.fb-draft-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.fb-draft-load-btn {
  flex-shrink: 0;
  padding: 10px 18px;
}
.fb-draft-delete-btn {
  flex-shrink: 0;
  padding: 10px 18px;
  color: var(--error, #e74c3c);
  border-color: var(--error, #e74c3c);
}
.fb-draft-delete-btn:hover {
  background: var(--error, #e74c3c);
  color: #fff;
}
.fb-draft-download-btn {
  flex-shrink: 0;
  padding: 10px 18px;
}

.guide-section {
  margin-bottom: 18px;
}
.guide-section h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--accent);
}
.guide-section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  opacity: 0.88;
}
.guide-section-warning {
  background: rgba(220, 53, 69, 0.08);
  border-left: 3px solid #dc3545;
  border-radius: 6px;
  padding: 12px 14px;
}
.guide-section-warning h3 {
  color: #dc3545;
}

/* Admin guide dynamic visibility — toggled by JS based on admin type */
.admin-guide-site-only,
.admin-guide-project-only { display: none; }
.admin-guide-modal-site .admin-guide-site-only { display: block; }
.admin-guide-modal-site .admin-guide-project-only { display: none; }
.admin-guide-modal-project .admin-guide-project-only { display: block; }
.admin-guide-modal-project .admin-guide-site-only { display: none; }

/* --- Scheduled Events Panel --- */
.schedules-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.schedules-header h2 {
  margin: 0;
}
.schedules-header .primary {
  margin-top: 0;
}
.schedules-filter-row {
  margin-bottom: 12px;
}
.schedule-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.schedule-status-badge.pending { background: #3498db22; color: #3498db; }
.schedule-status-badge.paused { background: #f0ad4e22; color: #f0ad4e; }
.schedule-status-badge.triggered { background: #9b59b622; color: #9b59b6; }
.schedule-status-badge.completed { background: #2ecc7122; color: #2ecc71; }
.schedule-status-badge.cancelled { background: #95a5a622; color: #6b7b8d; }
body.dark .schedule-status-badge.pending { color: #5dade2; }
body.dark .schedule-status-badge.paused { color: #f5c842; }
body.dark .schedule-status-badge.triggered { color: #bb8fce; }
body.dark .schedule-status-badge.completed { color: #58d68d; }
body.dark .schedule-status-badge.cancelled { color: #adb5bd; }

.sched-lock-badge {
  font-size: 12px;
  margin-right: 4px;
  vertical-align: middle;
  opacity: 0.85;
}
.sched-lock-info {
  color: #f0ad4e;
  font-size: 13px;
}
.schedule-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: auto;
}

.schedule-action-btn {
  position: relative;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--panel-bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  margin-right: 4px;
}
.schedule-action-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.schedule-action-btn.danger:hover {
  border-color: #d9534f;
  background: #d9534f;
  color: #fff;
}
.schedule-action-btn.btn-loading {
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
  min-width: 36px;
  min-height: 28px;
  transition: none;
}
.schedule-action-btn.btn-loading::after {
  font-size: 14px;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -7px 0 0 -7px;
  border-color: rgba(255,255,255,0.15);
  border-top-color: var(--accent);
}

.schedule-command-cell {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Schedule detail panel */
.schedule-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.schedule-detail-actions button {
  margin-top: 0;
}
.schedule-detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 14px;
}
.schedule-detail-label {
  font-weight: 600;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.schedule-detail-value {
  color: var(--text);
  word-break: break-word;
}

/* --- Schedule Confirmation Modal --- */
.schedule-confirm-modal {
  max-width: 480px;
}
.schedule-confirm-details {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
}
.schedule-confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}
.schedule-confirm-row + .schedule-confirm-row {
  border-top: 1px solid var(--panel-border);
}
.schedule-confirm-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--accent);
}
.schedule-confirm-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
/* --- Searchable Timezone Picker --- */
.schedule-confirm-row--tz {
  position: relative;
}
.tz-picker {
  position: relative;
  width: 100%;
  max-width: 320px;
}
.tz-picker-input {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  width: 100%;
  box-sizing: border-box;
  cursor: text;
}
.tz-picker-input:focus {
  outline: none;
  border-color: var(--accent);
}
.tz-picker-input::placeholder {
  color: var(--text);
  opacity: 0.45;
}
.tz-picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.tz-picker-dropdown.hidden {
  display: none;
}
.tz-picker-option {
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tz-picker-option:hover,
.tz-picker-option.tz-highlighted {
  background: var(--accent);
  color: #fff;
}
.tz-picker-option.tz-selected {
  font-weight: 700;
}
.tz-picker-no-match {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  opacity: 0.5;
  font-style: italic;
}

/* --- Send Confirmation Modal --- */
.send-confirm-modal {
  max-width: 560px;
}

.admin-confirm-modal {
  max-width: 500px;
}

.admin-confirm-message {
  font-size: 15px;
  margin-bottom: 12px;
}

.admin-confirm-details {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  max-height: 120px;
  overflow-y: auto;
}

.admin-confirm-details.hidden {
  display: none;
}

.admin-confirm-cancel-btn {
  background: #555;
  color: #fff;
}

.admin-confirm-cancel-btn:hover {
  background: #666;
}
.send-confirm-message {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.5;
  opacity: 0.92;
}
.test-disclaimer {
  margin: 0 0 18px;
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--warning, #f0ad4e);
  border-radius: 4px;
}
.send-confirm-section {
  margin-bottom: 16px;
}
.send-confirm-section h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
}
.send-confirm-code {
  margin: 0;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  color: var(--text);
}
.send-confirm-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
}
.send-confirm-actions-right {
  display: flex;
  gap: 10px;
  margin-left: auto;
}
.send-confirm-actions > .test-btn {
  padding: 6px 12px;
  font-size: 13px;
}
/* Unified modal button sizing for all popups */
.modal-btn {
  width: 100px;
  box-sizing: border-box;
  padding: 9px 0 !important;
  font-size: 14px !important;
  border-radius: 6px;
  border: none !important;
  cursor: pointer;
  margin-left: 0 !important;
  text-align: center;
  transition: filter 0.15s ease;
}
.modal-btn:hover {
  filter: brightness(0.9);
}

@keyframes fadeInOverlay {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ------------------------------
   CHAT ACTION ROW & SCHEDULE
------------------------------ */
.chat-action-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 12px;
  gap: 12px;
}
.chat-action-left {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chat-action-left button {
  margin-top: 0;
}
.chat-action-right {
  display: flex;
  align-items: center;
}

/* Schedule button */
.schedule-wrapper {
  position: relative;
}
.schedule-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.schedule-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 4px var(--accent);
  transform: translateY(-2px);
}
.schedule-btn:active {
  transform: translateY(0);
}
.schedule-btn-icon {
  font-size: 16px;
  line-height: 1;
}

/* Test button */
.test-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}
.test-btn:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 4px var(--accent);
  transform: translateY(-2px);
}
.test-btn:active:not(:disabled) {
  transform: translateY(0);
}
.test-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.test-btn-icon {
  font-size: 16px;
  line-height: 1;
}

/* Schedule popover */
.schedule-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 300px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 100;
  animation: schedulePopIn 0.2s ease;
}
@keyframes schedulePopIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.schedule-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--panel-border);
}
.schedule-popover-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.schedule-popover-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}
.schedule-popover-close:hover {
  opacity: 1;
}
.schedule-popover-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.schedule-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.schedule-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.8;
}
.schedule-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
  color-scheme: light;
}
body.dark .schedule-input {
  color-scheme: dark;
}
.schedule-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 4px var(--accent);
  outline: none;
}

/* Toggle switch */
.schedule-toggle-field {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.schedule-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.schedule-toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.schedule-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--panel-border);
  border-radius: 24px;
  transition: background 0.25s ease;
}
.schedule-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
}
.schedule-toggle-input:checked + .schedule-toggle-slider {
  background: var(--accent);
}
.schedule-toggle-input:checked + .schedule-toggle-slider::before {
  transform: translateX(18px);
}

/* Recurrence options */
.schedule-recurrence-options {
  transition: max-height 0.25s ease, opacity 0.25s ease;
}

/* Schedule popover footer */
.schedule-popover-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--panel-border);
}
.schedule-save-btn {
  width: 100%;
  margin-top: 0 !important;
}

/* ==============================
   RESPONSIVE — TABLET (≤ 768px)
============================== */
@media (max-width: 768px) {
  /* Layout: stack sidebar above content */
  .layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  /* Sidebar becomes a top nav bar */
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    align-items: center;
    gap: 6px;
  }
  /* Prevent sidebar collapse on mobile — always visible as top bar */
  .sidebar.collapsed {
    transform: none;
    width: 100%;
    padding: 10px 12px;
    border-bottom: 1px solid var(--sidebar-border);
    height: auto;
    overflow: visible;
  }
  /* Hide collapse controls on mobile */
  #sidebarToggle,
  .sidebar-toggle-floating,
  .sidebar-hover-zone {
    display: none !important;
  }
  .logo-block {
    margin: 0 8px 0 0;
  }
  .logo-icon {
    width: 36px;
    height: 36px;
  }
  .sidebar nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
  }
  .nav-btn {
    width: auto;
    padding: 8px 12px;
    margin-bottom: 0;
    font-size: 13px;
  }
  .nav-btn:hover {
    transform: none;
  }
  .sidebar-footer {
    margin-top: 0;
    gap: 6px;
  }

  /* Content */
  .content {
    padding: 16px 12px;
    margin: 0;
    overflow-y: visible;
  }
  body.sidebar-collapsed .content {
    padding-left: 12px;
  }

  /* Panels */
  .panel {
    padding: 14px;
  }

  /* Chat */
  .chat-window {
    height: 250px;
  }
  .bubble {
    max-width: 92%;
  }

  /* GPU Quota bar */
  .gpu-quota-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }
  .gpu-quota-right {
    max-width: 100%;
    flex: 1 1 100%;
  }

  /* Schedule Quota bar */
  .sched-quota-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }
  .sched-quota-right {
    max-width: 100%;
    flex: 1 1 100%;
  }
  .admin-sched-quota-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Tables: card layout on mobile */
  .help-table-wrapper {
    overflow-x: visible;
  }
  .rollback-table {
    min-width: 0;
  }
  .rollback-table thead {
    display: none;
  }
  .rollback-table tbody tr {
    display: block;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px 14px;
    background: var(--panel-bg);
  }
  .rollback-table tbody tr.inline-progress-row {
    border: none;
    border-radius: 0;
    margin-top: -10px;
    margin-bottom: 10px;
    padding: 0;
    background: transparent;
  }
  .rollback-table tbody tr.inline-progress-row td {
    display: block;
    padding: 0;
  }
  .rollback-table tbody tr.inline-progress-row td::before {
    display: none;
  }
  .rollback-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border: none;
    font-size: 14px;
  }
  .rollback-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 80px;
    flex-shrink: 0;
  }
  .rollback-table tbody td:last-child {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--panel-border);
    margin-top: 4px;
  }
  .rollback-table tbody td:last-child::before {
    display: none;
  }
  .rollback-table tbody td:last-child .rollback-view-btn,
  .rollback-table tbody td:last-child button {
    flex: 1;
    min-width: 0;
  }
  .rollback-job-id {
    word-break: break-all;
  }

  /* Reset audit desktop overrides for mobile card layout */
  #rollbackAuditTable td,
  #adminAuditTable td {
    max-width: none;
  }

  /* Non-rollback tables: horizontal scroll */
  .help-table:not(.rollback-table) {
    min-width: 500px;
  }
  .help-table-wrapper:has(.help-table:not(.rollback-table)) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Rollback filters */
  .rollback-filter-row {
    gap: 10px;
  }
  .rollback-input {
    width: 120px;
  }

  /* Admin grids */
  .admin-stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .admin-input-wide {
    width: 100% !important;
  }
  .admin-input-narrow {
    width: 100%;
  }
  .admin-concurrency-row {
    gap: 10px;
  }
  .admin-concurrency-row button {
    width: 100%;
  }

  /* Inline progress bar in card layout */
  .inline-progress-wrap {
    flex-wrap: wrap;
    gap: 8px;
  }
  .inline-progress-left {
    flex: 1 1 100%;
  }
  .inline-progress-bar-track {
    flex: 1 1 100%;
  }
  .inline-cancel-btn {
    width: 100%;
  }

  /* Modals */
  .modal-content {
    width: 95%;
    max-height: 85vh;
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 16px;
  }

  /* Welcome modal */
  .welcome-modal {
    max-width: 95%;
  }
  .welcome-modal-hero {
    padding: 24px 16px 16px;
  }
  .welcome-modal-hero h1 {
    font-size: 20px;
  }

  /* Support grid */
  .support-grid {
    grid-template-columns: 1fr;
  }

  /* Bug report form */
  .bug-report-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Support chatbot */
  .support-chatbot-window {
    height: 250px;
  }
  .support-chatbot-suggestions {
    flex-direction: column;
  }
  .support-chatbot-suggestion {
    white-space: normal;
    text-align: left;
  }

  /* Rollback result grid */
  .rollback-result-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Purge action row */
  .purge-action-row {
    flex-wrap: wrap;
  }

  /* Schedule detail grid — stack on mobile */
  .schedule-detail-grid {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  /* Send confirmation modal */
  .send-confirm-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .send-confirm-actions .modal-btn {
    flex: 1;
    min-width: 80px;
  }

  /* Support tier badges: stack on tablet */
  .support-tier {
    align-items: flex-start;
  }

  /* Schedule confirm rows */
  .schedule-confirm-row {
    flex-wrap: wrap;
    gap: 4px;
  }
}

/* ==============================
   RESPONSIVE — MOBILE (≤ 480px)
============================== */
@media (max-width: 480px) {
  /* Sidebar: compact single-row */
  .sidebar {
    padding: 8px 10px;
    gap: 4px;
  }
  .sidebar nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar nav::-webkit-scrollbar {
    display: none;
  }
  .nav-btn {
    flex-shrink: 0;
    padding: 7px 10px;
    font-size: 12px;
  }
  .logo-block {
    display: none;
  }

  /* Content: tighter */
  .content {
    padding: 10px 8px;
  }

  /* Panels: smaller padding */
  .panel {
    padding: 12px 10px;
    margin-bottom: 12px;
  }

  /* Chat: taller for more screen real-estate */
  .chat-window {
    height: 220px;
  }
  .bubble {
    max-width: 96%;
    font-size: 14px;
  }

  /* Input */
  input[type="text"],
  textarea {
    font-size: 14px;
    padding: 10px;
  }
  button.primary,
  button.secondary {
    width: 100%;
    margin-left: 0;
    /* margin-top: 8px; */
  }

  /* Chat action row: stack on mobile */
  .chat-action-row {
    flex-direction: column;
    gap: 8px;
  }
  .chat-action-left {
    flex-direction: column;
    width: 100%;
  }
  .chat-action-left button {
    width: 100%;
  }
  .chat-action-right {
    width: 100%;
  }
  .schedule-btn {
    width: 100%;
    justify-content: center;
  }
  .test-btn {
    width: 100%;
    justify-content: center;
  }
  .schedule-popover {
    width: calc(100vw - 40px);
    right: -10px;
  }

  /* GPU Quota: stack vertically */
  .gpu-quota-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .gpu-quota-left {
    justify-content: space-between;
  }
  .gpu-quota-right {
    max-width: 100%;
  }

  /* Schedule Quota: stack vertically */
  .sched-quota-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .sched-quota-left {
    justify-content: space-between;
  }
  .sched-quota-right {
    max-width: 100%;
  }
  .admin-sched-quota-grid {
    grid-template-columns: 1fr;
  }

  /* Tables: tighter cards */
  .rollback-table tbody tr:not(.inline-progress-row) {
    padding: 8px 10px;
  }
  .rollback-table tbody td {
    font-size: 13px;
  }
  .help-table:not(.rollback-table) {
    min-width: 420px;
    font-size: 13px;
  }
  .help-table:not(.rollback-table) th,
  .help-table:not(.rollback-table) td {
    padding: 8px 10px;
  }

  /* Rollback filters: stack */
  .rollback-filter-row {
    flex-direction: column;
    gap: 8px;
  }
  .rollback-filter-group {
    width: 100%;
  }
  .rollback-filter-group select,
  .rollback-input {
    width: 100%;
    min-width: 0;
  }
  .multi-filter {
    width: 100%;
  }

  /* Admin stat cards */
  .admin-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .admin-stat-value {
    font-size: 22px;
  }
  .admin-override-grid {
    grid-template-columns: 1fr;
  }

  /* Session panel */
  .session-panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .session-panel-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Inline progress: full stack */
  .inline-progress-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
  }
  .inline-progress-right {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* Modals: full-width */
  .modal-content {
    width: 98%;
    max-height: 90vh;
    border-radius: 10px;
  }
  .send-confirm-modal,
  .admin-confirm-modal,
  .system-message-modal {
    max-width: 98%;
  }
  .welcome-modal {
    max-width: 98%;
  }
  .welcome-modal-hero h1 {
    font-size: 18px;
  }
  .welcome-modal-logo {
    width: 44px;
    height: 44px;
  }

  /* Support sections */
  .support-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Bug report form */
  .bug-report-row {
    grid-template-columns: 1fr;
  }
  .bug-report-input,
  .bug-report-textarea,
  .bug-report-select {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .rollback-result-grid {
    grid-template-columns: 1fr;
  }

  /* Auth gate */
  .auth-gate-card {
    padding: 32px 20px;
    max-width: 90%;
  }

  /* Admin detail actions: wrap */
  .admin-detail-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-detail-actions button {
    width: 100%;
  }
  .detail-modal-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .detail-modal-actions button {
    width: 100%;
  }
  .detail-modal-content .modal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 12px 16px;
  }
  .detail-modal-content .modal-footer button {
    width: 100%;
  }

  /* Purge row: stack */
  .purge-action-row {
    flex-direction: column;
    align-items: stretch;
  }
  .purge-age-input {
    width: 100% !important;
  }

  /* Support tier badges: stack vertically on mobile */
  .support-tier {
    flex-direction: column;
    gap: 4px;
  }
  .support-tier-badge {
    align-self: flex-start;
  }

  /* Schedule confirm rows: stack */
  .schedule-confirm-row {
    flex-direction: column;
    gap: 4px;
  }

  /* Modal footer: stack buttons */
  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-footer button,
  .modal-footer .modal-btn {
    width: 100%;
  }

  /* Admin bulk schedule bar: stack */
  .admin-sched-bulk-bar {
    flex-direction: column;
  }
  .admin-sched-bulk-btn {
    width: 100%;
  }

  /* Admin concurrency row: stack */
  .admin-concurrency-row {
    flex-direction: column;
  }
  .admin-concurrency-row .rollback-filter-group {
    width: 100%;
  }
}

/* ========================================
   FORM BUILDER
======================================== */

/* ─── Header ─── */
.fb-header {
  padding: 28px 24px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}
.fb-header-text { flex: 1; }
.fb-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fb-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.fb-new-form-btn {
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.fb-new-form-btn:hover {
  background: var(--accent);
  color: #fff;
}
.fb-header h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.fb-subtitle {
  margin: 6px 0 0;
  font-size: 0.84rem;
  color: var(--text);
  opacity: 0.45;
  line-height: 1.4;
}

/* Tier badge in header */
.fb-tier-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  margin-top: 0;
  background: var(--border);
  color: var(--text);
}
.fb-tier-badge:empty { display: none; }
.fb-tier-badge.tier-standard { background: #e5e7eb; color: #374151; }
.fb-tier-badge.tier-premium  { background: #fef3c7; color: #92400e; }
.fb-tier-badge.tier-enterprise { background: #dbeafe; color: #1e40af; }
body.dark .fb-tier-badge.tier-standard { background: #374151; color: #d1d5db; }
body.dark .fb-tier-badge.tier-premium  { background: #78350f; color: #fde68a; }
body.dark .fb-tier-badge.tier-enterprise { background: #1e3a5f; color: #93c5fd; }

/* ─── Sections ─── */
.fb-section {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  background: var(--panel-bg);
  margin-bottom: 18px;
  transition: border-color 0.25s, box-shadow 0.25s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.fb-section:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}
body.dark .fb-section {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
body.dark .fb-section:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

/* Colored left accent per section type */
.fb-section--search {
  border-left: 3.5px solid #3b82f6;
}
.fb-section--update {
  border-left: 3.5px solid #f59e0b;
}
.fb-section--preview {
  border-left: 3.5px solid #10b981;
}

/* Section header */
.fb-section-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.fb-section-icon {
  font-size: 1.15rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.fb-section-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.fb-section-hint {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0.45;
}

/* ─── Rows ─── */
.fb-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.fb-row:hover {
  border-color: var(--border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}
body.dark .fb-row:hover {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}
.fb-row-disabled {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}
.fb-row-disabled::after {
  content: '\1F512 Excluded for this project';
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--danger, #e74c3c);
  pointer-events: none;
  white-space: nowrap;
}

/* Form controls inside rows */
.fb-row select,
.fb-row input,
.fb-row .fb-value-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--text);
  font-size: 0.84rem;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin: 0;
  color-scheme: light;
}
body.dark .fb-row .fb-value-input {
  color-scheme: dark;
}
.fb-row select:focus,
.fb-row input:focus,
.fb-row .fb-value-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.15);
}

.fb-field-select {
  flex: 0 0 180px;
  max-width: 220px;
  font-weight: 600;
  height: 34px;
}
.fb-op-select {
  flex: 0 0 120px;
  max-width: 150px;
  height: 34px;
}
.fb-value-container {
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  min-width: 150px;
}
.fb-value-input {
  width: 100%;
  box-sizing: border-box;
}
input[type="text"].fb-value-input,
input[type="number"].fb-value-input,
input[type="date"].fb-value-input {
  height: 34px;
}
select[multiple].fb-value-input {
  min-height: 60px;
}

/* ─── Chip-select dropdown ─── */
.fb-chip-select {
  position: relative;
  min-width: 0;
}
.fb-cs-trigger {
  width: 100%;
  height: 34px;
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--text);
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  /* dropdown arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.fb-chip-select.open .fb-cs-trigger,
.fb-cs-trigger:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.15);
}
.fb-cs-panel {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  z-index: 80;
  padding: 4px 0;
}
.fb-chip-select.open .fb-cs-panel {
  display: block;
}
.fb-cs-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.fb-cs-item:hover {
  background: rgba(77, 163, 255, 0.08);
}
.fb-cs-item input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}
.fb-cs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.fb-cs-chips:empty { display: none; }
.fb-cs-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 100px;
  background: rgba(77, 163, 255, 0.12);
  color: var(--accent);
  white-space: nowrap;
}
.fb-cs-chip-x {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 1px;
  opacity: 0.6;
  transition: opacity 0.1s;
}
.fb-cs-chip-x:hover {
  opacity: 1;
}
.fb-cs-add-input {
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.fb-cs-add-input::placeholder { color: var(--text); opacity: .45; }

/* Freeform chip-select: inline text input instead of dropdown trigger */
.fb-chip-select--freeform .fb-cs-trigger { display: none; }

/* ─── Custom single-select dropdown ─── */
.fb-custom-select {
  position: relative;
  min-width: 0;
}
.fb-custom-select.disabled .fb-cs-trigger {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Single-select item (no checkbox) */
.fb-cs-item--single {
  cursor: pointer;
}
.fb-cs-item--single.active {
  background: rgba(77, 163, 255, 0.12);
  font-weight: 600;
}
.fb-custom-select.open .fb-cs-panel {
  display: block;
}

/* ─── Tooltip subtitle for dropdown items ─── */
.fb-cs-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.fb-cs-item-tip {
  font-size: 0.7rem;
  color: var(--text-muted, #888);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-chip-select--freeform .fb-cs-add-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  height: 34px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
}
.fb-chip-select--freeform .fb-cs-add-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.15);
}

/* ─── Key compound widget ─── */
.fb-key-compound {
  display: flex;
  gap: 6px;
  align-items: center;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}
.fb-key-compound select,
.fb-key-compound input {
  flex: 1;
  height: 34px;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
}

/* ─── Issue-link compound widget ─── */
.fb-issuelink-compound {
  display: flex;
  gap: 6px;
  align-items: center;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}
.fb-issuelink-compound select,
.fb-issuelink-compound input {
  flex: 1;
  height: 34px;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
}
.fb-issuelink-compound .fb-il-type { flex: 2; }
.fb-issuelink-compound .fb-il-project { flex: 2; }
.fb-issuelink-compound .fb-il-number { flex: 1; }
.fb-issuelink-compound .fb-il-direction { flex: 1; }

/* ─── Worklog compound widget ─── */
.fb-worklog-compound {
  display: flex;
  gap: 6px;
  align-items: center;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}
.fb-worklog-compound input {
  flex: 1;
  height: 34px;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
}
.fb-worklog-compound .fb-wl-timespent { flex: 1; }
.fb-worklog-compound .fb-wl-started { flex: 2; }
.fb-worklog-compound .fb-wl-comment { flex: 2; }

/* ─── Remove row button ─── */
.fb-remove-row,
.fb-dupe-row {
  background: none;
  border: none;
  color: var(--text);
  opacity: 0.25;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fb-row:hover .fb-remove-row,
.fb-row:hover .fb-dupe-row {
  opacity: 0.6;
}
.fb-remove-row:hover {
  opacity: 1 !important;
  color: var(--danger);
  background: rgba(220, 53, 69, 0.08);
}
.fb-dupe-row:hover {
  opacity: 1 !important;
  color: var(--accent);
  background: rgba(13, 110, 253, 0.08);
}

/* Disabled value container (e.g. remove op on non-array field) */
.fb-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Required field badge */
.fb-required-badge {
  color: var(--danger, #dc3545);
  font-weight: 700;
  font-size: 16px;
  margin-left: 3px;
  vertical-align: middle;
  line-height: 1;
}

/* ─── Add row button (ghost style) ─── */
.fb-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 18px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text);
  opacity: 0.6;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}
.fb-add-btn:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(77, 163, 255, 0.04);
}
.fb-add-icon {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

/* ─── Logic toggle (AND / OR) ─── */
.fb-logic-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  align-self: center;
}
.fb-logic-btn {
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  opacity: 0.4;
  transition: all 0.15s;
}
.fb-logic-btn.active {
  background: var(--accent);
  color: #fff;
  opacity: 1;
}
.fb-logic-btn:hover:not(.active) {
  opacity: 0.7;
  background: rgba(77, 163, 255, 0.08);
}

/* ─── Special value chips ─── */
.fb-special-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fb-chip {
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  border-radius: 100px;
  border: 1px solid var(--accent);
  background: rgba(77, 163, 255, 0.06);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.fb-chip:hover {
  background: var(--accent);
  color: #fff;
}

/* ─── Exclude toggle (JQL auto-detect) ─── */
.fb-exclude-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  align-self: center;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  opacity: 0.6;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.fb-exclude-toggle.hidden {
  display: none;
}
.fb-exclude-toggle:hover {
  opacity: 1;
  border-color: var(--border);
  background: rgba(220, 53, 69, 0.04);
}
.fb-exclude-toggle input {
  accent-color: var(--danger);
  cursor: pointer;
}
.fb-exclude-toggle span {
  font-weight: 500;
}
.fb-exclude-toggle:has(input:checked) {
  opacity: 1;
  border-color: var(--danger);
  background: rgba(220, 53, 69, 0.06);
}
.fb-exclude-toggle:has(input:checked) span {
  color: var(--danger);
  font-weight: 700;
}

/* ─── Empty toggle (JQL special value) ─── */
.fb-empty-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  align-self: center;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  opacity: 0.6;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.fb-empty-toggle:hover {
  opacity: 1;
  border-color: var(--border);
  background: rgba(77, 163, 255, 0.04);
}
.fb-empty-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}
.fb-empty-toggle span {
  font-weight: 500;
}
.fb-empty-toggle:has(input:checked) {
  opacity: 1;
  border-color: var(--accent);
  background: rgba(77, 163, 255, 0.06);
}
.fb-empty-toggle:has(input:checked) span {
  color: var(--accent);
  font-weight: 700;
}

/* Disabled state for chip-select when Empty is checked */
.fb-chip-select.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ─── Comment input ─── */
.fb-comment-block {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.fb-comment-block label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.fb-comment-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--text);
  font-size: 0.85rem;
  resize: vertical;
  font-family: inherit;
}

/* ─── Warnings ─── */
.fb-warnings {
  padding: 0 4px;
  margin-bottom: 12px;
}
.fb-warning-item {
  background: rgba(255, 193, 7, 0.08);
  color: #b8860b;
  border: 1px solid rgba(255, 193, 7, 0.25);
  border-left: 3px solid #ffc107;
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 6px;
  font-size: 0.82rem;
}
body.dark .fb-warning-item {
  background: rgba(255, 193, 7, 0.06);
  color: #ffe066;
  border-color: rgba(255, 193, 7, 0.15);
  border-left-color: #ffc107;
}

/* ─── Preview ─── */
.fb-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fb-preview-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
  max-height: 220px;
}
.fb-preview-block h4 {
  margin: 0 0 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--text);
  opacity: 0.45;
}
.fb-preview-block pre,
.fb-preview-block code {
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  color: var(--text);
}
.fb-preview-block:last-child {
  grid-column: 1 / -1;
}

/* ─── Sticky bottom bar wrapper ─── */
.fb-bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  padding: 14px 22px 10px;
  margin: 16px -24px 0;
  border-radius: 0;
}
body.dark .fb-bottom-bar {
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
}

/* ─── Actions bar ─── */
.fb-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0;
  margin-bottom: 12px;
}
.fb-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fb-actions-left button {
  margin-top: 0;
}
.fb-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Ghost button (Save Draft) */
.fb-ghost-btn {
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.fb-ghost-btn:hover {
  border-color: var(--accent);
  background: rgba(77, 163, 255, 0.04);
  transform: translateY(-1px);
}

/* Clear button */
.fb-clear-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: var(--text);
  opacity: 0.4;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s;
}
.fb-clear-btn:hover {
  opacity: 1;
  color: var(--danger);
}

.fb-status {
  font-size: 0.82rem;
}
.fb-status-error {
  color: var(--danger);
}
.fb-status-success {
  color: #10b981;
}

/* ─── Execution action bar ─── */
.fb-exec-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin-bottom: 0;
}
.fb-exec-left {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: 12px;
  margin-right: auto;
  flex-wrap: wrap;
}
.fb-exec-quota {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  opacity: 0.75;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.fb-exec-quota-icon {
  font-size: 14px;
}
.fb-exec-quota strong {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.fb-exec-quota.quota-warn strong {
  color: #e8a317;
}
.fb-exec-quota.quota-ok strong {
  color: #28a745;
}
.fb-notify-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: normal;
  color: var(--text);
}
.fb-notify-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}
.fb-exec-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px;
}
.fb-execute-btn {
  margin-left: 0;
  margin-top: 0;
}

/* Footer spacer (removed — sticky bar handles spacing) */

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .fb-header {
    padding: 16px 16px 12px;
    margin-bottom: 2px;
  }
  .fb-section {
    padding: 14px;
  }
  .fb-row {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    gap: 8px;
  }
  .fb-field-select,
  .fb-op-select {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .fb-value-container {
    min-width: 0;
    flex: 1 1 auto;
  }
  .fb-logic-toggle {
    margin-bottom: 4px;
  }
  /* Use grid for clean mobile layout with 5-column bottom row */
  .fb-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    gap: 8px;
    align-items: start;
  }
  /* Main inputs span full width - rows 1-4 */
  .fb-row > .fb-logic-toggle {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .fb-row > .fb-field-select {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .fb-row > .fb-op-select {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  .fb-row > .fb-value-container {
    grid-column: 1 / -1;
    grid-row: 4;
  }
  /* Divider at row 5 */
  .fb-row::after {
    content: '';
    grid-column: 1 / -1;
    grid-row: 5;
    height: 1px;
    background: var(--border);
    opacity: 0.3;
    margin: 4px 0 2px;
  }
  /* Bottom action row (row 6) - Exclude in column 1 */
  .fb-row > .fb-exclude-toggle {
    grid-column: 1;
    grid-row: 6;
    opacity: 0.75;
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: rgba(128, 128, 128, 0.03);
  }
  /* Empty in column 2, row 6 */
  .fb-row > .fb-empty-toggle {
    grid-column: 2;
    grid-row: 6;
    opacity: 0.75;
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: rgba(128, 128, 128, 0.03);
  }
  body.dark .fb-exclude-toggle,
  body.dark .fb-empty-toggle {
    background: rgba(255, 255, 255, 0.03);
  }
  /* Duplicate button in column 4, row 6 */
  .fb-row > .fb-dupe-row {
    grid-column: 4;
    grid-row: 6;
    opacity: 0.7;
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
    background: rgba(128, 128, 128, 0.04);
    border: 1px solid var(--border);
  }
  /* Remove button in column 5, row 6 */
  .fb-row > .fb-remove-row {
    grid-column: 5;
    grid-row: 6;
    opacity: 0.7;
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
    background: rgba(128, 128, 128, 0.04);
    border: 1px solid var(--border);
  }
  body.dark .fb-remove-row,
  body.dark .fb-dupe-row {
    background: rgba(255, 255, 255, 0.03);
  }
  .fb-preview-grid {
    grid-template-columns: 1fr;
  }
  .fb-bottom-bar {
    margin: 12px -16px 0;
    padding: 12px 16px 8px;
  }
  .fb-actions-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
  }
  .fb-actions-left {
    display: contents;
  }
  #fbSubmitBtn {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  #fbSaveDraftBtn {
    grid-column: 1;
    grid-row: 2;
  }
  #fbLoadDraftBtn {
    grid-column: 2;
    grid-row: 2;
  }
  .fb-actions-right {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: center;
  }
  .fb-actions-right .fb-clear-btn {
    width: 100%;
  }
  .fb-exec-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .fb-exec-left {
    margin-left: 0;
    margin-right: 0;
  }
  .fb-exec-right {
    justify-content: center;
    margin: 8px 0;
  }
  .fb-status {
    text-align: center;
  }
  /* Field Blocker sticky bar - side by side buttons */
  .admin-fb-sticky-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .admin-fb-sticky-actions button {
    width: 100%;
  }
  /* Admin section header actions - side by side buttons */
  .admin-section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .admin-section-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .admin-section-actions button {
    width: 100%;
  }
  .admin-section-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .admin-section-header-actions button {
    width: 100%;
  }
  /* Draft modal mobile styles */
  .fb-draft-modal {
    max-width: 95%;
    width: 95%;
    padding: 16px;
  }
  .fb-draft-list {
    max-height: 300px;
  }
  .fb-draft-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .fb-draft-actions {
    flex-direction: column;
    width: 100%;
  }
  .fb-draft-load-btn {
    width: 100%;
  }
  .fb-draft-delete-btn {
    width: 100%;
  }
  .fb-draft-download-btn {
    width: 100%;
  }
  .fb-draft-search {
    flex-wrap: wrap;
  }
  .fb-draft-search input {
    min-width: 0;
    flex: 1 1 200px;
  }
  .fb-draft-search button {
    flex: 1 1 100px;
    padding: 12px 18px;
  }

  /* Import zone: handle long filenames */
  .fb-import-result {
    flex-wrap: wrap;
  }
  .fb-import-file-name {
    word-break: break-all;
  }
}

/* ─── File Import Zone ─── */
.fb-import-zone {
  margin: 12px 0;
}
.fb-import-droparea {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.fb-import-droparea:hover,
.fb-import-droparea.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}
.fb-import-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}
.fb-import-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.fb-import-file-input {
  display: none;
}
.fb-import-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-radius: 8px;
}
.fb-import-result.hidden {
  display: none;
}
.fb-import-file-name {
  font-weight: 600;
}
.fb-import-count {
  color: var(--text-muted);
  font-size: 0.9em;
}
.fb-import-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.85rem;
}
.fb-import-remove:hover {
  text-decoration: underline;
}
.fb-import-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.fb-import-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
